@tanagram/lore 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +48 -48
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
3
|
-
var j9=Object.create;var o_=Object.defineProperty;var H9=Object.getOwnPropertyDescriptor;var F9=Object.getOwnPropertyNames;var V9=Object.getPrototypeOf,q9=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),sg=(t,e)=>{for(var n in e)o_(t,n,{get:e[n],enumerable:!0})},kC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of F9(e))!q9.call(t,o)&&o!==n&&o_(t,o,{get:()=>e[o],enumerable:!(r=H9(e,o))||r.enumerable});return t};var K=(t,e,n)=>(n=t!=null?j9(V9(t)):{},kC(e||!t||!t.__esModule?o_(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>kC(o_({},"__esModule",{value:!0}),t);var Oo,ig=z(()=>{Oo="1.9.1"});function $9(t){let e=new Set([t]),n=new Set,r=t.match(GC);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===t};function s(a){return n.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(GC);if(!l)return s(c);let p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?s(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):s(c):o.minor<=p.minor?i(c):s(c)}}var GC,BC,jC=z(()=>{ig();GC=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;BC=$9(Oo)});function jr(t,e,n,r=!1){var o;let s=Sl[El]=(o=Sl[El])!==null&&o!==void 0?o:{version:Oo};if(!r&&s[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(s.version!==Oo){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Oo}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Oo}.`),!0}function Dn(t){var e,n;let r=(e=Sl[El])===null||e===void 0?void 0:e.version;if(!(!r||!BC(r)))return(n=Sl[El])===null||n===void 0?void 0:n[t]}function Hr(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Oo}.`);let n=Sl[El];n&&delete n[t]}var Y9,El,Sl,Ii=z(()=>{ig();jC();Y9=Oo.split(".")[0],El=Symbol.for(`opentelemetry.js.api.${Y9}`),Sl=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function gl(t,e,n){let r=Dn("diag");if(r)return r[t](e,...n)}var s_,HC=z(()=>{Ii();s_=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return gl("debug",this._namespace,e)}error(...e){return gl("error",this._namespace,e)}info(...e){return gl("info",this._namespace,e)}warn(...e){return gl("warn",this._namespace,e)}verbose(...e){return gl("verbose",this._namespace,e)}}});var dt,i_=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(dt||(dt={}))});function FC(t,e){t<dt.NONE?t=dt.NONE:t>dt.ALL&&(t=dt.ALL),e=e||{};function n(r,o){let s=e[r];return typeof s=="function"&&t>=o?s.bind(e):function(){}}return{error:n("error",dt.ERROR),warn:n("warn",dt.WARN),info:n("info",dt.INFO),debug:n("debug",dt.DEBUG),verbose:n("verbose",dt.VERBOSE)}}var VC=z(()=>{i_()});var W9,St,Oi=z(()=>{HC();VC();i_();Ii();W9="diag",St=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=Dn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:dt.INFO})=>{var i,a,c;if(o===n){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof s=="number"&&(s={logLevel:s});let l=Dn("diag"),p=FC((a=s.logLevel)!==null&&a!==void 0?a:dt.INFO,o);if(l&&!s.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),p.warn(`Current logger will overwrite one already registered from ${d}`)}return jr("diag",p,n,!0)};n.setLogger=r,n.disable=()=>{Hr(W9,n)},n.createComponentLogger=o=>new s_(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var a_,qC=z(()=>{a_=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var $C,YC=z(()=>{$C=Symbol("BaggageEntryMetadata")});function WC(t={}){return new a_(new Map(Object.entries(t)))}function zC(t){return typeof t!="string"&&(z9.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:$C,toString(){return t}}}var z9,ag=z(()=>{Oi();qC();YC();z9=St.instance()});function Un(t){return Symbol.for(t)}var cg,Wa,Al=z(()=>{cg=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,o)=>{let s=new t(n._currentContext);return s._currentContext.set(r,o),s},n.deleteValue=r=>{let o=new t(n._currentContext);return o._currentContext.delete(r),o}}},Wa=new cg});var ug,lg,c_,KC=z(()=>{ug=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],lg={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(lg[e]=console[e])}c_=class{constructor(){function e(n){return function(...r){let o=lg[n];if(typeof o!="function"&&(o=lg.log),typeof o!="function"&&console&&(o=console[n],typeof o!="function"&&(o=console.log)),typeof o=="function")return o.apply(console,r)}}for(let n=0;n<ug.length;n++)this[ug[n].n]=e(ug[n].c)}}});function QC(){return Sg}var pg,za,dg,_g,fg,mg,Rl,hg,Tg,Eg,Sg,K9,Q9,X9,J9,Z9,eQ,tQ,gg=z(()=>{pg=class{constructor(){}createGauge(e,n){return Q9}createHistogram(e,n){return X9}createCounter(e,n){return K9}createUpDownCounter(e,n){return J9}createObservableGauge(e,n){return eQ}createObservableCounter(e,n){return Z9}createObservableUpDownCounter(e,n){return tQ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},za=class{},dg=class extends za{add(e,n){}},_g=class extends za{add(e,n){}},fg=class extends za{record(e,n){}},mg=class extends za{record(e,n){}},Rl=class{addCallback(e){}removeCallback(e){}},hg=class extends Rl{},Tg=class extends Rl{},Eg=class extends Rl{},Sg=new pg,K9=new dg,Q9=new fg,X9=new mg,J9=new _g,Z9=new hg,eQ=new Tg,tQ=new Eg});var u_,XC=z(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(u_||(u_={}))});var l_,p_,Ag=z(()=>{l_={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},p_={set(t,e,n){t!=null&&(t[e]=n)}}});var d_,JC=z(()=>{Al();d_=class{active(){return Wa}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var Rg,nQ,Fr,yl=z(()=>{JC();Ii();Oi();Rg="context",nQ=new d_,Fr=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return jr(Rg,e,St.instance())}active(){return this._getContextManager().active()}with(e,n,r,...o){return this._getContextManager().with(e,n,r,...o)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return Dn(Rg)||nQ}disable(){this._getContextManager().disable(),Hr(Rg,St.instance())}}});var Vt,yg=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Vt||(Vt={}))});var Il,Ni,__,f_=z(()=>{yg();Il="0000000000000000",Ni="00000000000000000000000000000000",__={traceId:Ni,spanId:Il,traceFlags:Vt.NONE}});var Vr,m_=z(()=>{f_();Vr=class{constructor(e=__){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function h_(t){return t.getValue(Ig)||void 0}function ZC(){return h_(Fr.getInstance().active())}function Ol(t,e){return t.setValue(Ig,e)}function eP(t){return t.deleteValue(Ig)}function tP(t,e){return Ol(t,new Vr(e))}function T_(t){var e;return(e=h_(t))===null||e===void 0?void 0:e.spanContext()}var Ig,Og=z(()=>{Al();m_();yl();Ig=Un("OpenTelemetry Context Key SPAN")});function nP(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(E_[t.charCodeAt(r)]|0)+(E_[t.charCodeAt(r+1)]|0)+(E_[t.charCodeAt(r+2)]|0)+(E_[t.charCodeAt(r+3)]|0);return n===e}function Ng(t){return nP(t,32)&&t!==Ni}function bg(t){return nP(t,16)&&t!==Il}function No(t){return Ng(t.traceId)&&bg(t.spanId)}function rP(t){return new Vr(t)}var E_,S_=z(()=>{f_();m_();E_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function rQ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var Cg,Ka,Pg=z(()=>{yl();Og();m_();S_();Cg=Fr.getInstance(),Ka=class{startSpan(e,n,r=Cg.active()){if(!!n?.root)return new Vr;let s=r&&T_(r);return rQ(s)&&No(s)?new Vr(s):new Vr}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Cg.active(),l=this.startSpan(e,s,c),p=Ol(c,l);return Cg.with(p,a,void 0,l)}}});var oQ,Qa,Mg=z(()=>{Pg();oQ=new Ka,Qa=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,o){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):oQ}}});var g_,oP=z(()=>{Pg();g_=class{getTracer(e,n,r){return new Ka}}});var sQ,bi,xg=z(()=>{Mg();oP();sQ=new g_,bi=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Qa(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:sQ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,n,r)}}});var A_,sP=z(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(A_||(A_={}))});var Ne,iP=z(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Ne||(Ne={}))});var Be,aP=z(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Be||(Be={}))});function cP(t){return cQ.test(t)}function uP(t){return uQ.test(t)&&!lQ.test(t)}var vg,iQ,aQ,cQ,uQ,lQ,lP=z(()=>{vg="[_0-9a-z-*/]",iQ=`[a-z]${vg}{0,255}`,aQ=`[a-z0-9]${vg}{0,240}@[a-z]${vg}{0,13}`,cQ=new RegExp(`^(?:${iQ}|${aQ})$`),uQ=/^[ -~]{0,255}[!-~]$/,lQ=/,|=/});var pP,pQ,dP,_P,R_,fP=z(()=>{lP();pP=32,pQ=512,dP=",",_P="=",R_=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+_P+this.get(n)),e),[]).join(dP)}_parse(e){e.length>pQ||(this._internalState=e.split(dP).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(_P);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);cP(i)&&uP(a)&&n.set(i,a)}return n},new Map),this._internalState.size>pP&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,pP))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function mP(t){return new R_(t)}var hP=z(()=>{fP()});var P,TP=z(()=>{yl();P=Fr.getInstance()});var wn,EP=z(()=>{Oi();wn=St.instance()});var Lg,SP,gP=z(()=>{gg();Lg=class{getMeter(e,n,r){return Sg}},SP=new Lg});var Dg,y_,AP=z(()=>{gP();Ii();Oi();Dg="metrics",y_=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return jr(Dg,e,St.instance())}getMeterProvider(){return Dn(Dg)||SP}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Hr(Dg,St.instance())}}});var Ug,RP=z(()=>{AP();Ug=y_.getInstance()});var I_,yP=z(()=>{I_=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function kg(t){return t.getValue(wg)||void 0}function IP(){return kg(Fr.getInstance().active())}function OP(t,e){return t.setValue(wg,e)}function NP(t){return t.deleteValue(wg)}var wg,bP=z(()=>{yl();Al();wg=Un("OpenTelemetry Baggage Key")});var Gg,dQ,O_,CP=z(()=>{Ii();yP();Ag();bP();ag();Oi();Gg="propagation",dQ=new I_,O_=class t{constructor(){this.createBaggage=WC,this.getBaggage=kg,this.getActiveBaggage=IP,this.setBaggage=OP,this.deleteBaggage=NP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return jr(Gg,e,St.instance())}inject(e,n,r=p_){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=l_){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Hr(Gg,St.instance())}_getGlobalPropagator(){return Dn(Gg)||dQ}}});var Ar,PP=z(()=>{CP();Ar=O_.getInstance()});var Bg,N_,MP=z(()=>{Ii();xg();S_();Og();Oi();Bg="trace",N_=class t{constructor(){this._proxyTracerProvider=new bi,this.wrapSpanContext=rP,this.isSpanContextValid=No,this.deleteSpan=eP,this.getSpan=h_,this.getActiveSpan=ZC,this.getSpanContext=T_,this.setSpan=Ol,this.setSpanContext=tP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=jr(Bg,this._proxyTracerProvider,St.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return Dn(Bg)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Hr(Bg,St.instance()),this._proxyTracerProvider=new bi}}});var X,xP=z(()=>{MP();X=N_.getInstance()});var v={};sg(v,{DiagConsoleLogger:()=>c_,DiagLogLevel:()=>dt,INVALID_SPANID:()=>Il,INVALID_SPAN_CONTEXT:()=>__,INVALID_TRACEID:()=>Ni,ProxyTracer:()=>Qa,ProxyTracerProvider:()=>bi,ROOT_CONTEXT:()=>Wa,SamplingDecision:()=>A_,SpanKind:()=>Ne,SpanStatusCode:()=>Be,TraceFlags:()=>Vt,ValueType:()=>u_,baggageEntryMetadataFromString:()=>zC,context:()=>P,createContextKey:()=>Un,createNoopMeter:()=>QC,createTraceState:()=>mP,default:()=>_Q,defaultTextMapGetter:()=>l_,defaultTextMapSetter:()=>p_,diag:()=>wn,isSpanContextValid:()=>No,isValidSpanId:()=>bg,isValidTraceId:()=>Ng,metrics:()=>Ug,propagation:()=>Ar,trace:()=>X});var _Q,b=z(()=>{ag();Al();KC();i_();gg();XC();Ag();Mg();xg();sP();iP();aP();yg();hP();S_();f_();TP();EP();RP();PP();xP();_Q={context:P,diag:wn,metrics:Ug,propagation:Ar,trace:X}});var Nl=E(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isTracingSuppressed=is.unsuppressTracing=is.suppressTracing=void 0;var fQ=(b(),O(v)),jg=(0,fQ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function mQ(t){return t.setValue(jg,!0)}is.suppressTracing=mQ;function hQ(t){return t.deleteValue(jg)}is.unsuppressTracing=hQ;function TQ(t){return t.getValue(jg)===!0}is.isTracingSuppressed=TQ});var Hg=E(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.BAGGAGE_MAX_TOTAL_LENGTH=qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=qt.BAGGAGE_HEADER=qt.BAGGAGE_ITEMS_SEPARATOR=qt.BAGGAGE_PROPERTIES_SEPARATOR=qt.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;qt.BAGGAGE_KEY_PAIR_SEPARATOR="=";qt.BAGGAGE_PROPERTIES_SEPARATOR=";";qt.BAGGAGE_ITEMS_SEPARATOR=",";qt.BAGGAGE_HEADER="baggage";qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;qt.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Fg=E(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.parseKeyPairsIntoRecord=qr.parsePairKeyValue=qr.getKeyPairs=qr.serializeKeyPairs=void 0;var EQ=(b(),O(v)),Xa=Hg();function SQ(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Xa.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Xa.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}qr.serializeKeyPairs=SQ;function gQ(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Xa.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}qr.getKeyPairs=gQ;function vP(t){if(!t)return;let e=t.indexOf(Xa.BAGGAGE_PROPERTIES_SEPARATOR),n=e===-1?t:t.substring(0,e),r=n.indexOf(Xa.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=n.substring(0,r).trim(),s=n.substring(r+1).trim();if(!o||!s)return;let i,a;try{i=decodeURIComponent(o),a=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=(0,EQ.baggageEntryMetadataFromString)(l)}return{key:i,value:a,metadata:c}}qr.parsePairKeyValue=vP;function AQ(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Xa.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let r=vP(n);r!==void 0&&r.value.length>0&&(e[r.key]=r.value)}),e}qr.parseKeyPairsIntoRecord=AQ});var LP=E(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});b_.W3CBaggagePropagator=void 0;var Vg=(b(),O(v)),RQ=Nl(),Ci=Hg(),qg=Fg(),$g=class{inject(e,n,r){let o=Vg.propagation.getBaggage(e);if(!o||(0,RQ.isTracingSuppressed)(e))return;let s=(0,qg.getKeyPairs)(o).filter(a=>a.length<=Ci.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Ci.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,qg.serializeKeyPairs)(s);i.length>0&&r.set(n,Ci.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Ci.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Ci.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Ci.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let l=(0,qg.parsePairKeyValue)(c);if(l){let p={value:l.value};l.metadata&&(p.metadata=l.metadata),i[l.key]=p}}),Object.entries(i).length===0)?e:Vg.propagation.setBaggage(e,Vg.propagation.createBaggage(i))}fields(){return[Ci.BAGGAGE_HEADER]}};b_.W3CBaggagePropagator=$g});var DP=E(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});C_.AnchoredClock=void 0;var Yg=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,n){this._monotonicClock=n,this._epochMillis=e.now(),this._performanceMillis=n.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};C_.AnchoredClock=Yg});var BP=E(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isAttributeValue=as.isAttributeKey=as.sanitizeAttributes=void 0;var UP=(b(),O(v));function yQ(t){let e={};if(typeof t!="object"||t==null)return e;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!wP(n)){UP.diag.warn(`Invalid attribute key: ${n}`);continue}let r=t[n];if(!kP(r)){UP.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}as.sanitizeAttributes=yQ;function wP(t){return typeof t=="string"&&t!==""}as.isAttributeKey=wP;function kP(t){return t==null?!0:Array.isArray(t)?IQ(t):GP(typeof t)}as.isAttributeValue=kP;function IQ(t){let e;for(let n of t){if(n==null)continue;let r=typeof n;if(r!==e){if(!e){if(GP(r)){e=r;continue}return!1}return!1}}return!0}function GP(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Wg=E(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});P_.loggingErrorHandler=void 0;var OQ=(b(),O(v));function NQ(){return t=>{OQ.diag.error(bQ(t))}}P_.loggingErrorHandler=NQ;function bQ(t){return typeof t=="string"?t:JSON.stringify(CQ(t))}function CQ(t){let e={},n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;let o=n[r];o&&(e[r]=String(o))}),n=Object.getPrototypeOf(n);return e}});var HP=E(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.globalErrorHandler=Ja.setGlobalErrorHandler=void 0;var PQ=Wg(),jP=(0,PQ.loggingErrorHandler)();function MQ(t){jP=t}Ja.setGlobalErrorHandler=MQ;function xQ(t){try{jP(t)}catch{}}Ja.globalErrorHandler=xQ});var $P=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getStringListFromEnv=$r.getBooleanFromEnv=$r.getStringFromEnv=$r.getNumberFromEnv=void 0;var FP=(b(),O(v)),VP=U("util");function vQ(t){let e=process.env[t];if(e==null||e.trim()==="")return;let n=Number(e);if(isNaN(n)){FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected a number, using defaults`);return}return n}$r.getNumberFromEnv=vQ;function qP(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}$r.getStringFromEnv=qP;function LQ(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}$r.getBooleanFromEnv=LQ;function DQ(t){return qP(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}$r.getStringListFromEnv=DQ});var YP=E(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});M_._globalThis=void 0;M_._globalThis=globalThis});var WP=E(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_.VERSION=void 0;x_.VERSION="2.6.1"});function We(t){let e={},n=t.length;for(let r=0;r<n;r++){let o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var zg=z(()=>{});var zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,UQ,Kg,wQ,kQ,GQ,BQ,Qg,jQ,HQ,FQ,VQ,qQ,$Q,YQ,WQ,zQ,KQ,QQ,XQ,JQ,ZQ,eX,tX,nX,rX,Xg,oX,sX,iX,aX,cX,uX,lX,pX,dX,_X,fX,mX,Jg,hX,TX,Zg,eA,EX,SX,gX,AX,RX,yX,IX,OX,NX,bX,CX,PX,MX,xX,vX,LX,DX,bl,Za,tA,UX,wX,Pi,kX,GX,BX,jX,nA,rA,HX,oA,FX,VX,qX,$X,YX,WX,zX,KX,QX,XX,JX,ZX,eJ,tJ,nJ,rJ,oJ,sJ,iJ,aJ,cJ,uJ,lJ,sA,pJ,dJ,_J,fJ,mJ,hJ,TJ,EJ,SJ,gJ,AJ,RJ,yJ,IJ,OJ,NJ,bJ,CJ,PJ,iA,MJ,aA,xJ,vJ,LJ,DJ,UJ,wJ,kJ,GJ,BJ,fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL,jJ,HJ,FJ,VJ,qJ,$J,YJ,WJ,zJ,KJ,QJ,XJ,JJ,ZJ,e5,t5,n5,r5,o5,s5,i5,a5,c5,u5,l5,p5,d5,_5,f5,m5,h5,T5,E5,S5,g5,A5,R5,y5,I5,O5,N5,b5,C5,P5,M5,x5,v5,L5,aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL,D5,U5,w5,k5,G5,B5,j5,H5,F5,V5,q5,$5,EL,SL,gL,AL,RL,Y5,W5,z5,K5,Q5,X5,yL,IL,OL,J5,Z5,eZ,tZ,NL,bL,CL,PL,nZ,rZ,oZ,sZ,iZ,ML,xL,vL,LL,DL,UL,wL,aZ,cZ,uZ,lZ,pZ,dZ,_Z,fZ,kL,GL,BL,jL,HL,mZ,hZ,TZ,EZ,SZ,gZ,FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0,AZ,RZ,yZ,IZ,OZ,NZ,bZ,CZ,PZ,MZ,xZ,vZ,LZ,DZ,UZ,wZ,kZ,GZ,BZ,jZ,HZ,FZ,u0,l0,p0,d0,_0,VZ,qZ,$Z,YZ,WZ,zZ,f0,m0,KZ,QZ,XZ,h0,T0,JZ,ZZ,e6,E0,S0,g0,A0,R0,y0,I0,O0,N0,b0,C0,P0,M0,x0,v0,L0,D0,t6,n6,r6,o6,s6,i6,a6,c6,u6,l6,p6,d6,_6,f6,m6,h6,T6,E6,U0,w0,S6,g6,A6,k0=z(()=>{zg();zP="aws.lambda.invoked_arn",KP="db.system",QP="db.connection_string",XP="db.user",JP="db.jdbc.driver_classname",ZP="db.name",eM="db.statement",tM="db.operation",nM="db.mssql.instance_name",rM="db.cassandra.keyspace",oM="db.cassandra.page_size",sM="db.cassandra.consistency_level",iM="db.cassandra.table",aM="db.cassandra.idempotence",cM="db.cassandra.speculative_execution_count",uM="db.cassandra.coordinator.id",lM="db.cassandra.coordinator.dc",pM="db.hbase.namespace",dM="db.redis.database_index",_M="db.mongodb.collection",fM="db.sql.table",mM="exception.type",hM="exception.message",TM="exception.stacktrace",EM="exception.escaped",SM="faas.trigger",gM="faas.execution",AM="faas.document.collection",RM="faas.document.operation",yM="faas.document.time",IM="faas.document.name",OM="faas.time",NM="faas.cron",bM="faas.coldstart",CM="faas.invoked_name",PM="faas.invoked_provider",MM="faas.invoked_region",xM="net.transport",vM="net.peer.ip",LM="net.peer.port",DM="net.peer.name",UM="net.host.ip",wM="net.host.port",kM="net.host.name",GM="net.host.connection.type",BM="net.host.connection.subtype",jM="net.host.carrier.name",HM="net.host.carrier.mcc",FM="net.host.carrier.mnc",VM="net.host.carrier.icc",qM="peer.service",$M="enduser.id",YM="enduser.role",WM="enduser.scope",zM="thread.id",KM="thread.name",QM="code.function",XM="code.namespace",JM="code.filepath",ZM="code.lineno",ex="http.method",tx="http.url",nx="http.target",rx="http.host",ox="http.scheme",sx="http.status_code",ix="http.flavor",ax="http.user_agent",cx="http.request_content_length",ux="http.request_content_length_uncompressed",lx="http.response_content_length",px="http.response_content_length_uncompressed",dx="http.server_name",_x="http.route",fx="http.client_ip",mx="aws.dynamodb.table_names",hx="aws.dynamodb.consumed_capacity",Tx="aws.dynamodb.item_collection_metrics",Ex="aws.dynamodb.provisioned_read_capacity",Sx="aws.dynamodb.provisioned_write_capacity",gx="aws.dynamodb.consistent_read",Ax="aws.dynamodb.projection",Rx="aws.dynamodb.limit",yx="aws.dynamodb.attributes_to_get",Ix="aws.dynamodb.index_name",Ox="aws.dynamodb.select",Nx="aws.dynamodb.global_secondary_indexes",bx="aws.dynamodb.local_secondary_indexes",Cx="aws.dynamodb.exclusive_start_table",Px="aws.dynamodb.table_count",Mx="aws.dynamodb.scan_forward",xx="aws.dynamodb.segment",vx="aws.dynamodb.total_segments",Lx="aws.dynamodb.count",Dx="aws.dynamodb.scanned_count",Ux="aws.dynamodb.attribute_definitions",wx="aws.dynamodb.global_secondary_index_updates",kx="messaging.system",Gx="messaging.destination",Bx="messaging.destination_kind",jx="messaging.temp_destination",Hx="messaging.protocol",Fx="messaging.protocol_version",Vx="messaging.url",qx="messaging.message_id",$x="messaging.conversation_id",Yx="messaging.message_payload_size_bytes",Wx="messaging.message_payload_compressed_size_bytes",zx="messaging.operation",Kx="messaging.consumer_id",Qx="messaging.rabbitmq.routing_key",Xx="messaging.kafka.message_key",Jx="messaging.kafka.consumer_group",Zx="messaging.kafka.client_id",ev="messaging.kafka.partition",tv="messaging.kafka.tombstone",nv="rpc.system",rv="rpc.service",ov="rpc.method",sv="rpc.grpc.status_code",iv="rpc.jsonrpc.version",av="rpc.jsonrpc.request_id",cv="rpc.jsonrpc.error_code",uv="rpc.jsonrpc.error_message",lv="message.type",pv="message.id",dv="message.compressed_size",_v="message.uncompressed_size",UQ=zP,Kg=KP,wQ=QP,kQ=XP,GQ=JP,BQ=ZP,Qg=eM,jQ=tM,HQ=nM,FQ=rM,VQ=oM,qQ=sM,$Q=iM,YQ=aM,WQ=cM,zQ=uM,KQ=lM,QQ=pM,XQ=dM,JQ=_M,ZQ=fM,eX=mM,tX=hM,nX=TM,rX=EM,Xg=SM,oX=gM,sX=AM,iX=RM,aX=yM,cX=IM,uX=OM,lX=NM,pX=bM,dX=CM,_X=PM,fX=MM,mX=xM,Jg=vM,hX=LM,TX=DM,Zg=UM,eA=wM,EX=kM,SX=GM,gX=BM,AX=jM,RX=HM,yX=FM,IX=VM,OX=qM,NX=$M,bX=YM,CX=WM,PX=zM,MX=KM,xX=QM,vX=XM,LX=JM,DX=ZM,bl=ex,Za=tx,tA=nx,UX=rx,wX=ox,Pi=sx,kX=ix,GX=ax,BX=cx,jX=ux,nA=lx,rA=px,HX=dx,oA=_x,FX=fx,VX=mx,qX=hx,$X=Tx,YX=Ex,WX=Sx,zX=gx,KX=Ax,QX=Rx,XX=yx,JX=Ix,ZX=Ox,eJ=Nx,tJ=bx,nJ=Cx,rJ=Px,oJ=Mx,sJ=xx,iJ=vx,aJ=Lx,cJ=Dx,uJ=Ux,lJ=wx,sA=kx,pJ=Gx,dJ=Bx,_J=jx,fJ=Hx,mJ=Fx,hJ=Vx,TJ=qx,EJ=$x,SJ=Yx,gJ=Wx,AJ=zx,RJ=Kx,yJ=Qx,IJ=Xx,OJ=Jx,NJ=Zx,bJ=ev,CJ=tv,PJ=nv,iA=rv,MJ=ov,aA=sv,xJ=iv,vJ=av,LJ=cv,DJ=uv,UJ=lv,wJ=pv,kJ=dv,GJ=_v,BJ=We([zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v]),fv="other_sql",mv="mssql",hv="mysql",Tv="oracle",Ev="db2",Sv="postgresql",gv="redshift",Av="hive",Rv="cloudscape",yv="hsqldb",Iv="progress",Ov="maxdb",Nv="hanadb",bv="ingres",Cv="firstsql",Pv="edb",Mv="cache",xv="adabas",vv="firebird",Lv="derby",Dv="filemaker",Uv="informix",wv="instantdb",kv="interbase",Gv="mariadb",Bv="netezza",jv="pervasive",Hv="pointbase",Fv="sqlite",Vv="sybase",qv="teradata",$v="vertica",Yv="h2",Wv="coldfusion",zv="cassandra",Kv="hbase",Qv="mongodb",Xv="redis",Jv="couchbase",Zv="couchdb",eL="cosmosdb",tL="dynamodb",nL="neo4j",rL="geode",oL="elasticsearch",sL="memcached",iL="cockroachdb",jJ=fv,HJ=mv,FJ=hv,VJ=Tv,qJ=Ev,$J=Sv,YJ=gv,WJ=Av,zJ=Rv,KJ=yv,QJ=Iv,XJ=Ov,JJ=Nv,ZJ=bv,e5=Cv,t5=Pv,n5=Mv,r5=xv,o5=vv,s5=Lv,i5=Dv,a5=Uv,c5=wv,u5=kv,l5=Gv,p5=Bv,d5=jv,_5=Hv,f5=Fv,m5=Vv,h5=qv,T5=$v,E5=Yv,S5=Wv,g5=zv,A5=Kv,R5=Qv,y5=Xv,I5=Jv,O5=Zv,N5=eL,b5=tL,C5=nL,P5=rL,M5=oL,x5=sL,v5=iL,L5=We([fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL]),aL="all",cL="each_quorum",uL="quorum",lL="local_quorum",pL="one",dL="two",_L="three",fL="local_one",mL="any",hL="serial",TL="local_serial",D5=aL,U5=cL,w5=uL,k5=lL,G5=pL,B5=dL,j5=_L,H5=fL,F5=mL,V5=hL,q5=TL,$5=We([aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL]),EL="datasource",SL="http",gL="pubsub",AL="timer",RL="other",Y5=EL,W5=SL,z5=gL,K5=AL,Q5=RL,X5=We([EL,SL,gL,AL,RL]),yL="insert",IL="edit",OL="delete",J5=yL,Z5=IL,eZ=OL,tZ=We([yL,IL,OL]),NL="alibaba_cloud",bL="aws",CL="azure",PL="gcp",nZ=NL,rZ=bL,oZ=CL,sZ=PL,iZ=We([NL,bL,CL,PL]),ML="ip_tcp",xL="ip_udp",vL="ip",LL="unix",DL="pipe",UL="inproc",wL="other",aZ=ML,cZ=xL,uZ=vL,lZ=LL,pZ=DL,dZ=UL,_Z=wL,fZ=We([ML,xL,vL,LL,DL,UL,wL]),kL="wifi",GL="wired",BL="cell",jL="unavailable",HL="unknown",mZ=kL,hZ=GL,TZ=BL,EZ=jL,SZ=HL,gZ=We([kL,GL,BL,jL,HL]),FL="gprs",VL="edge",qL="umts",$L="cdma",YL="evdo_0",WL="evdo_a",zL="cdma2000_1xrtt",KL="hsdpa",QL="hsupa",XL="hspa",JL="iden",ZL="evdo_b",e0="lte",t0="ehrpd",n0="hspap",r0="gsm",o0="td_scdma",s0="iwlan",i0="nr",a0="nrnsa",c0="lte_ca",AZ=FL,RZ=VL,yZ=qL,IZ=$L,OZ=YL,NZ=WL,bZ=zL,CZ=KL,PZ=QL,MZ=XL,xZ=JL,vZ=ZL,LZ=e0,DZ=t0,UZ=n0,wZ=r0,kZ=o0,GZ=s0,BZ=i0,jZ=a0,HZ=c0,FZ=We([FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0]),u0="1.0",l0="1.1",p0="2.0",d0="SPDY",_0="QUIC",VZ=u0,qZ=l0,$Z=p0,YZ=d0,WZ=_0,zZ={HTTP_1_0:u0,HTTP_1_1:l0,HTTP_2_0:p0,SPDY:d0,QUIC:_0},f0="queue",m0="topic",KZ=f0,QZ=m0,XZ=We([f0,m0]),h0="receive",T0="process",JZ=h0,ZZ=T0,e6=We([h0,T0]),E0=0,S0=1,g0=2,A0=3,R0=4,y0=5,I0=6,O0=7,N0=8,b0=9,C0=10,P0=11,M0=12,x0=13,v0=14,L0=15,D0=16,t6=E0,n6=S0,r6=g0,o6=A0,s6=R0,i6=y0,a6=I0,c6=O0,u6=N0,l6=b0,p6=C0,d6=P0,_6=M0,f6=x0,m6=v0,h6=L0,T6=D0,E6={OK:E0,CANCELLED:S0,UNKNOWN:g0,INVALID_ARGUMENT:A0,DEADLINE_EXCEEDED:R0,NOT_FOUND:y0,ALREADY_EXISTS:I0,PERMISSION_DENIED:O0,RESOURCE_EXHAUSTED:N0,FAILED_PRECONDITION:b0,ABORTED:C0,OUT_OF_RANGE:P0,UNIMPLEMENTED:M0,INTERNAL:x0,UNAVAILABLE:v0,DATA_LOSS:L0,UNAUTHENTICATED:D0},U0="SENT",w0="RECEIVED",S6=U0,g6=w0,A6=We([U0,w0])});var G0=z(()=>{k0()});var B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU,R6,y6,I6,O6,N6,b6,C6,P6,M6,x6,v6,L6,D6,U6,w6,k6,G6,B6,j6,H6,F6,V6,q6,$6,Y6,W6,z6,K6,Q6,X6,J6,Z6,e8,t8,n8,r8,o8,s8,i8,a8,c8,u8,l8,p8,d8,_8,f8,m8,h8,T8,E8,S8,g8,A8,R8,y8,I8,O8,N8,b8,C8,P8,M8,x8,v8,L8,D8,U8,w8,k8,G8,cA,B8,j8,H8,F8,V8,q8,$8,Y8,W8,z8,dU,_U,fU,mU,K8,Q8,X8,J8,Z8,hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU,e7,t7,n7,r7,o7,s7,i7,a7,c7,u7,l7,p7,d7,_7,f7,m7,h7,T7,LU,DU,E7,S7,g7,UU,wU,kU,GU,BU,jU,HU,A7,R7,y7,I7,O7,N7,b7,C7,FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU,P7,M7,x7,v7,L7,D7,U7,w7,k7,G7,B7,j7,ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw,H7,F7,V7,q7,$7,Y7,W7,z7,K7,Q7,X7,uw=z(()=>{zg();B0="cloud.provider",j0="cloud.account.id",H0="cloud.region",F0="cloud.availability_zone",V0="cloud.platform",q0="aws.ecs.container.arn",$0="aws.ecs.cluster.arn",Y0="aws.ecs.launchtype",W0="aws.ecs.task.arn",z0="aws.ecs.task.family",K0="aws.ecs.task.revision",Q0="aws.eks.cluster.arn",X0="aws.log.group.names",J0="aws.log.group.arns",Z0="aws.log.stream.names",eD="aws.log.stream.arns",tD="container.name",nD="container.id",rD="container.runtime",oD="container.image.name",sD="container.image.tag",iD="deployment.environment",aD="device.id",cD="device.model.identifier",uD="device.model.name",lD="faas.name",pD="faas.id",dD="faas.version",_D="faas.instance",fD="faas.max_memory",mD="host.id",hD="host.name",TD="host.type",ED="host.arch",SD="host.image.name",gD="host.image.id",AD="host.image.version",RD="k8s.cluster.name",yD="k8s.node.name",ID="k8s.node.uid",OD="k8s.namespace.name",ND="k8s.pod.uid",bD="k8s.pod.name",CD="k8s.container.name",PD="k8s.replicaset.uid",MD="k8s.replicaset.name",xD="k8s.deployment.uid",vD="k8s.deployment.name",LD="k8s.statefulset.uid",DD="k8s.statefulset.name",UD="k8s.daemonset.uid",wD="k8s.daemonset.name",kD="k8s.job.uid",GD="k8s.job.name",BD="k8s.cronjob.uid",jD="k8s.cronjob.name",HD="os.type",FD="os.description",VD="os.name",qD="os.version",$D="process.pid",YD="process.executable.name",WD="process.executable.path",zD="process.command",KD="process.command_line",QD="process.command_args",XD="process.owner",JD="process.runtime.name",ZD="process.runtime.version",eU="process.runtime.description",tU="service.name",nU="service.namespace",rU="service.instance.id",oU="service.version",sU="telemetry.sdk.name",iU="telemetry.sdk.language",aU="telemetry.sdk.version",cU="telemetry.auto.version",uU="webengine.name",lU="webengine.version",pU="webengine.description",R6=B0,y6=j0,I6=H0,O6=F0,N6=V0,b6=q0,C6=$0,P6=Y0,M6=W0,x6=z0,v6=K0,L6=Q0,D6=X0,U6=J0,w6=Z0,k6=eD,G6=tD,B6=nD,j6=rD,H6=oD,F6=sD,V6=iD,q6=aD,$6=cD,Y6=uD,W6=lD,z6=pD,K6=dD,Q6=_D,X6=fD,J6=mD,Z6=hD,e8=TD,t8=ED,n8=SD,r8=gD,o8=AD,s8=RD,i8=yD,a8=ID,c8=OD,u8=ND,l8=bD,p8=CD,d8=PD,_8=MD,f8=xD,m8=vD,h8=LD,T8=DD,E8=UD,S8=wD,g8=kD,A8=GD,R8=BD,y8=jD,I8=HD,O8=FD,N8=VD,b8=qD,C8=$D,P8=YD,M8=WD,x8=zD,v8=KD,L8=QD,D8=XD,U8=JD,w8=ZD,k8=eU,G8=tU,cA=nU,B8=rU,j8=oU,H8=sU,F8=iU,V8=aU,q8=cU,$8=uU,Y8=lU,W8=pU,z8=We([B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU]),dU="alibaba_cloud",_U="aws",fU="azure",mU="gcp",K8=dU,Q8=_U,X8=fU,J8=mU,Z8=We([dU,_U,fU,mU]),hU="alibaba_cloud_ecs",TU="alibaba_cloud_fc",EU="aws_ec2",SU="aws_ecs",gU="aws_eks",AU="aws_lambda",RU="aws_elastic_beanstalk",yU="azure_vm",IU="azure_container_instances",OU="azure_aks",NU="azure_functions",bU="azure_app_service",CU="gcp_compute_engine",PU="gcp_cloud_run",MU="gcp_kubernetes_engine",xU="gcp_cloud_functions",vU="gcp_app_engine",e7=hU,t7=TU,n7=EU,r7=SU,o7=gU,s7=AU,i7=RU,a7=yU,c7=IU,u7=OU,l7=NU,p7=bU,d7=CU,_7=PU,f7=MU,m7=xU,h7=vU,T7=We([hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU]),LU="ec2",DU="fargate",E7=LU,S7=DU,g7=We([LU,DU]),UU="amd64",wU="arm32",kU="arm64",GU="ia64",BU="ppc32",jU="ppc64",HU="x86",A7=UU,R7=wU,y7=kU,I7=GU,O7=BU,N7=jU,b7=HU,C7=We([UU,wU,kU,GU,BU,jU,HU]),FU="windows",VU="linux",qU="darwin",$U="freebsd",YU="netbsd",WU="openbsd",zU="dragonflybsd",KU="hpux",QU="aix",XU="solaris",JU="z_os",P7=FU,M7=VU,x7=qU,v7=$U,L7=YU,D7=WU,U7=zU,w7=KU,k7=QU,G7=XU,B7=JU,j7=We([FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU]),ZU="cpp",ew="dotnet",tw="erlang",nw="go",rw="java",ow="nodejs",sw="php",iw="python",aw="ruby",cw="webjs",H7=ZU,F7=ew,V7=tw,q7=nw,$7=rw,Y7=ow,W7=sw,z7=iw,K7=aw,Q7=cw,X7=We([ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw])});var lw=z(()=>{uw()});var J7,Z7,eee,tee,nee,ree,oee,see,iee,aee,cee,uee,lee,pee,dee,_ee,fee,mee,hee,Tee,Eee,See,gee,Aee,Ree,uA,lA,yee,ec,Iee,pA,dA,Oee,Mi,Nee,bee,Cee,Pee,Mee,xee,vee,Lee,Dee,Uee,_A,wee,kee,Gee,Bee,jee,Hee,xi,Fee,Vee,qee,$ee,Yee,Wee,zee,Kee,Qee,Xee,Jee,Zee,ete,bo,Co,tte,nte,rte,ote,ste,ite,ate,cte,ute,lte,pte,dte,_te,fte,mte,hte,fA,mA,Tte,hA,TA,Ete,Ste,gte,Ate,Rte,yte,Ite,Ote,Nte,bte,Cte,Pte,Mte,xte,EA,SA,vte,gA,Lte,AA,Dte,Ute,wte,kte,Gte,Bte,jte,Hte,Fte,Vte,qte,$te,Yte,Wte,zte,Kte,Qte,Xte,Jte,Zte,ene,tne,nne,rne,cs,one,sne,ine,RA,pw=z(()=>{J7="aspnetcore.diagnostics.exception.result",Z7="aborted",eee="handled",tee="skipped",nee="unhandled",ree="aspnetcore.diagnostics.handler.type",oee="aspnetcore.rate_limiting.policy",see="aspnetcore.rate_limiting.result",iee="acquired",aee="endpoint_limiter",cee="global_limiter",uee="request_canceled",lee="aspnetcore.request.is_unhandled",pee="aspnetcore.routing.is_fallback",dee="aspnetcore.routing.match_status",_ee="failure",fee="success",mee="aspnetcore.user.is_authenticated",hee="client.address",Tee="client.port",Eee="code.column.number",See="code.file.path",gee="code.function.name",Aee="code.line.number",Ree="code.stacktrace",uA="db.collection.name",lA="db.namespace",yee="db.operation.batch.size",ec="db.operation.name",Iee="db.query.summary",pA="db.query.text",dA="db.response.status_code",Oee="db.stored_procedure.name",Mi="db.system.name",Nee="mariadb",bee="microsoft.sql_server",Cee="mysql",Pee="postgresql",Mee="dotnet.gc.heap.generation",xee="gen0",vee="gen1",Lee="gen2",Dee="loh",Uee="poh",_A="error.type",wee="_OTHER",kee="exception.escaped",Gee="exception.message",Bee="exception.stacktrace",jee="exception.type",Hee=t=>`http.request.header.${t}`,xi="http.request.method",Fee="_OTHER",Vee="CONNECT",qee="DELETE",$ee="GET",Yee="HEAD",Wee="OPTIONS",zee="PATCH",Kee="POST",Qee="PUT",Xee="TRACE",Jee="http.request.method_original",Zee="http.request.resend_count",ete=t=>`http.response.header.${t}`,bo="http.response.status_code",Co="http.route",tte="jvm.gc.action",nte="jvm.gc.name",rte="jvm.memory.pool.name",ote="jvm.memory.type",ste="heap",ite="non_heap",ate="jvm.thread.daemon",cte="jvm.thread.state",ute="blocked",lte="new",pte="runnable",dte="terminated",_te="timed_waiting",fte="waiting",mte="network.local.address",hte="network.local.port",fA="network.peer.address",mA="network.peer.port",Tte="network.protocol.name",hA="network.protocol.version",TA="network.transport",Ete="pipe",Ste="quic",gte="tcp",Ate="udp",Rte="unix",yte="network.type",Ite="ipv4",Ote="ipv6",Nte="otel.scope.name",bte="otel.scope.version",Cte="otel.status_code",Pte="ERROR",Mte="OK",xte="otel.status_description",EA="server.address",SA="server.port",vte="service.instance.id",gA="service.name",Lte="service.namespace",AA="service.version",Dte="signalr.connection.status",Ute="app_shutdown",wte="normal_closure",kte="timeout",Gte="signalr.transport",Bte="long_polling",jte="server_sent_events",Hte="web_sockets",Fte="telemetry.sdk.language",Vte="cpp",qte="dotnet",$te="erlang",Yte="go",Wte="java",zte="nodejs",Kte="php",Qte="python",Xte="ruby",Jte="rust",Zte="swift",ene="webjs",tne="telemetry.sdk.name",nne="telemetry.sdk.version",rne="url.fragment",cs="url.full",one="url.path",sne="url.query",ine="url.scheme",RA="user_agent.original"});var ane,cne,une,lne,pne,dne,_ne,fne,mne,hne,Tne,Ene,Sne,gne,Ane,Rne,yne,Ine,One,Nne,bne,Cne,Pne,Mne,xne,vne,Lne,Dne,Une,wne,kne,Gne,Bne,jne,Hne,Fne,Vne,qne,$ne,Yne,Wne,zne,Kne,Qne,Xne,Jne,Zne,ere,tre,nre,rre,dw=z(()=>{ane="aspnetcore.diagnostics.exceptions",cne="aspnetcore.rate_limiting.active_request_leases",une="aspnetcore.rate_limiting.queued_requests",lne="aspnetcore.rate_limiting.request.time_in_queue",pne="aspnetcore.rate_limiting.request_lease.duration",dne="aspnetcore.rate_limiting.requests",_ne="aspnetcore.routing.match_attempts",fne="db.client.operation.duration",mne="dotnet.assembly.count",hne="dotnet.exceptions",Tne="dotnet.gc.collections",Ene="dotnet.gc.heap.total_allocated",Sne="dotnet.gc.last_collection.heap.fragmentation.size",gne="dotnet.gc.last_collection.heap.size",Ane="dotnet.gc.last_collection.memory.committed_size",Rne="dotnet.gc.pause.time",yne="dotnet.jit.compilation.time",Ine="dotnet.jit.compiled_il.size",One="dotnet.jit.compiled_methods",Nne="dotnet.monitor.lock_contentions",bne="dotnet.process.cpu.count",Cne="dotnet.process.cpu.time",Pne="dotnet.process.memory.working_set",Mne="dotnet.thread_pool.queue.length",xne="dotnet.thread_pool.thread.count",vne="dotnet.thread_pool.work_item.count",Lne="dotnet.timer.count",Dne="http.client.request.duration",Une="http.server.request.duration",wne="jvm.class.count",kne="jvm.class.loaded",Gne="jvm.class.unloaded",Bne="jvm.cpu.count",jne="jvm.cpu.recent_utilization",Hne="jvm.cpu.time",Fne="jvm.gc.duration",Vne="jvm.memory.committed",qne="jvm.memory.limit",$ne="jvm.memory.used",Yne="jvm.memory.used_after_last_gc",Wne="jvm.thread.count",zne="kestrel.active_connections",Kne="kestrel.active_tls_handshakes",Qne="kestrel.connection.duration",Xne="kestrel.queued_connections",Jne="kestrel.queued_requests",Zne="kestrel.rejected_connections",ere="kestrel.tls_handshake.duration",tre="kestrel.upgraded_connections",nre="signalr.server.active_connections",rre="signalr.server.connection.duration"});var ore,_w=z(()=>{ore="exception"});var Ae={};sg(Ae,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>Z7,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>eee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>tee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>nee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>iee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>aee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>cee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>uee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>_ee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>fee,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>J7,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>ree,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>oee,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>see,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>lee,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>pee,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>dee,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>mee,ATTR_CLIENT_ADDRESS:()=>hee,ATTR_CLIENT_PORT:()=>Tee,ATTR_CODE_COLUMN_NUMBER:()=>Eee,ATTR_CODE_FILE_PATH:()=>See,ATTR_CODE_FUNCTION_NAME:()=>gee,ATTR_CODE_LINE_NUMBER:()=>Aee,ATTR_CODE_STACKTRACE:()=>Ree,ATTR_DB_COLLECTION_NAME:()=>uA,ATTR_DB_NAMESPACE:()=>lA,ATTR_DB_OPERATION_BATCH_SIZE:()=>yee,ATTR_DB_OPERATION_NAME:()=>ec,ATTR_DB_QUERY_SUMMARY:()=>Iee,ATTR_DB_QUERY_TEXT:()=>pA,ATTR_DB_RESPONSE_STATUS_CODE:()=>dA,ATTR_DB_STORED_PROCEDURE_NAME:()=>Oee,ATTR_DB_SYSTEM_NAME:()=>Mi,ATTR_DOTNET_GC_HEAP_GENERATION:()=>Mee,ATTR_ERROR_TYPE:()=>_A,ATTR_EXCEPTION_ESCAPED:()=>kee,ATTR_EXCEPTION_MESSAGE:()=>Gee,ATTR_EXCEPTION_STACKTRACE:()=>Bee,ATTR_EXCEPTION_TYPE:()=>jee,ATTR_HTTP_REQUEST_HEADER:()=>Hee,ATTR_HTTP_REQUEST_METHOD:()=>xi,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>Jee,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>Zee,ATTR_HTTP_RESPONSE_HEADER:()=>ete,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>bo,ATTR_HTTP_ROUTE:()=>Co,ATTR_JVM_GC_ACTION:()=>tte,ATTR_JVM_GC_NAME:()=>nte,ATTR_JVM_MEMORY_POOL_NAME:()=>rte,ATTR_JVM_MEMORY_TYPE:()=>ote,ATTR_JVM_THREAD_DAEMON:()=>ate,ATTR_JVM_THREAD_STATE:()=>cte,ATTR_NETWORK_LOCAL_ADDRESS:()=>mte,ATTR_NETWORK_LOCAL_PORT:()=>hte,ATTR_NETWORK_PEER_ADDRESS:()=>fA,ATTR_NETWORK_PEER_PORT:()=>mA,ATTR_NETWORK_PROTOCOL_NAME:()=>Tte,ATTR_NETWORK_PROTOCOL_VERSION:()=>hA,ATTR_NETWORK_TRANSPORT:()=>TA,ATTR_NETWORK_TYPE:()=>yte,ATTR_OTEL_SCOPE_NAME:()=>Nte,ATTR_OTEL_SCOPE_VERSION:()=>bte,ATTR_OTEL_STATUS_CODE:()=>Cte,ATTR_OTEL_STATUS_DESCRIPTION:()=>xte,ATTR_SERVER_ADDRESS:()=>EA,ATTR_SERVER_PORT:()=>SA,ATTR_SERVICE_INSTANCE_ID:()=>vte,ATTR_SERVICE_NAME:()=>gA,ATTR_SERVICE_NAMESPACE:()=>Lte,ATTR_SERVICE_VERSION:()=>AA,ATTR_SIGNALR_CONNECTION_STATUS:()=>Dte,ATTR_SIGNALR_TRANSPORT:()=>Gte,ATTR_TELEMETRY_SDK_LANGUAGE:()=>Fte,ATTR_TELEMETRY_SDK_NAME:()=>tne,ATTR_TELEMETRY_SDK_VERSION:()=>nne,ATTR_URL_FRAGMENT:()=>rne,ATTR_URL_FULL:()=>cs,ATTR_URL_PATH:()=>one,ATTR_URL_QUERY:()=>sne,ATTR_URL_SCHEME:()=>ine,ATTR_USER_AGENT_ORIGINAL:()=>RA,AWSECSLAUNCHTYPEVALUES_EC2:()=>E7,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>S7,AwsEcsLaunchtypeValues:()=>g7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>e7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>t7,CLOUDPLATFORMVALUES_AWS_EC2:()=>n7,CLOUDPLATFORMVALUES_AWS_ECS:()=>r7,CLOUDPLATFORMVALUES_AWS_EKS:()=>o7,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>i7,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>s7,CLOUDPLATFORMVALUES_AZURE_AKS:()=>u7,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>p7,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>c7,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>l7,CLOUDPLATFORMVALUES_AZURE_VM:()=>a7,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>h7,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>m7,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>_7,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>d7,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>f7,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>K8,CLOUDPROVIDERVALUES_AWS:()=>Q8,CLOUDPROVIDERVALUES_AZURE:()=>X8,CLOUDPROVIDERVALUES_GCP:()=>J8,CloudPlatformValues:()=>T7,CloudProviderValues:()=>Z8,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>D5,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>F5,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>U5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>H5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>k5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>q5,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>G5,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>w5,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>V5,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>j5,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>B5,DBSYSTEMVALUES_ADABAS:()=>r5,DBSYSTEMVALUES_CACHE:()=>n5,DBSYSTEMVALUES_CASSANDRA:()=>g5,DBSYSTEMVALUES_CLOUDSCAPE:()=>zJ,DBSYSTEMVALUES_COCKROACHDB:()=>v5,DBSYSTEMVALUES_COLDFUSION:()=>S5,DBSYSTEMVALUES_COSMOSDB:()=>N5,DBSYSTEMVALUES_COUCHBASE:()=>I5,DBSYSTEMVALUES_COUCHDB:()=>O5,DBSYSTEMVALUES_DB2:()=>qJ,DBSYSTEMVALUES_DERBY:()=>s5,DBSYSTEMVALUES_DYNAMODB:()=>b5,DBSYSTEMVALUES_EDB:()=>t5,DBSYSTEMVALUES_ELASTICSEARCH:()=>M5,DBSYSTEMVALUES_FILEMAKER:()=>i5,DBSYSTEMVALUES_FIREBIRD:()=>o5,DBSYSTEMVALUES_FIRSTSQL:()=>e5,DBSYSTEMVALUES_GEODE:()=>P5,DBSYSTEMVALUES_H2:()=>E5,DBSYSTEMVALUES_HANADB:()=>JJ,DBSYSTEMVALUES_HBASE:()=>A5,DBSYSTEMVALUES_HIVE:()=>WJ,DBSYSTEMVALUES_HSQLDB:()=>KJ,DBSYSTEMVALUES_INFORMIX:()=>a5,DBSYSTEMVALUES_INGRES:()=>ZJ,DBSYSTEMVALUES_INSTANTDB:()=>c5,DBSYSTEMVALUES_INTERBASE:()=>u5,DBSYSTEMVALUES_MARIADB:()=>l5,DBSYSTEMVALUES_MAXDB:()=>XJ,DBSYSTEMVALUES_MEMCACHED:()=>x5,DBSYSTEMVALUES_MONGODB:()=>R5,DBSYSTEMVALUES_MSSQL:()=>HJ,DBSYSTEMVALUES_MYSQL:()=>FJ,DBSYSTEMVALUES_NEO4J:()=>C5,DBSYSTEMVALUES_NETEZZA:()=>p5,DBSYSTEMVALUES_ORACLE:()=>VJ,DBSYSTEMVALUES_OTHER_SQL:()=>jJ,DBSYSTEMVALUES_PERVASIVE:()=>d5,DBSYSTEMVALUES_POINTBASE:()=>_5,DBSYSTEMVALUES_POSTGRESQL:()=>$J,DBSYSTEMVALUES_PROGRESS:()=>QJ,DBSYSTEMVALUES_REDIS:()=>y5,DBSYSTEMVALUES_REDSHIFT:()=>YJ,DBSYSTEMVALUES_SQLITE:()=>f5,DBSYSTEMVALUES_SYBASE:()=>m5,DBSYSTEMVALUES_TERADATA:()=>h5,DBSYSTEMVALUES_VERTICA:()=>T5,DB_SYSTEM_NAME_VALUE_MARIADB:()=>Nee,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>bee,DB_SYSTEM_NAME_VALUE_MYSQL:()=>Cee,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>Pee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>xee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>vee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>Lee,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>Dee,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>Uee,DbCassandraConsistencyLevelValues:()=>$5,DbSystemValues:()=>L5,ERROR_TYPE_VALUE_OTHER:()=>wee,EVENT_EXCEPTION:()=>ore,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>eZ,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>Z5,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>J5,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>nZ,FAASINVOKEDPROVIDERVALUES_AWS:()=>rZ,FAASINVOKEDPROVIDERVALUES_AZURE:()=>oZ,FAASINVOKEDPROVIDERVALUES_GCP:()=>sZ,FAASTRIGGERVALUES_DATASOURCE:()=>Y5,FAASTRIGGERVALUES_HTTP:()=>W5,FAASTRIGGERVALUES_OTHER:()=>Q5,FAASTRIGGERVALUES_PUBSUB:()=>z5,FAASTRIGGERVALUES_TIMER:()=>K5,FaasDocumentOperationValues:()=>tZ,FaasInvokedProviderValues:()=>iZ,FaasTriggerValues:()=>X5,HOSTARCHVALUES_AMD64:()=>A7,HOSTARCHVALUES_ARM32:()=>R7,HOSTARCHVALUES_ARM64:()=>y7,HOSTARCHVALUES_IA64:()=>I7,HOSTARCHVALUES_PPC32:()=>O7,HOSTARCHVALUES_PPC64:()=>N7,HOSTARCHVALUES_X86:()=>b7,HTTPFLAVORVALUES_HTTP_1_0:()=>VZ,HTTPFLAVORVALUES_HTTP_1_1:()=>qZ,HTTPFLAVORVALUES_HTTP_2_0:()=>$Z,HTTPFLAVORVALUES_QUIC:()=>WZ,HTTPFLAVORVALUES_SPDY:()=>YZ,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>Vee,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>qee,HTTP_REQUEST_METHOD_VALUE_GET:()=>$ee,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>Yee,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>Wee,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>Fee,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>zee,HTTP_REQUEST_METHOD_VALUE_POST:()=>Kee,HTTP_REQUEST_METHOD_VALUE_PUT:()=>Qee,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>Xee,HostArchValues:()=>C7,HttpFlavorValues:()=>zZ,JVM_MEMORY_TYPE_VALUE_HEAP:()=>ste,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>ite,JVM_THREAD_STATE_VALUE_BLOCKED:()=>ute,JVM_THREAD_STATE_VALUE_NEW:()=>lte,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>pte,JVM_THREAD_STATE_VALUE_TERMINATED:()=>dte,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>_te,JVM_THREAD_STATE_VALUE_WAITING:()=>fte,MESSAGETYPEVALUES_RECEIVED:()=>g6,MESSAGETYPEVALUES_SENT:()=>S6,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>KZ,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>QZ,MESSAGINGOPERATIONVALUES_PROCESS:()=>ZZ,MESSAGINGOPERATIONVALUES_RECEIVE:()=>JZ,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>ane,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>cne,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>une,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>dne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>pne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>lne,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>_ne,METRIC_DB_CLIENT_OPERATION_DURATION:()=>fne,METRIC_DOTNET_ASSEMBLY_COUNT:()=>mne,METRIC_DOTNET_EXCEPTIONS:()=>hne,METRIC_DOTNET_GC_COLLECTIONS:()=>Tne,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>Ene,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>Sne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>gne,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>Ane,METRIC_DOTNET_GC_PAUSE_TIME:()=>Rne,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>yne,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>Ine,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>One,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>Nne,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>bne,METRIC_DOTNET_PROCESS_CPU_TIME:()=>Cne,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>Pne,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>Mne,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>xne,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>vne,METRIC_DOTNET_TIMER_COUNT:()=>Lne,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>Dne,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>Une,METRIC_JVM_CLASS_COUNT:()=>wne,METRIC_JVM_CLASS_LOADED:()=>kne,METRIC_JVM_CLASS_UNLOADED:()=>Gne,METRIC_JVM_CPU_COUNT:()=>Bne,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>jne,METRIC_JVM_CPU_TIME:()=>Hne,METRIC_JVM_GC_DURATION:()=>Fne,METRIC_JVM_MEMORY_COMMITTED:()=>Vne,METRIC_JVM_MEMORY_LIMIT:()=>qne,METRIC_JVM_MEMORY_USED:()=>$ne,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>Yne,METRIC_JVM_THREAD_COUNT:()=>Wne,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>zne,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Kne,METRIC_KESTREL_CONNECTION_DURATION:()=>Qne,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Xne,METRIC_KESTREL_QUEUED_REQUESTS:()=>Jne,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>Zne,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>ere,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>tre,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>nre,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>rre,MessageTypeValues:()=>A6,MessagingDestinationKindValues:()=>XZ,MessagingOperationValues:()=>e6,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>IZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>bZ,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>RZ,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>DZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>OZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>NZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>vZ,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>AZ,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>wZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>CZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>MZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>UZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>PZ,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>xZ,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>GZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>LZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>HZ,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>BZ,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>jZ,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>kZ,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>yZ,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>TZ,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>EZ,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>SZ,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>mZ,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>hZ,NETTRANSPORTVALUES_INPROC:()=>dZ,NETTRANSPORTVALUES_IP:()=>uZ,NETTRANSPORTVALUES_IP_TCP:()=>aZ,NETTRANSPORTVALUES_IP_UDP:()=>cZ,NETTRANSPORTVALUES_OTHER:()=>_Z,NETTRANSPORTVALUES_PIPE:()=>pZ,NETTRANSPORTVALUES_UNIX:()=>lZ,NETWORK_TRANSPORT_VALUE_PIPE:()=>Ete,NETWORK_TRANSPORT_VALUE_QUIC:()=>Ste,NETWORK_TRANSPORT_VALUE_TCP:()=>gte,NETWORK_TRANSPORT_VALUE_UDP:()=>Ate,NETWORK_TRANSPORT_VALUE_UNIX:()=>Rte,NETWORK_TYPE_VALUE_IPV4:()=>Ite,NETWORK_TYPE_VALUE_IPV6:()=>Ote,NetHostConnectionSubtypeValues:()=>FZ,NetHostConnectionTypeValues:()=>gZ,NetTransportValues:()=>fZ,OSTYPEVALUES_AIX:()=>k7,OSTYPEVALUES_DARWIN:()=>x7,OSTYPEVALUES_DRAGONFLYBSD:()=>U7,OSTYPEVALUES_FREEBSD:()=>v7,OSTYPEVALUES_HPUX:()=>w7,OSTYPEVALUES_LINUX:()=>M7,OSTYPEVALUES_NETBSD:()=>L7,OSTYPEVALUES_OPENBSD:()=>D7,OSTYPEVALUES_SOLARIS:()=>G7,OSTYPEVALUES_WINDOWS:()=>P7,OSTYPEVALUES_Z_OS:()=>B7,OTEL_STATUS_CODE_VALUE_ERROR:()=>Pte,OTEL_STATUS_CODE_VALUE_OK:()=>Mte,OsTypeValues:()=>j7,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>p6,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>a6,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>n6,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>h6,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>s6,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>l6,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>f6,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>o6,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>i6,RPCGRPCSTATUSCODEVALUES_OK:()=>t6,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>d6,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>c6,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>u6,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>T6,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>m6,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>_6,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>r6,RpcGrpcStatusCodeValues:()=>E6,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>XX,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>uJ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>zX,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>qX,SEMATTRS_AWS_DYNAMODB_COUNT:()=>aJ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>nJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>eJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>lJ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>JX,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>$X,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>QX,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>tJ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>KX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>YX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>WX,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>cJ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>oJ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>sJ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>ZX,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>rJ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>VX,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>iJ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>UQ,SEMATTRS_CODE_FILEPATH:()=>LX,SEMATTRS_CODE_FUNCTION:()=>xX,SEMATTRS_CODE_LINENO:()=>DX,SEMATTRS_CODE_NAMESPACE:()=>vX,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>qQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>KQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>zQ,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>YQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>FQ,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>VQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>WQ,SEMATTRS_DB_CASSANDRA_TABLE:()=>$Q,SEMATTRS_DB_CONNECTION_STRING:()=>wQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>QQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>GQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>JQ,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>HQ,SEMATTRS_DB_NAME:()=>BQ,SEMATTRS_DB_OPERATION:()=>jQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>XQ,SEMATTRS_DB_SQL_TABLE:()=>ZQ,SEMATTRS_DB_STATEMENT:()=>Qg,SEMATTRS_DB_SYSTEM:()=>Kg,SEMATTRS_DB_USER:()=>kQ,SEMATTRS_ENDUSER_ID:()=>NX,SEMATTRS_ENDUSER_ROLE:()=>bX,SEMATTRS_ENDUSER_SCOPE:()=>CX,SEMATTRS_EXCEPTION_ESCAPED:()=>rX,SEMATTRS_EXCEPTION_MESSAGE:()=>tX,SEMATTRS_EXCEPTION_STACKTRACE:()=>nX,SEMATTRS_EXCEPTION_TYPE:()=>eX,SEMATTRS_FAAS_COLDSTART:()=>pX,SEMATTRS_FAAS_CRON:()=>lX,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>sX,SEMATTRS_FAAS_DOCUMENT_NAME:()=>cX,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>iX,SEMATTRS_FAAS_DOCUMENT_TIME:()=>aX,SEMATTRS_FAAS_EXECUTION:()=>oX,SEMATTRS_FAAS_INVOKED_NAME:()=>dX,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>_X,SEMATTRS_FAAS_INVOKED_REGION:()=>fX,SEMATTRS_FAAS_TIME:()=>uX,SEMATTRS_FAAS_TRIGGER:()=>Xg,SEMATTRS_HTTP_CLIENT_IP:()=>FX,SEMATTRS_HTTP_FLAVOR:()=>kX,SEMATTRS_HTTP_HOST:()=>UX,SEMATTRS_HTTP_METHOD:()=>bl,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>BX,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>jX,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>nA,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>rA,SEMATTRS_HTTP_ROUTE:()=>oA,SEMATTRS_HTTP_SCHEME:()=>wX,SEMATTRS_HTTP_SERVER_NAME:()=>HX,SEMATTRS_HTTP_STATUS_CODE:()=>Pi,SEMATTRS_HTTP_TARGET:()=>tA,SEMATTRS_HTTP_URL:()=>Za,SEMATTRS_HTTP_USER_AGENT:()=>GX,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>kJ,SEMATTRS_MESSAGE_ID:()=>wJ,SEMATTRS_MESSAGE_TYPE:()=>UJ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>GJ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>RJ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>EJ,SEMATTRS_MESSAGING_DESTINATION:()=>pJ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>dJ,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>NJ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>OJ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>IJ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>bJ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>CJ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>TJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>gJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>SJ,SEMATTRS_MESSAGING_OPERATION:()=>AJ,SEMATTRS_MESSAGING_PROTOCOL:()=>fJ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>mJ,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>yJ,SEMATTRS_MESSAGING_SYSTEM:()=>sA,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>_J,SEMATTRS_MESSAGING_URL:()=>hJ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>IX,SEMATTRS_NET_HOST_CARRIER_MCC:()=>RX,SEMATTRS_NET_HOST_CARRIER_MNC:()=>yX,SEMATTRS_NET_HOST_CARRIER_NAME:()=>AX,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>gX,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>SX,SEMATTRS_NET_HOST_IP:()=>Zg,SEMATTRS_NET_HOST_NAME:()=>EX,SEMATTRS_NET_HOST_PORT:()=>eA,SEMATTRS_NET_PEER_IP:()=>Jg,SEMATTRS_NET_PEER_NAME:()=>TX,SEMATTRS_NET_PEER_PORT:()=>hX,SEMATTRS_NET_TRANSPORT:()=>mX,SEMATTRS_PEER_SERVICE:()=>OX,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>aA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>LJ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>DJ,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>vJ,SEMATTRS_RPC_JSONRPC_VERSION:()=>xJ,SEMATTRS_RPC_METHOD:()=>MJ,SEMATTRS_RPC_SERVICE:()=>iA,SEMATTRS_RPC_SYSTEM:()=>PJ,SEMATTRS_THREAD_ID:()=>PX,SEMATTRS_THREAD_NAME:()=>MX,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>C6,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>b6,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>P6,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>M6,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>x6,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>v6,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>L6,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>U6,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>D6,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>k6,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>w6,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>y6,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>O6,SEMRESATTRS_CLOUD_PLATFORM:()=>N6,SEMRESATTRS_CLOUD_PROVIDER:()=>R6,SEMRESATTRS_CLOUD_REGION:()=>I6,SEMRESATTRS_CONTAINER_ID:()=>B6,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>H6,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>F6,SEMRESATTRS_CONTAINER_NAME:()=>G6,SEMRESATTRS_CONTAINER_RUNTIME:()=>j6,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>V6,SEMRESATTRS_DEVICE_ID:()=>q6,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>$6,SEMRESATTRS_DEVICE_MODEL_NAME:()=>Y6,SEMRESATTRS_FAAS_ID:()=>z6,SEMRESATTRS_FAAS_INSTANCE:()=>Q6,SEMRESATTRS_FAAS_MAX_MEMORY:()=>X6,SEMRESATTRS_FAAS_NAME:()=>W6,SEMRESATTRS_FAAS_VERSION:()=>K6,SEMRESATTRS_HOST_ARCH:()=>t8,SEMRESATTRS_HOST_ID:()=>J6,SEMRESATTRS_HOST_IMAGE_ID:()=>r8,SEMRESATTRS_HOST_IMAGE_NAME:()=>n8,SEMRESATTRS_HOST_IMAGE_VERSION:()=>o8,SEMRESATTRS_HOST_NAME:()=>Z6,SEMRESATTRS_HOST_TYPE:()=>e8,SEMRESATTRS_K8S_CLUSTER_NAME:()=>s8,SEMRESATTRS_K8S_CONTAINER_NAME:()=>p8,SEMRESATTRS_K8S_CRONJOB_NAME:()=>y8,SEMRESATTRS_K8S_CRONJOB_UID:()=>R8,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>S8,SEMRESATTRS_K8S_DAEMONSET_UID:()=>E8,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>m8,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>f8,SEMRESATTRS_K8S_JOB_NAME:()=>A8,SEMRESATTRS_K8S_JOB_UID:()=>g8,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>c8,SEMRESATTRS_K8S_NODE_NAME:()=>i8,SEMRESATTRS_K8S_NODE_UID:()=>a8,SEMRESATTRS_K8S_POD_NAME:()=>l8,SEMRESATTRS_K8S_POD_UID:()=>u8,SEMRESATTRS_K8S_REPLICASET_NAME:()=>_8,SEMRESATTRS_K8S_REPLICASET_UID:()=>d8,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>T8,SEMRESATTRS_K8S_STATEFULSET_UID:()=>h8,SEMRESATTRS_OS_DESCRIPTION:()=>O8,SEMRESATTRS_OS_NAME:()=>N8,SEMRESATTRS_OS_TYPE:()=>I8,SEMRESATTRS_OS_VERSION:()=>b8,SEMRESATTRS_PROCESS_COMMAND:()=>x8,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>L8,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>v8,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>P8,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>M8,SEMRESATTRS_PROCESS_OWNER:()=>D8,SEMRESATTRS_PROCESS_PID:()=>C8,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>k8,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>U8,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>w8,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>B8,SEMRESATTRS_SERVICE_NAME:()=>G8,SEMRESATTRS_SERVICE_NAMESPACE:()=>cA,SEMRESATTRS_SERVICE_VERSION:()=>j8,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>q8,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>F8,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>H8,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>V8,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>W8,SEMRESATTRS_WEBENGINE_NAME:()=>$8,SEMRESATTRS_WEBENGINE_VERSION:()=>Y8,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>Ute,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>wte,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>kte,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>Bte,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>jte,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>Hte,SemanticAttributes:()=>BJ,SemanticResourceAttributes:()=>z8,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>H7,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>F7,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>V7,TELEMETRYSDKLANGUAGEVALUES_GO:()=>q7,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>$7,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>Y7,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>W7,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>z7,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>K7,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>Q7,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>Vte,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>qte,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>$te,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>Yte,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>Wte,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>zte,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Kte,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>Qte,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Xte,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Jte,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>Zte,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>ene,TelemetrySdkLanguageValues:()=>X7});var le=z(()=>{G0();lw();pw();dw();_w()});var fw=E(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});v_.ATTR_PROCESS_RUNTIME_NAME=void 0;v_.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var mw=E(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});D_.SDK_INFO=void 0;var sre=WP(),L_=(le(),O(Ae)),ire=fw();D_.SDK_INFO={[L_.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[ire.ATTR_PROCESS_RUNTIME_NAME]:"node",[L_.ATTR_TELEMETRY_SDK_LANGUAGE]:L_.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[L_.ATTR_TELEMETRY_SDK_VERSION]:sre.VERSION}});var hw=E($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.otperformance=$t.SDK_INFO=$t._globalThis=$t.getStringListFromEnv=$t.getNumberFromEnv=$t.getBooleanFromEnv=$t.getStringFromEnv=void 0;var U_=$P();Object.defineProperty($t,"getStringFromEnv",{enumerable:!0,get:function(){return U_.getStringFromEnv}});Object.defineProperty($t,"getBooleanFromEnv",{enumerable:!0,get:function(){return U_.getBooleanFromEnv}});Object.defineProperty($t,"getNumberFromEnv",{enumerable:!0,get:function(){return U_.getNumberFromEnv}});Object.defineProperty($t,"getStringListFromEnv",{enumerable:!0,get:function(){return U_.getStringListFromEnv}});var are=YP();Object.defineProperty($t,"_globalThis",{enumerable:!0,get:function(){return are._globalThis}});var cre=mw();Object.defineProperty($t,"SDK_INFO",{enumerable:!0,get:function(){return cre.SDK_INFO}});$t.otperformance=performance});var yA=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getStringListFromEnv=Yt.getNumberFromEnv=Yt.getStringFromEnv=Yt.getBooleanFromEnv=Yt.otperformance=Yt._globalThis=Yt.SDK_INFO=void 0;var vi=hw();Object.defineProperty(Yt,"SDK_INFO",{enumerable:!0,get:function(){return vi.SDK_INFO}});Object.defineProperty(Yt,"_globalThis",{enumerable:!0,get:function(){return vi._globalThis}});Object.defineProperty(Yt,"otperformance",{enumerable:!0,get:function(){return vi.otperformance}});Object.defineProperty(Yt,"getBooleanFromEnv",{enumerable:!0,get:function(){return vi.getBooleanFromEnv}});Object.defineProperty(Yt,"getStringFromEnv",{enumerable:!0,get:function(){return vi.getStringFromEnv}});Object.defineProperty(Yt,"getNumberFromEnv",{enumerable:!0,get:function(){return vi.getNumberFromEnv}});Object.defineProperty(Yt,"getStringListFromEnv",{enumerable:!0,get:function(){return vi.getStringListFromEnv}})});var gw=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addHrTimes=be.isTimeInput=be.isTimeInputHrTime=be.hrTimeToMicroseconds=be.hrTimeToMilliseconds=be.hrTimeToNanoseconds=be.hrTimeToTimeStamp=be.hrTimeDuration=be.timeInputToHrTime=be.hrTime=be.getTimeOrigin=be.millisToHrTime=void 0;var w_=yA(),Tw=9,ure=6,lre=Math.pow(10,ure),k_=Math.pow(10,Tw);function Cl(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*lre);return[n,r]}be.millisToHrTime=Cl;function pre(){return w_.otperformance.timeOrigin}be.getTimeOrigin=pre;function Ew(t){let e=Cl(w_.otperformance.timeOrigin),n=Cl(typeof t=="number"?t:w_.otperformance.now());return Sw(e,n)}be.hrTime=Ew;function dre(t){if(IA(t))return t;if(typeof t=="number")return t<w_.otperformance.timeOrigin?Ew(t):Cl(t);if(t instanceof Date)return Cl(t.getTime());throw TypeError("Invalid input type")}be.timeInputToHrTime=dre;function _re(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=k_),[n,r]}be.hrTimeDuration=_re;function fre(t){let e=Tw,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}be.hrTimeToTimeStamp=fre;function mre(t){return t[0]*k_+t[1]}be.hrTimeToNanoseconds=mre;function hre(t){return t[0]*1e3+t[1]/1e6}be.hrTimeToMilliseconds=hre;function Tre(t){return t[0]*1e6+t[1]/1e3}be.hrTimeToMicroseconds=Tre;function IA(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}be.isTimeInputHrTime=IA;function Ere(t){return IA(t)||typeof t=="number"||t instanceof Date}be.isTimeInput=Ere;function Sw(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=k_&&(n[1]-=k_,n[0]+=1),n}be.addHrTimes=Sw});var Aw=E(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});G_.unrefTimer=void 0;function Sre(t){typeof t!="number"&&t.unref()}G_.unrefTimer=Sre});var Rw=E(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.ExportResultCode=void 0;var gre;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(gre=Pl.ExportResultCode||(Pl.ExportResultCode={}))});var Iw=E(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});B_.CompositePropagator=void 0;var yw=(b(),O(v)),OA=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){yw.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,n,r){return this._propagators.reduce((o,s)=>{try{return s.extract(o,n,r)}catch(i){yw.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};B_.CompositePropagator=OA});var Ow=E(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.validateValue=tc.validateKey=void 0;var NA="[_0-9a-z-*/]",Are=`[a-z]${NA}{0,255}`,Rre=`[a-z0-9]${NA}{0,240}@[a-z]${NA}{0,13}`,yre=new RegExp(`^(?:${Are}|${Rre})$`),Ire=/^[ -~]{0,255}[!-~]$/,Ore=/,|=/;function Nre(t){return yre.test(t)}tc.validateKey=Nre;function bre(t){return Ire.test(t)&&!Ore.test(t)}tc.validateValue=bre});var CA=E(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});j_.TraceState=void 0;var Nw=Ow(),bw=32,Cre=512,Cw=",",Pw="=",bA=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+Pw+this.get(n)),e),[]).join(Cw)}_parse(e){e.length>Cre||(this._internalState=e.split(Cw).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(Pw);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Nw.validateKey)(i)&&(0,Nw.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>bw&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,bw))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};j_.TraceState=bA});var xw=E(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.W3CTraceContextPropagator=Wt.parseTraceParent=Wt.TRACE_STATE_HEADER=Wt.TRACE_PARENT_HEADER=void 0;var H_=(b(),O(v)),Pre=Nl(),Mre=CA();Wt.TRACE_PARENT_HEADER="traceparent";Wt.TRACE_STATE_HEADER="tracestate";var xre="00",vre="(?!ff)[\\da-f]{2}",Lre="(?![0]{32})[\\da-f]{32}",Dre="(?![0]{16})[\\da-f]{16}",Ure="[\\da-f]{2}",wre=new RegExp(`^\\s?(${vre})-(${Lre})-(${Dre})-(${Ure})(-.*)?\\s?$`);function Mw(t){let e=wre.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Wt.parseTraceParent=Mw;var PA=class{inject(e,n,r){let o=H_.trace.getSpanContext(e);if(!o||(0,Pre.isTracingSuppressed)(e)||!(0,H_.isSpanContextValid)(o))return;let s=`${xre}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||H_.TraceFlags.NONE).toString(16)}`;r.set(n,Wt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,Wt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,Wt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Mw(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,Wt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new Mre.TraceState(typeof c=="string"?c:void 0)}return H_.trace.setSpanContext(e,i)}fields(){return[Wt.TRACE_PARENT_HEADER,Wt.TRACE_STATE_HEADER]}};Wt.W3CTraceContextPropagator=PA});var vw=E(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.getRPCMetadata=Rr.deleteRPCMetadata=Rr.setRPCMetadata=Rr.RPCType=void 0;var kre=(b(),O(v)),MA=(0,kre.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Gre;(function(t){t.HTTP="http"})(Gre=Rr.RPCType||(Rr.RPCType={}));function Bre(t,e){return t.setValue(MA,e)}Rr.setRPCMetadata=Bre;function jre(t){return t.deleteValue(MA)}Rr.deleteRPCMetadata=jre;function Hre(t){return t.getValue(MA)}Rr.getRPCMetadata=Hre});var kw=E(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});F_.isPlainObject=void 0;var Fre="[object Object]",Vre="[object Null]",qre="[object Undefined]",$re=Function.prototype,Lw=$re.toString,Yre=Lw.call(Object),Wre=Object.getPrototypeOf,Dw=Object.prototype,Uw=Dw.hasOwnProperty,Li=Symbol?Symbol.toStringTag:void 0,ww=Dw.toString;function zre(t){if(!Kre(t)||Qre(t)!==Fre)return!1;let e=Wre(t);if(e===null)return!0;let n=Uw.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Lw.call(n)===Yre}F_.isPlainObject=zre;function Kre(t){return t!=null&&typeof t=="object"}function Qre(t){return t==null?t===void 0?qre:Vre:Li&&Li in Object(t)?Xre(t):Jre(t)}function Xre(t){let e=Uw.call(t,Li),n=t[Li],r=!1;try{t[Li]=void 0,r=!0}catch{}let o=ww.call(t);return r&&(e?t[Li]=n:delete t[Li]),o}function Jre(t){return ww.call(t)}});var Fw=E($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});$_.merge=void 0;var Gw=kw(),Zre=20;function eoe(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=jw(e,t.shift(),0,n);return e}$_.merge=eoe;function xA(t){return q_(t)?t.slice():t}function jw(t,e,n=0,r){let o;if(!(n>Zre)){if(n++,V_(t)||V_(e)||Hw(e))o=xA(e);else if(q_(t)){if(o=t.slice(),q_(e))for(let s=0,i=e.length;s<i;s++)o.push(xA(e[s]));else if(Ml(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=xA(e[c])}}}else if(Ml(t))if(Ml(e)){if(!toe(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i],l=e[c];if(V_(l))typeof l>"u"?delete o[c]:o[c]=l;else{let p=o[c],d=l;if(Bw(t,c,r)||Bw(e,c,r))delete o[c];else{if(Ml(p)&&Ml(d)){let _=r.get(p)||[],f=r.get(d)||[];_.push({obj:t,key:c}),f.push({obj:e,key:c}),r.set(p,_),r.set(d,f)}o[c]=jw(o[c],l,n,r)}}}}else o=e;return o}}function Bw(t,e,n){let r=n.get(t[e])||[];for(let o=0,s=r.length;o<s;o++){let i=r[o];if(i.key===e&&i.obj===t)return!0}return!1}function q_(t){return Array.isArray(t)}function Hw(t){return typeof t=="function"}function Ml(t){return!V_(t)&&!q_(t)&&!Hw(t)&&typeof t=="object"}function V_(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function toe(t,e){return!(!(0,Gw.isPlainObject)(t)||!(0,Gw.isPlainObject)(e))}});var Vw=E(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.callWithTimeout=nc.TimeoutError=void 0;var Y_=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};nc.TimeoutError=Y_;function noe(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new Y_("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}nc.callWithTimeout=noe});var $w=E(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.isUrlIgnored=rc.urlMatches=void 0;function qw(t,e){return typeof e=="string"?t===e:!!t.match(e)}rc.urlMatches=qw;function roe(t,e){if(!e)return!1;for(let n of e)if(qw(t,n))return!0;return!1}rc.isUrlIgnored=roe});var Yw=E(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.Deferred=void 0;var vA=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};W_.Deferred=vA});var Ww=E(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.BindOnceFuture=void 0;var ooe=Yw(),LA=class{_isCalled=!1;_deferred=new ooe.Deferred;_callback;_that;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}};z_.BindOnceFuture=LA});var Kw=E(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.diagLogLevelFromString=void 0;var Po=(b(),O(v)),zw={ALL:Po.DiagLogLevel.ALL,VERBOSE:Po.DiagLogLevel.VERBOSE,DEBUG:Po.DiagLogLevel.DEBUG,INFO:Po.DiagLogLevel.INFO,WARN:Po.DiagLogLevel.WARN,ERROR:Po.DiagLogLevel.ERROR,NONE:Po.DiagLogLevel.NONE};function soe(t){if(t==null)return;let e=zw[t.toUpperCase()];return e??(Po.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(zw)}, using default`),Po.DiagLogLevel.INFO)}K_.diagLogLevelFromString=soe});var Xw=E(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});Q_._export=void 0;var Qw=(b(),O(v)),ioe=Nl();function aoe(t,e){return new Promise(n=>{Qw.context.with((0,ioe.suppressTracing)(Qw.context.active()),()=>{t.export(e,n)})})}Q_._export=aoe});var Te=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.internal=y.diagLogLevelFromString=y.BindOnceFuture=y.urlMatches=y.isUrlIgnored=y.callWithTimeout=y.TimeoutError=y.merge=y.TraceState=y.unsuppressTracing=y.suppressTracing=y.isTracingSuppressed=y.setRPCMetadata=y.getRPCMetadata=y.deleteRPCMetadata=y.RPCType=y.parseTraceParent=y.W3CTraceContextPropagator=y.TRACE_STATE_HEADER=y.TRACE_PARENT_HEADER=y.CompositePropagator=y.otperformance=y.getStringListFromEnv=y.getNumberFromEnv=y.getBooleanFromEnv=y.getStringFromEnv=y._globalThis=y.SDK_INFO=y.parseKeyPairsIntoRecord=y.ExportResultCode=y.unrefTimer=y.timeInputToHrTime=y.millisToHrTime=y.isTimeInputHrTime=y.isTimeInput=y.hrTimeToTimeStamp=y.hrTimeToNanoseconds=y.hrTimeToMilliseconds=y.hrTimeToMicroseconds=y.hrTimeDuration=y.hrTime=y.getTimeOrigin=y.addHrTimes=y.loggingErrorHandler=y.setGlobalErrorHandler=y.globalErrorHandler=y.sanitizeAttributes=y.isAttributeValue=y.AnchoredClock=y.W3CBaggagePropagator=void 0;var coe=LP();Object.defineProperty(y,"W3CBaggagePropagator",{enumerable:!0,get:function(){return coe.W3CBaggagePropagator}});var uoe=DP();Object.defineProperty(y,"AnchoredClock",{enumerable:!0,get:function(){return uoe.AnchoredClock}});var Jw=BP();Object.defineProperty(y,"isAttributeValue",{enumerable:!0,get:function(){return Jw.isAttributeValue}});Object.defineProperty(y,"sanitizeAttributes",{enumerable:!0,get:function(){return Jw.sanitizeAttributes}});var Zw=HP();Object.defineProperty(y,"globalErrorHandler",{enumerable:!0,get:function(){return Zw.globalErrorHandler}});Object.defineProperty(y,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Zw.setGlobalErrorHandler}});var loe=Wg();Object.defineProperty(y,"loggingErrorHandler",{enumerable:!0,get:function(){return loe.loggingErrorHandler}});var Qn=gw();Object.defineProperty(y,"addHrTimes",{enumerable:!0,get:function(){return Qn.addHrTimes}});Object.defineProperty(y,"getTimeOrigin",{enumerable:!0,get:function(){return Qn.getTimeOrigin}});Object.defineProperty(y,"hrTime",{enumerable:!0,get:function(){return Qn.hrTime}});Object.defineProperty(y,"hrTimeDuration",{enumerable:!0,get:function(){return Qn.hrTimeDuration}});Object.defineProperty(y,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMicroseconds}});Object.defineProperty(y,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMilliseconds}});Object.defineProperty(y,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Qn.hrTimeToNanoseconds}});Object.defineProperty(y,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Qn.hrTimeToTimeStamp}});Object.defineProperty(y,"isTimeInput",{enumerable:!0,get:function(){return Qn.isTimeInput}});Object.defineProperty(y,"isTimeInputHrTime",{enumerable:!0,get:function(){return Qn.isTimeInputHrTime}});Object.defineProperty(y,"millisToHrTime",{enumerable:!0,get:function(){return Qn.millisToHrTime}});Object.defineProperty(y,"timeInputToHrTime",{enumerable:!0,get:function(){return Qn.timeInputToHrTime}});var poe=Aw();Object.defineProperty(y,"unrefTimer",{enumerable:!0,get:function(){return poe.unrefTimer}});var doe=Rw();Object.defineProperty(y,"ExportResultCode",{enumerable:!0,get:function(){return doe.ExportResultCode}});var _oe=Fg();Object.defineProperty(y,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return _oe.parseKeyPairsIntoRecord}});var Di=yA();Object.defineProperty(y,"SDK_INFO",{enumerable:!0,get:function(){return Di.SDK_INFO}});Object.defineProperty(y,"_globalThis",{enumerable:!0,get:function(){return Di._globalThis}});Object.defineProperty(y,"getStringFromEnv",{enumerable:!0,get:function(){return Di.getStringFromEnv}});Object.defineProperty(y,"getBooleanFromEnv",{enumerable:!0,get:function(){return Di.getBooleanFromEnv}});Object.defineProperty(y,"getNumberFromEnv",{enumerable:!0,get:function(){return Di.getNumberFromEnv}});Object.defineProperty(y,"getStringListFromEnv",{enumerable:!0,get:function(){return Di.getStringListFromEnv}});Object.defineProperty(y,"otperformance",{enumerable:!0,get:function(){return Di.otperformance}});var foe=Iw();Object.defineProperty(y,"CompositePropagator",{enumerable:!0,get:function(){return foe.CompositePropagator}});var X_=xw();Object.defineProperty(y,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return X_.TRACE_PARENT_HEADER}});Object.defineProperty(y,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return X_.TRACE_STATE_HEADER}});Object.defineProperty(y,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return X_.W3CTraceContextPropagator}});Object.defineProperty(y,"parseTraceParent",{enumerable:!0,get:function(){return X_.parseTraceParent}});var J_=vw();Object.defineProperty(y,"RPCType",{enumerable:!0,get:function(){return J_.RPCType}});Object.defineProperty(y,"deleteRPCMetadata",{enumerable:!0,get:function(){return J_.deleteRPCMetadata}});Object.defineProperty(y,"getRPCMetadata",{enumerable:!0,get:function(){return J_.getRPCMetadata}});Object.defineProperty(y,"setRPCMetadata",{enumerable:!0,get:function(){return J_.setRPCMetadata}});var DA=Nl();Object.defineProperty(y,"isTracingSuppressed",{enumerable:!0,get:function(){return DA.isTracingSuppressed}});Object.defineProperty(y,"suppressTracing",{enumerable:!0,get:function(){return DA.suppressTracing}});Object.defineProperty(y,"unsuppressTracing",{enumerable:!0,get:function(){return DA.unsuppressTracing}});var moe=CA();Object.defineProperty(y,"TraceState",{enumerable:!0,get:function(){return moe.TraceState}});var hoe=Fw();Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return hoe.merge}});var ek=Vw();Object.defineProperty(y,"TimeoutError",{enumerable:!0,get:function(){return ek.TimeoutError}});Object.defineProperty(y,"callWithTimeout",{enumerable:!0,get:function(){return ek.callWithTimeout}});var tk=$w();Object.defineProperty(y,"isUrlIgnored",{enumerable:!0,get:function(){return tk.isUrlIgnored}});Object.defineProperty(y,"urlMatches",{enumerable:!0,get:function(){return tk.urlMatches}});var Toe=Ww();Object.defineProperty(y,"BindOnceFuture",{enumerable:!0,get:function(){return Toe.BindOnceFuture}});var Eoe=Kw();Object.defineProperty(y,"diagLogLevelFromString",{enumerable:!0,get:function(){return Eoe.diagLogLevelFromString}});var Soe=Xw();y.internal={_export:Soe._export}});var nk=E(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});Z_.VERSION=void 0;Z_.VERSION="0.214.0"});var rk=E(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.SeverityNumber=void 0;var goe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(goe=xl.SeverityNumber||(xl.SeverityNumber={}))});var tf=E(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.NOOP_LOGGER=oc.NoopLogger=void 0;var ef=class{emit(e){}};oc.NoopLogger=ef;oc.NOOP_LOGGER=new ef});var ok=E(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.API_BACKWARDS_COMPATIBILITY_VERSION=Yr.makeGetter=Yr._global=Yr.GLOBAL_LOGS_API_KEY=void 0;Yr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Yr._global=globalThis;function Aoe(t,e,n){return r=>r===t?e:n}Yr.makeGetter=Aoe;Yr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var UA=E(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.NOOP_LOGGER_PROVIDER=sc.NoopLoggerProvider=void 0;var Roe=tf(),nf=class{getLogger(e,n,r){return new Roe.NoopLogger}};sc.NoopLoggerProvider=nf;sc.NOOP_LOGGER_PROVIDER=new nf});var sk=E(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.ProxyLogger=void 0;var yoe=tf(),wA=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):yoe.NOOP_LOGGER}};rf.ProxyLogger=wA});var ik=E(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.ProxyLoggerProvider=void 0;var Ioe=UA(),Ooe=sk(),kA=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Ooe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Ioe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};of.ProxyLoggerProvider=kA});var ck=E(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.LogsAPI=void 0;var Xn=ok(),Noe=UA(),ak=ik(),GA=class t{constructor(){this._proxyLoggerProvider=new ak.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Xn._global[Xn.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Xn._global[Xn.GLOBAL_LOGS_API_KEY]=(0,Xn.makeGetter)(Xn.API_BACKWARDS_COMPATIBILITY_VERSION,e,Noe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Xn._global[Xn.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Xn._global,Xn.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Xn._global[Xn.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new ak.ProxyLoggerProvider}};sf.LogsAPI=GA});var BA=E(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.logs=Wr.NoopLogger=Wr.NOOP_LOGGER=Wr.SeverityNumber=void 0;var boe=rk();Object.defineProperty(Wr,"SeverityNumber",{enumerable:!0,get:function(){return boe.SeverityNumber}});var uk=tf();Object.defineProperty(Wr,"NOOP_LOGGER",{enumerable:!0,get:function(){return uk.NOOP_LOGGER}});Object.defineProperty(Wr,"NoopLogger",{enumerable:!0,get:function(){return uk.NoopLogger}});var Coe=ck();Wr.logs=Coe.LogsAPI.getInstance()});var lk=E(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.disableInstrumentations=ic.enableInstrumentations=void 0;function Poe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}ic.enableInstrumentations=Poe;function Moe(t){t.forEach(e=>e.disable())}ic.disableInstrumentations=Moe});var _k=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.registerInstrumentations=void 0;var pk=(b(),O(v)),xoe=BA(),dk=lk();function voe(t){let e=t.tracerProvider||pk.trace.getTracerProvider(),n=t.meterProvider||pk.metrics.getMeterProvider(),r=t.loggerProvider||xoe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,dk.enableInstrumentations)(o,e,n,r),()=>{(0,dk.disableInstrumentations)(o)}}af.registerInstrumentations=voe});var Rk=E(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.satisfies=void 0;var VA=(b(),O(v)),Ek=/^(?: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-]+)*))?$/,Loe=/^(?<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-]+)*))?$/,Doe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Uoe(t,e,n){if(!woe(t))return VA.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=joe(t);if(!r)return!1;let o=[],s=Sk(r,e,o,n);return s&&!n?.includePrerelease?Goe(r,o):s}cf.satisfies=Uoe;function woe(t){return typeof t=="string"&&Ek.test(t)}function Sk(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(jA(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=ase(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!jA(t,s,n,r))return!1;return!0}return jA(t,e,n,r)}function jA(t,e,n,r){if(e=Boe(e,r),e.includes(" "))return Sk(t,e,n,r);{let o=Hoe(e);return n.push(o),koe(t,o)}}function koe(t,e){if(e.invalid)return!1;if(!e.version||FA(e.version))return!0;let n=mk(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=mk(r,o)}return Doe[e.op]?.includes(n)}function Goe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Boe(t,e){return t=t.trim(),t=sse(t,e),t=ose(t),t=ise(t,e),t=t.trim(),t}function sn(t){return!t||t.toLowerCase()==="x"||t==="*"}function joe(t){let e=t.match(Ek);if(!e){VA.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function Hoe(t){if(!t)return{};let e=t.match(Loe);if(!e)return VA.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function FA(t){return t==="*"||t==="x"||t==="X"}function fk(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Foe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Voe(t,e){if(FA(t)||FA(e))return 0;let[n,r]=Foe(fk(t),fk(e));return n>r?1:n<r?-1:0}function mk(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Voe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var gk="[a-zA-Z0-9-]",Ak="0|[1-9]\\d*",qoe=`\\d*[a-zA-Z-]${gk}*`,$oe="((?:<|>)?=?)",hk=`(?:${Ak}|${qoe})`,Yoe=`(?:-(${hk}(?:\\.${hk})*))`,Tk=`${gk}+`,Woe=`(?:\\+(${Tk}(?:\\.${Tk})*))`,HA=`${Ak}|x|X|\\*`,vl=`[v=\\s]*(${HA})(?:\\.(${HA})(?:\\.(${HA})(?:${Yoe})?${Woe}?)?)?`,zoe=`^${$oe}\\s*${vl}$`,Koe=new RegExp(zoe),Qoe=`^\\s*(${vl})\\s+-\\s+(${vl})\\s*$`,Xoe=new RegExp(Qoe),Joe="(?:~>?)",Zoe=`^${Joe}${vl}$`,ese=new RegExp(Zoe),tse="(?:\\^)",nse=`^${tse}${vl}$`,rse=new RegExp(nse);function ose(t){let e=ese;return t.replace(e,(n,r,o,s,i)=>{let a;return sn(r)?a="":sn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:sn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function sse(t,e){let n=rse,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return sn(s)?l="":sn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:sn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function ise(t,e){let n=Koe;return t.replace(n,(r,o,s,i,a,c)=>{let l=sn(s),p=l||sn(i),d=p||sn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function ase(t,e){let n=Xoe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(sn(s)?o="":sn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:sn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,sn(d)?p="":sn(_)?p=`<${+d+1}.0.0-0`:sn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var qA=E(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.massUnwrap=vt.unwrap=vt.massWrap=vt.wrap=void 0;var an=console.error.bind(console);function Ll(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var cse=(t,e,n)=>{if(!t||!t[e]){an("no original function "+String(e)+" to wrap");return}if(!n){an("no wrapper function"),an(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){an("original object and wrapper must be functions");return}let o=n(r,e);return Ll(o,"__original",r),Ll(o,"__unwrap",()=>{t[e]===o&&Ll(t,e,r)}),Ll(o,"__wrapped",!0),Ll(t,e,o),o};vt.wrap=cse;var use=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,vt.wrap)(r,o,n)})})};vt.massWrap=use;var lse=(t,e)=>{if(!t||!t[e]){an("no function to unwrap."),an(new Error().stack);return}let n=t[e];if(!n.__unwrap)an("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};vt.unwrap=lse;var pse=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,vt.unwrap)(n,r)})})};vt.massUnwrap=pse;function Dl(t){t&&t.logger&&(typeof t.logger!="function"?an("new logger isn't a function, not replacing"):an=t.logger)}vt.default=Dl;Dl.wrap=vt.wrap;Dl.massWrap=vt.massWrap;Dl.unwrap=vt.unwrap;Dl.massUnwrap=vt.massUnwrap});var yk=E(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InstrumentationAbstract=void 0;var $A=(b(),O(v)),dse=BA(),uf=qA(),YA=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=$A.diag.createComponentLogger({namespace:e}),this._tracer=$A.trace.getTracer(e,n),this._meter=$A.metrics.getMeter(e,n),this._logger=dse.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=uf.wrap;_unwrap=uf.unwrap;_massWrap=uf.massWrap;_massUnwrap=uf.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};lf.InstrumentationAbstract=YA});var Ok=E((q0e,Ik)=>{var ac=1e3,cc=ac*60,uc=cc*60,Ui=uc*24,_se=Ui*7,fse=Ui*365.25;Ik.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return mse(t);if(n==="number"&&isFinite(t))return e.long?Tse(t):hse(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function mse(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*fse;case"weeks":case"week":case"w":return n*_se;case"days":case"day":case"d":return n*Ui;case"hours":case"hour":case"hrs":case"hr":case"h":return n*uc;case"minutes":case"minute":case"mins":case"min":case"m":return n*cc;case"seconds":case"second":case"secs":case"sec":case"s":return n*ac;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function hse(t){var e=Math.abs(t);return e>=Ui?Math.round(t/Ui)+"d":e>=uc?Math.round(t/uc)+"h":e>=cc?Math.round(t/cc)+"m":e>=ac?Math.round(t/ac)+"s":t+"ms"}function Tse(t){var e=Math.abs(t);return e>=Ui?pf(t,e,Ui,"day"):e>=uc?pf(t,e,uc,"hour"):e>=cc?pf(t,e,cc,"minute"):e>=ac?pf(t,e,ac,"second"):t+" ms"}function pf(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var WA=E(($0e,Nk)=>{function Ese(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ok(),n.destroy=l,Object.keys(t).forEach(p=>{n[p]=t[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let d=0;for(let _=0;_<p.length;_++)d=(d<<5)-d+p.charCodeAt(_),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(p){let d,_=null,f,m;function h(...T){if(!h.enabled)return;let S=h,R=Number(new Date),I=R-(d||R);S.diff=I,S.prev=d,S.curr=R,d=R,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let x=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(B,se)=>{if(B==="%%")return"%";x++;let ve=n.formatters[se];if(typeof ve=="function"){let on=T[x];B=ve.call(S,on),T.splice(x,1),x--}return B}),n.formatArgs.call(S,T),(S.log||n.log).apply(S,T)}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:()=>_!==null?_:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(p)),m),set:T=>{_=T}}),typeof n.init=="function"&&n.init(h),h}function r(p,d){let _=n(this.namespace+(typeof d>"u"?":":d)+p);return _.log=this.log,_}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let d=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of d)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function s(p,d){let _=0,f=0,m=-1,h=0;for(;_<p.length;)if(f<d.length&&(d[f]===p[_]||d[f]==="*"))d[f]==="*"?(m=f,h=_,f++):(_++,f++);else if(m!==-1)f=m+1,h++,_=h;else return!1;for(;f<d.length&&d[f]==="*";)f++;return f===d.length}function i(){let p=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),p}function a(p){for(let d of n.skips)if(s(p,d))return!1;for(let d of n.names)if(s(p,d))return!0;return!1}function c(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}Nk.exports=Ese});var bk=E((gn,df)=>{gn.formatArgs=gse;gn.save=Ase;gn.load=Rse;gn.useColors=Sse;gn.storage=yse();gn.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();gn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Sse(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function gse(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+df.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),t.splice(r,0,e)}gn.log=console.debug||console.log||(()=>{});function Ase(t){try{t?gn.storage.setItem("debug",t):gn.storage.removeItem("debug")}catch{}}function Rse(){let t;try{t=gn.storage.getItem("debug")||gn.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function yse(){try{return localStorage}catch{}}df.exports=WA()(gn);var{formatters:Ise}=df.exports;Ise.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Pk=E((Y0e,Ck)=>{"use strict";Ck.exports=(t,e=process.argv)=>{let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}});var vk=E((W0e,xk)=>{"use strict";var Ose=U("os"),Mk=U("tty"),Jn=Pk(),{env:gt}=process,us;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?us=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(us=1);"FORCE_COLOR"in gt&&(gt.FORCE_COLOR==="true"?us=1:gt.FORCE_COLOR==="false"?us=0:us=gt.FORCE_COLOR.length===0?1:Math.min(parseInt(gt.FORCE_COLOR,10),3));function zA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function KA(t,e){if(us===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(t&&!e&&us===void 0)return 0;let n=us||0;if(gt.TERM==="dumb")return n;if(process.platform==="win32"){let r=Ose.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in gt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in gt)||gt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in gt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(gt.TEAMCITY_VERSION)?1:0;if(gt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in gt){let r=parseInt((gt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(gt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(gt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(gt.TERM)||"COLORTERM"in gt?1:n}function Nse(t){let e=KA(t,t&&t.isTTY);return zA(e)}xk.exports={supportsColor:Nse,stdout:zA(KA(!0,Mk.isatty(1))),stderr:zA(KA(!0,Mk.isatty(2)))}});var Dk=E((At,ff)=>{var bse=U("tty"),_f=U("util");At.init=Dse;At.log=xse;At.formatArgs=Pse;At.save=vse;At.load=Lse;At.useColors=Cse;At.destroy=_f.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");At.colors=[6,2,3,4,5,1];try{let t=vk();t&&(t.stderr||t).level>=2&&(At.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{}At.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),t[n]=r,t},{});function Cse(){return"colors"in At.inspectOpts?!!At.inspectOpts.colors:bse.isatty(process.stderr.fd)}function Pse(t){let{namespace:e,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
3
|
+
var H9=Object.create;var s_=Object.defineProperty;var F9=Object.getOwnPropertyDescriptor;var V9=Object.getOwnPropertyNames;var q9=Object.getPrototypeOf,$9=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),sg=(t,e)=>{for(var n in e)s_(t,n,{get:e[n],enumerable:!0})},kC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V9(e))!$9.call(t,o)&&o!==n&&s_(t,o,{get:()=>e[o],enumerable:!(r=F9(e,o))||r.enumerable});return t};var K=(t,e,n)=>(n=t!=null?H9(q9(t)):{},kC(e||!t||!t.__esModule?s_(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>kC(s_({},"__esModule",{value:!0}),t);var Oo,ig=z(()=>{Oo="1.9.1"});function Y9(t){let e=new Set([t]),n=new Set,r=t.match(GC);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===t};function s(a){return n.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(GC);if(!l)return s(c);let p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?s(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):s(c):o.minor<=p.minor?i(c):s(c)}}var GC,BC,jC=z(()=>{ig();GC=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;BC=Y9(Oo)});function jr(t,e,n,r=!1){var o;let s=gl[Sl]=(o=gl[Sl])!==null&&o!==void 0?o:{version:Oo};if(!r&&s[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(s.version!==Oo){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Oo}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Oo}.`),!0}function Dn(t){var e,n;let r=(e=gl[Sl])===null||e===void 0?void 0:e.version;if(!(!r||!BC(r)))return(n=gl[Sl])===null||n===void 0?void 0:n[t]}function Hr(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Oo}.`);let n=gl[Sl];n&&delete n[t]}var W9,Sl,gl,Oi=z(()=>{ig();jC();W9=Oo.split(".")[0],Sl=Symbol.for(`opentelemetry.js.api.${W9}`),gl=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Al(t,e,n){let r=Dn("diag");if(r)return r[t](e,...n)}var i_,HC=z(()=>{Oi();i_=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Al("debug",this._namespace,e)}error(...e){return Al("error",this._namespace,e)}info(...e){return Al("info",this._namespace,e)}warn(...e){return Al("warn",this._namespace,e)}verbose(...e){return Al("verbose",this._namespace,e)}}});var dt,a_=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(dt||(dt={}))});function FC(t,e){t<dt.NONE?t=dt.NONE:t>dt.ALL&&(t=dt.ALL),e=e||{};function n(r,o){let s=e[r];return typeof s=="function"&&t>=o?s.bind(e):function(){}}return{error:n("error",dt.ERROR),warn:n("warn",dt.WARN),info:n("info",dt.INFO),debug:n("debug",dt.DEBUG),verbose:n("verbose",dt.VERBOSE)}}var VC=z(()=>{a_()});var z9,St,Ni=z(()=>{HC();VC();a_();Oi();z9="diag",St=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=Dn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:dt.INFO})=>{var i,a,c;if(o===n){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof s=="number"&&(s={logLevel:s});let l=Dn("diag"),p=FC((a=s.logLevel)!==null&&a!==void 0?a:dt.INFO,o);if(l&&!s.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),p.warn(`Current logger will overwrite one already registered from ${d}`)}return jr("diag",p,n,!0)};n.setLogger=r,n.disable=()=>{Hr(z9,n)},n.createComponentLogger=o=>new i_(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var c_,qC=z(()=>{c_=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var $C,YC=z(()=>{$C=Symbol("BaggageEntryMetadata")});function WC(t={}){return new c_(new Map(Object.entries(t)))}function zC(t){return typeof t!="string"&&(K9.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:$C,toString(){return t}}}var K9,ag=z(()=>{Ni();qC();YC();K9=St.instance()});function Un(t){return Symbol.for(t)}var cg,za,Rl=z(()=>{cg=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,o)=>{let s=new t(n._currentContext);return s._currentContext.set(r,o),s},n.deleteValue=r=>{let o=new t(n._currentContext);return o._currentContext.delete(r),o}}},za=new cg});var ug,lg,u_,KC=z(()=>{ug=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],lg={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(lg[e]=console[e])}u_=class{constructor(){function e(n){return function(...r){let o=lg[n];if(typeof o!="function"&&(o=lg.log),typeof o!="function"&&console&&(o=console[n],typeof o!="function"&&(o=console.log)),typeof o=="function")return o.apply(console,r)}}for(let n=0;n<ug.length;n++)this[ug[n].n]=e(ug[n].c)}}});function QC(){return Sg}var pg,Ka,dg,_g,fg,mg,yl,hg,Tg,Eg,Sg,Q9,X9,J9,Z9,eQ,tQ,nQ,gg=z(()=>{pg=class{constructor(){}createGauge(e,n){return X9}createHistogram(e,n){return J9}createCounter(e,n){return Q9}createUpDownCounter(e,n){return Z9}createObservableGauge(e,n){return tQ}createObservableCounter(e,n){return eQ}createObservableUpDownCounter(e,n){return nQ}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},Ka=class{},dg=class extends Ka{add(e,n){}},_g=class extends Ka{add(e,n){}},fg=class extends Ka{record(e,n){}},mg=class extends Ka{record(e,n){}},yl=class{addCallback(e){}removeCallback(e){}},hg=class extends yl{},Tg=class extends yl{},Eg=class extends yl{},Sg=new pg,Q9=new dg,X9=new fg,J9=new mg,Z9=new _g,eQ=new hg,tQ=new Tg,nQ=new Eg});var l_,XC=z(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(l_||(l_={}))});var p_,d_,Ag=z(()=>{p_={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},d_={set(t,e,n){t!=null&&(t[e]=n)}}});var __,JC=z(()=>{Rl();__=class{active(){return za}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var Rg,rQ,Fr,Il=z(()=>{JC();Oi();Ni();Rg="context",rQ=new __,Fr=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return jr(Rg,e,St.instance())}active(){return this._getContextManager().active()}with(e,n,r,...o){return this._getContextManager().with(e,n,r,...o)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return Dn(Rg)||rQ}disable(){this._getContextManager().disable(),Hr(Rg,St.instance())}}});var Vt,yg=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Vt||(Vt={}))});var Ol,bi,f_,m_=z(()=>{yg();Ol="0000000000000000",bi="00000000000000000000000000000000",f_={traceId:bi,spanId:Ol,traceFlags:Vt.NONE}});var Vr,h_=z(()=>{m_();Vr=class{constructor(e=f_){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function T_(t){return t.getValue(Ig)||void 0}function ZC(){return T_(Fr.getInstance().active())}function Nl(t,e){return t.setValue(Ig,e)}function eP(t){return t.deleteValue(Ig)}function tP(t,e){return Nl(t,new Vr(e))}function E_(t){var e;return(e=T_(t))===null||e===void 0?void 0:e.spanContext()}var Ig,Og=z(()=>{Rl();h_();Il();Ig=Un("OpenTelemetry Context Key SPAN")});function nP(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(S_[t.charCodeAt(r)]|0)+(S_[t.charCodeAt(r+1)]|0)+(S_[t.charCodeAt(r+2)]|0)+(S_[t.charCodeAt(r+3)]|0);return n===e}function Ng(t){return nP(t,32)&&t!==bi}function bg(t){return nP(t,16)&&t!==Ol}function No(t){return Ng(t.traceId)&&bg(t.spanId)}function rP(t){return new Vr(t)}var S_,g_=z(()=>{m_();h_();S_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function oQ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var Cg,Qa,Pg=z(()=>{Il();Og();h_();g_();Cg=Fr.getInstance(),Qa=class{startSpan(e,n,r=Cg.active()){if(!!n?.root)return new Vr;let s=r&&E_(r);return oQ(s)&&No(s)?new Vr(s):new Vr}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Cg.active(),l=this.startSpan(e,s,c),p=Nl(c,l);return Cg.with(p,a,void 0,l)}}});var sQ,Xa,Mg=z(()=>{Pg();sQ=new Qa,Xa=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,o){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):sQ}}});var A_,oP=z(()=>{Pg();A_=class{getTracer(e,n,r){return new Qa}}});var iQ,Ci,xg=z(()=>{Mg();oP();iQ=new A_,Ci=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Xa(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:iQ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,n,r)}}});var R_,sP=z(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(R_||(R_={}))});var Ne,iP=z(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Ne||(Ne={}))});var Be,aP=z(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Be||(Be={}))});function cP(t){return uQ.test(t)}function uP(t){return lQ.test(t)&&!pQ.test(t)}var vg,aQ,cQ,uQ,lQ,pQ,lP=z(()=>{vg="[_0-9a-z-*/]",aQ=`[a-z]${vg}{0,255}`,cQ=`[a-z0-9]${vg}{0,240}@[a-z]${vg}{0,13}`,uQ=new RegExp(`^(?:${aQ}|${cQ})$`),lQ=/^[ -~]{0,255}[!-~]$/,pQ=/,|=/});var pP,dQ,dP,_P,y_,fP=z(()=>{lP();pP=32,dQ=512,dP=",",_P="=",y_=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+_P+this.get(n)),e),[]).join(dP)}_parse(e){e.length>dQ||(this._internalState=e.split(dP).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(_P);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);cP(i)&&uP(a)&&n.set(i,a)}return n},new Map),this._internalState.size>pP&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,pP))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function mP(t){return new y_(t)}var hP=z(()=>{fP()});var P,TP=z(()=>{Il();P=Fr.getInstance()});var wn,EP=z(()=>{Ni();wn=St.instance()});var Lg,SP,gP=z(()=>{gg();Lg=class{getMeter(e,n,r){return Sg}},SP=new Lg});var Dg,I_,AP=z(()=>{gP();Oi();Ni();Dg="metrics",I_=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return jr(Dg,e,St.instance())}getMeterProvider(){return Dn(Dg)||SP}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Hr(Dg,St.instance())}}});var Ug,RP=z(()=>{AP();Ug=I_.getInstance()});var O_,yP=z(()=>{O_=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function kg(t){return t.getValue(wg)||void 0}function IP(){return kg(Fr.getInstance().active())}function OP(t,e){return t.setValue(wg,e)}function NP(t){return t.deleteValue(wg)}var wg,bP=z(()=>{Il();Rl();wg=Un("OpenTelemetry Baggage Key")});var Gg,_Q,N_,CP=z(()=>{Oi();yP();Ag();bP();ag();Ni();Gg="propagation",_Q=new O_,N_=class t{constructor(){this.createBaggage=WC,this.getBaggage=kg,this.getActiveBaggage=IP,this.setBaggage=OP,this.deleteBaggage=NP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return jr(Gg,e,St.instance())}inject(e,n,r=d_){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=p_){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Hr(Gg,St.instance())}_getGlobalPropagator(){return Dn(Gg)||_Q}}});var Ar,PP=z(()=>{CP();Ar=N_.getInstance()});var Bg,b_,MP=z(()=>{Oi();xg();g_();Og();Ni();Bg="trace",b_=class t{constructor(){this._proxyTracerProvider=new Ci,this.wrapSpanContext=rP,this.isSpanContextValid=No,this.deleteSpan=eP,this.getSpan=T_,this.getActiveSpan=ZC,this.getSpanContext=E_,this.setSpan=Nl,this.setSpanContext=tP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=jr(Bg,this._proxyTracerProvider,St.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return Dn(Bg)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Hr(Bg,St.instance()),this._proxyTracerProvider=new Ci}}});var X,xP=z(()=>{MP();X=b_.getInstance()});var v={};sg(v,{DiagConsoleLogger:()=>u_,DiagLogLevel:()=>dt,INVALID_SPANID:()=>Ol,INVALID_SPAN_CONTEXT:()=>f_,INVALID_TRACEID:()=>bi,ProxyTracer:()=>Xa,ProxyTracerProvider:()=>Ci,ROOT_CONTEXT:()=>za,SamplingDecision:()=>R_,SpanKind:()=>Ne,SpanStatusCode:()=>Be,TraceFlags:()=>Vt,ValueType:()=>l_,baggageEntryMetadataFromString:()=>zC,context:()=>P,createContextKey:()=>Un,createNoopMeter:()=>QC,createTraceState:()=>mP,default:()=>fQ,defaultTextMapGetter:()=>p_,defaultTextMapSetter:()=>d_,diag:()=>wn,isSpanContextValid:()=>No,isValidSpanId:()=>bg,isValidTraceId:()=>Ng,metrics:()=>Ug,propagation:()=>Ar,trace:()=>X});var fQ,b=z(()=>{ag();Rl();KC();a_();gg();XC();Ag();Mg();xg();sP();iP();aP();yg();hP();g_();m_();TP();EP();RP();PP();xP();fQ={context:P,diag:wn,metrics:Ug,propagation:Ar,trace:X}});var bl=E(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isTracingSuppressed=is.unsuppressTracing=is.suppressTracing=void 0;var mQ=(b(),O(v)),jg=(0,mQ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function hQ(t){return t.setValue(jg,!0)}is.suppressTracing=hQ;function TQ(t){return t.deleteValue(jg)}is.unsuppressTracing=TQ;function EQ(t){return t.getValue(jg)===!0}is.isTracingSuppressed=EQ});var Hg=E(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.BAGGAGE_MAX_TOTAL_LENGTH=qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=qt.BAGGAGE_HEADER=qt.BAGGAGE_ITEMS_SEPARATOR=qt.BAGGAGE_PROPERTIES_SEPARATOR=qt.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;qt.BAGGAGE_KEY_PAIR_SEPARATOR="=";qt.BAGGAGE_PROPERTIES_SEPARATOR=";";qt.BAGGAGE_ITEMS_SEPARATOR=",";qt.BAGGAGE_HEADER="baggage";qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;qt.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Fg=E(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.parseKeyPairsIntoRecord=qr.parsePairKeyValue=qr.getKeyPairs=qr.serializeKeyPairs=void 0;var SQ=(b(),O(v)),Ja=Hg();function gQ(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Ja.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Ja.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}qr.serializeKeyPairs=gQ;function AQ(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Ja.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}qr.getKeyPairs=AQ;function vP(t){if(!t)return;let e=t.indexOf(Ja.BAGGAGE_PROPERTIES_SEPARATOR),n=e===-1?t:t.substring(0,e),r=n.indexOf(Ja.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=n.substring(0,r).trim(),s=n.substring(r+1).trim();if(!o||!s)return;let i,a;try{i=decodeURIComponent(o),a=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=(0,SQ.baggageEntryMetadataFromString)(l)}return{key:i,value:a,metadata:c}}qr.parsePairKeyValue=vP;function RQ(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Ja.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let r=vP(n);r!==void 0&&r.value.length>0&&(e[r.key]=r.value)}),e}qr.parseKeyPairsIntoRecord=RQ});var LP=E(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});C_.W3CBaggagePropagator=void 0;var Vg=(b(),O(v)),yQ=bl(),Pi=Hg(),qg=Fg(),$g=class{inject(e,n,r){let o=Vg.propagation.getBaggage(e);if(!o||(0,yQ.isTracingSuppressed)(e))return;let s=(0,qg.getKeyPairs)(o).filter(a=>a.length<=Pi.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Pi.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,qg.serializeKeyPairs)(s);i.length>0&&r.set(n,Pi.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Pi.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Pi.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Pi.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let l=(0,qg.parsePairKeyValue)(c);if(l){let p={value:l.value};l.metadata&&(p.metadata=l.metadata),i[l.key]=p}}),Object.entries(i).length===0)?e:Vg.propagation.setBaggage(e,Vg.propagation.createBaggage(i))}fields(){return[Pi.BAGGAGE_HEADER]}};C_.W3CBaggagePropagator=$g});var DP=E(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});P_.AnchoredClock=void 0;var Yg=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,n){this._monotonicClock=n,this._epochMillis=e.now(),this._performanceMillis=n.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};P_.AnchoredClock=Yg});var BP=E(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isAttributeValue=as.isAttributeKey=as.sanitizeAttributes=void 0;var UP=(b(),O(v));function IQ(t){let e={};if(typeof t!="object"||t==null)return e;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!wP(n)){UP.diag.warn(`Invalid attribute key: ${n}`);continue}let r=t[n];if(!kP(r)){UP.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}as.sanitizeAttributes=IQ;function wP(t){return typeof t=="string"&&t!==""}as.isAttributeKey=wP;function kP(t){return t==null?!0:Array.isArray(t)?OQ(t):GP(typeof t)}as.isAttributeValue=kP;function OQ(t){let e;for(let n of t){if(n==null)continue;let r=typeof n;if(r!==e){if(!e){if(GP(r)){e=r;continue}return!1}return!1}}return!0}function GP(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Wg=E(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});M_.loggingErrorHandler=void 0;var NQ=(b(),O(v));function bQ(){return t=>{NQ.diag.error(CQ(t))}}M_.loggingErrorHandler=bQ;function CQ(t){return typeof t=="string"?t:JSON.stringify(PQ(t))}function PQ(t){let e={},n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;let o=n[r];o&&(e[r]=String(o))}),n=Object.getPrototypeOf(n);return e}});var HP=E(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.globalErrorHandler=Za.setGlobalErrorHandler=void 0;var MQ=Wg(),jP=(0,MQ.loggingErrorHandler)();function xQ(t){jP=t}Za.setGlobalErrorHandler=xQ;function vQ(t){try{jP(t)}catch{}}Za.globalErrorHandler=vQ});var $P=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getStringListFromEnv=$r.getBooleanFromEnv=$r.getStringFromEnv=$r.getNumberFromEnv=void 0;var FP=(b(),O(v)),VP=U("util");function LQ(t){let e=process.env[t];if(e==null||e.trim()==="")return;let n=Number(e);if(isNaN(n)){FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected a number, using defaults`);return}return n}$r.getNumberFromEnv=LQ;function qP(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}$r.getStringFromEnv=qP;function DQ(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}$r.getBooleanFromEnv=DQ;function UQ(t){return qP(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}$r.getStringListFromEnv=UQ});var YP=E(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_._globalThis=void 0;x_._globalThis=globalThis});var WP=E(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});v_.VERSION=void 0;v_.VERSION="2.6.1"});function We(t){let e={},n=t.length;for(let r=0;r<n;r++){let o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var zg=z(()=>{});var zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,wQ,Kg,kQ,GQ,BQ,jQ,Qg,HQ,FQ,VQ,qQ,$Q,YQ,WQ,zQ,KQ,QQ,XQ,JQ,ZQ,eX,tX,nX,rX,oX,Xg,sX,iX,aX,cX,uX,lX,pX,dX,_X,fX,mX,hX,Jg,TX,EX,Zg,eA,SX,gX,AX,RX,yX,IX,OX,NX,bX,CX,PX,MX,xX,vX,LX,DX,UX,Cl,ec,tA,wX,kX,Mi,GX,BX,jX,HX,nA,rA,FX,oA,VX,qX,$X,YX,WX,zX,KX,QX,XX,JX,ZX,eJ,tJ,nJ,rJ,oJ,sJ,iJ,aJ,cJ,uJ,lJ,pJ,sA,dJ,_J,fJ,mJ,hJ,TJ,EJ,SJ,gJ,AJ,RJ,yJ,IJ,OJ,NJ,bJ,CJ,PJ,MJ,iA,xJ,aA,vJ,LJ,DJ,UJ,wJ,kJ,GJ,BJ,jJ,fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL,HJ,FJ,VJ,qJ,$J,YJ,WJ,zJ,KJ,QJ,XJ,JJ,ZJ,e5,t5,n5,r5,o5,s5,i5,a5,c5,u5,l5,p5,d5,_5,f5,m5,h5,T5,E5,S5,g5,A5,R5,y5,I5,O5,N5,b5,C5,P5,M5,x5,v5,L5,D5,aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL,U5,w5,k5,G5,B5,j5,H5,F5,V5,q5,$5,Y5,EL,SL,gL,AL,RL,W5,z5,K5,Q5,X5,J5,yL,IL,OL,Z5,eZ,tZ,nZ,NL,bL,CL,PL,rZ,oZ,sZ,iZ,aZ,ML,xL,vL,LL,DL,UL,wL,cZ,uZ,lZ,pZ,dZ,_Z,fZ,mZ,kL,GL,BL,jL,HL,hZ,TZ,EZ,SZ,gZ,AZ,FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0,RZ,yZ,IZ,OZ,NZ,bZ,CZ,PZ,MZ,xZ,vZ,LZ,DZ,UZ,wZ,kZ,GZ,BZ,jZ,HZ,FZ,VZ,u0,l0,p0,d0,_0,qZ,$Z,YZ,WZ,zZ,KZ,f0,m0,QZ,XZ,JZ,h0,T0,ZZ,e6,t6,E0,S0,g0,A0,R0,y0,I0,O0,N0,b0,C0,P0,M0,x0,v0,L0,D0,n6,r6,o6,s6,i6,a6,c6,u6,l6,p6,d6,_6,f6,m6,h6,T6,E6,S6,U0,w0,g6,A6,R6,k0=z(()=>{zg();zP="aws.lambda.invoked_arn",KP="db.system",QP="db.connection_string",XP="db.user",JP="db.jdbc.driver_classname",ZP="db.name",eM="db.statement",tM="db.operation",nM="db.mssql.instance_name",rM="db.cassandra.keyspace",oM="db.cassandra.page_size",sM="db.cassandra.consistency_level",iM="db.cassandra.table",aM="db.cassandra.idempotence",cM="db.cassandra.speculative_execution_count",uM="db.cassandra.coordinator.id",lM="db.cassandra.coordinator.dc",pM="db.hbase.namespace",dM="db.redis.database_index",_M="db.mongodb.collection",fM="db.sql.table",mM="exception.type",hM="exception.message",TM="exception.stacktrace",EM="exception.escaped",SM="faas.trigger",gM="faas.execution",AM="faas.document.collection",RM="faas.document.operation",yM="faas.document.time",IM="faas.document.name",OM="faas.time",NM="faas.cron",bM="faas.coldstart",CM="faas.invoked_name",PM="faas.invoked_provider",MM="faas.invoked_region",xM="net.transport",vM="net.peer.ip",LM="net.peer.port",DM="net.peer.name",UM="net.host.ip",wM="net.host.port",kM="net.host.name",GM="net.host.connection.type",BM="net.host.connection.subtype",jM="net.host.carrier.name",HM="net.host.carrier.mcc",FM="net.host.carrier.mnc",VM="net.host.carrier.icc",qM="peer.service",$M="enduser.id",YM="enduser.role",WM="enduser.scope",zM="thread.id",KM="thread.name",QM="code.function",XM="code.namespace",JM="code.filepath",ZM="code.lineno",ex="http.method",tx="http.url",nx="http.target",rx="http.host",ox="http.scheme",sx="http.status_code",ix="http.flavor",ax="http.user_agent",cx="http.request_content_length",ux="http.request_content_length_uncompressed",lx="http.response_content_length",px="http.response_content_length_uncompressed",dx="http.server_name",_x="http.route",fx="http.client_ip",mx="aws.dynamodb.table_names",hx="aws.dynamodb.consumed_capacity",Tx="aws.dynamodb.item_collection_metrics",Ex="aws.dynamodb.provisioned_read_capacity",Sx="aws.dynamodb.provisioned_write_capacity",gx="aws.dynamodb.consistent_read",Ax="aws.dynamodb.projection",Rx="aws.dynamodb.limit",yx="aws.dynamodb.attributes_to_get",Ix="aws.dynamodb.index_name",Ox="aws.dynamodb.select",Nx="aws.dynamodb.global_secondary_indexes",bx="aws.dynamodb.local_secondary_indexes",Cx="aws.dynamodb.exclusive_start_table",Px="aws.dynamodb.table_count",Mx="aws.dynamodb.scan_forward",xx="aws.dynamodb.segment",vx="aws.dynamodb.total_segments",Lx="aws.dynamodb.count",Dx="aws.dynamodb.scanned_count",Ux="aws.dynamodb.attribute_definitions",wx="aws.dynamodb.global_secondary_index_updates",kx="messaging.system",Gx="messaging.destination",Bx="messaging.destination_kind",jx="messaging.temp_destination",Hx="messaging.protocol",Fx="messaging.protocol_version",Vx="messaging.url",qx="messaging.message_id",$x="messaging.conversation_id",Yx="messaging.message_payload_size_bytes",Wx="messaging.message_payload_compressed_size_bytes",zx="messaging.operation",Kx="messaging.consumer_id",Qx="messaging.rabbitmq.routing_key",Xx="messaging.kafka.message_key",Jx="messaging.kafka.consumer_group",Zx="messaging.kafka.client_id",ev="messaging.kafka.partition",tv="messaging.kafka.tombstone",nv="rpc.system",rv="rpc.service",ov="rpc.method",sv="rpc.grpc.status_code",iv="rpc.jsonrpc.version",av="rpc.jsonrpc.request_id",cv="rpc.jsonrpc.error_code",uv="rpc.jsonrpc.error_message",lv="message.type",pv="message.id",dv="message.compressed_size",_v="message.uncompressed_size",wQ=zP,Kg=KP,kQ=QP,GQ=XP,BQ=JP,jQ=ZP,Qg=eM,HQ=tM,FQ=nM,VQ=rM,qQ=oM,$Q=sM,YQ=iM,WQ=aM,zQ=cM,KQ=uM,QQ=lM,XQ=pM,JQ=dM,ZQ=_M,eX=fM,tX=mM,nX=hM,rX=TM,oX=EM,Xg=SM,sX=gM,iX=AM,aX=RM,cX=yM,uX=IM,lX=OM,pX=NM,dX=bM,_X=CM,fX=PM,mX=MM,hX=xM,Jg=vM,TX=LM,EX=DM,Zg=UM,eA=wM,SX=kM,gX=GM,AX=BM,RX=jM,yX=HM,IX=FM,OX=VM,NX=qM,bX=$M,CX=YM,PX=WM,MX=zM,xX=KM,vX=QM,LX=XM,DX=JM,UX=ZM,Cl=ex,ec=tx,tA=nx,wX=rx,kX=ox,Mi=sx,GX=ix,BX=ax,jX=cx,HX=ux,nA=lx,rA=px,FX=dx,oA=_x,VX=fx,qX=mx,$X=hx,YX=Tx,WX=Ex,zX=Sx,KX=gx,QX=Ax,XX=Rx,JX=yx,ZX=Ix,eJ=Ox,tJ=Nx,nJ=bx,rJ=Cx,oJ=Px,sJ=Mx,iJ=xx,aJ=vx,cJ=Lx,uJ=Dx,lJ=Ux,pJ=wx,sA=kx,dJ=Gx,_J=Bx,fJ=jx,mJ=Hx,hJ=Fx,TJ=Vx,EJ=qx,SJ=$x,gJ=Yx,AJ=Wx,RJ=zx,yJ=Kx,IJ=Qx,OJ=Xx,NJ=Jx,bJ=Zx,CJ=ev,PJ=tv,MJ=nv,iA=rv,xJ=ov,aA=sv,vJ=iv,LJ=av,DJ=cv,UJ=uv,wJ=lv,kJ=pv,GJ=dv,BJ=_v,jJ=We([zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v]),fv="other_sql",mv="mssql",hv="mysql",Tv="oracle",Ev="db2",Sv="postgresql",gv="redshift",Av="hive",Rv="cloudscape",yv="hsqldb",Iv="progress",Ov="maxdb",Nv="hanadb",bv="ingres",Cv="firstsql",Pv="edb",Mv="cache",xv="adabas",vv="firebird",Lv="derby",Dv="filemaker",Uv="informix",wv="instantdb",kv="interbase",Gv="mariadb",Bv="netezza",jv="pervasive",Hv="pointbase",Fv="sqlite",Vv="sybase",qv="teradata",$v="vertica",Yv="h2",Wv="coldfusion",zv="cassandra",Kv="hbase",Qv="mongodb",Xv="redis",Jv="couchbase",Zv="couchdb",eL="cosmosdb",tL="dynamodb",nL="neo4j",rL="geode",oL="elasticsearch",sL="memcached",iL="cockroachdb",HJ=fv,FJ=mv,VJ=hv,qJ=Tv,$J=Ev,YJ=Sv,WJ=gv,zJ=Av,KJ=Rv,QJ=yv,XJ=Iv,JJ=Ov,ZJ=Nv,e5=bv,t5=Cv,n5=Pv,r5=Mv,o5=xv,s5=vv,i5=Lv,a5=Dv,c5=Uv,u5=wv,l5=kv,p5=Gv,d5=Bv,_5=jv,f5=Hv,m5=Fv,h5=Vv,T5=qv,E5=$v,S5=Yv,g5=Wv,A5=zv,R5=Kv,y5=Qv,I5=Xv,O5=Jv,N5=Zv,b5=eL,C5=tL,P5=nL,M5=rL,x5=oL,v5=sL,L5=iL,D5=We([fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL]),aL="all",cL="each_quorum",uL="quorum",lL="local_quorum",pL="one",dL="two",_L="three",fL="local_one",mL="any",hL="serial",TL="local_serial",U5=aL,w5=cL,k5=uL,G5=lL,B5=pL,j5=dL,H5=_L,F5=fL,V5=mL,q5=hL,$5=TL,Y5=We([aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL]),EL="datasource",SL="http",gL="pubsub",AL="timer",RL="other",W5=EL,z5=SL,K5=gL,Q5=AL,X5=RL,J5=We([EL,SL,gL,AL,RL]),yL="insert",IL="edit",OL="delete",Z5=yL,eZ=IL,tZ=OL,nZ=We([yL,IL,OL]),NL="alibaba_cloud",bL="aws",CL="azure",PL="gcp",rZ=NL,oZ=bL,sZ=CL,iZ=PL,aZ=We([NL,bL,CL,PL]),ML="ip_tcp",xL="ip_udp",vL="ip",LL="unix",DL="pipe",UL="inproc",wL="other",cZ=ML,uZ=xL,lZ=vL,pZ=LL,dZ=DL,_Z=UL,fZ=wL,mZ=We([ML,xL,vL,LL,DL,UL,wL]),kL="wifi",GL="wired",BL="cell",jL="unavailable",HL="unknown",hZ=kL,TZ=GL,EZ=BL,SZ=jL,gZ=HL,AZ=We([kL,GL,BL,jL,HL]),FL="gprs",VL="edge",qL="umts",$L="cdma",YL="evdo_0",WL="evdo_a",zL="cdma2000_1xrtt",KL="hsdpa",QL="hsupa",XL="hspa",JL="iden",ZL="evdo_b",e0="lte",t0="ehrpd",n0="hspap",r0="gsm",o0="td_scdma",s0="iwlan",i0="nr",a0="nrnsa",c0="lte_ca",RZ=FL,yZ=VL,IZ=qL,OZ=$L,NZ=YL,bZ=WL,CZ=zL,PZ=KL,MZ=QL,xZ=XL,vZ=JL,LZ=ZL,DZ=e0,UZ=t0,wZ=n0,kZ=r0,GZ=o0,BZ=s0,jZ=i0,HZ=a0,FZ=c0,VZ=We([FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0]),u0="1.0",l0="1.1",p0="2.0",d0="SPDY",_0="QUIC",qZ=u0,$Z=l0,YZ=p0,WZ=d0,zZ=_0,KZ={HTTP_1_0:u0,HTTP_1_1:l0,HTTP_2_0:p0,SPDY:d0,QUIC:_0},f0="queue",m0="topic",QZ=f0,XZ=m0,JZ=We([f0,m0]),h0="receive",T0="process",ZZ=h0,e6=T0,t6=We([h0,T0]),E0=0,S0=1,g0=2,A0=3,R0=4,y0=5,I0=6,O0=7,N0=8,b0=9,C0=10,P0=11,M0=12,x0=13,v0=14,L0=15,D0=16,n6=E0,r6=S0,o6=g0,s6=A0,i6=R0,a6=y0,c6=I0,u6=O0,l6=N0,p6=b0,d6=C0,_6=P0,f6=M0,m6=x0,h6=v0,T6=L0,E6=D0,S6={OK:E0,CANCELLED:S0,UNKNOWN:g0,INVALID_ARGUMENT:A0,DEADLINE_EXCEEDED:R0,NOT_FOUND:y0,ALREADY_EXISTS:I0,PERMISSION_DENIED:O0,RESOURCE_EXHAUSTED:N0,FAILED_PRECONDITION:b0,ABORTED:C0,OUT_OF_RANGE:P0,UNIMPLEMENTED:M0,INTERNAL:x0,UNAVAILABLE:v0,DATA_LOSS:L0,UNAUTHENTICATED:D0},U0="SENT",w0="RECEIVED",g6=U0,A6=w0,R6=We([U0,w0])});var G0=z(()=>{k0()});var B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU,y6,I6,O6,N6,b6,C6,P6,M6,x6,v6,L6,D6,U6,w6,k6,G6,B6,j6,H6,F6,V6,q6,$6,Y6,W6,z6,K6,Q6,X6,J6,Z6,e8,t8,n8,r8,o8,s8,i8,a8,c8,u8,l8,p8,d8,_8,f8,m8,h8,T8,E8,S8,g8,A8,R8,y8,I8,O8,N8,b8,C8,P8,M8,x8,v8,L8,D8,U8,w8,k8,G8,B8,cA,j8,H8,F8,V8,q8,$8,Y8,W8,z8,K8,dU,_U,fU,mU,Q8,X8,J8,Z8,e7,hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU,t7,n7,r7,o7,s7,i7,a7,c7,u7,l7,p7,d7,_7,f7,m7,h7,T7,E7,LU,DU,S7,g7,A7,UU,wU,kU,GU,BU,jU,HU,R7,y7,I7,O7,N7,b7,C7,P7,FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU,M7,x7,v7,L7,D7,U7,w7,k7,G7,B7,j7,H7,ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw,F7,V7,q7,$7,Y7,W7,z7,K7,Q7,X7,J7,uw=z(()=>{zg();B0="cloud.provider",j0="cloud.account.id",H0="cloud.region",F0="cloud.availability_zone",V0="cloud.platform",q0="aws.ecs.container.arn",$0="aws.ecs.cluster.arn",Y0="aws.ecs.launchtype",W0="aws.ecs.task.arn",z0="aws.ecs.task.family",K0="aws.ecs.task.revision",Q0="aws.eks.cluster.arn",X0="aws.log.group.names",J0="aws.log.group.arns",Z0="aws.log.stream.names",eD="aws.log.stream.arns",tD="container.name",nD="container.id",rD="container.runtime",oD="container.image.name",sD="container.image.tag",iD="deployment.environment",aD="device.id",cD="device.model.identifier",uD="device.model.name",lD="faas.name",pD="faas.id",dD="faas.version",_D="faas.instance",fD="faas.max_memory",mD="host.id",hD="host.name",TD="host.type",ED="host.arch",SD="host.image.name",gD="host.image.id",AD="host.image.version",RD="k8s.cluster.name",yD="k8s.node.name",ID="k8s.node.uid",OD="k8s.namespace.name",ND="k8s.pod.uid",bD="k8s.pod.name",CD="k8s.container.name",PD="k8s.replicaset.uid",MD="k8s.replicaset.name",xD="k8s.deployment.uid",vD="k8s.deployment.name",LD="k8s.statefulset.uid",DD="k8s.statefulset.name",UD="k8s.daemonset.uid",wD="k8s.daemonset.name",kD="k8s.job.uid",GD="k8s.job.name",BD="k8s.cronjob.uid",jD="k8s.cronjob.name",HD="os.type",FD="os.description",VD="os.name",qD="os.version",$D="process.pid",YD="process.executable.name",WD="process.executable.path",zD="process.command",KD="process.command_line",QD="process.command_args",XD="process.owner",JD="process.runtime.name",ZD="process.runtime.version",eU="process.runtime.description",tU="service.name",nU="service.namespace",rU="service.instance.id",oU="service.version",sU="telemetry.sdk.name",iU="telemetry.sdk.language",aU="telemetry.sdk.version",cU="telemetry.auto.version",uU="webengine.name",lU="webengine.version",pU="webengine.description",y6=B0,I6=j0,O6=H0,N6=F0,b6=V0,C6=q0,P6=$0,M6=Y0,x6=W0,v6=z0,L6=K0,D6=Q0,U6=X0,w6=J0,k6=Z0,G6=eD,B6=tD,j6=nD,H6=rD,F6=oD,V6=sD,q6=iD,$6=aD,Y6=cD,W6=uD,z6=lD,K6=pD,Q6=dD,X6=_D,J6=fD,Z6=mD,e8=hD,t8=TD,n8=ED,r8=SD,o8=gD,s8=AD,i8=RD,a8=yD,c8=ID,u8=OD,l8=ND,p8=bD,d8=CD,_8=PD,f8=MD,m8=xD,h8=vD,T8=LD,E8=DD,S8=UD,g8=wD,A8=kD,R8=GD,y8=BD,I8=jD,O8=HD,N8=FD,b8=VD,C8=qD,P8=$D,M8=YD,x8=WD,v8=zD,L8=KD,D8=QD,U8=XD,w8=JD,k8=ZD,G8=eU,B8=tU,cA=nU,j8=rU,H8=oU,F8=sU,V8=iU,q8=aU,$8=cU,Y8=uU,W8=lU,z8=pU,K8=We([B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU]),dU="alibaba_cloud",_U="aws",fU="azure",mU="gcp",Q8=dU,X8=_U,J8=fU,Z8=mU,e7=We([dU,_U,fU,mU]),hU="alibaba_cloud_ecs",TU="alibaba_cloud_fc",EU="aws_ec2",SU="aws_ecs",gU="aws_eks",AU="aws_lambda",RU="aws_elastic_beanstalk",yU="azure_vm",IU="azure_container_instances",OU="azure_aks",NU="azure_functions",bU="azure_app_service",CU="gcp_compute_engine",PU="gcp_cloud_run",MU="gcp_kubernetes_engine",xU="gcp_cloud_functions",vU="gcp_app_engine",t7=hU,n7=TU,r7=EU,o7=SU,s7=gU,i7=AU,a7=RU,c7=yU,u7=IU,l7=OU,p7=NU,d7=bU,_7=CU,f7=PU,m7=MU,h7=xU,T7=vU,E7=We([hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU]),LU="ec2",DU="fargate",S7=LU,g7=DU,A7=We([LU,DU]),UU="amd64",wU="arm32",kU="arm64",GU="ia64",BU="ppc32",jU="ppc64",HU="x86",R7=UU,y7=wU,I7=kU,O7=GU,N7=BU,b7=jU,C7=HU,P7=We([UU,wU,kU,GU,BU,jU,HU]),FU="windows",VU="linux",qU="darwin",$U="freebsd",YU="netbsd",WU="openbsd",zU="dragonflybsd",KU="hpux",QU="aix",XU="solaris",JU="z_os",M7=FU,x7=VU,v7=qU,L7=$U,D7=YU,U7=WU,w7=zU,k7=KU,G7=QU,B7=XU,j7=JU,H7=We([FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU]),ZU="cpp",ew="dotnet",tw="erlang",nw="go",rw="java",ow="nodejs",sw="php",iw="python",aw="ruby",cw="webjs",F7=ZU,V7=ew,q7=tw,$7=nw,Y7=rw,W7=ow,z7=sw,K7=iw,Q7=aw,X7=cw,J7=We([ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw])});var lw=z(()=>{uw()});var Z7,eee,tee,nee,ree,oee,see,iee,aee,cee,uee,lee,pee,dee,_ee,fee,mee,hee,Tee,Eee,See,gee,Aee,Ree,yee,uA,lA,Iee,tc,Oee,pA,dA,Nee,xi,bee,Cee,Pee,Mee,xee,vee,Lee,Dee,Uee,wee,_A,kee,Gee,Bee,jee,Hee,Fee,vi,Vee,qee,$ee,Yee,Wee,zee,Kee,Qee,Xee,Jee,Zee,ete,tte,bo,Co,nte,rte,ote,ste,ite,ate,cte,ute,lte,pte,dte,_te,fte,mte,hte,Tte,fA,mA,Ete,hA,TA,Ste,gte,Ate,Rte,yte,Ite,Ote,Nte,bte,Cte,Pte,Mte,xte,vte,EA,SA,Lte,gA,Dte,AA,Ute,wte,kte,Gte,Bte,jte,Hte,Fte,Vte,qte,$te,Yte,Wte,zte,Kte,Qte,Xte,Jte,Zte,ene,tne,nne,rne,one,cs,sne,ine,ane,RA,pw=z(()=>{Z7="aspnetcore.diagnostics.exception.result",eee="aborted",tee="handled",nee="skipped",ree="unhandled",oee="aspnetcore.diagnostics.handler.type",see="aspnetcore.rate_limiting.policy",iee="aspnetcore.rate_limiting.result",aee="acquired",cee="endpoint_limiter",uee="global_limiter",lee="request_canceled",pee="aspnetcore.request.is_unhandled",dee="aspnetcore.routing.is_fallback",_ee="aspnetcore.routing.match_status",fee="failure",mee="success",hee="aspnetcore.user.is_authenticated",Tee="client.address",Eee="client.port",See="code.column.number",gee="code.file.path",Aee="code.function.name",Ree="code.line.number",yee="code.stacktrace",uA="db.collection.name",lA="db.namespace",Iee="db.operation.batch.size",tc="db.operation.name",Oee="db.query.summary",pA="db.query.text",dA="db.response.status_code",Nee="db.stored_procedure.name",xi="db.system.name",bee="mariadb",Cee="microsoft.sql_server",Pee="mysql",Mee="postgresql",xee="dotnet.gc.heap.generation",vee="gen0",Lee="gen1",Dee="gen2",Uee="loh",wee="poh",_A="error.type",kee="_OTHER",Gee="exception.escaped",Bee="exception.message",jee="exception.stacktrace",Hee="exception.type",Fee=t=>`http.request.header.${t}`,vi="http.request.method",Vee="_OTHER",qee="CONNECT",$ee="DELETE",Yee="GET",Wee="HEAD",zee="OPTIONS",Kee="PATCH",Qee="POST",Xee="PUT",Jee="TRACE",Zee="http.request.method_original",ete="http.request.resend_count",tte=t=>`http.response.header.${t}`,bo="http.response.status_code",Co="http.route",nte="jvm.gc.action",rte="jvm.gc.name",ote="jvm.memory.pool.name",ste="jvm.memory.type",ite="heap",ate="non_heap",cte="jvm.thread.daemon",ute="jvm.thread.state",lte="blocked",pte="new",dte="runnable",_te="terminated",fte="timed_waiting",mte="waiting",hte="network.local.address",Tte="network.local.port",fA="network.peer.address",mA="network.peer.port",Ete="network.protocol.name",hA="network.protocol.version",TA="network.transport",Ste="pipe",gte="quic",Ate="tcp",Rte="udp",yte="unix",Ite="network.type",Ote="ipv4",Nte="ipv6",bte="otel.scope.name",Cte="otel.scope.version",Pte="otel.status_code",Mte="ERROR",xte="OK",vte="otel.status_description",EA="server.address",SA="server.port",Lte="service.instance.id",gA="service.name",Dte="service.namespace",AA="service.version",Ute="signalr.connection.status",wte="app_shutdown",kte="normal_closure",Gte="timeout",Bte="signalr.transport",jte="long_polling",Hte="server_sent_events",Fte="web_sockets",Vte="telemetry.sdk.language",qte="cpp",$te="dotnet",Yte="erlang",Wte="go",zte="java",Kte="nodejs",Qte="php",Xte="python",Jte="ruby",Zte="rust",ene="swift",tne="webjs",nne="telemetry.sdk.name",rne="telemetry.sdk.version",one="url.fragment",cs="url.full",sne="url.path",ine="url.query",ane="url.scheme",RA="user_agent.original"});var cne,une,lne,pne,dne,_ne,fne,mne,hne,Tne,Ene,Sne,gne,Ane,Rne,yne,Ine,One,Nne,bne,Cne,Pne,Mne,xne,vne,Lne,Dne,Une,wne,kne,Gne,Bne,jne,Hne,Fne,Vne,qne,$ne,Yne,Wne,zne,Kne,Qne,Xne,Jne,Zne,ere,tre,nre,rre,ore,dw=z(()=>{cne="aspnetcore.diagnostics.exceptions",une="aspnetcore.rate_limiting.active_request_leases",lne="aspnetcore.rate_limiting.queued_requests",pne="aspnetcore.rate_limiting.request.time_in_queue",dne="aspnetcore.rate_limiting.request_lease.duration",_ne="aspnetcore.rate_limiting.requests",fne="aspnetcore.routing.match_attempts",mne="db.client.operation.duration",hne="dotnet.assembly.count",Tne="dotnet.exceptions",Ene="dotnet.gc.collections",Sne="dotnet.gc.heap.total_allocated",gne="dotnet.gc.last_collection.heap.fragmentation.size",Ane="dotnet.gc.last_collection.heap.size",Rne="dotnet.gc.last_collection.memory.committed_size",yne="dotnet.gc.pause.time",Ine="dotnet.jit.compilation.time",One="dotnet.jit.compiled_il.size",Nne="dotnet.jit.compiled_methods",bne="dotnet.monitor.lock_contentions",Cne="dotnet.process.cpu.count",Pne="dotnet.process.cpu.time",Mne="dotnet.process.memory.working_set",xne="dotnet.thread_pool.queue.length",vne="dotnet.thread_pool.thread.count",Lne="dotnet.thread_pool.work_item.count",Dne="dotnet.timer.count",Une="http.client.request.duration",wne="http.server.request.duration",kne="jvm.class.count",Gne="jvm.class.loaded",Bne="jvm.class.unloaded",jne="jvm.cpu.count",Hne="jvm.cpu.recent_utilization",Fne="jvm.cpu.time",Vne="jvm.gc.duration",qne="jvm.memory.committed",$ne="jvm.memory.limit",Yne="jvm.memory.used",Wne="jvm.memory.used_after_last_gc",zne="jvm.thread.count",Kne="kestrel.active_connections",Qne="kestrel.active_tls_handshakes",Xne="kestrel.connection.duration",Jne="kestrel.queued_connections",Zne="kestrel.queued_requests",ere="kestrel.rejected_connections",tre="kestrel.tls_handshake.duration",nre="kestrel.upgraded_connections",rre="signalr.server.active_connections",ore="signalr.server.connection.duration"});var sre,_w=z(()=>{sre="exception"});var Ae={};sg(Ae,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>eee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>tee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>nee,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>ree,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>aee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>cee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>uee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>lee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>fee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>mee,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>Z7,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>oee,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>see,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>iee,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>pee,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>dee,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>_ee,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>hee,ATTR_CLIENT_ADDRESS:()=>Tee,ATTR_CLIENT_PORT:()=>Eee,ATTR_CODE_COLUMN_NUMBER:()=>See,ATTR_CODE_FILE_PATH:()=>gee,ATTR_CODE_FUNCTION_NAME:()=>Aee,ATTR_CODE_LINE_NUMBER:()=>Ree,ATTR_CODE_STACKTRACE:()=>yee,ATTR_DB_COLLECTION_NAME:()=>uA,ATTR_DB_NAMESPACE:()=>lA,ATTR_DB_OPERATION_BATCH_SIZE:()=>Iee,ATTR_DB_OPERATION_NAME:()=>tc,ATTR_DB_QUERY_SUMMARY:()=>Oee,ATTR_DB_QUERY_TEXT:()=>pA,ATTR_DB_RESPONSE_STATUS_CODE:()=>dA,ATTR_DB_STORED_PROCEDURE_NAME:()=>Nee,ATTR_DB_SYSTEM_NAME:()=>xi,ATTR_DOTNET_GC_HEAP_GENERATION:()=>xee,ATTR_ERROR_TYPE:()=>_A,ATTR_EXCEPTION_ESCAPED:()=>Gee,ATTR_EXCEPTION_MESSAGE:()=>Bee,ATTR_EXCEPTION_STACKTRACE:()=>jee,ATTR_EXCEPTION_TYPE:()=>Hee,ATTR_HTTP_REQUEST_HEADER:()=>Fee,ATTR_HTTP_REQUEST_METHOD:()=>vi,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>Zee,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>ete,ATTR_HTTP_RESPONSE_HEADER:()=>tte,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>bo,ATTR_HTTP_ROUTE:()=>Co,ATTR_JVM_GC_ACTION:()=>nte,ATTR_JVM_GC_NAME:()=>rte,ATTR_JVM_MEMORY_POOL_NAME:()=>ote,ATTR_JVM_MEMORY_TYPE:()=>ste,ATTR_JVM_THREAD_DAEMON:()=>cte,ATTR_JVM_THREAD_STATE:()=>ute,ATTR_NETWORK_LOCAL_ADDRESS:()=>hte,ATTR_NETWORK_LOCAL_PORT:()=>Tte,ATTR_NETWORK_PEER_ADDRESS:()=>fA,ATTR_NETWORK_PEER_PORT:()=>mA,ATTR_NETWORK_PROTOCOL_NAME:()=>Ete,ATTR_NETWORK_PROTOCOL_VERSION:()=>hA,ATTR_NETWORK_TRANSPORT:()=>TA,ATTR_NETWORK_TYPE:()=>Ite,ATTR_OTEL_SCOPE_NAME:()=>bte,ATTR_OTEL_SCOPE_VERSION:()=>Cte,ATTR_OTEL_STATUS_CODE:()=>Pte,ATTR_OTEL_STATUS_DESCRIPTION:()=>vte,ATTR_SERVER_ADDRESS:()=>EA,ATTR_SERVER_PORT:()=>SA,ATTR_SERVICE_INSTANCE_ID:()=>Lte,ATTR_SERVICE_NAME:()=>gA,ATTR_SERVICE_NAMESPACE:()=>Dte,ATTR_SERVICE_VERSION:()=>AA,ATTR_SIGNALR_CONNECTION_STATUS:()=>Ute,ATTR_SIGNALR_TRANSPORT:()=>Bte,ATTR_TELEMETRY_SDK_LANGUAGE:()=>Vte,ATTR_TELEMETRY_SDK_NAME:()=>nne,ATTR_TELEMETRY_SDK_VERSION:()=>rne,ATTR_URL_FRAGMENT:()=>one,ATTR_URL_FULL:()=>cs,ATTR_URL_PATH:()=>sne,ATTR_URL_QUERY:()=>ine,ATTR_URL_SCHEME:()=>ane,ATTR_USER_AGENT_ORIGINAL:()=>RA,AWSECSLAUNCHTYPEVALUES_EC2:()=>S7,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>g7,AwsEcsLaunchtypeValues:()=>A7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>t7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>n7,CLOUDPLATFORMVALUES_AWS_EC2:()=>r7,CLOUDPLATFORMVALUES_AWS_ECS:()=>o7,CLOUDPLATFORMVALUES_AWS_EKS:()=>s7,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>a7,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>i7,CLOUDPLATFORMVALUES_AZURE_AKS:()=>l7,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>d7,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>u7,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>p7,CLOUDPLATFORMVALUES_AZURE_VM:()=>c7,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>T7,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>h7,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>f7,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>_7,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>m7,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>Q8,CLOUDPROVIDERVALUES_AWS:()=>X8,CLOUDPROVIDERVALUES_AZURE:()=>J8,CLOUDPROVIDERVALUES_GCP:()=>Z8,CloudPlatformValues:()=>E7,CloudProviderValues:()=>e7,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>U5,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>V5,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>w5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>F5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>G5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>$5,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>B5,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>k5,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>q5,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>H5,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>j5,DBSYSTEMVALUES_ADABAS:()=>o5,DBSYSTEMVALUES_CACHE:()=>r5,DBSYSTEMVALUES_CASSANDRA:()=>A5,DBSYSTEMVALUES_CLOUDSCAPE:()=>KJ,DBSYSTEMVALUES_COCKROACHDB:()=>L5,DBSYSTEMVALUES_COLDFUSION:()=>g5,DBSYSTEMVALUES_COSMOSDB:()=>b5,DBSYSTEMVALUES_COUCHBASE:()=>O5,DBSYSTEMVALUES_COUCHDB:()=>N5,DBSYSTEMVALUES_DB2:()=>$J,DBSYSTEMVALUES_DERBY:()=>i5,DBSYSTEMVALUES_DYNAMODB:()=>C5,DBSYSTEMVALUES_EDB:()=>n5,DBSYSTEMVALUES_ELASTICSEARCH:()=>x5,DBSYSTEMVALUES_FILEMAKER:()=>a5,DBSYSTEMVALUES_FIREBIRD:()=>s5,DBSYSTEMVALUES_FIRSTSQL:()=>t5,DBSYSTEMVALUES_GEODE:()=>M5,DBSYSTEMVALUES_H2:()=>S5,DBSYSTEMVALUES_HANADB:()=>ZJ,DBSYSTEMVALUES_HBASE:()=>R5,DBSYSTEMVALUES_HIVE:()=>zJ,DBSYSTEMVALUES_HSQLDB:()=>QJ,DBSYSTEMVALUES_INFORMIX:()=>c5,DBSYSTEMVALUES_INGRES:()=>e5,DBSYSTEMVALUES_INSTANTDB:()=>u5,DBSYSTEMVALUES_INTERBASE:()=>l5,DBSYSTEMVALUES_MARIADB:()=>p5,DBSYSTEMVALUES_MAXDB:()=>JJ,DBSYSTEMVALUES_MEMCACHED:()=>v5,DBSYSTEMVALUES_MONGODB:()=>y5,DBSYSTEMVALUES_MSSQL:()=>FJ,DBSYSTEMVALUES_MYSQL:()=>VJ,DBSYSTEMVALUES_NEO4J:()=>P5,DBSYSTEMVALUES_NETEZZA:()=>d5,DBSYSTEMVALUES_ORACLE:()=>qJ,DBSYSTEMVALUES_OTHER_SQL:()=>HJ,DBSYSTEMVALUES_PERVASIVE:()=>_5,DBSYSTEMVALUES_POINTBASE:()=>f5,DBSYSTEMVALUES_POSTGRESQL:()=>YJ,DBSYSTEMVALUES_PROGRESS:()=>XJ,DBSYSTEMVALUES_REDIS:()=>I5,DBSYSTEMVALUES_REDSHIFT:()=>WJ,DBSYSTEMVALUES_SQLITE:()=>m5,DBSYSTEMVALUES_SYBASE:()=>h5,DBSYSTEMVALUES_TERADATA:()=>T5,DBSYSTEMVALUES_VERTICA:()=>E5,DB_SYSTEM_NAME_VALUE_MARIADB:()=>bee,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>Cee,DB_SYSTEM_NAME_VALUE_MYSQL:()=>Pee,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>Mee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>vee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>Lee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>Dee,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>Uee,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>wee,DbCassandraConsistencyLevelValues:()=>Y5,DbSystemValues:()=>D5,ERROR_TYPE_VALUE_OTHER:()=>kee,EVENT_EXCEPTION:()=>sre,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>tZ,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>eZ,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>Z5,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>rZ,FAASINVOKEDPROVIDERVALUES_AWS:()=>oZ,FAASINVOKEDPROVIDERVALUES_AZURE:()=>sZ,FAASINVOKEDPROVIDERVALUES_GCP:()=>iZ,FAASTRIGGERVALUES_DATASOURCE:()=>W5,FAASTRIGGERVALUES_HTTP:()=>z5,FAASTRIGGERVALUES_OTHER:()=>X5,FAASTRIGGERVALUES_PUBSUB:()=>K5,FAASTRIGGERVALUES_TIMER:()=>Q5,FaasDocumentOperationValues:()=>nZ,FaasInvokedProviderValues:()=>aZ,FaasTriggerValues:()=>J5,HOSTARCHVALUES_AMD64:()=>R7,HOSTARCHVALUES_ARM32:()=>y7,HOSTARCHVALUES_ARM64:()=>I7,HOSTARCHVALUES_IA64:()=>O7,HOSTARCHVALUES_PPC32:()=>N7,HOSTARCHVALUES_PPC64:()=>b7,HOSTARCHVALUES_X86:()=>C7,HTTPFLAVORVALUES_HTTP_1_0:()=>qZ,HTTPFLAVORVALUES_HTTP_1_1:()=>$Z,HTTPFLAVORVALUES_HTTP_2_0:()=>YZ,HTTPFLAVORVALUES_QUIC:()=>zZ,HTTPFLAVORVALUES_SPDY:()=>WZ,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>qee,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>$ee,HTTP_REQUEST_METHOD_VALUE_GET:()=>Yee,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>Wee,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>zee,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>Vee,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>Kee,HTTP_REQUEST_METHOD_VALUE_POST:()=>Qee,HTTP_REQUEST_METHOD_VALUE_PUT:()=>Xee,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>Jee,HostArchValues:()=>P7,HttpFlavorValues:()=>KZ,JVM_MEMORY_TYPE_VALUE_HEAP:()=>ite,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>ate,JVM_THREAD_STATE_VALUE_BLOCKED:()=>lte,JVM_THREAD_STATE_VALUE_NEW:()=>pte,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>dte,JVM_THREAD_STATE_VALUE_TERMINATED:()=>_te,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>fte,JVM_THREAD_STATE_VALUE_WAITING:()=>mte,MESSAGETYPEVALUES_RECEIVED:()=>A6,MESSAGETYPEVALUES_SENT:()=>g6,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>QZ,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>XZ,MESSAGINGOPERATIONVALUES_PROCESS:()=>e6,MESSAGINGOPERATIONVALUES_RECEIVE:()=>ZZ,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>cne,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>une,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>lne,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>_ne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>dne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>pne,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>fne,METRIC_DB_CLIENT_OPERATION_DURATION:()=>mne,METRIC_DOTNET_ASSEMBLY_COUNT:()=>hne,METRIC_DOTNET_EXCEPTIONS:()=>Tne,METRIC_DOTNET_GC_COLLECTIONS:()=>Ene,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>Sne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>gne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>Ane,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>Rne,METRIC_DOTNET_GC_PAUSE_TIME:()=>yne,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>Ine,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>One,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>Nne,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>bne,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>Cne,METRIC_DOTNET_PROCESS_CPU_TIME:()=>Pne,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>Mne,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>xne,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>vne,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>Lne,METRIC_DOTNET_TIMER_COUNT:()=>Dne,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>Une,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>wne,METRIC_JVM_CLASS_COUNT:()=>kne,METRIC_JVM_CLASS_LOADED:()=>Gne,METRIC_JVM_CLASS_UNLOADED:()=>Bne,METRIC_JVM_CPU_COUNT:()=>jne,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>Hne,METRIC_JVM_CPU_TIME:()=>Fne,METRIC_JVM_GC_DURATION:()=>Vne,METRIC_JVM_MEMORY_COMMITTED:()=>qne,METRIC_JVM_MEMORY_LIMIT:()=>$ne,METRIC_JVM_MEMORY_USED:()=>Yne,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>Wne,METRIC_JVM_THREAD_COUNT:()=>zne,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>Kne,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Qne,METRIC_KESTREL_CONNECTION_DURATION:()=>Xne,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Jne,METRIC_KESTREL_QUEUED_REQUESTS:()=>Zne,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>ere,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>tre,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>nre,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>rre,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>ore,MessageTypeValues:()=>R6,MessagingDestinationKindValues:()=>JZ,MessagingOperationValues:()=>t6,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>OZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>CZ,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>yZ,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>UZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>NZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>bZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>LZ,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>RZ,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>kZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>PZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>xZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>wZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>MZ,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>vZ,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>BZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>DZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>FZ,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>jZ,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>HZ,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>GZ,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>IZ,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>EZ,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>SZ,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>gZ,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>hZ,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>TZ,NETTRANSPORTVALUES_INPROC:()=>_Z,NETTRANSPORTVALUES_IP:()=>lZ,NETTRANSPORTVALUES_IP_TCP:()=>cZ,NETTRANSPORTVALUES_IP_UDP:()=>uZ,NETTRANSPORTVALUES_OTHER:()=>fZ,NETTRANSPORTVALUES_PIPE:()=>dZ,NETTRANSPORTVALUES_UNIX:()=>pZ,NETWORK_TRANSPORT_VALUE_PIPE:()=>Ste,NETWORK_TRANSPORT_VALUE_QUIC:()=>gte,NETWORK_TRANSPORT_VALUE_TCP:()=>Ate,NETWORK_TRANSPORT_VALUE_UDP:()=>Rte,NETWORK_TRANSPORT_VALUE_UNIX:()=>yte,NETWORK_TYPE_VALUE_IPV4:()=>Ote,NETWORK_TYPE_VALUE_IPV6:()=>Nte,NetHostConnectionSubtypeValues:()=>VZ,NetHostConnectionTypeValues:()=>AZ,NetTransportValues:()=>mZ,OSTYPEVALUES_AIX:()=>G7,OSTYPEVALUES_DARWIN:()=>v7,OSTYPEVALUES_DRAGONFLYBSD:()=>w7,OSTYPEVALUES_FREEBSD:()=>L7,OSTYPEVALUES_HPUX:()=>k7,OSTYPEVALUES_LINUX:()=>x7,OSTYPEVALUES_NETBSD:()=>D7,OSTYPEVALUES_OPENBSD:()=>U7,OSTYPEVALUES_SOLARIS:()=>B7,OSTYPEVALUES_WINDOWS:()=>M7,OSTYPEVALUES_Z_OS:()=>j7,OTEL_STATUS_CODE_VALUE_ERROR:()=>Mte,OTEL_STATUS_CODE_VALUE_OK:()=>xte,OsTypeValues:()=>H7,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>d6,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>c6,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>r6,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>T6,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>i6,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>p6,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>m6,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>s6,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>a6,RPCGRPCSTATUSCODEVALUES_OK:()=>n6,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>_6,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>u6,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>l6,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>E6,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>h6,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>f6,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>o6,RpcGrpcStatusCodeValues:()=>S6,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>JX,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>lJ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>KX,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>$X,SEMATTRS_AWS_DYNAMODB_COUNT:()=>cJ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>rJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>tJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>pJ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>ZX,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>YX,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>XX,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>nJ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>QX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>WX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>zX,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>uJ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>sJ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>iJ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>eJ,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>oJ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>qX,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>aJ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>wQ,SEMATTRS_CODE_FILEPATH:()=>DX,SEMATTRS_CODE_FUNCTION:()=>vX,SEMATTRS_CODE_LINENO:()=>UX,SEMATTRS_CODE_NAMESPACE:()=>LX,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>$Q,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>QQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>KQ,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>WQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>VQ,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>qQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>zQ,SEMATTRS_DB_CASSANDRA_TABLE:()=>YQ,SEMATTRS_DB_CONNECTION_STRING:()=>kQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>XQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>BQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>ZQ,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>FQ,SEMATTRS_DB_NAME:()=>jQ,SEMATTRS_DB_OPERATION:()=>HQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>JQ,SEMATTRS_DB_SQL_TABLE:()=>eX,SEMATTRS_DB_STATEMENT:()=>Qg,SEMATTRS_DB_SYSTEM:()=>Kg,SEMATTRS_DB_USER:()=>GQ,SEMATTRS_ENDUSER_ID:()=>bX,SEMATTRS_ENDUSER_ROLE:()=>CX,SEMATTRS_ENDUSER_SCOPE:()=>PX,SEMATTRS_EXCEPTION_ESCAPED:()=>oX,SEMATTRS_EXCEPTION_MESSAGE:()=>nX,SEMATTRS_EXCEPTION_STACKTRACE:()=>rX,SEMATTRS_EXCEPTION_TYPE:()=>tX,SEMATTRS_FAAS_COLDSTART:()=>dX,SEMATTRS_FAAS_CRON:()=>pX,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>iX,SEMATTRS_FAAS_DOCUMENT_NAME:()=>uX,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>aX,SEMATTRS_FAAS_DOCUMENT_TIME:()=>cX,SEMATTRS_FAAS_EXECUTION:()=>sX,SEMATTRS_FAAS_INVOKED_NAME:()=>_X,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>fX,SEMATTRS_FAAS_INVOKED_REGION:()=>mX,SEMATTRS_FAAS_TIME:()=>lX,SEMATTRS_FAAS_TRIGGER:()=>Xg,SEMATTRS_HTTP_CLIENT_IP:()=>VX,SEMATTRS_HTTP_FLAVOR:()=>GX,SEMATTRS_HTTP_HOST:()=>wX,SEMATTRS_HTTP_METHOD:()=>Cl,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>jX,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>HX,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>nA,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>rA,SEMATTRS_HTTP_ROUTE:()=>oA,SEMATTRS_HTTP_SCHEME:()=>kX,SEMATTRS_HTTP_SERVER_NAME:()=>FX,SEMATTRS_HTTP_STATUS_CODE:()=>Mi,SEMATTRS_HTTP_TARGET:()=>tA,SEMATTRS_HTTP_URL:()=>ec,SEMATTRS_HTTP_USER_AGENT:()=>BX,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>GJ,SEMATTRS_MESSAGE_ID:()=>kJ,SEMATTRS_MESSAGE_TYPE:()=>wJ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>BJ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>yJ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>SJ,SEMATTRS_MESSAGING_DESTINATION:()=>dJ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>_J,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>bJ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>NJ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>OJ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>CJ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>PJ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>EJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>AJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>gJ,SEMATTRS_MESSAGING_OPERATION:()=>RJ,SEMATTRS_MESSAGING_PROTOCOL:()=>mJ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>hJ,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>IJ,SEMATTRS_MESSAGING_SYSTEM:()=>sA,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>fJ,SEMATTRS_MESSAGING_URL:()=>TJ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>OX,SEMATTRS_NET_HOST_CARRIER_MCC:()=>yX,SEMATTRS_NET_HOST_CARRIER_MNC:()=>IX,SEMATTRS_NET_HOST_CARRIER_NAME:()=>RX,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>AX,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>gX,SEMATTRS_NET_HOST_IP:()=>Zg,SEMATTRS_NET_HOST_NAME:()=>SX,SEMATTRS_NET_HOST_PORT:()=>eA,SEMATTRS_NET_PEER_IP:()=>Jg,SEMATTRS_NET_PEER_NAME:()=>EX,SEMATTRS_NET_PEER_PORT:()=>TX,SEMATTRS_NET_TRANSPORT:()=>hX,SEMATTRS_PEER_SERVICE:()=>NX,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>aA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>DJ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>UJ,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>LJ,SEMATTRS_RPC_JSONRPC_VERSION:()=>vJ,SEMATTRS_RPC_METHOD:()=>xJ,SEMATTRS_RPC_SERVICE:()=>iA,SEMATTRS_RPC_SYSTEM:()=>MJ,SEMATTRS_THREAD_ID:()=>MX,SEMATTRS_THREAD_NAME:()=>xX,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>P6,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>C6,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>M6,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>x6,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>v6,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>L6,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>D6,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>w6,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>U6,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>G6,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>k6,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>I6,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>N6,SEMRESATTRS_CLOUD_PLATFORM:()=>b6,SEMRESATTRS_CLOUD_PROVIDER:()=>y6,SEMRESATTRS_CLOUD_REGION:()=>O6,SEMRESATTRS_CONTAINER_ID:()=>j6,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>F6,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>V6,SEMRESATTRS_CONTAINER_NAME:()=>B6,SEMRESATTRS_CONTAINER_RUNTIME:()=>H6,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>q6,SEMRESATTRS_DEVICE_ID:()=>$6,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>Y6,SEMRESATTRS_DEVICE_MODEL_NAME:()=>W6,SEMRESATTRS_FAAS_ID:()=>K6,SEMRESATTRS_FAAS_INSTANCE:()=>X6,SEMRESATTRS_FAAS_MAX_MEMORY:()=>J6,SEMRESATTRS_FAAS_NAME:()=>z6,SEMRESATTRS_FAAS_VERSION:()=>Q6,SEMRESATTRS_HOST_ARCH:()=>n8,SEMRESATTRS_HOST_ID:()=>Z6,SEMRESATTRS_HOST_IMAGE_ID:()=>o8,SEMRESATTRS_HOST_IMAGE_NAME:()=>r8,SEMRESATTRS_HOST_IMAGE_VERSION:()=>s8,SEMRESATTRS_HOST_NAME:()=>e8,SEMRESATTRS_HOST_TYPE:()=>t8,SEMRESATTRS_K8S_CLUSTER_NAME:()=>i8,SEMRESATTRS_K8S_CONTAINER_NAME:()=>d8,SEMRESATTRS_K8S_CRONJOB_NAME:()=>I8,SEMRESATTRS_K8S_CRONJOB_UID:()=>y8,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>g8,SEMRESATTRS_K8S_DAEMONSET_UID:()=>S8,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>h8,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>m8,SEMRESATTRS_K8S_JOB_NAME:()=>R8,SEMRESATTRS_K8S_JOB_UID:()=>A8,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>u8,SEMRESATTRS_K8S_NODE_NAME:()=>a8,SEMRESATTRS_K8S_NODE_UID:()=>c8,SEMRESATTRS_K8S_POD_NAME:()=>p8,SEMRESATTRS_K8S_POD_UID:()=>l8,SEMRESATTRS_K8S_REPLICASET_NAME:()=>f8,SEMRESATTRS_K8S_REPLICASET_UID:()=>_8,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>E8,SEMRESATTRS_K8S_STATEFULSET_UID:()=>T8,SEMRESATTRS_OS_DESCRIPTION:()=>N8,SEMRESATTRS_OS_NAME:()=>b8,SEMRESATTRS_OS_TYPE:()=>O8,SEMRESATTRS_OS_VERSION:()=>C8,SEMRESATTRS_PROCESS_COMMAND:()=>v8,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>D8,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>L8,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>M8,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>x8,SEMRESATTRS_PROCESS_OWNER:()=>U8,SEMRESATTRS_PROCESS_PID:()=>P8,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>G8,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>w8,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>k8,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>j8,SEMRESATTRS_SERVICE_NAME:()=>B8,SEMRESATTRS_SERVICE_NAMESPACE:()=>cA,SEMRESATTRS_SERVICE_VERSION:()=>H8,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>$8,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>V8,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>F8,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>q8,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>z8,SEMRESATTRS_WEBENGINE_NAME:()=>Y8,SEMRESATTRS_WEBENGINE_VERSION:()=>W8,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>wte,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>kte,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>Gte,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>jte,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>Hte,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>Fte,SemanticAttributes:()=>jJ,SemanticResourceAttributes:()=>K8,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>F7,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>V7,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>q7,TELEMETRYSDKLANGUAGEVALUES_GO:()=>$7,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>Y7,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>W7,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>z7,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>K7,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>Q7,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>X7,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>qte,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>$te,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>Yte,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>Wte,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>zte,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>Kte,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Qte,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>Xte,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Jte,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Zte,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>ene,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>tne,TelemetrySdkLanguageValues:()=>J7});var le=z(()=>{G0();lw();pw();dw();_w()});var fw=E(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});L_.ATTR_PROCESS_RUNTIME_NAME=void 0;L_.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var mw=E(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});U_.SDK_INFO=void 0;var ire=WP(),D_=(le(),O(Ae)),are=fw();U_.SDK_INFO={[D_.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[are.ATTR_PROCESS_RUNTIME_NAME]:"node",[D_.ATTR_TELEMETRY_SDK_LANGUAGE]:D_.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[D_.ATTR_TELEMETRY_SDK_VERSION]:ire.VERSION}});var hw=E($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.otperformance=$t.SDK_INFO=$t._globalThis=$t.getStringListFromEnv=$t.getNumberFromEnv=$t.getBooleanFromEnv=$t.getStringFromEnv=void 0;var w_=$P();Object.defineProperty($t,"getStringFromEnv",{enumerable:!0,get:function(){return w_.getStringFromEnv}});Object.defineProperty($t,"getBooleanFromEnv",{enumerable:!0,get:function(){return w_.getBooleanFromEnv}});Object.defineProperty($t,"getNumberFromEnv",{enumerable:!0,get:function(){return w_.getNumberFromEnv}});Object.defineProperty($t,"getStringListFromEnv",{enumerable:!0,get:function(){return w_.getStringListFromEnv}});var cre=YP();Object.defineProperty($t,"_globalThis",{enumerable:!0,get:function(){return cre._globalThis}});var ure=mw();Object.defineProperty($t,"SDK_INFO",{enumerable:!0,get:function(){return ure.SDK_INFO}});$t.otperformance=performance});var yA=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getStringListFromEnv=Yt.getNumberFromEnv=Yt.getStringFromEnv=Yt.getBooleanFromEnv=Yt.otperformance=Yt._globalThis=Yt.SDK_INFO=void 0;var Li=hw();Object.defineProperty(Yt,"SDK_INFO",{enumerable:!0,get:function(){return Li.SDK_INFO}});Object.defineProperty(Yt,"_globalThis",{enumerable:!0,get:function(){return Li._globalThis}});Object.defineProperty(Yt,"otperformance",{enumerable:!0,get:function(){return Li.otperformance}});Object.defineProperty(Yt,"getBooleanFromEnv",{enumerable:!0,get:function(){return Li.getBooleanFromEnv}});Object.defineProperty(Yt,"getStringFromEnv",{enumerable:!0,get:function(){return Li.getStringFromEnv}});Object.defineProperty(Yt,"getNumberFromEnv",{enumerable:!0,get:function(){return Li.getNumberFromEnv}});Object.defineProperty(Yt,"getStringListFromEnv",{enumerable:!0,get:function(){return Li.getStringListFromEnv}})});var gw=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addHrTimes=be.isTimeInput=be.isTimeInputHrTime=be.hrTimeToMicroseconds=be.hrTimeToMilliseconds=be.hrTimeToNanoseconds=be.hrTimeToTimeStamp=be.hrTimeDuration=be.timeInputToHrTime=be.hrTime=be.getTimeOrigin=be.millisToHrTime=void 0;var k_=yA(),Tw=9,lre=6,pre=Math.pow(10,lre),G_=Math.pow(10,Tw);function Pl(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*pre);return[n,r]}be.millisToHrTime=Pl;function dre(){return k_.otperformance.timeOrigin}be.getTimeOrigin=dre;function Ew(t){let e=Pl(k_.otperformance.timeOrigin),n=Pl(typeof t=="number"?t:k_.otperformance.now());return Sw(e,n)}be.hrTime=Ew;function _re(t){if(IA(t))return t;if(typeof t=="number")return t<k_.otperformance.timeOrigin?Ew(t):Pl(t);if(t instanceof Date)return Pl(t.getTime());throw TypeError("Invalid input type")}be.timeInputToHrTime=_re;function fre(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=G_),[n,r]}be.hrTimeDuration=fre;function mre(t){let e=Tw,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}be.hrTimeToTimeStamp=mre;function hre(t){return t[0]*G_+t[1]}be.hrTimeToNanoseconds=hre;function Tre(t){return t[0]*1e3+t[1]/1e6}be.hrTimeToMilliseconds=Tre;function Ere(t){return t[0]*1e6+t[1]/1e3}be.hrTimeToMicroseconds=Ere;function IA(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}be.isTimeInputHrTime=IA;function Sre(t){return IA(t)||typeof t=="number"||t instanceof Date}be.isTimeInput=Sre;function Sw(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=G_&&(n[1]-=G_,n[0]+=1),n}be.addHrTimes=Sw});var Aw=E(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});B_.unrefTimer=void 0;function gre(t){typeof t!="number"&&t.unref()}B_.unrefTimer=gre});var Rw=E(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.ExportResultCode=void 0;var Are;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Are=Ml.ExportResultCode||(Ml.ExportResultCode={}))});var Iw=E(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});j_.CompositePropagator=void 0;var yw=(b(),O(v)),OA=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){yw.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,n,r){return this._propagators.reduce((o,s)=>{try{return s.extract(o,n,r)}catch(i){yw.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};j_.CompositePropagator=OA});var Ow=E(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.validateValue=nc.validateKey=void 0;var NA="[_0-9a-z-*/]",Rre=`[a-z]${NA}{0,255}`,yre=`[a-z0-9]${NA}{0,240}@[a-z]${NA}{0,13}`,Ire=new RegExp(`^(?:${Rre}|${yre})$`),Ore=/^[ -~]{0,255}[!-~]$/,Nre=/,|=/;function bre(t){return Ire.test(t)}nc.validateKey=bre;function Cre(t){return Ore.test(t)&&!Nre.test(t)}nc.validateValue=Cre});var CA=E(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.TraceState=void 0;var Nw=Ow(),bw=32,Pre=512,Cw=",",Pw="=",bA=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+Pw+this.get(n)),e),[]).join(Cw)}_parse(e){e.length>Pre||(this._internalState=e.split(Cw).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(Pw);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Nw.validateKey)(i)&&(0,Nw.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>bw&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,bw))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};H_.TraceState=bA});var xw=E(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.W3CTraceContextPropagator=Wt.parseTraceParent=Wt.TRACE_STATE_HEADER=Wt.TRACE_PARENT_HEADER=void 0;var F_=(b(),O(v)),Mre=bl(),xre=CA();Wt.TRACE_PARENT_HEADER="traceparent";Wt.TRACE_STATE_HEADER="tracestate";var vre="00",Lre="(?!ff)[\\da-f]{2}",Dre="(?![0]{32})[\\da-f]{32}",Ure="(?![0]{16})[\\da-f]{16}",wre="[\\da-f]{2}",kre=new RegExp(`^\\s?(${Lre})-(${Dre})-(${Ure})-(${wre})(-.*)?\\s?$`);function Mw(t){let e=kre.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Wt.parseTraceParent=Mw;var PA=class{inject(e,n,r){let o=F_.trace.getSpanContext(e);if(!o||(0,Mre.isTracingSuppressed)(e)||!(0,F_.isSpanContextValid)(o))return;let s=`${vre}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||F_.TraceFlags.NONE).toString(16)}`;r.set(n,Wt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,Wt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,Wt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Mw(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,Wt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new xre.TraceState(typeof c=="string"?c:void 0)}return F_.trace.setSpanContext(e,i)}fields(){return[Wt.TRACE_PARENT_HEADER,Wt.TRACE_STATE_HEADER]}};Wt.W3CTraceContextPropagator=PA});var vw=E(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.getRPCMetadata=Rr.deleteRPCMetadata=Rr.setRPCMetadata=Rr.RPCType=void 0;var Gre=(b(),O(v)),MA=(0,Gre.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Bre;(function(t){t.HTTP="http"})(Bre=Rr.RPCType||(Rr.RPCType={}));function jre(t,e){return t.setValue(MA,e)}Rr.setRPCMetadata=jre;function Hre(t){return t.deleteValue(MA)}Rr.deleteRPCMetadata=Hre;function Fre(t){return t.getValue(MA)}Rr.getRPCMetadata=Fre});var kw=E(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0});V_.isPlainObject=void 0;var Vre="[object Object]",qre="[object Null]",$re="[object Undefined]",Yre=Function.prototype,Lw=Yre.toString,Wre=Lw.call(Object),zre=Object.getPrototypeOf,Dw=Object.prototype,Uw=Dw.hasOwnProperty,Di=Symbol?Symbol.toStringTag:void 0,ww=Dw.toString;function Kre(t){if(!Qre(t)||Xre(t)!==Vre)return!1;let e=zre(t);if(e===null)return!0;let n=Uw.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Lw.call(n)===Wre}V_.isPlainObject=Kre;function Qre(t){return t!=null&&typeof t=="object"}function Xre(t){return t==null?t===void 0?$re:qre:Di&&Di in Object(t)?Jre(t):Zre(t)}function Jre(t){let e=Uw.call(t,Di),n=t[Di],r=!1;try{t[Di]=void 0,r=!0}catch{}let o=ww.call(t);return r&&(e?t[Di]=n:delete t[Di]),o}function Zre(t){return ww.call(t)}});var Fw=E(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.merge=void 0;var Gw=kw(),eoe=20;function toe(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=jw(e,t.shift(),0,n);return e}Y_.merge=toe;function xA(t){return $_(t)?t.slice():t}function jw(t,e,n=0,r){let o;if(!(n>eoe)){if(n++,q_(t)||q_(e)||Hw(e))o=xA(e);else if($_(t)){if(o=t.slice(),$_(e))for(let s=0,i=e.length;s<i;s++)o.push(xA(e[s]));else if(xl(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=xA(e[c])}}}else if(xl(t))if(xl(e)){if(!noe(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i],l=e[c];if(q_(l))typeof l>"u"?delete o[c]:o[c]=l;else{let p=o[c],d=l;if(Bw(t,c,r)||Bw(e,c,r))delete o[c];else{if(xl(p)&&xl(d)){let _=r.get(p)||[],f=r.get(d)||[];_.push({obj:t,key:c}),f.push({obj:e,key:c}),r.set(p,_),r.set(d,f)}o[c]=jw(o[c],l,n,r)}}}}else o=e;return o}}function Bw(t,e,n){let r=n.get(t[e])||[];for(let o=0,s=r.length;o<s;o++){let i=r[o];if(i.key===e&&i.obj===t)return!0}return!1}function $_(t){return Array.isArray(t)}function Hw(t){return typeof t=="function"}function xl(t){return!q_(t)&&!$_(t)&&!Hw(t)&&typeof t=="object"}function q_(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function noe(t,e){return!(!(0,Gw.isPlainObject)(t)||!(0,Gw.isPlainObject)(e))}});var Vw=E(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.callWithTimeout=rc.TimeoutError=void 0;var W_=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};rc.TimeoutError=W_;function roe(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new W_("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}rc.callWithTimeout=roe});var $w=E(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.isUrlIgnored=oc.urlMatches=void 0;function qw(t,e){return typeof e=="string"?t===e:!!t.match(e)}oc.urlMatches=qw;function ooe(t,e){if(!e)return!1;for(let n of e)if(qw(t,n))return!0;return!1}oc.isUrlIgnored=ooe});var Yw=E(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.Deferred=void 0;var vA=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};z_.Deferred=vA});var Ww=E(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.BindOnceFuture=void 0;var soe=Yw(),LA=class{_isCalled=!1;_deferred=new soe.Deferred;_callback;_that;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}};K_.BindOnceFuture=LA});var Kw=E(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});Q_.diagLogLevelFromString=void 0;var Po=(b(),O(v)),zw={ALL:Po.DiagLogLevel.ALL,VERBOSE:Po.DiagLogLevel.VERBOSE,DEBUG:Po.DiagLogLevel.DEBUG,INFO:Po.DiagLogLevel.INFO,WARN:Po.DiagLogLevel.WARN,ERROR:Po.DiagLogLevel.ERROR,NONE:Po.DiagLogLevel.NONE};function ioe(t){if(t==null)return;let e=zw[t.toUpperCase()];return e??(Po.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(zw)}, using default`),Po.DiagLogLevel.INFO)}Q_.diagLogLevelFromString=ioe});var Xw=E(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});X_._export=void 0;var Qw=(b(),O(v)),aoe=bl();function coe(t,e){return new Promise(n=>{Qw.context.with((0,aoe.suppressTracing)(Qw.context.active()),()=>{t.export(e,n)})})}X_._export=coe});var Te=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.internal=y.diagLogLevelFromString=y.BindOnceFuture=y.urlMatches=y.isUrlIgnored=y.callWithTimeout=y.TimeoutError=y.merge=y.TraceState=y.unsuppressTracing=y.suppressTracing=y.isTracingSuppressed=y.setRPCMetadata=y.getRPCMetadata=y.deleteRPCMetadata=y.RPCType=y.parseTraceParent=y.W3CTraceContextPropagator=y.TRACE_STATE_HEADER=y.TRACE_PARENT_HEADER=y.CompositePropagator=y.otperformance=y.getStringListFromEnv=y.getNumberFromEnv=y.getBooleanFromEnv=y.getStringFromEnv=y._globalThis=y.SDK_INFO=y.parseKeyPairsIntoRecord=y.ExportResultCode=y.unrefTimer=y.timeInputToHrTime=y.millisToHrTime=y.isTimeInputHrTime=y.isTimeInput=y.hrTimeToTimeStamp=y.hrTimeToNanoseconds=y.hrTimeToMilliseconds=y.hrTimeToMicroseconds=y.hrTimeDuration=y.hrTime=y.getTimeOrigin=y.addHrTimes=y.loggingErrorHandler=y.setGlobalErrorHandler=y.globalErrorHandler=y.sanitizeAttributes=y.isAttributeValue=y.AnchoredClock=y.W3CBaggagePropagator=void 0;var uoe=LP();Object.defineProperty(y,"W3CBaggagePropagator",{enumerable:!0,get:function(){return uoe.W3CBaggagePropagator}});var loe=DP();Object.defineProperty(y,"AnchoredClock",{enumerable:!0,get:function(){return loe.AnchoredClock}});var Jw=BP();Object.defineProperty(y,"isAttributeValue",{enumerable:!0,get:function(){return Jw.isAttributeValue}});Object.defineProperty(y,"sanitizeAttributes",{enumerable:!0,get:function(){return Jw.sanitizeAttributes}});var Zw=HP();Object.defineProperty(y,"globalErrorHandler",{enumerable:!0,get:function(){return Zw.globalErrorHandler}});Object.defineProperty(y,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Zw.setGlobalErrorHandler}});var poe=Wg();Object.defineProperty(y,"loggingErrorHandler",{enumerable:!0,get:function(){return poe.loggingErrorHandler}});var Qn=gw();Object.defineProperty(y,"addHrTimes",{enumerable:!0,get:function(){return Qn.addHrTimes}});Object.defineProperty(y,"getTimeOrigin",{enumerable:!0,get:function(){return Qn.getTimeOrigin}});Object.defineProperty(y,"hrTime",{enumerable:!0,get:function(){return Qn.hrTime}});Object.defineProperty(y,"hrTimeDuration",{enumerable:!0,get:function(){return Qn.hrTimeDuration}});Object.defineProperty(y,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMicroseconds}});Object.defineProperty(y,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMilliseconds}});Object.defineProperty(y,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Qn.hrTimeToNanoseconds}});Object.defineProperty(y,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Qn.hrTimeToTimeStamp}});Object.defineProperty(y,"isTimeInput",{enumerable:!0,get:function(){return Qn.isTimeInput}});Object.defineProperty(y,"isTimeInputHrTime",{enumerable:!0,get:function(){return Qn.isTimeInputHrTime}});Object.defineProperty(y,"millisToHrTime",{enumerable:!0,get:function(){return Qn.millisToHrTime}});Object.defineProperty(y,"timeInputToHrTime",{enumerable:!0,get:function(){return Qn.timeInputToHrTime}});var doe=Aw();Object.defineProperty(y,"unrefTimer",{enumerable:!0,get:function(){return doe.unrefTimer}});var _oe=Rw();Object.defineProperty(y,"ExportResultCode",{enumerable:!0,get:function(){return _oe.ExportResultCode}});var foe=Fg();Object.defineProperty(y,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return foe.parseKeyPairsIntoRecord}});var Ui=yA();Object.defineProperty(y,"SDK_INFO",{enumerable:!0,get:function(){return Ui.SDK_INFO}});Object.defineProperty(y,"_globalThis",{enumerable:!0,get:function(){return Ui._globalThis}});Object.defineProperty(y,"getStringFromEnv",{enumerable:!0,get:function(){return Ui.getStringFromEnv}});Object.defineProperty(y,"getBooleanFromEnv",{enumerable:!0,get:function(){return Ui.getBooleanFromEnv}});Object.defineProperty(y,"getNumberFromEnv",{enumerable:!0,get:function(){return Ui.getNumberFromEnv}});Object.defineProperty(y,"getStringListFromEnv",{enumerable:!0,get:function(){return Ui.getStringListFromEnv}});Object.defineProperty(y,"otperformance",{enumerable:!0,get:function(){return Ui.otperformance}});var moe=Iw();Object.defineProperty(y,"CompositePropagator",{enumerable:!0,get:function(){return moe.CompositePropagator}});var J_=xw();Object.defineProperty(y,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return J_.TRACE_PARENT_HEADER}});Object.defineProperty(y,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return J_.TRACE_STATE_HEADER}});Object.defineProperty(y,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return J_.W3CTraceContextPropagator}});Object.defineProperty(y,"parseTraceParent",{enumerable:!0,get:function(){return J_.parseTraceParent}});var Z_=vw();Object.defineProperty(y,"RPCType",{enumerable:!0,get:function(){return Z_.RPCType}});Object.defineProperty(y,"deleteRPCMetadata",{enumerable:!0,get:function(){return Z_.deleteRPCMetadata}});Object.defineProperty(y,"getRPCMetadata",{enumerable:!0,get:function(){return Z_.getRPCMetadata}});Object.defineProperty(y,"setRPCMetadata",{enumerable:!0,get:function(){return Z_.setRPCMetadata}});var DA=bl();Object.defineProperty(y,"isTracingSuppressed",{enumerable:!0,get:function(){return DA.isTracingSuppressed}});Object.defineProperty(y,"suppressTracing",{enumerable:!0,get:function(){return DA.suppressTracing}});Object.defineProperty(y,"unsuppressTracing",{enumerable:!0,get:function(){return DA.unsuppressTracing}});var hoe=CA();Object.defineProperty(y,"TraceState",{enumerable:!0,get:function(){return hoe.TraceState}});var Toe=Fw();Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return Toe.merge}});var ek=Vw();Object.defineProperty(y,"TimeoutError",{enumerable:!0,get:function(){return ek.TimeoutError}});Object.defineProperty(y,"callWithTimeout",{enumerable:!0,get:function(){return ek.callWithTimeout}});var tk=$w();Object.defineProperty(y,"isUrlIgnored",{enumerable:!0,get:function(){return tk.isUrlIgnored}});Object.defineProperty(y,"urlMatches",{enumerable:!0,get:function(){return tk.urlMatches}});var Eoe=Ww();Object.defineProperty(y,"BindOnceFuture",{enumerable:!0,get:function(){return Eoe.BindOnceFuture}});var Soe=Kw();Object.defineProperty(y,"diagLogLevelFromString",{enumerable:!0,get:function(){return Soe.diagLogLevelFromString}});var goe=Xw();y.internal={_export:goe._export}});var nk=E(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.VERSION=void 0;ef.VERSION="0.214.0"});var rk=E(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.SeverityNumber=void 0;var Aoe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Aoe=vl.SeverityNumber||(vl.SeverityNumber={}))});var nf=E(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.NOOP_LOGGER=sc.NoopLogger=void 0;var tf=class{emit(e){}};sc.NoopLogger=tf;sc.NOOP_LOGGER=new tf});var ok=E(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.API_BACKWARDS_COMPATIBILITY_VERSION=Yr.makeGetter=Yr._global=Yr.GLOBAL_LOGS_API_KEY=void 0;Yr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Yr._global=globalThis;function Roe(t,e,n){return r=>r===t?e:n}Yr.makeGetter=Roe;Yr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var UA=E(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.NOOP_LOGGER_PROVIDER=ic.NoopLoggerProvider=void 0;var yoe=nf(),rf=class{getLogger(e,n,r){return new yoe.NoopLogger}};ic.NoopLoggerProvider=rf;ic.NOOP_LOGGER_PROVIDER=new rf});var sk=E(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.ProxyLogger=void 0;var Ioe=nf(),wA=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ioe.NOOP_LOGGER}};of.ProxyLogger=wA});var ik=E(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ProxyLoggerProvider=void 0;var Ooe=UA(),Noe=sk(),kA=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Noe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Ooe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};sf.ProxyLoggerProvider=kA});var ck=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.LogsAPI=void 0;var Xn=ok(),boe=UA(),ak=ik(),GA=class t{constructor(){this._proxyLoggerProvider=new ak.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Xn._global[Xn.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Xn._global[Xn.GLOBAL_LOGS_API_KEY]=(0,Xn.makeGetter)(Xn.API_BACKWARDS_COMPATIBILITY_VERSION,e,boe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Xn._global[Xn.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Xn._global,Xn.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Xn._global[Xn.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new ak.ProxyLoggerProvider}};af.LogsAPI=GA});var BA=E(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.logs=Wr.NoopLogger=Wr.NOOP_LOGGER=Wr.SeverityNumber=void 0;var Coe=rk();Object.defineProperty(Wr,"SeverityNumber",{enumerable:!0,get:function(){return Coe.SeverityNumber}});var uk=nf();Object.defineProperty(Wr,"NOOP_LOGGER",{enumerable:!0,get:function(){return uk.NOOP_LOGGER}});Object.defineProperty(Wr,"NoopLogger",{enumerable:!0,get:function(){return uk.NoopLogger}});var Poe=ck();Wr.logs=Poe.LogsAPI.getInstance()});var lk=E(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.disableInstrumentations=ac.enableInstrumentations=void 0;function Moe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}ac.enableInstrumentations=Moe;function xoe(t){t.forEach(e=>e.disable())}ac.disableInstrumentations=xoe});var _k=E(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.registerInstrumentations=void 0;var pk=(b(),O(v)),voe=BA(),dk=lk();function Loe(t){let e=t.tracerProvider||pk.trace.getTracerProvider(),n=t.meterProvider||pk.metrics.getMeterProvider(),r=t.loggerProvider||voe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,dk.enableInstrumentations)(o,e,n,r),()=>{(0,dk.disableInstrumentations)(o)}}cf.registerInstrumentations=Loe});var Rk=E(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.satisfies=void 0;var VA=(b(),O(v)),Ek=/^(?: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-]+)*))?$/,Doe=/^(?<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-]+)*))?$/,Uoe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function woe(t,e,n){if(!koe(t))return VA.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Hoe(t);if(!r)return!1;let o=[],s=Sk(r,e,o,n);return s&&!n?.includePrerelease?Boe(r,o):s}uf.satisfies=woe;function koe(t){return typeof t=="string"&&Ek.test(t)}function Sk(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(jA(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=cse(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!jA(t,s,n,r))return!1;return!0}return jA(t,e,n,r)}function jA(t,e,n,r){if(e=joe(e,r),e.includes(" "))return Sk(t,e,n,r);{let o=Foe(e);return n.push(o),Goe(t,o)}}function Goe(t,e){if(e.invalid)return!1;if(!e.version||FA(e.version))return!0;let n=mk(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=mk(r,o)}return Uoe[e.op]?.includes(n)}function Boe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function joe(t,e){return t=t.trim(),t=ise(t,e),t=sse(t),t=ase(t,e),t=t.trim(),t}function sn(t){return!t||t.toLowerCase()==="x"||t==="*"}function Hoe(t){let e=t.match(Ek);if(!e){VA.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function Foe(t){if(!t)return{};let e=t.match(Doe);if(!e)return VA.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function FA(t){return t==="*"||t==="x"||t==="X"}function fk(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Voe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function qoe(t,e){if(FA(t)||FA(e))return 0;let[n,r]=Voe(fk(t),fk(e));return n>r?1:n<r?-1:0}function mk(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=qoe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var gk="[a-zA-Z0-9-]",Ak="0|[1-9]\\d*",$oe=`\\d*[a-zA-Z-]${gk}*`,Yoe="((?:<|>)?=?)",hk=`(?:${Ak}|${$oe})`,Woe=`(?:-(${hk}(?:\\.${hk})*))`,Tk=`${gk}+`,zoe=`(?:\\+(${Tk}(?:\\.${Tk})*))`,HA=`${Ak}|x|X|\\*`,Ll=`[v=\\s]*(${HA})(?:\\.(${HA})(?:\\.(${HA})(?:${Woe})?${zoe}?)?)?`,Koe=`^${Yoe}\\s*${Ll}$`,Qoe=new RegExp(Koe),Xoe=`^\\s*(${Ll})\\s+-\\s+(${Ll})\\s*$`,Joe=new RegExp(Xoe),Zoe="(?:~>?)",ese=`^${Zoe}${Ll}$`,tse=new RegExp(ese),nse="(?:\\^)",rse=`^${nse}${Ll}$`,ose=new RegExp(rse);function sse(t){let e=tse;return t.replace(e,(n,r,o,s,i)=>{let a;return sn(r)?a="":sn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:sn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function ise(t,e){let n=ose,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return sn(s)?l="":sn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:sn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function ase(t,e){let n=Qoe;return t.replace(n,(r,o,s,i,a,c)=>{let l=sn(s),p=l||sn(i),d=p||sn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function cse(t,e){let n=Joe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(sn(s)?o="":sn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:sn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,sn(d)?p="":sn(_)?p=`<${+d+1}.0.0-0`:sn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var qA=E(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.massUnwrap=vt.unwrap=vt.massWrap=vt.wrap=void 0;var an=console.error.bind(console);function Dl(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var use=(t,e,n)=>{if(!t||!t[e]){an("no original function "+String(e)+" to wrap");return}if(!n){an("no wrapper function"),an(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){an("original object and wrapper must be functions");return}let o=n(r,e);return Dl(o,"__original",r),Dl(o,"__unwrap",()=>{t[e]===o&&Dl(t,e,r)}),Dl(o,"__wrapped",!0),Dl(t,e,o),o};vt.wrap=use;var lse=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,vt.wrap)(r,o,n)})})};vt.massWrap=lse;var pse=(t,e)=>{if(!t||!t[e]){an("no function to unwrap."),an(new Error().stack);return}let n=t[e];if(!n.__unwrap)an("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};vt.unwrap=pse;var dse=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,vt.unwrap)(n,r)})})};vt.massUnwrap=dse;function Ul(t){t&&t.logger&&(typeof t.logger!="function"?an("new logger isn't a function, not replacing"):an=t.logger)}vt.default=Ul;Ul.wrap=vt.wrap;Ul.massWrap=vt.massWrap;Ul.unwrap=vt.unwrap;Ul.massUnwrap=vt.massUnwrap});var yk=E(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.InstrumentationAbstract=void 0;var $A=(b(),O(v)),_se=BA(),lf=qA(),YA=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=$A.diag.createComponentLogger({namespace:e}),this._tracer=$A.trace.getTracer(e,n),this._meter=$A.metrics.getMeter(e,n),this._logger=_se.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=lf.wrap;_unwrap=lf.unwrap;_massWrap=lf.massWrap;_massUnwrap=lf.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};pf.InstrumentationAbstract=YA});var Ok=E(($0e,Ik)=>{var cc=1e3,uc=cc*60,lc=uc*60,wi=lc*24,fse=wi*7,mse=wi*365.25;Ik.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return hse(t);if(n==="number"&&isFinite(t))return e.long?Ese(t):Tse(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function hse(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*mse;case"weeks":case"week":case"w":return n*fse;case"days":case"day":case"d":return n*wi;case"hours":case"hour":case"hrs":case"hr":case"h":return n*lc;case"minutes":case"minute":case"mins":case"min":case"m":return n*uc;case"seconds":case"second":case"secs":case"sec":case"s":return n*cc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Tse(t){var e=Math.abs(t);return e>=wi?Math.round(t/wi)+"d":e>=lc?Math.round(t/lc)+"h":e>=uc?Math.round(t/uc)+"m":e>=cc?Math.round(t/cc)+"s":t+"ms"}function Ese(t){var e=Math.abs(t);return e>=wi?df(t,e,wi,"day"):e>=lc?df(t,e,lc,"hour"):e>=uc?df(t,e,uc,"minute"):e>=cc?df(t,e,cc,"second"):t+" ms"}function df(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var WA=E((Y0e,Nk)=>{function Sse(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ok(),n.destroy=l,Object.keys(t).forEach(p=>{n[p]=t[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let d=0;for(let _=0;_<p.length;_++)d=(d<<5)-d+p.charCodeAt(_),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(p){let d,_=null,f,m;function h(...T){if(!h.enabled)return;let S=h,R=Number(new Date),I=R-(d||R);S.diff=I,S.prev=d,S.curr=R,d=R,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let x=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(B,se)=>{if(B==="%%")return"%";x++;let ve=n.formatters[se];if(typeof ve=="function"){let on=T[x];B=ve.call(S,on),T.splice(x,1),x--}return B}),n.formatArgs.call(S,T),(S.log||n.log).apply(S,T)}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:()=>_!==null?_:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(p)),m),set:T=>{_=T}}),typeof n.init=="function"&&n.init(h),h}function r(p,d){let _=n(this.namespace+(typeof d>"u"?":":d)+p);return _.log=this.log,_}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let d=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of d)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function s(p,d){let _=0,f=0,m=-1,h=0;for(;_<p.length;)if(f<d.length&&(d[f]===p[_]||d[f]==="*"))d[f]==="*"?(m=f,h=_,f++):(_++,f++);else if(m!==-1)f=m+1,h++,_=h;else return!1;for(;f<d.length&&d[f]==="*";)f++;return f===d.length}function i(){let p=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),p}function a(p){for(let d of n.skips)if(s(p,d))return!1;for(let d of n.names)if(s(p,d))return!0;return!1}function c(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}Nk.exports=Sse});var bk=E((gn,_f)=>{gn.formatArgs=Ase;gn.save=Rse;gn.load=yse;gn.useColors=gse;gn.storage=Ise();gn.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();gn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function gse(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ase(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+_f.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),t.splice(r,0,e)}gn.log=console.debug||console.log||(()=>{});function Rse(t){try{t?gn.storage.setItem("debug",t):gn.storage.removeItem("debug")}catch{}}function yse(){let t;try{t=gn.storage.getItem("debug")||gn.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Ise(){try{return localStorage}catch{}}_f.exports=WA()(gn);var{formatters:Ose}=_f.exports;Ose.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Pk=E((W0e,Ck)=>{"use strict";Ck.exports=(t,e=process.argv)=>{let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}});var vk=E((z0e,xk)=>{"use strict";var Nse=U("os"),Mk=U("tty"),Jn=Pk(),{env:gt}=process,us;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?us=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(us=1);"FORCE_COLOR"in gt&&(gt.FORCE_COLOR==="true"?us=1:gt.FORCE_COLOR==="false"?us=0:us=gt.FORCE_COLOR.length===0?1:Math.min(parseInt(gt.FORCE_COLOR,10),3));function zA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function KA(t,e){if(us===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(t&&!e&&us===void 0)return 0;let n=us||0;if(gt.TERM==="dumb")return n;if(process.platform==="win32"){let r=Nse.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in gt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in gt)||gt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in gt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(gt.TEAMCITY_VERSION)?1:0;if(gt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in gt){let r=parseInt((gt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(gt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(gt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(gt.TERM)||"COLORTERM"in gt?1:n}function bse(t){let e=KA(t,t&&t.isTTY);return zA(e)}xk.exports={supportsColor:bse,stdout:zA(KA(!0,Mk.isatty(1))),stderr:zA(KA(!0,Mk.isatty(2)))}});var Dk=E((At,mf)=>{var Cse=U("tty"),ff=U("util");At.init=Use;At.log=vse;At.formatArgs=Mse;At.save=Lse;At.load=Dse;At.useColors=Pse;At.destroy=ff.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");At.colors=[6,2,3,4,5,1];try{let t=vk();t&&(t.stderr||t).level>=2&&(At.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{}At.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),t[n]=r,t},{});function Pse(){return"colors"in At.inspectOpts?!!At.inspectOpts.colors:Cse.isatty(process.stderr.fd)}function Mse(t){let{namespace:e,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
4
4
|
`).join(`
|
|
5
|
-
`+s),t.push(o+"m+"+
|
|
6
|
-
`)}function
|
|
7
|
-
`).map(e=>e.trim()).join(" ")};Lk.O=function(t){return this.inspectOpts.colors=this.useColors,_f.inspect(t,this.inspectOpts)}});var Uk=E((z0e,QA)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?QA.exports=bk():QA.exports=Dk()});var mf=E((K0e,wk)=>{"use strict";var XA=U("path").sep;wk.exports=function(t){var e=t.split(XA),n=e.lastIndexOf("node_modules");if(n!==-1&&e[n+1]){for(var r=e[n+1][0]==="@",o=r?e[n+1]+"/"+e[n+2]:e[n+1],s=r?3:2,i="",a=n+s-1,c=0;c<=a;c++)c===a?i+=e[c]:i+=e[c]+XA;for(var l="",p=e.length-1,d=n+s;d<=p;d++)d===p?l+=e[d]:l+=e[d]+XA;return{name:o,basedir:i,path:l}}}});var wi=E((Q0e,eR)=>{"use strict";var lc=U("path"),yr=U("module"),ze=Uk()("require-in-the-middle"),Use=mf();eR.exports=Ul;eR.exports.Hook=Ul;var JA,hf;if(yr.isBuiltin)hf=yr.isBuiltin;else if(yr.builtinModules)hf=t=>t.startsWith("node:")?!0:(JA===void 0&&(JA=new Set(yr.builtinModules)),JA.has(t));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var wse=/([/\\]index)?(\.js)?$/,ZA=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let r=U.cache[e];return!!(r&&this._kRitmExports in r)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let o=U.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in U.cache?U.cache[e][this._kRitmExports]=n:(ze('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function Ul(t,e,n){if(!(this instanceof Ul))return new Ul(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof yr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof yr._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 ZA,this._unhooked=!1,this._origRequire=yr.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);ze("registering require hook"),this._require=yr.prototype.require=function(c){return r._unhooked===!0?(ze("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):a.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(c){return r._unhooked===!0?(ze("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,l){let p=c[0],d=hf(p),_;if(d){if(_=p,p.startsWith("node:")){let R=p.slice(5);hf(R)&&(_=R)}}else{if(l)return ze("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{_=yr._resolveFilename(p,this)}catch(R){return ze('Module._resolveFilename("%s") threw %j, calling original Module.require',p,R.message),r._origRequire.apply(this,c)}}let f,m;if(ze("processing %s module require('%s'): %s",d===!0?"core":"non-core",p,_),r._cache.has(_,d)===!0)return ze("returning already patched cached module: %s",_),r._cache.get(_,d);let h=o.has(_);h===!1&&o.add(_);let T=l?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(h===!0)return ze("module is in the process of being patched already - ignoring: %s",_),T;if(o.delete(_),d===!0){if(i===!0&&t.includes(_)===!1)return ze("ignoring core module not on whitelist: %s",_),T;f=_}else if(i===!0&&t.includes(_)){let R=lc.parse(_);f=R.name,m=R.dir}else{let R=Use(_);if(R===void 0)return ze("could not parse filename: %s",_),T;f=R.name,m=R.basedir;let I=kse(R);ze("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",f,p,I,m);let x=!1;if(i){if(!p.startsWith(".")&&t.includes(p)&&(f=p,x=!0),!t.includes(f)&&!t.includes(I))return T;t.includes(I)&&I!==f&&(f=I,x=!0)}if(!x){let F;try{F=U.resolve(f,{paths:[m]})}catch{return ze("could not resolve module: %s",f),r._cache.set(_,T,d),T}if(F!==_)if(s===!0)f=f+lc.sep+lc.relative(m,_),ze("preparing to process require of internal file: %s",f);else return ze("ignoring require of non-main module file: %s",F),r._cache.set(_,T,d),T}}r._cache.set(_,T,d),ze("calling require hook: %s",f);let S=n(T,f,m);return r._cache.set(_,S,d),ze("returning module: %s",f),S}}Ul.prototype.unhook=function(){this._unhooked=!0,this._require===yr.prototype.require?(yr.prototype.require=this._origRequire,ze("require unhook successful")):ze("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ze("process.getBuiltinModule unhook successful")):ze("process.getBuiltinModule unhook unsuccessful"))};function kse(t){let e=lc.sep!=="/"?t.path.split(lc.sep).join("/"):t.path;return lc.posix.join(t.name,e).replace(wse,"")}});var kk=E(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ModuleNameTrie=ls.ModuleNameSeparator=void 0;ls.ModuleNameSeparator="/";var Tf=class{hooks=[];children=new Map},tR=class{_trie=new Tf;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ls.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new Tf,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ls.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ls.ModuleNameTrie=tR});var Bk=E(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.RequireInTheMiddleSingleton=void 0;var Gse=wi(),Gk=U("path"),nR=kk(),Bse=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),rR=class t{_moduleNameTrie=new nR.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new Gse.Hook(null,{internals:!0},(e,n,r)=>{let o=jse(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return Bse?new t:this._instance=this._instance??new t}};Ef.RequireInTheMiddleSingleton=rR;function jse(t){return Gk.sep!==nR.ModuleNameSeparator?t.split(Gk.sep).join(nR.ModuleNameSeparator):t}});var qk=E(wl=>{var jk=[],oR=new WeakMap,Hk=new WeakMap,Fk=new Map,Vk=[],Hse={set(t,e,n){let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Hk.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function Fse(t,e,n,r,o){Fk.set(t,o),oR.set(e,n),Hk.set(e,r);let s=new Proxy(e,Hse);jk.forEach(i=>i(t,s,o)),Vk.push([t,s,o])}wl.register=Fse;wl.importHooks=jk;wl.specifiers=Fk;wl.toHook=Vk});var cR=E((tDe,dc)=>{var $k=U("path"),Vse=mf(),{fileURLToPath:qse}=U("url"),{MessageChannel:$se}=U("worker_threads"),{isBuiltin:sR}=U("module");sR||(sR=()=>!0);var{importHooks:iR,specifiers:Yse,toHook:Wse}=qk();function Yk(t){iR.push(t),Wse.forEach(([e,n,r])=>t(e,n,r))}function Wk(t){let e=iR.indexOf(t);e>-1&&iR.splice(e,1)}function pc(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var aR;function zse(){let{port1:t,port2:e}=new $se,n=0,r;aR=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function kl(t,e,n){if(!(this instanceof kl))return new kl(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;aR&&Array.isArray(t)&&aR(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);sR(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=qse(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=Vse(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)pc(n,s,l,void 0);else if(d===o){if(!p)pc(n,s,o,p);else if(p.endsWith(Yse.get(a)))pc(n,s,o,p);else if(r){let _=o+$k.sep+$k.relative(p,l);pc(n,s,_,p)}}else d===i&&pc(n,s,i,p);else pc(n,s,o,p)},Yk(this._iitmHook)}kl.prototype.unhook=function(){Wk(this._iitmHook)};dc.exports=kl;dc.exports.Hook=kl;dc.exports.addHook=Yk;dc.exports.removeHook=Wk;dc.exports.createAddHookMessageChannel=zse});var uR=E(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.isWrapped=ps.safeExecuteInTheMiddleAsync=ps.safeExecuteInTheMiddle=void 0;function Kse(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddle=Kse;async function Qse(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddleAsync=Qse;function Xse(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ps.isWrapped=Xse});var Qk=E(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.InstrumentationBase=void 0;var Gl=U("path"),zk=U("util"),Jse=Rk(),lR=qA(),Zse=yk(),eie=Bk(),tie=cR(),Bl=(b(),O(v)),nie=wi(),rie=U("fs"),oie=uR(),pR=class extends Zse.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=eie.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,oie.isWrapped)(e[n])&&this._unwrap(e,n),zk.types.isProxy(e)){let o=(0,lR.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,lR.wrap)(e,n,r)};_unwrap=(e,n)=>zk.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,lR.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Bl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Bl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Bl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Bl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=e.resolve(r);e.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,rie.readFileSync)(Gl.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Bl.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return Kk(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Gl.normalize(r);return i.filter(l=>l.name===a&&Kk(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Gl.isAbsolute(a)){let l=Gl.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Gl.isAbsolute(e.name)?new nie.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new tie.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};Sf.InstrumentationBase=pR;function Kk(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,Jse.satisfies)(e,r,{includePrerelease:n}))}});var Xk=E(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.normalize=void 0;var sie=U("path");Object.defineProperty(gf,"normalize",{enumerable:!0,get:function(){return sie.normalize}})});var Jk=E(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.normalize=_c.InstrumentationBase=void 0;var iie=Qk();Object.defineProperty(_c,"InstrumentationBase",{enumerable:!0,get:function(){return iie.InstrumentationBase}});var aie=Xk();Object.defineProperty(_c,"normalize",{enumerable:!0,get:function(){return aie.normalize}})});var dR=E(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.normalize=fc.InstrumentationBase=void 0;var Zk=Jk();Object.defineProperty(fc,"InstrumentationBase",{enumerable:!0,get:function(){return Zk.InstrumentationBase}});Object.defineProperty(fc,"normalize",{enumerable:!0,get:function(){return Zk.normalize}})});var eG=E(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.InstrumentationNodeModuleDefinition=void 0;var _R=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};Af.InstrumentationNodeModuleDefinition=_R});var tG=E(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InstrumentationNodeModuleFile=void 0;var cie=dR(),fR=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,cie.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};Rf.InstrumentationNodeModuleFile=fR});var nG=E(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.semconvStabilityFromStr=ki.SemconvStability=void 0;var yf;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(yf=ki.SemconvStability||(ki.SemconvStability={}));function uie(t,e){let n=yf.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=yf.DUPLICATE;break}else o.toLowerCase()===t&&(n=yf.STABLE);return n}ki.semconvStabilityFromStr=uie});var ne=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.semconvStabilityFromStr=tt.SemconvStability=tt.safeExecuteInTheMiddleAsync=tt.safeExecuteInTheMiddle=tt.isWrapped=tt.InstrumentationNodeModuleFile=tt.InstrumentationNodeModuleDefinition=tt.InstrumentationBase=tt.registerInstrumentations=void 0;var lie=_k();Object.defineProperty(tt,"registerInstrumentations",{enumerable:!0,get:function(){return lie.registerInstrumentations}});var pie=dR();Object.defineProperty(tt,"InstrumentationBase",{enumerable:!0,get:function(){return pie.InstrumentationBase}});var die=eG();Object.defineProperty(tt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return die.InstrumentationNodeModuleDefinition}});var _ie=tG();Object.defineProperty(tt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return _ie.InstrumentationNodeModuleFile}});var mR=uR();Object.defineProperty(tt,"isWrapped",{enumerable:!0,get:function(){return mR.isWrapped}});Object.defineProperty(tt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddle}});Object.defineProperty(tt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddleAsync}});var rG=nG();Object.defineProperty(tt,"SemconvStability",{enumerable:!0,get:function(){return rG.SemconvStability}});Object.defineProperty(tt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return rG.semconvStabilityFromStr}})});var oG=E(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.HTTP_FLAVOR_VALUE_HTTP_1_1=q.NET_TRANSPORT_VALUE_IP_UDP=q.NET_TRANSPORT_VALUE_IP_TCP=q.ATTR_NET_TRANSPORT=q.ATTR_NET_PEER_PORT=q.ATTR_NET_PEER_NAME=q.ATTR_NET_PEER_IP=q.ATTR_NET_HOST_PORT=q.ATTR_NET_HOST_NAME=q.ATTR_NET_HOST_IP=q.ATTR_HTTP_USER_AGENT=q.ATTR_HTTP_URL=q.ATTR_HTTP_TARGET=q.ATTR_HTTP_STATUS_CODE=q.ATTR_HTTP_SERVER_NAME=q.ATTR_HTTP_SCHEME=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH=q.ATTR_HTTP_METHOD=q.ATTR_HTTP_HOST=q.ATTR_HTTP_FLAVOR=q.ATTR_HTTP_CLIENT_IP=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=q.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0;q.ATTR_USER_AGENT_SYNTHETIC_TYPE="user_agent.synthetic.type";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT="bot";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST="test";q.ATTR_HTTP_CLIENT_IP="http.client_ip";q.ATTR_HTTP_FLAVOR="http.flavor";q.ATTR_HTTP_HOST="http.host";q.ATTR_HTTP_METHOD="http.method";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH="http.request_content_length";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED="http.response_content_length_uncompressed";q.ATTR_HTTP_SCHEME="http.scheme";q.ATTR_HTTP_SERVER_NAME="http.server_name";q.ATTR_HTTP_STATUS_CODE="http.status_code";q.ATTR_HTTP_TARGET="http.target";q.ATTR_HTTP_URL="http.url";q.ATTR_HTTP_USER_AGENT="http.user_agent";q.ATTR_NET_HOST_IP="net.host.ip";q.ATTR_NET_HOST_NAME="net.host.name";q.ATTR_NET_HOST_PORT="net.host.port";q.ATTR_NET_PEER_IP="net.peer.ip";q.ATTR_NET_PEER_NAME="net.peer.name";q.ATTR_NET_PEER_PORT="net.peer.port";q.ATTR_NET_TRANSPORT="net.transport";q.NET_TRANSPORT_VALUE_IP_TCP="ip_tcp";q.NET_TRANSPORT_VALUE_IP_UDP="ip_udp";q.HTTP_FLAVOR_VALUE_HTTP_1_1="1.1"});var sG=E(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.AttributeNames=void 0;var fie;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(fie=jl.AttributeNames||(jl.AttributeNames={}))});var hR=E(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.DEFAULT_QUERY_STRINGS_TO_REDACT=zr.STR_REDACTED=zr.SYNTHETIC_BOT_NAMES=zr.SYNTHETIC_TEST_NAMES=void 0;zr.SYNTHETIC_TEST_NAMES=["alwayson"];zr.SYNTHETIC_BOT_NAMES=["googlebot","bingbot"];zr.STR_REDACTED="REDACTED";zr.DEFAULT_QUERY_STRINGS_TO_REDACT=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"]});var aG=E((fDe,iG)=>{"use strict";var mie=U("util");function TR(t,e){Error.captureStackTrace(this,TR),this.name=this.constructor.name,this.message=t,this.input=e}mie.inherits(TR,Error);iG.exports=TR});var uG=E((mDe,cG)=>{"use strict";function hie(t){return t===34||t===40||t===41||t===44||t===47||t>=58&&t<=64||t>=91&&t<=93||t===123||t===125}function Tie(t){return t===33||t>=35&&t<=39||t===42||t===43||t===45||t===46||t>=48&&t<=57||t>=65&&t<=90||t>=94&&t<=122||t===124||t===126}function Eie(t){return t>=32&&t<=126}function Sie(t){return t>=128&&t<=255}cG.exports={isDelimiter:hie,isTokenChar:Tie,isExtended:Sie,isPrint:Eie}});var fG=E((hDe,_G)=>{"use strict";var gie=U("util"),mc=aG(),If=uG(),Aie=If.isDelimiter,lG=If.isTokenChar,pG=If.isExtended,Rie=If.isPrint;function dG(t){return t.replace(/\\(.)/g,"$1")}function Hl(t,e){return gie.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function yie(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,l,p=0;p<t.length;p++)if(l=t.charCodeAt(p),c===void 0){if(p!==0&&i===-1&&(l===32||l===9))continue;if(lG(l))i===-1&&(i=p);else if(l===61&&i!==-1)c=t.slice(i,p).toLowerCase(),i=-1;else throw new mc(Hl(t,p),t)}else if(n&&(l===9||Rie(l)||pG(l)))n=!1;else if(lG(l)){if(a!==-1)throw new mc(Hl(t,p),t);i===-1&&(i=p)}else if(Aie(l)||pG(l))if(r)l===34?(r=!1,a=p):l===92?(i===-1&&(i=p),n=e=!0):i===-1&&(i=p);else if(l===34&&t.charCodeAt(p-1)===61)r=!0;else if((l===44||l===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",l===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new mc(Hl(t,p),t);else if(l===32||l===9){if(a!==-1)continue;if(r)i===-1&&(i=p);else if(i!==-1)a=p;else throw new mc(Hl(t,p),t)}else throw new mc(Hl(t,p),t);if(c===void 0||r||i===-1&&a===-1||l===32||l===9)throw new mc("Unexpected end of input",t);return i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}_G.exports=yie});var yG=E($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.headerCapture=$.getIncomingStableRequestMetricAttributesOnResponse=$.getIncomingRequestMetricAttributesOnResponse=$.getIncomingRequestAttributesOnResponse=$.getIncomingRequestMetricAttributes=$.getIncomingRequestAttributes=$.getRemoteClientAddress=$.getOutgoingStableRequestMetricAttributesOnResponse=$.getOutgoingRequestMetricAttributesOnResponse=$.getOutgoingRequestAttributesOnResponse=$.setAttributesFromHttpKind=$.getOutgoingRequestMetricAttributes=$.getOutgoingRequestAttributes=$.extractHostnameAndPort=$.isValidOptionsType=$.getRequestInfo=$.isCompressed=$.setResponseContentLengthAttribute=$.setRequestContentLengthAttribute=$.setSpanWithError=$.satisfiesPattern=$.parseResponseStatus=$.getAbsoluteUrl=void 0;var Fl=(b(),O(v)),ae=(le(),O(Ae)),V=oG(),mG=Te(),kn=ne(),Iie=U("url"),Nf=sG(),hG=hR(),Of=hR(),Oie=fG(),Nie=(t,e,n="http:",r=Array.from(Of.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let o=t||{},s=o.protocol||n,i=(o.port||"").toString(),a=o.path||"/",c=o.host||o.hostname||e.host||"localhost";if(c.indexOf(":")===-1&&i&&i!=="80"&&i!=="443"&&(c+=`:${i}`),a.includes("?"))try{let p=new URL(a,"http://localhost"),d=r||[];for(let _ of d)p.searchParams.get(_)&&p.searchParams.set(_,Of.STR_REDACTED);a=`${p.pathname}${p.search}`}catch{}let l=o.auth?`${Of.STR_REDACTED}:${Of.STR_REDACTED}@`:"";return`${s}//${l}${c}${a}`};$.getAbsoluteUrl=Nie;var bie=(t,e)=>{let n=t===Fl.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?Fl.SpanStatusCode.UNSET:Fl.SpanStatusCode.ERROR};$.parseResponseStatus=bie;var Cie=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")};$.satisfiesPattern=Cie;var Pie=(t,e,n)=>{let r=e.message;n&kn.SemconvStability.OLD&&(t.setAttribute(Nf.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(Nf.AttributeNames.HTTP_ERROR_MESSAGE,r)),n&kn.SemconvStability.STABLE&&t.setAttribute(ae.ATTR_ERROR_TYPE,e.name),t.setStatus({code:Fl.SpanStatusCode.ERROR,message:r}),t.recordException(e)};$.setSpanWithError=Pie;var Mie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setRequestContentLengthAttribute=Mie;var xie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setResponseContentLengthAttribute=xie;function EG(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var vie=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};$.isCompressed=vie;function Lie(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:l,origin:p,host:d}=new URL(t),_={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:l,origin:p,host:d};return r!==""&&(_.port=Number(r)),(o||s)&&(_.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),_}var Die=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=Lie(e);s=c,r=c.pathname||"/"}catch(c){i=!0,t.verbose("Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:",c),s={path:e},r=s.path||"/"}o=`${s.protocol||"http:"}//${s.host}`,n!==void 0&&Object.assign(s,n)}else if(e instanceof Iie.URL)s={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,path:`${e.pathname||""}${e.search||""}`},e.port!==""&&(s.port=Number(e.port)),(e.username||e.password)&&(s.auth=`${e.username}:${e.password}`),r=e.pathname,o=e.origin,n!==void 0&&Object.assign(s,n);else{s=Object.assign({protocol:e.host?"http:":void 0},e);let c=s.host||(s.port!=null?`${s.hostname}${s.port}`:s.hostname);if(o=`${s.protocol||"http:"}//${c}`,r=e.pathname,!r&&s.path)try{r=new URL(s.path,o).pathname||"/"}catch{r="/"}}let a=s.method?s.method.toUpperCase():"GET";return{origin:o,pathname:r,method:a,optionsParsed:s,invalidUrl:i}};$.getRequestInfo=Die;var Uie=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};$.isValidOptionsType=Uie;var wie=t=>{if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let e=t.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=t.hostname||(e===null?"localhost":e[1]),r=t.port;return r||(e&&e[2]?r=e[2].substring(1):r=t.protocol==="https:"?"443":"80"),{hostname:n,port:r}};$.extractHostnameAndPort=wie;var kie=(t,e,n,r)=>{let o=e.hostname,s=e.port,i=t.method??"GET",a=AG(i),c=t.headers||{},l=c["user-agent"],p=(0,$.getAbsoluteUrl)(t,c,`${e.component}:`,e.redactedQueryParams),d={[V.ATTR_HTTP_URL]:p,[V.ATTR_HTTP_METHOD]:i,[V.ATTR_HTTP_TARGET]:t.path||"/",[V.ATTR_NET_PEER_NAME]:o,[V.ATTR_HTTP_HOST]:c.host??`${o}:${s}`},_={[ae.ATTR_HTTP_REQUEST_METHOD]:a,[ae.ATTR_SERVER_ADDRESS]:o,[ae.ATTR_SERVER_PORT]:Number(s),[ae.ATTR_URL_FULL]:p,[ae.ATTR_USER_AGENT_ORIGINAL]:l};switch(i!==a&&(_[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=i),r&&l&&(_[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(l)),l!==void 0&&(d[V.ATTR_HTTP_USER_AGENT]=l),n){case kn.SemconvStability.STABLE:return Object.assign(_,e.hookAttributes);case kn.SemconvStability.OLD:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};$.getOutgoingRequestAttributes=kie;var Gie=t=>{let e={};return e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_PEER_NAME]=t[V.ATTR_NET_PEER_NAME],e};$.getOutgoingRequestMetricAttributes=Gie;var Bie=(t,e)=>{t&&(e[V.ATTR_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_TCP:e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_UDP)};$.setAttributesFromHttpKind=Bie;var SG=t=>{let e=String(t).toLowerCase();for(let n of hG.SYNTHETIC_TEST_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let n of hG.SYNTHETIC_BOT_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT},jie=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:l}=s;i[V.ATTR_NET_PEER_IP]=c,i[V.ATTR_NET_PEER_PORT]=l,a[ae.ATTR_NETWORK_PEER_ADDRESS]=c,a[ae.ATTR_NETWORK_PEER_PORT]=l,a[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,$.setResponseContentLengthAttribute)(t,i),n&&(i[V.ATTR_HTTP_STATUS_CODE]=n,i[Nf.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,$.setAttributesFromHttpKind)(o,i),e){case kn.SemconvStability.STABLE:return a;case kn.SemconvStability.OLD:return i}return Object.assign(i,a)};$.getOutgoingRequestAttributesOnResponse=jie;var Hie=t=>{let e={};return e[V.ATTR_NET_PEER_PORT]=t[V.ATTR_NET_PEER_PORT],e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getOutgoingRequestMetricAttributesOnResponse=Hie;var Fie=t=>{let e={};return t[ae.ATTR_NETWORK_PROTOCOL_VERSION]&&(e[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t[ae.ATTR_NETWORK_PROTOCOL_VERSION]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getOutgoingStableRequestMetricAttributesOnResponse=Fie;function ds(t,e){let n=t.split(":");if(n.length===1)return e==="http"?{host:n[0],port:"80"}:e==="https"?{host:n[0],port:"443"}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith("[")){if(n[n.length-1].endsWith("]")){if(e==="http")return{host:t,port:"80"};if(e==="https")return{host:t,port:"443"}}else if(n[n.length-2].endsWith("]"))return{host:n.slice(0,-1).join(":"),port:n[n.length-1]}}return{host:t}}function Vie(t,e){let n=t.headers.forwarded;if(n){for(let s of RG(n))if(s.host)return ds(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?ds(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r,t.headers["x-forwarded-proto"][0]):ds(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?ds(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r[0],t.headers["x-forwarded-proto"][0]):ds(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?ds(o,e):null}function gG(t){let e=t.headers.forwarded;if(e){for(let o of RG(e))if(o.for)return TG(o.for)}let n=t.headers["x-forwarded-for"];if(n){let o;if(typeof n=="string"?o=n:Array.isArray(n)&&(o=n[0]),typeof o=="string")return o=o.split(",")[0].trim(),TG(o)}let r=t.socket.remoteAddress;return r||null}$.getRemoteClientAddress=gG;function TG(t){try{let{hostname:e}=new URL(`http://${t}`);return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}catch{return t}}function qie(t,e,n){try{if(e.headers.host)return new URL(e.url??"/",`${t}://${e.headers.host}`);{let r=new URL(e.url??"/",`${t}://localhost`);return{pathname:r.pathname,search:r.search,toString:function(){return r.pathname+r.search}}}}catch(r){return n.verbose("Unable to get URL from request",r),{}}}var $ie=(t,e,n)=>{let{component:r,enableSyntheticSourceDetection:o,hookAttributes:s,semconvStability:i,serverName:a}=e,{headers:c,httpVersion:l,method:p}=t,{host:d,"user-agent":_,"x-forwarded-for":f}=c,m=qie(r,t,n),h,T;if(i!==kn.SemconvStability.OLD){let S=AG(p),R=Vie(t,r),I=gG(t);h={[ae.ATTR_HTTP_REQUEST_METHOD]:S,[ae.ATTR_URL_SCHEME]:r,[ae.ATTR_SERVER_ADDRESS]:R?.host,[ae.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[ae.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[ae.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[ae.ATTR_USER_AGENT_ORIGINAL]:_},m.pathname!=null&&(h[ae.ATTR_URL_PATH]=m.pathname),m.search&&(h[ae.ATTR_URL_QUERY]=m.search.slice(1)),I!=null&&(h[ae.ATTR_CLIENT_ADDRESS]=I),R?.port!=null&&(h[ae.ATTR_SERVER_PORT]=Number(R.port)),p!==S&&(h[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=p),o&&_&&(h[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(_))}if(i!==kn.SemconvStability.STABLE){let S=d?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost";T={[V.ATTR_HTTP_URL]:m.toString(),[V.ATTR_HTTP_HOST]:d,[V.ATTR_NET_HOST_NAME]:S,[V.ATTR_HTTP_METHOD]:p,[V.ATTR_HTTP_SCHEME]:r},typeof f=="string"&&(T[V.ATTR_HTTP_CLIENT_IP]=f.split(",")[0]),typeof a=="string"&&(T[V.ATTR_HTTP_SERVER_NAME]=a),m.pathname&&(T[V.ATTR_HTTP_TARGET]=m.pathname+m.search||"/"),_!==void 0&&(T[V.ATTR_HTTP_USER_AGENT]=_),(0,$.setRequestContentLengthAttribute)(t,T),(0,$.setAttributesFromHttpKind)(l,T)}switch(i){case kn.SemconvStability.STABLE:return Object.assign(h,s);case kn.SemconvStability.OLD:return Object.assign(T,s);default:return Object.assign(T,h,s)}};$.getIncomingRequestAttributes=$ie;var Yie=t=>{let e={};return e[V.ATTR_HTTP_SCHEME]=t[V.ATTR_HTTP_SCHEME],e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_HOST_NAME]=t[V.ATTR_NET_HOST_NAME],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getIncomingRequestMetricAttributes=Yie;var Wie=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,mG.getRPCMetadata)(Fl.context.active()),c={};if(r){let{localAddress:l,localPort:p,remoteAddress:d,remotePort:_}=r;c[V.ATTR_NET_HOST_IP]=l,c[V.ATTR_NET_HOST_PORT]=p,c[V.ATTR_NET_PEER_IP]=d,c[V.ATTR_NET_PEER_PORT]=_}switch(c[V.ATTR_HTTP_STATUS_CODE]=o,c[Nf.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===mG.RPCType.HTTP&&a.route!==void 0&&(c[ae.ATTR_HTTP_ROUTE]=a.route,i[ae.ATTR_HTTP_ROUTE]=a.route),n){case kn.SemconvStability.STABLE:return i;case kn.SemconvStability.OLD:return c}return Object.assign(c,i)};$.getIncomingRequestAttributesOnResponse=Wie;var zie=t=>{let e={};return e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_NET_HOST_PORT]=t[V.ATTR_NET_HOST_PORT],t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),e};$.getIncomingRequestMetricAttributesOnResponse=zie;var Kie=t=>{let e={};return t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getIncomingStableRequestMetricAttributesOnResponse=Kie;function Qie(t,e,n){let r=new Map;for(let o=0,s=e.length;o<s;o++){let i=e[o].toLowerCase();n&kn.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll("-","_"))}return o=>{let s={};for(let i of r.keys()){let a=o(i);if(a===void 0)continue;let c=r.get(i),l=`http.${t}.header.${c}`;typeof a=="string"?s[l]=[a]:Array.isArray(a)?s[l]=a:s[l]=[a]}return s}}$.headerCapture=Qie;var Xie=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","QUERY"]);function AG(t){if(t==null)return"GET";let e=t.toUpperCase();return Xie.has(e)?e:"_OTHER"}function RG(t){try{return Oie(t)}catch{return[]}}});var IG=E(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.HttpInstrumentation=void 0;var oe=(b(),O(v)),_s=Te(),Jie=U("url"),Zie=nk(),Rt=ne(),ER=U("events"),Le=(le(),O(Ae)),Ke=yG(),SR=class extends Rt.InstrumentationBase{_spanNotEnded=new WeakSet;_headerCapture;_httpPatched=!1;_httpsPatched=!1;_semconvStability=Rt.SemconvStability.OLD;constructor(e={}){super("@opentelemetry/instrumentation-http",Zie.VERSION,e),this._semconvStability=(0,Rt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("http",["*"],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchOutgoingRequestFunction("http")),o=this._wrap(e,"get",this._getPatchOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("https",["*"],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchHttpsOutgoingRequestFunction("https")),o=this._wrap(e,"get",this._getPatchHttpsOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(e){return n=>this._incomingRequestFunction(e,n)}_getPatchOutgoingRequestFunction(e){return n=>this._outgoingRequestFunction(e,n)}_getPatchOutgoingGetFunction(e){return n=>function(o,...s){let i=e(o,...s);return i.end(),i}}_getPatchHttpsOutgoingRequestFunction(e){return n=>{let r=this;return function(s,...i){return e==="https"&&typeof s=="object"&&s?.constructor?.name!=="URL"&&(s=Object.assign({},s),r._setDefaultOptions(s)),r._getPatchOutgoingRequestFunction(e)(n)(s,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||"https:",e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return n=>{let r=this;return function(s,...i){return r._getPatchOutgoingGetFunction(e)(n)(s,...i)}}}_traceClientRequest(e,n,r,o,s){this.getConfig().requestHook&&this._callRequestHook(n,e);let i=!1;return e.prependListener("response",a=>{this._diag.debug("outgoingRequest on response()"),e.listenerCount("response")<=1&&a.resume();let c=(0,Ke.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ke.getOutgoingRequestMetricAttributesOnResponse)(c)),s=Object.assign(s,(0,Ke.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),n.setAttributes(this._headerCapture.client.captureRequestHeaders(p=>e.getHeader(p))),n.setAttributes(this._headerCapture.client.captureResponseHeaders(p=>a.headers[p])),oe.context.bind(oe.context.active(),a);let l=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let p;a.aborted&&!a.complete?p={code:oe.SpanStatusCode.ERROR}:p={code:(0,Ke.parseResponseStatus)(oe.SpanKind.CLIENT,a.statusCode)},n.setStatus(p),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s)};a.on("end",l),a.on(ER.errorMonitor,p=>{this._diag.debug("outgoingRequest on error()",p),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,p))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s))}),e.on(ER.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,a))}),this._diag.debug("http.ClientRequest return request"),e}_incomingRequestFunction(e,n){let r=this;return function(s,...i){if(s!=="request")return n.apply(this,[s,...i]);let a=i[0],c=i[1],l=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreIncomingRequestHook?.(a),I=>{I!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",I)},!0))return oe.context.with((0,_s.suppressTracing)(oe.context.active()),()=>(oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),n.apply(this,[s,...i])));let p=a.headers,d=(0,Ke.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability,enableSyntheticSourceDetection:r.getConfig().enableSyntheticSourceDetection||!1},r._diag);Object.assign(d,r._headerCapture.server.captureRequestHeaders(I=>a.headers[I]));let _={kind:oe.SpanKind.SERVER,attributes:d},f=(0,_s.hrTime)(),m=(0,Ke.getIncomingRequestMetricAttributes)(d),h={[Le.ATTR_HTTP_REQUEST_METHOD]:d[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_URL_SCHEME]:d[Le.ATTR_URL_SCHEME]};d[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(h[Le.ATTR_NETWORK_PROTOCOL_VERSION]=d[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let T=oe.propagation.extract(oe.ROOT_CONTEXT,p),S=r._startHttpSpan(l,_,T),R={type:_s.RPCType.HTTP,span:S};return oe.context.with((0,_s.setRPCMetadata)(oe.trace.setSpan(T,S),R),()=>{oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(S,a),r.getConfig().responseHook&&r._callResponseHook(S,c);let I=!1;return c.on("close",()=>{I||r._onServerResponseFinish(a,c,S,m,h,f)}),c.on(ER.errorMonitor,x=>{I=!0,r._onServerResponseError(S,m,h,f,x)}),(0,Rt.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),x=>{if(x)throw r._onServerResponseError(S,m,h,f,x),x})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ke.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof Jie.URL)?i.shift():void 0,{method:c,invalidUrl:l,optionsParsed:p}=(0,Ke.getRequestInfo)(r._diag,s,a);if((0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreOutgoingRequestHook?.(p),F=>{F!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",F)},!0))return n.apply(this,[p,...i]);let{hostname:d,port:_}=(0,Ke.extractHostnameAndPort)(p),f=(0,Ke.getOutgoingRequestAttributes)(p,{component:e,port:_,hostname:d,hookAttributes:r._callStartSpanHook(p,r.getConfig().startOutgoingSpanHook),redactedQueryParams:r.getConfig().redactedQueryParams},r._semconvStability,r.getConfig().enableSyntheticSourceDetection||!1),m=(0,_s.hrTime)(),h=(0,Ke.getOutgoingRequestMetricAttributes)(f),T={[Le.ATTR_HTTP_REQUEST_METHOD]:f[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_SERVER_ADDRESS]:f[Le.ATTR_SERVER_ADDRESS],[Le.ATTR_SERVER_PORT]:f[Le.ATTR_SERVER_PORT]};f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(T[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]=f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]),f[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[Le.ATTR_NETWORK_PROTOCOL_VERSION]=f[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let S={kind:oe.SpanKind.CLIENT,attributes:f},R=r._startHttpSpan(c,S),I=oe.context.active(),x=oe.trace.setSpan(I,R);return p.headers?p.headers=Object.assign({},p.headers):p.headers={},oe.propagation.inject(x,p.headers),oe.context.with(x,()=>{let F=i[i.length-1];typeof F=="function"&&(i[i.length-1]=oe.context.bind(I,F));let B=(0,Rt.safeExecuteInTheMiddle)(()=>l?n.apply(this,[s,...i]):n.apply(this,[p,...i]),se=>{if(se)throw r._onOutgoingRequestError(R,h,T,m,se),se});return r._diag.debug(`${e} instrumentation outgoingRequest`),oe.context.bind(I,B),r._traceClientRequest(B,R,m,h,T)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ke.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ke.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ke.getIncomingStableRequestMetricAttributesOnResponse)(a)),r.setAttributes(this._headerCapture.server.captureResponseHeaders(l=>n.getHeader(l))),r.setAttributes(a).setStatus({code:(0,Ke.parseResponseStatus)(oe.SpanKind.SERVER,n.statusCode)});let c=a[Le.ATTR_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,oe.SpanKind.SERVER,i,o,s)}_onOutgoingRequestError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.CLIENT,o,n,r)}_onServerResponseError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=oe.context.active()){let o=n.kind===oe.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=oe.trace.getSpan(r);return o===!0&&(!i||!oe.trace.isSpanContextValid(i.spanContext()))?s=oe.trace.wrapSpanContext(oe.INVALID_SPAN_CONTEXT):o===!0&&i?.spanContext().isRemote?s=i:s=this.tracer.startSpan(e,n,r),this._spanNotEnded.add(s),s}_closeHttpSpan(e,n,r,o,s){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let i=(0,_s.hrTimeToMilliseconds)((0,_s.hrTimeDuration)(r,(0,_s.hrTime)()));n===oe.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===oe.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,Rt.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(e){let n=this.getConfig();return{client:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}};bf.HttpInstrumentation=SR});var OG=E(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.HttpInstrumentation=void 0;var eae=IG();Object.defineProperty(Cf,"HttpInstrumentation",{enumerable:!0,get:function(){return eae.HttpInstrumentation}})});var EI=E(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.AbstractAsyncHooksContextManager=void 0;var Upe=U("events"),wpe=["addListener","on","once","prependListener","prependOnceListener"],TI=class{bind(e,n){return n instanceof Upe.EventEmitter?this._bindEventEmitter(e,n):typeof n=="function"?this._bindFunction(e,n):n}_bindFunction(e,n){let r=this,o=function(...s){return r.with(e,()=>n.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(e,n){return this._getPatchMap(n)!==void 0||(this._createPatchMap(n),wpe.forEach(o=>{n[o]!==void 0&&(n[o]=this._patchAddListener(n,n[o],e))}),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(e,n){let r=this;return function(o,s){let i=r._getPatchMap(e)?.[o];if(i===void 0)return n.call(this,o,s);let a=i.get(s);return n.call(this,o,a||s)}}_patchRemoveAllListeners(e,n){let r=this;return function(o){let s=r._getPatchMap(e);return s!==void 0&&(arguments.length===0?r._createPatchMap(e):s[o]!==void 0&&delete s[o]),n.apply(this,arguments)}}_patchAddListener(e,n,r){let o=this;return function(s,i){if(o._wrapped)return n.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let l=o.bind(r,i);c.set(i,l),o._wrapped=!0;try{return n.call(this,s,l)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};jm.AbstractAsyncHooksContextManager=TI});var PH=E(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.AsyncHooksContextManager=void 0;var kpe=(b(),O(v)),Gpe=U("async_hooks"),Bpe=EI(),SI=class extends Bpe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=Gpe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??kpe.ROOT_CONTEXT}with(e,n,r,...o){this._enterContext(e);try{return n.call(r,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,n){if(n==="TIMERWRAP")return;let r=this._stack[this._stack.length-1];r!==void 0&&this._contexts.set(e,r)}_destroy(e){this._contexts.delete(e)}_before(e){let n=this._contexts.get(e);n!==void 0&&this._enterContext(n)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};Hm.AsyncHooksContextManager=SI});var MH=E(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.AsyncLocalStorageContextManager=void 0;var jpe=(b(),O(v)),Hpe=U("async_hooks"),Fpe=EI(),gI=class extends Fpe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new Hpe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??jpe.ROOT_CONTEXT}with(e,n,r,...o){let s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Fm.AsyncLocalStorageContextManager=gI});var xH=E(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.AsyncLocalStorageContextManager=Kc.AsyncHooksContextManager=void 0;var Vpe=PH();Object.defineProperty(Kc,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Vpe.AsyncHooksContextManager}});var qpe=MH();Object.defineProperty(Kc,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return qpe.AsyncLocalStorageContextManager}})});var AI=E(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc._clearDefaultServiceNameCache=Qc.defaultServiceName=void 0;var Mp;function $pe(){if(Mp===void 0)try{let t=globalThis.process.argv0;Mp=t?`unknown_service:${t}`:"unknown_service"}catch{Mp="unknown_service"}return Mp}Qc.defaultServiceName=$pe;function Ype(){Mp=void 0}Qc._clearDefaultServiceNameCache=Ype});var vH=E(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.isPromiseLike=void 0;var Wpe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";Vm.isPromiseLike=Wpe});var II=E(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.defaultResource=to.emptyResource=to.resourceFromDetectedResource=to.resourceFromAttributes=void 0;var vp=(b(),O(v)),RI=Te(),sa=(le(),O(Ae)),zpe=AI(),xp=vH(),qm=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,n){let r=new t({},n);return r._rawAttributes=LH(e),r._asyncAttributesPending=e.filter(([o,s])=>(0,xp.isPromiseLike)(s)).length>0,r}constructor(e,n){let r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([o,s])=>((0,xp.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=LH(this._rawAttributes),this._schemaUrl=Jpe(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,(0,xp.isPromiseLike)(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&vp.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,xp.isPromiseLike)(r)){vp.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let n=Zpe(this,e),r=n?{schemaUrl:n}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r)}};function yI(t,e){return qm.FromAttributeList(Object.entries(t),e)}to.resourceFromAttributes=yI;function Kpe(t,e){return new qm(t,e)}to.resourceFromDetectedResource=Kpe;function Qpe(){return yI({})}to.emptyResource=Qpe;function Xpe(){return yI({[sa.ATTR_SERVICE_NAME]:(0,zpe.defaultServiceName)(),[sa.ATTR_TELEMETRY_SDK_LANGUAGE]:RI.SDK_INFO[sa.ATTR_TELEMETRY_SDK_LANGUAGE],[sa.ATTR_TELEMETRY_SDK_NAME]:RI.SDK_INFO[sa.ATTR_TELEMETRY_SDK_NAME],[sa.ATTR_TELEMETRY_SDK_VERSION]:RI.SDK_INFO[sa.ATTR_TELEMETRY_SDK_VERSION]})}to.defaultResource=Xpe;function LH(t){return t.map(([e,n])=>(0,xp.isPromiseLike)(n)?[e,n.catch(r=>{vp.diag.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}function Jpe(t){if(typeof t=="string"||t===void 0)return t;vp.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function Zpe(t,e){let n=t?.schemaUrl,r=e?.schemaUrl,o=n===void 0||n==="",s=r===void 0||r==="";if(o)return r;if(s||n===r)return n;vp.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}});var UH=E($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.detectResources=void 0;var DH=(b(),O(v)),OI=II(),ede=(t={})=>(t.detectors||[]).map(n=>{try{let r=(0,OI.resourceFromDetectedResource)(n.detect(t));return DH.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return DH.diag.debug(`${n.constructor.name} failed: ${r.message}`),(0,OI.emptyResource)()}}).reduce((n,r)=>n.merge(r),(0,OI.emptyResource)());$m.detectResources=ede});var kH=E(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});Ym.envDetector=void 0;var tde=(b(),O(v)),nde=(le(),O(Ae)),wH=Te(),NI=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){let n={},r=(0,wH.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,wH.getStringFromEnv)("OTEL_SERVICE_NAME");if(r)try{let s=this._parseResourceAttributes(r);Object.assign(n,s)}catch(s){tde.diag.debug(`EnvDetector failed: ${s instanceof Error?s.message:s}`)}return o&&(n[nde.ATTR_SERVICE_NAME]=o),{attributes:n}}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER);if(s.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${o}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[i,a]=s,c=i.trim(),l=a.trim();if(c.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${o}".`);let p,d;try{p=decodeURIComponent(c),d=decodeURIComponent(l)}catch(_){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${o}": ${_ instanceof Error?_.message:_}`)}if(p.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${p}".`);if(d.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${p}".`);n[p]=d}return n}};Ym.envDetector=new NI});var Lp=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.ATTR_WEBENGINE_VERSION=L.ATTR_WEBENGINE_NAME=L.ATTR_WEBENGINE_DESCRIPTION=L.ATTR_SERVICE_NAMESPACE=L.ATTR_SERVICE_INSTANCE_ID=L.ATTR_PROCESS_RUNTIME_VERSION=L.ATTR_PROCESS_RUNTIME_NAME=L.ATTR_PROCESS_RUNTIME_DESCRIPTION=L.ATTR_PROCESS_PID=L.ATTR_PROCESS_OWNER=L.ATTR_PROCESS_EXECUTABLE_PATH=L.ATTR_PROCESS_EXECUTABLE_NAME=L.ATTR_PROCESS_COMMAND_ARGS=L.ATTR_PROCESS_COMMAND=L.ATTR_OS_VERSION=L.ATTR_OS_TYPE=L.ATTR_K8S_POD_NAME=L.ATTR_K8S_NAMESPACE_NAME=L.ATTR_K8S_DEPLOYMENT_NAME=L.ATTR_K8S_CLUSTER_NAME=L.ATTR_HOST_TYPE=L.ATTR_HOST_NAME=L.ATTR_HOST_IMAGE_VERSION=L.ATTR_HOST_IMAGE_NAME=L.ATTR_HOST_IMAGE_ID=L.ATTR_HOST_ID=L.ATTR_HOST_ARCH=L.ATTR_CONTAINER_NAME=L.ATTR_CONTAINER_IMAGE_TAGS=L.ATTR_CONTAINER_IMAGE_NAME=L.ATTR_CONTAINER_ID=L.ATTR_CLOUD_REGION=L.ATTR_CLOUD_PROVIDER=L.ATTR_CLOUD_AVAILABILITY_ZONE=L.ATTR_CLOUD_ACCOUNT_ID=void 0;L.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";L.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";L.ATTR_CLOUD_PROVIDER="cloud.provider";L.ATTR_CLOUD_REGION="cloud.region";L.ATTR_CONTAINER_ID="container.id";L.ATTR_CONTAINER_IMAGE_NAME="container.image.name";L.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";L.ATTR_CONTAINER_NAME="container.name";L.ATTR_HOST_ARCH="host.arch";L.ATTR_HOST_ID="host.id";L.ATTR_HOST_IMAGE_ID="host.image.id";L.ATTR_HOST_IMAGE_NAME="host.image.name";L.ATTR_HOST_IMAGE_VERSION="host.image.version";L.ATTR_HOST_NAME="host.name";L.ATTR_HOST_TYPE="host.type";L.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";L.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";L.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";L.ATTR_K8S_POD_NAME="k8s.pod.name";L.ATTR_OS_TYPE="os.type";L.ATTR_OS_VERSION="os.version";L.ATTR_PROCESS_COMMAND="process.command";L.ATTR_PROCESS_COMMAND_ARGS="process.command_args";L.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";L.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";L.ATTR_PROCESS_OWNER="process.owner";L.ATTR_PROCESS_PID="process.pid";L.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";L.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";L.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";L.ATTR_SERVICE_INSTANCE_ID="service.instance.id";L.ATTR_SERVICE_NAMESPACE="service.namespace";L.ATTR_WEBENGINE_DESCRIPTION="webengine.description";L.ATTR_WEBENGINE_NAME="webengine.name";L.ATTR_WEBENGINE_VERSION="webengine.version"});var zm=E(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});Wm.execAsync=void 0;var rde=U("child_process"),ode=U("util");Wm.execAsync=ode.promisify(rde.exec)});var GH=E(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.getMachineId=void 0;var sde=zm(),ide=(b(),O(v));async function ade(){try{let e=(await(0,sde.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
8
|
-
`).find(r=>r.includes("IOPlatformUUID"));if(!e)return;let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){ide.diag.debug(`error reading machine id: ${t}`)}}Km.getMachineId=ade});var BH=E(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.getMachineId=void 0;var cde=U("fs"),ude=(b(),O(v));async function lde(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await cde.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){ude.diag.debug(`error reading machine id: ${n}`)}}Qm.getMachineId=lde});var HH=E(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});Xm.getMachineId=void 0;var pde=U("fs"),dde=zm(),jH=(b(),O(v));async function _de(){try{return(await pde.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,dde.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}}Xm.getMachineId=_de});var VH=E(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.getMachineId=void 0;var FH=U("process"),fde=zm(),mde=(b(),O(v));async function hde(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";FH.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in FH.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,fde.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){mde.diag.debug(`error reading machine id: ${n}`)}}Jm.getMachineId=hde});var qH=E(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.getMachineId=void 0;var Tde=(b(),O(v));async function Ede(){Tde.diag.debug("could not read machine-id: unsupported platform")}Zm.getMachineId=Ede});var $H=E(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.getMachineId=void 0;var Sde=U("process"),ia;async function gde(){if(!ia)switch(Sde.platform){case"darwin":ia=(await Promise.resolve().then(()=>K(GH()))).getMachineId;break;case"linux":ia=(await Promise.resolve().then(()=>K(BH()))).getMachineId;break;case"freebsd":ia=(await Promise.resolve().then(()=>K(HH()))).getMachineId;break;case"win32":ia=(await Promise.resolve().then(()=>K(VH()))).getMachineId;break;default:ia=(await Promise.resolve().then(()=>K(qH()))).getMachineId;break}return ia()}eh.getMachineId=gde});var bI=E(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.normalizeType=Xc.normalizeArch=void 0;var Ade=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Xc.normalizeArch=Ade;var Rde=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Xc.normalizeType=Rde});var WH=E(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.hostDetector=void 0;var CI=Lp(),YH=U("os"),yde=$H(),Ide=bI(),PI=class{detect(e){return{attributes:{[CI.ATTR_HOST_NAME]:(0,YH.hostname)(),[CI.ATTR_HOST_ARCH]:(0,Ide.normalizeArch)((0,YH.arch)()),[CI.ATTR_HOST_ID]:(0,yde.getMachineId)()}}}};th.hostDetector=new PI});var QH=E(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.osDetector=void 0;var zH=Lp(),KH=U("os"),Ode=bI(),MI=class{detect(e){return{attributes:{[zH.ATTR_OS_TYPE]:(0,Ode.normalizeType)((0,KH.platform)()),[zH.ATTR_OS_VERSION]:(0,KH.release)()}}}};nh.osDetector=new MI});var XH=E(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.processDetector=void 0;var Nde=(b(),O(v)),Ho=Lp(),bde=U("os"),xI=class{detect(e){let n={[Ho.ATTR_PROCESS_PID]:process.pid,[Ho.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[Ho.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[Ho.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Ho.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[Ho.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[Ho.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Ho.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let r=bde.userInfo();n[Ho.ATTR_PROCESS_OWNER]=r.username}catch(r){Nde.diag.debug(`error obtaining process owner: ${r}`)}return{attributes:n}}};rh.processDetector=new xI});var JH=E(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.serviceInstanceIdDetector=void 0;var Cde=Lp(),Pde=U("crypto"),vI=class{detect(e){return{attributes:{[Cde.ATTR_SERVICE_INSTANCE_ID]:(0,Pde.randomUUID)()}}}};oh.serviceInstanceIdDetector=new vI});var ZH=E(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.serviceInstanceIdDetector=no.processDetector=no.osDetector=no.hostDetector=void 0;var Mde=WH();Object.defineProperty(no,"hostDetector",{enumerable:!0,get:function(){return Mde.hostDetector}});var xde=QH();Object.defineProperty(no,"osDetector",{enumerable:!0,get:function(){return xde.osDetector}});var vde=XH();Object.defineProperty(no,"processDetector",{enumerable:!0,get:function(){return vde.processDetector}});var Lde=JH();Object.defineProperty(no,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Lde.serviceInstanceIdDetector}})});var eF=E(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.serviceInstanceIdDetector=ro.processDetector=ro.osDetector=ro.hostDetector=void 0;var sh=ZH();Object.defineProperty(ro,"hostDetector",{enumerable:!0,get:function(){return sh.hostDetector}});Object.defineProperty(ro,"osDetector",{enumerable:!0,get:function(){return sh.osDetector}});Object.defineProperty(ro,"processDetector",{enumerable:!0,get:function(){return sh.processDetector}});Object.defineProperty(ro,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return sh.serviceInstanceIdDetector}})});var tF=E(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.noopDetector=Jc.NoopDetector=void 0;var ih=class{detect(){return{attributes:{}}}};Jc.NoopDetector=ih;Jc.noopDetector=new ih});var nF=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.noopDetector=On.serviceInstanceIdDetector=On.processDetector=On.osDetector=On.hostDetector=On.envDetector=void 0;var Dde=kH();Object.defineProperty(On,"envDetector",{enumerable:!0,get:function(){return Dde.envDetector}});var ah=eF();Object.defineProperty(On,"hostDetector",{enumerable:!0,get:function(){return ah.hostDetector}});Object.defineProperty(On,"osDetector",{enumerable:!0,get:function(){return ah.osDetector}});Object.defineProperty(On,"processDetector",{enumerable:!0,get:function(){return ah.processDetector}});Object.defineProperty(On,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ah.serviceInstanceIdDetector}});var Ude=tF();Object.defineProperty(On,"noopDetector",{enumerable:!0,get:function(){return Ude.noopDetector}})});var DI=E(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.defaultServiceName=Fe.emptyResource=Fe.defaultResource=Fe.resourceFromAttributes=Fe.serviceInstanceIdDetector=Fe.processDetector=Fe.osDetector=Fe.hostDetector=Fe.envDetector=Fe.detectResources=void 0;var wde=UH();Object.defineProperty(Fe,"detectResources",{enumerable:!0,get:function(){return wde.detectResources}});var Dp=nF();Object.defineProperty(Fe,"envDetector",{enumerable:!0,get:function(){return Dp.envDetector}});Object.defineProperty(Fe,"hostDetector",{enumerable:!0,get:function(){return Dp.hostDetector}});Object.defineProperty(Fe,"osDetector",{enumerable:!0,get:function(){return Dp.osDetector}});Object.defineProperty(Fe,"processDetector",{enumerable:!0,get:function(){return Dp.processDetector}});Object.defineProperty(Fe,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Dp.serviceInstanceIdDetector}});var LI=II();Object.defineProperty(Fe,"resourceFromAttributes",{enumerable:!0,get:function(){return LI.resourceFromAttributes}});Object.defineProperty(Fe,"defaultResource",{enumerable:!0,get:function(){return LI.defaultResource}});Object.defineProperty(Fe,"emptyResource",{enumerable:!0,get:function(){return LI.emptyResource}});var kde=AI();Object.defineProperty(Fe,"defaultServiceName",{enumerable:!0,get:function(){return kde.defaultServiceName}})});var rF=E(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.ExceptionEventName=void 0;ch.ExceptionEventName="exception"});var oF=E(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.SpanImpl=void 0;var kt=(b(),O(v)),Gt=Te(),aa=(le(),O(Ae)),Gde=rF(),UI=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:kt.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let n=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Gt.otperformance.now(),this._performanceOffset=n-(this._performanceStartTime+Gt.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let r of e.links)this.addLink(r);this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return kt.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,Gt.isAttributeValue)(n))return kt.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),o&&this._attributesCount++,this)}setAttributes(e){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.setAttribute(n,e[n]);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return kt.diag.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&kt.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,Gt.isTimeInput)(n)&&((0,Gt.isTimeInput)(r)||(r=n),n=void 0);let s=(0,Gt.sanitizeAttributes)(n),{attributePerEventCountLimit:i}=this._spanLimits,a={},c=0,l=0;for(let p in s){if(!Object.prototype.hasOwnProperty.call(s,p))continue;let d=s[p];if(i!==void 0&&l>=i){c++;continue}a[p]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&kt.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,o=(0,Gt.sanitizeAttributes)(e.attributes),s={},i=0,a=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&a>=r){i++;continue}s[l]=this._truncateToSize(p),a++}let c={context:e.context};return a>0&&(c.attributes=s),i>0&&(c.droppedAttributesCount=i),this.links.push(c),this}addLinks(e){for(let n of e)this.addLink(n);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===kt.SpanStatusCode.UNSET)return this;if(this.status.code===kt.SpanStatusCode.OK)return this;let n={code:e.code};return e.code===kt.SpanStatusCode.ERROR&&(typeof e.message=="string"?n.message=e.message:e.message!=null&&kt.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=n,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){kt.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,Gt.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(kt.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&kt.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&kt.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=Gt.otperformance.now())return(0,Gt.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,Gt.millisToHrTime)(e);if(e instanceof Date)return(0,Gt.millisToHrTime)(e.getTime());if((0,Gt.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,Gt.millisToHrTime)(Date.now());let n=Gt.otperformance.now()-this._performanceStartTime;return(0,Gt.addHrTimes)(this.startTime,(0,Gt.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[aa.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[aa.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[aa.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[aa.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[aa.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[aa.ATTR_EXCEPTION_TYPE]||r[aa.ATTR_EXCEPTION_MESSAGE]?this.addEvent(Gde.ExceptionEventName,r,n):kt.diag.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);kt.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(kt.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}};uh.SpanImpl=UI});var Zc=E(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});Up.SamplingDecision=void 0;var Bde;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Bde=Up.SamplingDecision||(Up.SamplingDecision={}))});var ph=E(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.AlwaysOffSampler=void 0;var jde=Zc(),wI=class{shouldSample(){return{decision:jde.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};lh.AlwaysOffSampler=wI});var _h=E(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.AlwaysOnSampler=void 0;var Hde=Zc(),kI=class{shouldSample(){return{decision:Hde.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};dh.AlwaysOnSampler=kI});var jI=E(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.ParentBasedSampler=void 0;var fh=(b(),O(v)),Fde=Te(),sF=ph(),GI=_h(),BI=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||((0,Fde.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new GI.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new GI.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new sF.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new GI.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new sF.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=fh.trace.getSpanContext(e);return!a||!(0,fh.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&fh.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&fh.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,n,r,o,s,i):this._localParentNotSampled.shouldSample(e,n,r,o,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};mh.ParentBasedSampler=BI});var FI=E(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.TraceIdRatioBasedSampler=void 0;var Vde=(b(),O(v)),iF=Zc(),HI=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,Vde.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?iF.SamplingDecision.RECORD_AND_SAMPLED:iF.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){let o=r*8,s=parseInt(e.slice(o,o+8),16);n=(n^s)>>>0}return n}};hh.TraceIdRatioBasedSampler=HI});var $I=E(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.buildSamplerFromEnv=eu.loadDefaultConfig=void 0;var qI=(b(),O(v)),oo=Te(),aF=ph(),VI=_h(),Th=jI(),cF=FI(),so;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(so||(so={}));var Eh=1;function qde(){return{sampler:lF(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}eu.loadDefaultConfig=qde;function lF(){let t=(0,oo.getStringFromEnv)("OTEL_TRACES_SAMPLER")??so.ParentBasedAlwaysOn;switch(t){case so.AlwaysOn:return new VI.AlwaysOnSampler;case so.AlwaysOff:return new aF.AlwaysOffSampler;case so.ParentBasedAlwaysOn:return new Th.ParentBasedSampler({root:new VI.AlwaysOnSampler});case so.ParentBasedAlwaysOff:return new Th.ParentBasedSampler({root:new aF.AlwaysOffSampler});case so.TraceIdRatio:return new cF.TraceIdRatioBasedSampler(uF());case so.ParentBasedTraceIdRatio:return new Th.ParentBasedSampler({root:new cF.TraceIdRatioBasedSampler(uF())});default:return qI.diag.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${so.ParentBasedAlwaysOn}".`),new Th.ParentBasedSampler({root:new VI.AlwaysOnSampler})}}eu.buildSamplerFromEnv=lF;function uF(){let t=(0,oo.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");return t==null?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Eh}.`),Eh):t<0||t>1?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${Eh}.`),Eh):t}});var YI=E(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.reconfigureLimits=ir.mergeConfig=ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var pF=$I(),Sh=Te();ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function $de(t){let e={sampler:(0,pF.buildSamplerFromEnv)()},n=(0,pF.loadDefaultConfig)(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}ir.mergeConfig=$de;function Yde(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??(0,Sh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,Sh.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??(0,Sh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Sh.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:e})}ir.reconfigureLimits=Yde});var dF=E(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.BatchSpanProcessorBase=void 0;var tu=(b(),O(v)),Fo=Te(),WI=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Fo.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(tu.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,n){}onEnd(e){this._shutdownOnce.isCalled||e.spanContext().traceFlags&tu.TraceFlags.SAMPLED&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&tu.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(tu.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{let r=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,i=o;s<i;s++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{let r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);tu.context.with((0,Fo.suppressTracing)(tu.context.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(o,a=>{clearTimeout(r),a.code===Fo.ExportResultCode.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let l=o[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,Fo.globalErrorHandler)(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,Fo.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};gh.BatchSpanProcessorBase=WI});var _F=E(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.BatchSpanProcessor=void 0;var Wde=dF(),zI=class extends Wde.BatchSpanProcessorBase{onShutdown(){}};Ah.BatchSpanProcessor=zI});var hF=E(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.RandomIdGenerator=void 0;var zde=8,mF=16,KI=class{generateTraceId=fF(mF);generateSpanId=fF(zde)};yh.RandomIdGenerator=KI;var Rh=Buffer.allocUnsafe(mF);function fF(t){return function(){for(let n=0;n<t/4;n++)Rh.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(Rh[n]>0);n++)n===t-1&&(Rh[t-1]=1);return Rh.toString("hex",0,t)}}});var TF=E(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.RandomIdGenerator=nu.BatchSpanProcessor=void 0;var Kde=_F();Object.defineProperty(nu,"BatchSpanProcessor",{enumerable:!0,get:function(){return Kde.BatchSpanProcessor}});var Qde=hF();Object.defineProperty(nu,"RandomIdGenerator",{enumerable:!0,get:function(){return Qde.RandomIdGenerator}})});var QI=E(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.RandomIdGenerator=ru.BatchSpanProcessor=void 0;var EF=TF();Object.defineProperty(ru,"BatchSpanProcessor",{enumerable:!0,get:function(){return EF.BatchSpanProcessor}});Object.defineProperty(ru,"RandomIdGenerator",{enumerable:!0,get:function(){return EF.RandomIdGenerator}})});var SF=E(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.METRIC_OTEL_SDK_SPAN_STARTED=io.METRIC_OTEL_SDK_SPAN_LIVE=io.ATTR_OTEL_SPAN_SAMPLING_RESULT=io.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;io.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";io.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";io.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";io.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var gF=E(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.TracerMetrics=void 0;var Ih=Zc(),wp=SF(),XI=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(wp.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(wp.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,n){let r=Jde(n);if(this.startedSpans.add(1,{[wp.ATTR_OTEL_SPAN_PARENT_ORIGIN]:Xde(e),[wp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r}),n===Ih.SamplingDecision.NOT_RECORD)return()=>{};let o={[wp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};Oh.TracerMetrics=XI;function Xde(t){return t?t.isRemote?"remote":"local":"none"}function Jde(t){switch(t){case Ih.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Ih.SamplingDecision.RECORD:return"RECORD_ONLY";case Ih.SamplingDecision.NOT_RECORD:return"DROP"}}});var AF=E(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.VERSION=void 0;Nh.VERSION="2.6.1"});var RF=E(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.Tracer=void 0;var Nt=(b(),O(v)),bh=Te(),Zde=oF(),e_e=YI(),t_e=QI(),n_e=gF(),r_e=AF(),JI=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,n,r,o){let s=(0,e_e.mergeConfig)(n);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=n.idGenerator||new t_e.RandomIdGenerator,this._resource=r,this._spanProcessor=o,this.instrumentationScope=e;let i=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace",r_e.VERSION):Nt.createNoopMeter();this._tracerMetrics=new n_e.TracerMetrics(i)}startSpan(e,n={},r=Nt.context.active()){n.root&&(r=Nt.trace.deleteSpan(r));let o=Nt.trace.getSpan(r);if((0,bh.isTracingSuppressed)(r))return Nt.diag.debug("Instrumentation suppressed, returning Noop Span"),Nt.trace.wrapSpanContext(Nt.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),i=this._idGenerator.generateSpanId(),a,c,l;!s||!Nt.trace.isSpanContextValid(s)?c=this._idGenerator.generateTraceId():(c=s.traceId,l=s.traceState,a=s);let p=n.kind??Nt.SpanKind.INTERNAL,d=(n.links??[]).map(I=>({context:I.context,attributes:(0,bh.sanitizeAttributes)(I.attributes)})),_=(0,bh.sanitizeAttributes)(n.attributes),f=this._sampler.shouldSample(r,c,e,p,_,d),m=this._tracerMetrics.startSpan(s,f.decision);l=f.traceState??l;let h=f.decision===Nt.SamplingDecision.RECORD_AND_SAMPLED?Nt.TraceFlags.SAMPLED:Nt.TraceFlags.NONE,T={traceId:c,spanId:i,traceFlags:h,traceState:l};if(f.decision===Nt.SamplingDecision.NOT_RECORD)return Nt.diag.debug("Recording is off, propagating context in a non-recording span"),Nt.trace.wrapSpanContext(T);let S=(0,bh.sanitizeAttributes)(Object.assign(_,f.attributes));return new Zde.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:T,name:e,kind:p,links:d,parentSpanContext:a,attributes:S,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Nt.context.active(),l=this.startSpan(e,s,c),p=Nt.trace.setSpan(c,l);return Nt.context.with(p,a,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};Ch.Tracer=JI});var yF=E(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.MultiSpanProcessor=void 0;var o_e=Te(),ZI=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{(0,o_e.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}onEnding(e){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(e)}onEnd(e){for(let n of this._spanProcessors)n.onEnd(e)}shutdown(){let e=[];for(let n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}};Ph.MultiSpanProcessor=ZI});var IF=E(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.BasicTracerProvider=ca.ForceFlushState=void 0;var s_e=Te(),i_e=DI(),a_e=RF(),c_e=$I(),u_e=yF(),l_e=YI(),ou;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(ou=ca.ForceFlushState||(ca.ForceFlushState={}));var eO=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let n=(0,s_e.merge)({},(0,c_e.loadDefaultConfig)(),(0,l_e.reconfigureLimits)(e));this._resource=n.resource??(0,i_e.defaultResource)(),this._config=Object.assign({},n,{resource:this._resource});let r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new u_e.MultiSpanProcessor(r)}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new a_e.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=ou.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==ou.timeout&&(s=ou.resolved,o(s))}).catch(a=>{clearTimeout(i),s=ou.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==ou.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};ca.BasicTracerProvider=eO});var OF=E(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.ConsoleSpanExporter=void 0;var tO=Te(),nO=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,tO.hrTimeToMicroseconds)(e.startTime),duration:(0,tO.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let r of e)console.dir(this._exportInfo(r),{depth:3});if(n)return n({code:tO.ExportResultCode.SUCCESS})}};Mh.ConsoleSpanExporter=nO});var bF=E(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.InMemorySpanExporter=void 0;var NF=Te(),rO=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:NF.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:NF.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};xh.InMemorySpanExporter=rO});var CF=E(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.SimpleSpanProcessor=void 0;var p_e=(b(),O(v)),vh=Te(),oO=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new vh.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,n){}onEnd(e){if(this._shutdownOnce.isCalled||!(e.spanContext().traceFlags&p_e.TraceFlags.SAMPLED))return;let n=this._doExport(e).catch(r=>(0,vh.globalErrorHandler)(r));this._pendingExports.add(n),n.finally(()=>this._pendingExports.delete(n))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let n=await vh.internal._export(this._exporter,[e]);if(n.code!==vh.ExportResultCode.SUCCESS)throw n.error??new Error(`SimpleSpanProcessor: span export failed (status ${n})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};Lh.SimpleSpanProcessor=oO});var PF=E(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.NoopSpanProcessor=void 0;var sO=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};Dh.NoopSpanProcessor=sO});var iO=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.SamplingDecision=Ce.TraceIdRatioBasedSampler=Ce.ParentBasedSampler=Ce.AlwaysOnSampler=Ce.AlwaysOffSampler=Ce.NoopSpanProcessor=Ce.SimpleSpanProcessor=Ce.InMemorySpanExporter=Ce.ConsoleSpanExporter=Ce.RandomIdGenerator=Ce.BatchSpanProcessor=Ce.BasicTracerProvider=void 0;var d_e=IF();Object.defineProperty(Ce,"BasicTracerProvider",{enumerable:!0,get:function(){return d_e.BasicTracerProvider}});var MF=QI();Object.defineProperty(Ce,"BatchSpanProcessor",{enumerable:!0,get:function(){return MF.BatchSpanProcessor}});Object.defineProperty(Ce,"RandomIdGenerator",{enumerable:!0,get:function(){return MF.RandomIdGenerator}});var __e=OF();Object.defineProperty(Ce,"ConsoleSpanExporter",{enumerable:!0,get:function(){return __e.ConsoleSpanExporter}});var f_e=bF();Object.defineProperty(Ce,"InMemorySpanExporter",{enumerable:!0,get:function(){return f_e.InMemorySpanExporter}});var m_e=CF();Object.defineProperty(Ce,"SimpleSpanProcessor",{enumerable:!0,get:function(){return m_e.SimpleSpanProcessor}});var h_e=PF();Object.defineProperty(Ce,"NoopSpanProcessor",{enumerable:!0,get:function(){return h_e.NoopSpanProcessor}});var T_e=ph();Object.defineProperty(Ce,"AlwaysOffSampler",{enumerable:!0,get:function(){return T_e.AlwaysOffSampler}});var E_e=_h();Object.defineProperty(Ce,"AlwaysOnSampler",{enumerable:!0,get:function(){return E_e.AlwaysOnSampler}});var S_e=jI();Object.defineProperty(Ce,"ParentBasedSampler",{enumerable:!0,get:function(){return S_e.ParentBasedSampler}});var g_e=FI();Object.defineProperty(Ce,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return g_e.TraceIdRatioBasedSampler}});var A_e=Zc();Object.defineProperty(Ce,"SamplingDecision",{enumerable:!0,get:function(){return A_e.SamplingDecision}})});var rq=E(uu=>{"use strict";Object.defineProperty(uu,"__esModule",{value:!0});uu.PACKAGE_NAME=uu.PACKAGE_VERSION=void 0;uu.PACKAGE_VERSION="0.24.0";uu.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var sq=E(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.UndiciInstrumentation=void 0;var DO=U("diagnostics_channel"),qme=U("url"),$p=ne(),qn=(b(),O(v)),zh=Te(),ot=(le(),O(Ae)),oq=rq(),UO=class extends $p.InstrumentationBase{_recordFromReq=new WeakMap;constructor(e={}){super(oq.PACKAGE_NAME,oq.PACKAGE_VERSION,e)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs.length=0}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this.subscribeToChannel("undici:request:create",this.onRequestCreated.bind(this)),this.subscribeToChannel("undici:client:sendHeaders",this.onRequestHeaders.bind(this)),this.subscribeToChannel("undici:request:headers",this.onResponseHeaders.bind(this)),this.subscribeToChannel("undici:request:trailers",this.onDone.bind(this)),this.subscribeToChannel("undici:request:error",this.onError.bind(this)))}_updateMetricInstruments(){this._httpClientDurationHistogram=this.meter.createHistogram(ot.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:qn.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){let[r,o]=process.version.replace("v","").split(".").map(a=>Number(a)),s=r>18||r===18&&o>=19,i;if(s)DO.subscribe?.(e,n),i=()=>DO.unsubscribe?.(e,n);else{let a=DO.channel(e);a.subscribe(n),i=()=>a.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:i})}parseRequestHeaders(e){let n=new Map;if(Array.isArray(e.headers))for(let r=0;r<e.headers.length;r+=2){let o=e.headers[r],s=e.headers[r+1];typeof o=="string"&&n.set(o.toLowerCase(),s)}else if(typeof e.headers=="string"){let r=e.headers.split(`\r
|
|
9
|
-
`);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0
|
|
10
|
-
`:Array.isArray(e.headers)&&e.headers.push(se,ve)}this._recordFromReq.set(e,{span:R,attributes:l,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[ot.ATTR_NETWORK_PEER_ADDRESS]:i,[ot.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let l=new Set(o.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=this.parseRequestHeaders(e);for(let[d,_]of p.entries())if(l.has(d)){let f=Array.isArray(_)?_:[_];c[`http.request.header.${d}`]=f}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[ot.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();if((0,$p.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),c=>c&&this._diag.error("caught responseHook error: ",c),!0),a.headersToSpanAttributes?.responseHeaders){let c=new Set;a.headersToSpanAttributes?.responseHeaders.forEach(l=>c.add(l.toLowerCase()));for(let l=0;l<n.headers.length;l=l+2){let p=n.headers[l].toString().toLowerCase(),d=n.headers[l+1];if(c.has(p)){let _=`http.response.header.${p}`;Object.hasOwn(i,_)?i[_].push(d.toString()):i[_]=[d.toString()]}}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?qn.SpanStatusCode.ERROR:qn.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:qn.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[ot.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[ot.ATTR_HTTP_RESPONSE_STATUS_CODE,ot.ATTR_HTTP_REQUEST_METHOD,ot.ATTR_SERVER_ADDRESS,ot.ATTR_SERVER_PORT,ot.ATTR_URL_SCHEME,ot.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,zh.hrTimeToMilliseconds)((0,zh.hrTimeDuration)(n,(0,zh.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};Kh.UndiciInstrumentation=UO});var iq=E(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.UndiciInstrumentation=void 0;var $me=sq();Object.defineProperty(Qh,"UndiciInstrumentation",{enumerable:!0,get:function(){return $me.UndiciInstrumentation}})});var Xh=E(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});Yp.ExpressLayerType=void 0;var Xme;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Xme=Yp.ExpressLayerType||(Yp.ExpressLayerType={}))});var Jh=E(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.AttributeNames=void 0;var Jme;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(Jme=Wp.AttributeNames||(Wp.AttributeNames={}))});var wO=E(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu._LAYERS_STORE_PROPERTY=lu.kLayerPatched=void 0;lu.kLayerPatched=Symbol("express-layer-patched");lu._LAYERS_STORE_PROPERTY="__ot_middlewares"});var _q=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getActualMatchedRoute=st.getConstructedRoute=st.getLayerPath=st.asErrorAndMessage=st.isLayerIgnored=st.getLayerMetadata=st.getRouterPath=st.storeLayerPath=void 0;var kO=Xh(),pu=Jh(),ua=wO(),Zme=(t,e)=>(Array.isArray(t[ua._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ua._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[ua._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));st.storeLayerPath=Zme;var ehe=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,st.getRouterPath)(t,n):t};st.getRouterPath=ehe;var the=(t,e,n)=>{if(e.name==="router"){let r=(0,st.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[pu.AttributeNames.EXPRESS_NAME]:o,[pu.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[pu.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[pu.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[pu.AttributeNames.EXPRESS_NAME]:e.name,[pu.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};st.getLayerMetadata=the;var nhe=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},rhe=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(nhe(t,r))return!0}catch{}return!1};st.isLayerIgnored=rhe;var ohe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];st.asErrorAndMessage=ohe;var she=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>pq(n)||"").join(","):pq(e)};st.getLayerPath=she;var pq=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function dq(t){let n=(Array.isArray(t[ua._LAYERS_STORE_PROPERTY])?t[ua._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}st.getConstructedRoute=dq;function ihe(t){let e=Array.isArray(t[ua._LAYERS_STORE_PROPERTY])?t[ua._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=dq(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||ahe(r))?r:void 0}st.getActualMatchedRoute=ihe;function ahe(t){return t.includes(":")||t.includes("*")}});var fq=E(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.PACKAGE_NAME=du.PACKAGE_VERSION=void 0;du.PACKAGE_VERSION="0.62.0";du.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var Sq=E(eT=>{"use strict";Object.defineProperty(eT,"__esModule",{value:!0});eT.ExpressInstrumentation=void 0;var mq=Te(),Nn=(b(),O(v)),hq=Xh(),Tq=Jh(),uo=_q(),Eq=fq(),_u=ne(),che=(le(),O(Ae)),Zh=wO(),GO=class extends _u.InstrumentationBase{constructor(e={}){super(Eq.PACKAGE_NAME,Eq.PACKAGE_VERSION,e)}init(){return[new _u.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,_u.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,_u.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,_u.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,uo.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[Zh.kLayerPatched]!==!0&&(e[Zh.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,uo.storeLayerPath)(i,n),l=(0,uo.getConstructedRoute)(i),p=(0,uo.getActualMatchedRoute)(i),d={[che.ATTR_HTTP_ROUTE]:p},_=(0,uo.getLayerMetadata)(l,e,n),f=_.attributes[Tq.AttributeNames.EXPRESS_TYPE],m=(0,mq.getRPCMetadata)(Nn.context.active());if(m?.type===mq.RPCType.HTTP&&(m.route=p),(0,uo.isLayerIgnored)(_.name,f,r.getConfig()))return f===hq.ExpressLayerType.MIDDLEWARE&&i[Zh._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(Nn.trace.getSpan(Nn.context.active())===void 0)return o.apply(this,arguments);let h=r._getSpanName({request:i,layerType:f,route:l},_.name),T=r.tracer.startSpan(h,{attributes:Object.assign(d,_.attributes)}),S=Nn.context.active(),R=Nn.trace.setSpan(S,T),{requestHook:I}=r.getConfig();I&&(0,_u.safeExecuteInTheMiddle)(()=>I(T,{request:i,layerType:f,route:l}),ve=>{ve&&Nn.diag.error("express instrumentation: request hook failed",ve)},!0);let x=!1;_.attributes[Tq.AttributeNames.EXPRESS_TYPE]===hq.ExpressLayerType.ROUTER&&(T.end(),x=!0,R=S);let F=()=>{x===!1&&(x=!0,T.end())},B=Array.from(arguments),se=B.findIndex(ve=>typeof ve=="function");se>=0&&(arguments[se]=function(){let ve=arguments[0],on=![void 0,null,"route","router"].includes(ve);if(!x&&on){let[$a,Ya]=(0,uo.asErrorAndMessage)(ve);T.recordException($a),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Ya})}x===!1&&(x=!0,i.res?.removeListener("finish",F),T.end()),!(i.route&&on)&&c&&i[Zh._LAYERS_STORE_PROPERTY].pop();let Io=B[se],ss=Nn.context.active(),yi=Nn.trace.getSpan(S),Et=yi?Nn.trace.setSpan(ss,yi):ss;return Nn.context.bind(Et,Io).apply(this,arguments)});try{return Nn.context.bind(R,o).apply(this,arguments)}catch(ve){let[on,Io]=(0,uo.asErrorAndMessage)(ve);throw T.recordException(on),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Io}),ve}finally{x||a.once("finish",F)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return Nn.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};eT.ExpressInstrumentation=GO});var gq=E(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.AttributeNames=Hs.ExpressLayerType=Hs.ExpressInstrumentation=void 0;var uhe=Sq();Object.defineProperty(Hs,"ExpressInstrumentation",{enumerable:!0,get:function(){return uhe.ExpressInstrumentation}});var lhe=Xh();Object.defineProperty(Hs,"ExpressLayerType",{enumerable:!0,get:function(){return lhe.ExpressLayerType}});var phe=Jh();Object.defineProperty(Hs,"AttributeNames",{enumerable:!0,get:function(){return phe.AttributeNames}})});var Oq=E(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.SeverityNumber=void 0;var mhe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(mhe=zp.SeverityNumber||(zp.SeverityNumber={}))});var rT=E(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.NOOP_LOGGER=fu.NoopLogger=void 0;var nT=class{emit(e){}};fu.NoopLogger=nT;fu.NOOP_LOGGER=new nT});var Nq=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.API_BACKWARDS_COMPATIBILITY_VERSION=lo.makeGetter=lo._global=lo.GLOBAL_LOGS_API_KEY=void 0;lo.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");lo._global=globalThis;function hhe(t,e,n){return r=>r===t?e:n}lo.makeGetter=hhe;lo.API_BACKWARDS_COMPATIBILITY_VERSION=1});var BO=E(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.NOOP_LOGGER_PROVIDER=mu.NoopLoggerProvider=void 0;var The=rT(),oT=class{getLogger(e,n,r){return new The.NoopLogger}};mu.NoopLoggerProvider=oT;mu.NOOP_LOGGER_PROVIDER=new oT});var bq=E(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});sT.ProxyLogger=void 0;var Ehe=rT(),jO=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ehe.NOOP_LOGGER}};sT.ProxyLogger=jO});var Cq=E(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});iT.ProxyLoggerProvider=void 0;var She=BO(),ghe=bq(),HO=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new ghe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:She.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};iT.ProxyLoggerProvider=HO});var Mq=E(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.LogsAPI=void 0;var ar=Nq(),Ahe=BO(),Pq=Cq(),FO=class t{constructor(){this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ar._global[ar.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ar._global[ar.GLOBAL_LOGS_API_KEY]=(0,ar.makeGetter)(ar.API_BACKWARDS_COMPATIBILITY_VERSION,e,Ahe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=ar._global[ar.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ar._global,ar.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete ar._global[ar.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}};aT.LogsAPI=FO});var VO=E(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.logs=po.NoopLogger=po.NOOP_LOGGER=po.SeverityNumber=void 0;var Rhe=Oq();Object.defineProperty(po,"SeverityNumber",{enumerable:!0,get:function(){return Rhe.SeverityNumber}});var xq=rT();Object.defineProperty(po,"NOOP_LOGGER",{enumerable:!0,get:function(){return xq.NOOP_LOGGER}});Object.defineProperty(po,"NoopLogger",{enumerable:!0,get:function(){return xq.NoopLogger}});var yhe=Mq();po.logs=yhe.LogsAPI.getInstance()});var vq=E(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.disableInstrumentations=hu.enableInstrumentations=void 0;function Ihe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}hu.enableInstrumentations=Ihe;function Ohe(t){t.forEach(e=>e.disable())}hu.disableInstrumentations=Ohe});var Uq=E(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.registerInstrumentations=void 0;var Lq=(b(),O(v)),Nhe=VO(),Dq=vq();function bhe(t){let e=t.tracerProvider||Lq.trace.getTracerProvider(),n=t.meterProvider||Lq.metrics.getMeterProvider(),r=t.loggerProvider||Nhe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,Dq.enableInstrumentations)(o,e,n,r),()=>{(0,Dq.disableInstrumentations)(o)}}cT.registerInstrumentations=bhe});var qq=E(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.satisfies=void 0;var WO=(b(),O(v)),jq=/^(?: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-]+)*))?$/,Che=/^(?<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-]+)*))?$/,Phe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Mhe(t,e,n){if(!xhe(t))return WO.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Uhe(t);if(!r)return!1;let o=[],s=Hq(r,e,o,n);return s&&!n?.includePrerelease?Lhe(r,o):s}uT.satisfies=Mhe;function xhe(t){return typeof t=="string"&&jq.test(t)}function Hq(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(qO(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=nTe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!qO(t,s,n,r))return!1;return!0}return qO(t,e,n,r)}function qO(t,e,n,r){if(e=Dhe(e,r),e.includes(" "))return Hq(t,e,n,r);{let o=whe(e);return n.push(o),vhe(t,o)}}function vhe(t,e){if(e.invalid)return!1;if(!e.version||YO(e.version))return!0;let n=kq(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=kq(r,o)}return Phe[e.op]?.includes(n)}function Lhe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Dhe(t,e){return t=t.trim(),t=eTe(t,e),t=Zhe(t),t=tTe(t,e),t=t.trim(),t}function _n(t){return!t||t.toLowerCase()==="x"||t==="*"}function Uhe(t){let e=t.match(jq);if(!e){WO.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function whe(t){if(!t)return{};let e=t.match(Che);if(!e)return WO.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function YO(t){return t==="*"||t==="x"||t==="X"}function wq(t){let e=parseInt(t,10);return isNaN(e)?t:e}function khe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Ghe(t,e){if(YO(t)||YO(e))return 0;let[n,r]=khe(wq(t),wq(e));return n>r?1:n<r?-1:0}function kq(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Ghe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var Fq="[a-zA-Z0-9-]",Vq="0|[1-9]\\d*",Bhe=`\\d*[a-zA-Z-]${Fq}*`,jhe="((?:<|>)?=?)",Gq=`(?:${Vq}|${Bhe})`,Hhe=`(?:-(${Gq}(?:\\.${Gq})*))`,Bq=`${Fq}+`,Fhe=`(?:\\+(${Bq}(?:\\.${Bq})*))`,$O=`${Vq}|x|X|\\*`,Kp=`[v=\\s]*(${$O})(?:\\.(${$O})(?:\\.(${$O})(?:${Hhe})?${Fhe}?)?)?`,Vhe=`^${jhe}\\s*${Kp}$`,qhe=new RegExp(Vhe),$he=`^\\s*(${Kp})\\s+-\\s+(${Kp})\\s*$`,Yhe=new RegExp($he),Whe="(?:~>?)",zhe=`^${Whe}${Kp}$`,Khe=new RegExp(zhe),Qhe="(?:\\^)",Xhe=`^${Qhe}${Kp}$`,Jhe=new RegExp(Xhe);function Zhe(t){let e=Khe;return t.replace(e,(n,r,o,s,i)=>{let a;return _n(r)?a="":_n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:_n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function eTe(t,e){let n=Jhe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return _n(s)?l="":_n(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:_n(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function tTe(t,e){let n=qhe;return t.replace(n,(r,o,s,i,a,c)=>{let l=_n(s),p=l||_n(i),d=p||_n(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function nTe(t,e){let n=Yhe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(_n(s)?o="":_n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:_n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,_n(d)?p="":_n(_)?p=`<${+d+1}.0.0-0`:_n(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var zO=E(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.massUnwrap=Bt.unwrap=Bt.massWrap=Bt.wrap=void 0;var fn=console.error.bind(console);function Qp(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var rTe=(t,e,n)=>{if(!t||!t[e]){fn("no original function "+String(e)+" to wrap");return}if(!n){fn("no wrapper function"),fn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){fn("original object and wrapper must be functions");return}let o=n(r,e);return Qp(o,"__original",r),Qp(o,"__unwrap",()=>{t[e]===o&&Qp(t,e,r)}),Qp(o,"__wrapped",!0),Qp(t,e,o),o};Bt.wrap=rTe;var oTe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Bt.wrap)(r,o,n)})})};Bt.massWrap=oTe;var sTe=(t,e)=>{if(!t||!t[e]){fn("no function to unwrap."),fn(new Error().stack);return}let n=t[e];if(!n.__unwrap)fn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Bt.unwrap=sTe;var iTe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Bt.unwrap)(n,r)})})};Bt.massUnwrap=iTe;function Xp(t){t&&t.logger&&(typeof t.logger!="function"?fn("new logger isn't a function, not replacing"):fn=t.logger)}Bt.default=Xp;Xp.wrap=Bt.wrap;Xp.massWrap=Bt.massWrap;Xp.unwrap=Bt.unwrap;Xp.massUnwrap=Bt.massUnwrap});var $q=E(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});pT.InstrumentationAbstract=void 0;var KO=(b(),O(v)),aTe=VO(),lT=zO(),QO=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=KO.diag.createComponentLogger({namespace:e}),this._tracer=KO.trace.getTracer(e,n),this._meter=KO.metrics.getMeter(e,n),this._logger=aTe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=lT.wrap;_unwrap=lT.unwrap;_massWrap=lT.massWrap;_massUnwrap=lT.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};pT.InstrumentationAbstract=QO});var Yq=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ModuleNameTrie=Fs.ModuleNameSeparator=void 0;Fs.ModuleNameSeparator="/";var dT=class{hooks=[];children=new Map},XO=class{_trie=new dT;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Fs.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new dT,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(Fs.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};Fs.ModuleNameTrie=XO});var zq=E(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0});_T.RequireInTheMiddleSingleton=void 0;var cTe=wi(),Wq=U("path"),JO=Yq(),uTe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),ZO=class t{_moduleNameTrie=new JO.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new cTe.Hook(null,{internals:!0},(e,n,r)=>{let o=lTe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return uTe?new t:this._instance=this._instance??new t}};_T.RequireInTheMiddleSingleton=ZO;function lTe(t){return Wq.sep!==JO.ModuleNameSeparator?t.split(Wq.sep).join(JO.ModuleNameSeparator):t}});var Zq=E(Jp=>{var Kq=[],eN=new WeakMap,Qq=new WeakMap,Xq=new Map,Jq=[],pTe={set(t,e,n){let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Qq.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function dTe(t,e,n,r,o){Xq.set(t,o),eN.set(e,n),Qq.set(e,r);let s=new Proxy(e,pTe);Kq.forEach(i=>i(t,s,o)),Jq.push([t,s,o])}Jp.register=dTe;Jp.importHooks=Kq;Jp.specifiers=Xq;Jp.toHook=Jq});var oN=E((gKe,Eu)=>{var e$=U("path"),_Te=mf(),{fileURLToPath:fTe}=U("url"),{MessageChannel:mTe}=U("worker_threads"),{isBuiltin:tN}=U("module");tN||(tN=()=>!0);var{importHooks:nN,specifiers:hTe,toHook:TTe}=Zq();function t$(t){nN.push(t),TTe.forEach(([e,n,r])=>t(e,n,r))}function n$(t){let e=nN.indexOf(t);e>-1&&nN.splice(e,1)}function Tu(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var rN;function ETe(){let{port1:t,port2:e}=new mTe,n=0,r;rN=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Zp(t,e,n){if(!(this instanceof Zp))return new Zp(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;rN&&Array.isArray(t)&&rN(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);tN(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=fTe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=_Te(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)Tu(n,s,l,void 0);else if(d===o){if(!p)Tu(n,s,o,p);else if(p.endsWith(hTe.get(a)))Tu(n,s,o,p);else if(r){let _=o+e$.sep+e$.relative(p,l);Tu(n,s,_,p)}}else d===i&&Tu(n,s,i,p);else Tu(n,s,o,p)},t$(this._iitmHook)}Zp.prototype.unhook=function(){n$(this._iitmHook)};Eu.exports=Zp;Eu.exports.Hook=Zp;Eu.exports.addHook=t$;Eu.exports.removeHook=n$;Eu.exports.createAddHookMessageChannel=ETe});var sN=E(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isWrapped=Vs.safeExecuteInTheMiddleAsync=Vs.safeExecuteInTheMiddle=void 0;function STe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddle=STe;async function gTe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddleAsync=gTe;function ATe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Vs.isWrapped=ATe});var s$=E(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.InstrumentationBase=void 0;var ed=U("path"),r$=U("util"),RTe=qq(),iN=zO(),yTe=$q(),ITe=zq(),OTe=oN(),td=(b(),O(v)),NTe=wi(),bTe=U("fs"),CTe=sN(),aN=class extends yTe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=ITe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,CTe.isWrapped)(e[n])&&this._unwrap(e,n),r$.types.isProxy(e)){let o=(0,iN.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,iN.wrap)(e,n,r)};_unwrap=(e,n)=>r$.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,iN.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{td.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){td.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{td.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){td.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,bTe.readFileSync)(ed.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{td.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return o$(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=ed.normalize(r);return i.filter(l=>l.name===a&&o$(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&ed.isAbsolute(a)){let l=ed.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=ed.isAbsolute(e.name)?new NTe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new OTe.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};fT.InstrumentationBase=aN;function o$(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,RTe.satisfies)(e,r,{includePrerelease:n}))}});var i$=E(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.normalize=void 0;var PTe=U("path");Object.defineProperty(mT,"normalize",{enumerable:!0,get:function(){return PTe.normalize}})});var a$=E(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.normalize=Su.InstrumentationBase=void 0;var MTe=s$();Object.defineProperty(Su,"InstrumentationBase",{enumerable:!0,get:function(){return MTe.InstrumentationBase}});var xTe=i$();Object.defineProperty(Su,"normalize",{enumerable:!0,get:function(){return xTe.normalize}})});var cN=E(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.normalize=gu.InstrumentationBase=void 0;var c$=a$();Object.defineProperty(gu,"InstrumentationBase",{enumerable:!0,get:function(){return c$.InstrumentationBase}});Object.defineProperty(gu,"normalize",{enumerable:!0,get:function(){return c$.normalize}})});var u$=E(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.InstrumentationNodeModuleDefinition=void 0;var uN=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};hT.InstrumentationNodeModuleDefinition=uN});var l$=E(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.InstrumentationNodeModuleFile=void 0;var vTe=cN(),lN=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,vTe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};TT.InstrumentationNodeModuleFile=lN});var p$=E(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.semconvStabilityFromStr=la.SemconvStability=void 0;var ET;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(ET=la.SemconvStability||(la.SemconvStability={}));function LTe(t,e){let n=ET.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=ET.DUPLICATE;break}else o.toLowerCase()===t&&(n=ET.STABLE);return n}la.semconvStabilityFromStr=LTe});var _$=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.semconvStabilityFromStr=it.SemconvStability=it.safeExecuteInTheMiddleAsync=it.safeExecuteInTheMiddle=it.isWrapped=it.InstrumentationNodeModuleFile=it.InstrumentationNodeModuleDefinition=it.InstrumentationBase=it.registerInstrumentations=void 0;var DTe=Uq();Object.defineProperty(it,"registerInstrumentations",{enumerable:!0,get:function(){return DTe.registerInstrumentations}});var UTe=cN();Object.defineProperty(it,"InstrumentationBase",{enumerable:!0,get:function(){return UTe.InstrumentationBase}});var wTe=u$();Object.defineProperty(it,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return wTe.InstrumentationNodeModuleDefinition}});var kTe=l$();Object.defineProperty(it,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return kTe.InstrumentationNodeModuleFile}});var pN=sN();Object.defineProperty(it,"isWrapped",{enumerable:!0,get:function(){return pN.isWrapped}});Object.defineProperty(it,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddle}});Object.defineProperty(it,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddleAsync}});var d$=p$();Object.defineProperty(it,"SemconvStability",{enumerable:!0,get:function(){return d$.SemconvStability}});Object.defineProperty(it,"semconvStabilityFromStr",{enumerable:!0,get:function(){return d$.semconvStabilityFromStr}})});var f$=E((xKe,GTe)=>{GTe.exports={name:"@fastify/otel",version:"0.18.0",description:"Official Fastify OpenTelemetry Instrumentation",main:"index.js",type:"commonjs",types:"types/index.d.ts",scripts:{lint:"eslint","lint:fix":"eslint --fix",test:"npm run test:all && npm run test:typescript","test:unit":"c8 --100 node --test","test:all":"npm run test:v4 && npm run test:v5","test:v4":"cross-env FASTIFY_VERSION=fastifyv4 npm run test:unit","test:v5":"cross-env FASTIFY_VERSION=fastify npm run test:unit","test:coverage":"c8 node --test && c8 report --reporter=html","test:typescript":"tsd"},repository:{type:"git",url:"git+https://github.com/fastify/otel.git"},keywords:["plugin","helper","fastify","instrumentation","otel","opentelemetry"],author:"Carlos Fuentes - @metcoder95 (https://metcoder.dev)",license:"MIT",bugs:{url:"https://github.com/fastify/otel/issues"},homepage:"https://github.com/fastify/otel#readme",funding:[{type:"github",url:"https://github.com/sponsors/fastify"},{type:"opencollective",url:"https://opencollective.com/fastify"}],devDependencies:{"@fastify/type-provider-typebox":"^6.1.0","@opentelemetry/context-async-hooks":"^2.0.0","@opentelemetry/contrib-test-utils":"^0.59.0","@opentelemetry/instrumentation-http":"^0.212.0","@opentelemetry/propagator-jaeger":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.2.0","@types/node":"^25.0.3",c8:"^11.0.0","cross-env":"^10.0.0",eslint:"^9.16.0",fastify:"^5.1.0","fastify-plugin":"^5.1.0",fastifyv4:"npm:fastify@^4.0.0",neostandard:"^0.12.0",tsd:"^0.33.0"},dependencies:{"@opentelemetry/core":"^2.0.0","@opentelemetry/instrumentation":"^0.212.0","@opentelemetry/semantic-conventions":"^1.28.0",minimatch:"^10.2.4"},peerDependencies:{"@opentelemetry/api":"^1.9.0"},tsd:{directory:"types"}}});var h$=E(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.range=pa.balanced=void 0;var BTe=(t,e,n)=>{let r=t instanceof RegExp?m$(t,n):t,o=e instanceof RegExp?m$(e,n):e,s=r!==null&&o!=null&&(0,pa.range)(r,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+o.length)}};pa.balanced=BTe;var m$=(t,e)=>{let n=e.match(t);return n?n[0]:null},jTe=(t,e,n)=>{let r,o,s,i,a,c=n.indexOf(t),l=n.indexOf(e,c+1),p=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;p>=0&&!a;){if(p===c)r.push(p),c=n.indexOf(t,p+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else o=r.pop(),o!==void 0&&o<s&&(s=o,i=l),l=n.indexOf(e,p+1);p=c<l&&c>=0?c:l}r.length&&i!==void 0&&(a=[s,i])}return a};pa.range=jTe});var y$=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.EXPANSION_MAX=void 0;Au.expand=ZTe;var T$=h$(),E$="\0SLASH"+Math.random()+"\0",S$="\0OPEN"+Math.random()+"\0",_N="\0CLOSE"+Math.random()+"\0",g$="\0COMMA"+Math.random()+"\0",A$="\0PERIOD"+Math.random()+"\0",HTe=new RegExp(E$,"g"),FTe=new RegExp(S$,"g"),VTe=new RegExp(_N,"g"),qTe=new RegExp(g$,"g"),$Te=new RegExp(A$,"g"),YTe=/\\\\/g,WTe=/\\{/g,zTe=/\\}/g,KTe=/\\,/g,QTe=/\\\./g;Au.EXPANSION_MAX=1e5;function dN(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function XTe(t){return t.replace(YTe,E$).replace(WTe,S$).replace(zTe,_N).replace(KTe,g$).replace(QTe,A$)}function JTe(t){return t.replace(HTe,"\\").replace(FTe,"{").replace(VTe,"}").replace(qTe,",").replace($Te,".")}function R$(t){if(!t)return[""];let e=[],n=(0,T$.balanced)("{","}",t);if(!n)return t.split(",");let{pre:r,body:o,post:s}=n,i=r.split(",");i[i.length-1]+="{"+o+"}";let a=R$(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function ZTe(t,e={}){if(!t)return[];let{max:n=Au.EXPANSION_MAX}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),nd(XTe(t),n,!0).map(JTe)}function eEe(t){return"{"+t+"}"}function tEe(t){return/^-?0\d/.test(t)}function nEe(t,e){return t<=e}function rEe(t,e){return t>=e}function nd(t,e,n){let r=[],o=(0,T$.balanced)("{","}",t);if(!o)return[t];let s=o.pre,i=o.post.length?nd(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(let a=0;a<i.length&&a<e;a++){let c=s+"{"+o.body+"}"+i[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),l=a||c,p=o.body.indexOf(",")>=0;if(!l&&!p)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+_N+o.post,nd(t,e,!0)):[t];let d;if(l)d=o.body.split(/\.\./);else if(d=R$(o.body),d.length===1&&d[0]!==void 0&&(d=nd(d[0],e,!1).map(eEe),d.length===1))return i.map(f=>o.pre+d[0]+f);let _;if(l&&d[0]!==void 0&&d[1]!==void 0){let f=dN(d[0]),m=dN(d[1]),h=Math.max(d[0].length,d[1].length),T=d.length===3&&d[2]!==void 0?Math.abs(dN(d[2])):1,S=nEe;m<f&&(T*=-1,S=rEe);let I=d.some(tEe);_=[];for(let x=f;S(x,m);x+=T){let F;if(c)F=String.fromCharCode(x),F==="\\"&&(F="");else if(F=String(x),I){let B=h-F.length;if(B>0){let se=new Array(B+1).join("0");x<0?F="-"+se+F.slice(1):F=se+F}}_.push(F)}}else{_=[];for(let f=0;f<d.length;f++)_.push.apply(_,nd(d[f],e,!1))}for(let f=0;f<_.length;f++)for(let m=0;m<i.length&&r.length<e;m++){let h=s+_[f]+i[m];(!n||l||h)&&r.push(h)}}return r}});var I$=E(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0});ST.assertValidPattern=void 0;var oEe=1024*64,sEe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>oEe)throw new TypeError("pattern is too long")};ST.assertValidPattern=sEe});var N$=E(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.parseClass=void 0;var iEe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},rd=t=>t.replace(/[[\]\\-]/g,"\\$&"),aEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),O$=t=>t.join(""),cEe=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,l=!1,p=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+1){l=!0,s++;continue}if(h==="]"&&i&&!c){p=s+1;break}if(i=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[S,R,I]]of Object.entries(iEe))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-n,!0];s+=T.length,I?o.push(S):r.push(S),a=a||R;continue e}}if(c=!1,d){h>d?r.push(rd(d)+"-"+rd(h)):h===d&&r.push(rd(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(rd(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(rd(h)),s++}if(p<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[aEe(h),!1,p-n,!1]}let _="["+(l?"^":"")+O$(r)+"]",f="["+(l?"":"^")+O$(o)+"]";return[r.length&&o.length?"("+_+"|"+f+")":r.length?_:f,a,p-n,!0]};gT.parseClass=cEe});var RT=E(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});AT.unescape=void 0;var uEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");AT.unescape=uEe});var hN=E(NT=>{"use strict";var bn;Object.defineProperty(NT,"__esModule",{value:!0});NT.AST=void 0;var lEe=N$(),yT=RT(),pEe=new Set(["!","?","+","*","@"]),fN=t=>pEe.has(t),b$=t=>fN(t.type),dEe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),_Ee=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fEe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),C$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),mEe="(?!(?:^|/)\\.\\.?(?:$|/))",IT="(?!\\.)",hEe=new Set(["[","."]),TEe=new Set(["..","."]),EEe=new Set("().*{}+?[]^$\\!"),SEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mN="[^/]",P$=mN+"*?",M$=mN+"+?",gEe=0,OT=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;id=++gEe;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#i=this.#e.map(e=>String(e)).join("")}#T(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let o=n.#a+1;!r.type&&o<r.#e.length;o++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[o])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof bn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof bn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new bn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#p(e,n,r,o,s){let i=o.maxExtglobRecursion??2,a=!1,c=!1,l=-1,p=!1;if(n.type===null){let h=r,T="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,T+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(p=!0):S==="]"&&!(h===l+2&&p)&&(c=!1),T+=S;continue}else if(S==="["){c=!0,l=h,p=!1,T+=S;continue}if(!o.noext&&fN(S)&&e.charAt(h)==="("&&s<=i){n.push(T),T="";let I=new bn(S,n);h=bn.#p(e,I,h,o,s+1),n.push(I);continue}T+=S}return n.push(T),h}let d=r+1,_=new bn(null,n),f=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(p=!0):h==="]"&&!(d===l+2&&p)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,p=!1,m+=h;continue}if(!o.noext&&fN(h)&&e.charAt(d)==="("&&(s<=i||n&&n.#d(h))){let S=n&&n.#d(h)?0:1;_.push(m),m="";let R=new bn(h,_);_.push(R),d=bn.#p(e,R,d,o,s+S);continue}if(h==="|"){_.push(m),m="",f.push(_),_=new bn(null,n);continue}if(h===")")return m===""&&n.#e.length===0&&(n.#l=!0),_.push(m),m="",n.push(...f,_),d;m+=h}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],d}#E(e){return this.#f(e,_Ee)}#f(e,n=dEe){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#d(r.type,n)}#d(e,n=fEe){return!!n.get(this.type)?.includes(e)}#S(e,n){let r=e.#e[0],o=new bn(null,r,this.options);o.#e.push(""),r.push(o),this.#m(e,n)}#m(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let o of r.#e)typeof o=="object"&&(o.#t=this);this.#i=void 0}#g(e){return!!C$.get(this.type)?.has(e)}#A(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type)}#R(e){let n=C$.get(this.type),r=e.#e[0],o=n?.get(r.type);if(!o)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=o,this.#i=void 0,this.#l=!1}static fromGlob(e,n={}){let r=new bn(null,void 0,n);return bn.#p(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#_(),this.#T()),!b$(this)){let c=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),l=this.#e.map(f=>{let[m,h,T,S]=typeof f=="string"?bn.#y(f,this.#r,c):f.toRegExpSource(e);return this.#r=this.#r||T,this.#o=this.#o||S,m}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&TEe.has(this.#e[0]))){let m=hEe,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!n&&!e&&m.has(l.charAt(0));p=h?mEe:T?IT:""}let d="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(d="(?:$|\\/)"),[p+l+d,(0,yT.unescape)(l),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#e=[c],l.type=null,l.#r=void 0,[c,(0,yT.unescape)(this.toString()),!1,!1]}let i=!r||e||n||!IT?"":this.#h(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?IT:"")+M$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?IT:"")+P$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,(0,yT.unescape)(s),this.#r=!!this.#r,this.#o]}#_(){if(b$(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let o=this.#e[r];typeof o=="object"&&(o.#_(),this.#f(o)?(n=!1,this.#m(o,r)):this.#E(o)?(n=!1,this.#S(o,r)):this.#A(o)&&(n=!1,this.#R(o)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#_();this.#i=void 0}#h(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#y(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(o){o=!1,s+=(EEe.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?M$:P$,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(l==="["){let[p,d,_,f]=(0,lEe.parseClass)(e,c);if(_){s+=p,i=i||d,c+=_-1,n=n||f;continue}}if(l==="?"){s+=mN,n=!0;continue}s+=SEe(l)}return[s,(0,yT.unescape)(e),!!n,i]}};NT.AST=OT;bn=OT});var TN=E(bT=>{"use strict";Object.defineProperty(bT,"__esModule",{value:!0});bT.escape=void 0;var AEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");bT.escape=AEe});var k$=E(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var REe=y$(),CT=I$(),L$=hN(),yEe=TN(),IEe=RT(),OEe=(t,e,n={})=>((0,CT.assertValidPattern)(e),!n.nocomment&&e.charAt(0)==="#"?!1:new da(e,n).match(t));k.minimatch=OEe;var NEe=/^\*+([^+@!?\*\[\(]*)$/,bEe=t=>e=>!e.startsWith(".")&&e.endsWith(t),CEe=t=>e=>e.endsWith(t),PEe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),MEe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),xEe=/^\*+\.\*+$/,vEe=t=>!t.startsWith(".")&&t.includes("."),LEe=t=>t!=="."&&t!==".."&&t.includes("."),DEe=/^\.\*+$/,UEe=t=>t!=="."&&t!==".."&&t.startsWith("."),wEe=/^\*+$/,kEe=t=>t.length!==0&&!t.startsWith("."),GEe=t=>t.length!==0&&t!=="."&&t!=="..",BEe=/^\?+([^+@!?\*\[\(]*)?$/,jEe=([t,e=""])=>{let n=D$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},HEe=([t,e=""])=>{let n=U$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},FEe=([t,e=""])=>{let n=U$([t]);return e?r=>n(r)&&r.endsWith(e):n},VEe=([t,e=""])=>{let n=D$([t]);return e?r=>n(r)&&r.endsWith(e):n},D$=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},U$=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},w$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",x$={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=w$==="win32"?x$.win32.sep:x$.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var qEe="[^/]",$Ee=qEe+"*?",YEe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",WEe="(?:(?!(?:\\/|^)\\.).)*?",zEe=(t,e={})=>n=>(0,k.minimatch)(n,t,e);k.filter=zEe;k.minimatch.filter=k.filter;var cr=(t,e={})=>Object.assign({},t,e),KEe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return k.minimatch;let e=k.minimatch;return Object.assign((r,o,s={})=>e(r,o,cr(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,cr(t,s))}static defaults(o){return e.defaults(cr(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,cr(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,cr(t,s))}},unescape:(r,o={})=>e.unescape(r,cr(t,o)),escape:(r,o={})=>e.escape(r,cr(t,o)),filter:(r,o={})=>e.filter(r,cr(t,o)),defaults:r=>e.defaults(cr(t,r)),makeRe:(r,o={})=>e.makeRe(r,cr(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,cr(t,o)),match:(r,o,s={})=>e.match(r,o,cr(t,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=KEe;k.minimatch.defaults=k.defaults;var QEe=(t,e={})=>((0,CT.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,REe.expand)(t,{max:e.braceExpandMax}));k.braceExpand=QEe;k.minimatch.braceExpand=k.braceExpand;var XEe=(t,e={})=>new da(t,e).makeRe();k.makeRe=XEe;k.minimatch.makeRe=k.makeRe;var JEe=(t,e,n={})=>{let r=new da(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};k.match=JEe;k.minimatch.match=k.match;var v$=/[?*]|[+@!]\(.*?\)|\[|\]/,ZEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),da=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){(0,CT.assertValidPattern)(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||w$,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!v$.test(s[2]))&&!v$.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],l=r[o+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(o,1);let p=r.slice(0);p[o]="**",e.push(p),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,_=p?3:l?0:void 0;if(typeof d=="number"&&typeof _=="number"){let[f,m]=[e[d],n[_]];f.toLowerCase()===m.toLowerCase()&&(n[_]=f,s=_,o=d)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(k.GLOBSTAR)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(k.GLOBSTAR,s),a=n.lastIndexOf(k.GLOBSTAR),[c,l,p]=r?[n.slice(s,i),n.slice(i+1),[]]:[n.slice(s,i),n.slice(i+1,a),n.slice(a+1)];if(c.length){let R=e.slice(o,o+c.length);if(!this.#o(R,c,r,0,0))return!1;o+=c.length,s+=c.length}let d=0;if(p.length){if(p.length+o>e.length)return!1;let R=e.length-p.length;if(this.#o(e,p,r,R,0))d=p.length;else{if(e[e.length-1]!==""||o+p.length===e.length||(R--,!this.#o(e,p,r,R,0)))return!1;d=p.length+1}}if(!l.length){let R=!!d;for(let I=o;I<e.length-d;I++){let x=String(e[I]);if(R=!0,x==="."||x===".."||!this.options.dot&&x.startsWith("."))return!1}return r||R}let _=[[[],0]],f=_[0],m=0,h=[0];for(let R of l)R===k.GLOBSTAR?(h.push(m),f=[[],0],_.push(f)):(f[0].push(R),m++);let T=_.length-1,S=e.length-d;for(let R of _)R[1]=S-(h[T--]+R[0].length);return!!this.#r(e,_,o,0,r,0,!!d)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let d=r;d<e.length;d++){a=!0;let _=e[d];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return a}let[l,p]=c;for(;r<=p;){if(this.#o(e.slice(0,r+l.length),l,s,r,0)&&i<this.maxGlobstarRecursion){let f=this.#r(e,n,r+l.length,o+1,s,i+1,a);if(f!==!1)return f}let _=e[r];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,l;for(i=o,a=s,l=e.length,c=n.length;i<l&&a<c;i++,a++){this.debug("matchOne loop");let p=n[a],d=e[i];if(this.debug(n,p,d),p===!1||p===k.GLOBSTAR)return!1;let _;if(typeof p=="string"?(_=d===p,this.debug("string match",p,d,_)):(_=p.test(d),this.debug("pattern match",p,d,_)),!_)return!1}if(i===l&&a===c)return!0;if(i===l)return r;if(a===c)return i===l-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,CT.assertValidPattern)(e);let n=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let r,o=null;(r=e.match(wEe))?o=n.dot?GEe:kEe:(r=e.match(NEe))?o=(n.nocase?n.dot?MEe:PEe:n.dot?CEe:bEe)(r[1]):(r=e.match(BEe))?o=(n.nocase?n.dot?HEe:jEe:n.dot?FEe:VEe)(r):(r=e.match(xEe))?o=n.dot?LEe:vEe:(r=e.match(DEe))&&(o=UEe);let s=L$.AST.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?$Ee:n.dot?YEe:WEe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let _ of d.flags.split(""))o.add(_);return typeof d=="string"?ZEe(d):d===k.GLOBSTAR?k.GLOBSTAR:d._src});l.forEach((d,_)=>{let f=l[_+1],m=l[_-1];d!==k.GLOBSTAR||m===k.GLOBSTAR||(m===void 0?f!==void 0&&f!==k.GLOBSTAR?l[_+1]="(?:\\/|"+r+"\\/)?"+f:l[_]=r:f===void 0?l[_-1]=m+"(?:\\/|\\/"+r+")?":f!==k.GLOBSTAR&&(l[_-1]=m+"(?:\\/|\\/"+r+"\\/)"+f,l[_+1]=k.GLOBSTAR))});let p=l.filter(d=>d!==k.GLOBSTAR);if(this.partial&&p.length>=1){let d=[];for(let _=1;_<=p.length;_++)d.push(p.slice(0,_).join("/"));return"(?:"+d.join("|")+")"}return p.join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.partial&&(s="^(?:\\/|"+i+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],l=o;if(r.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=da;var eSe=hN();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return eSe.AST}});var tSe=TN();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return tSe.escape}});var nSe=RT();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return nSe.unescape}});k.minimatch.AST=L$.AST;k.minimatch.Minimatch=da;k.minimatch.escape=yEe.escape;k.minimatch.unescape=IEe.unescape});var q$=E((FKe,gN)=>{"use strict";var G$=U("node:diagnostics_channel"),{context:PT,trace:EN,SpanStatusCode:MT,propagation:SN,diag:rSe}=(b(),O(v)),{getRPCMetadata:oSe,RPCType:sSe}=Te(),{ATTR_HTTP_ROUTE:xT,ATTR_HTTP_RESPONSE_STATUS_CODE:B$,ATTR_HTTP_REQUEST_METHOD:iSe,ATTR_URL_PATH:aSe}=(le(),O(Ae)),{InstrumentationBase:cSe}=_$(),{version:uSe,name:j$}=f$(),lSe=">=4.0.0 <6",H$=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Me={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},qs={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},qo="anonymous",$s=Symbol("fastify otel instance"),Ys=Symbol("fastify otel request spans"),od=Symbol("fastify otel request context"),F$=Symbol("fastify otel addhook original"),V$=Symbol("fastify otel setnotfound original"),sd=Symbol("fastify otel ignore path"),id=Symbol("fastify otel record exceptions"),vT=class extends cSe{logger=null;_requestHook=null;_lifecycleHook=null;constructor(e){if(super(j$,uSe,e),this.logger=rSe.createComponentLogger({namespace:j$}),this[sd]=null,this[id]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!="boolean")throw new TypeError("recordExceptions must be a boolean");this[id]=e.recordExceptions}if(typeof e?.requestHook=="function"&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook=="function"&&(this._lifecycleHook=e.lifecycleHook),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=null;this[sd]=o=>typeof n=="function"?n(o):(r==null&&(r=k$().minimatch),r(o.url,n))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let n=(r,o,s)=>{s()};n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",e.fastify.register(n)},G$.subscribe("fastify.initialization",this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(G$.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:lSe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate($s,e),r.decorate(F$,r.addHook),r.decorate(V$,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let f=this[od],m=this[Ys];return{enabled:this.routeOptions.config?.otel!==!1,span:m,tracer:e.tracer,context:f,inject:(h,T)=>SN.inject(f,h,T),extract:(h,T)=>SN.extract(f,h,T)}}),r.decorateRequest(Ys,null),r.decorateRequest(od,null),r.addHook("onRoute",function(f){if(e[sd]?.(f)===!0){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it matches the ignore path`);return}if(f.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it is disabled`);return}for(let m of H$)if(f[m]!=null){let h=f[m];if(typeof h=="function")f[m]=d(h,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[xT]:f.url,[Me.HOOK_CALLBACK_NAME]:h.name?.length>0?h.name:qo});else if(Array.isArray(h)){let T=[];for(let S of h)T.push(d(S,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[xT]:f.url,[Me.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:qo}));f[m]=T}}f.onSend!=null?f.onSend=Array.isArray(f.onSend)?[...f.onSend,i]:[f.onSend,i]:f.onSend=i,f.onError!=null?f.onError=Array.isArray(f.onError)?[...f.onError,a]:[f.onError,a]:f.onError=a,f.handler=d(f.handler,"handler",{[Me.HOOK_NAME]:`${this.pluginName} - route-handler`,[Me.FASTIFY_TYPE]:qs.HANDLER,[xT]:f.url,[Me.HOOK_CALLBACK_NAME]:f.handler.name.length>0?f.handler.name:qo})}),r.addHook("onRequest",function(f,m,h){if(this[$s].isEnabled()===!1||f.routeOptions.config?.otel===!1)return h();if(this[$s][sd]?.({url:f.url,method:f.method})===!0)return this[$s].logger.debug(`Ignoring request ${f.method} ${f.url} because it matches the ignore path`),h();let T=PT.active();EN.getSpan(T)==null&&(T=SN.extract(T,f.headers));let S=oSe(T);f.routeOptions.url!=null&&S?.type===sSe.HTTP&&(S.route=f.routeOptions.url);let R={[Me.ROOT]:"@fastify/otel",[iSe]:f.method,[aSe]:f.url};f.routeOptions.url!=null&&(R[xT]=f.routeOptions.url);let I=this[$s].tracer.startSpan("request",{attributes:R},T);try{this[$s]._requestHook?.(I,f)}catch(x){this[$s].logger.error({err:x},"requestHook threw")}f[od]=EN.setSpan(T,I),f[Ys]=I,PT.with(f[od],()=>{h()})}),r.addHook("onResponse",function(f,m,h){let T=f[Ys];T!=null&&(T.setAttributes({[B$]:m.statusCode}),T.end()),f[Ys]=null,h()}),r.addHook=c,r.setNotFoundHandler=l,s();function i(_,f,m,h){let T=_[Ys];T!=null&&(f.statusCode>=500&&T.setStatus({code:MT.ERROR}),T.setAttributes({[B$]:f.statusCode}),T.end()),_[Ys]=null,h(null,m)}function a(_,f,m,h){let T=_[Ys];T!=null&&(T.setStatus({code:MT.ERROR,message:m.message}),e[id]!==!1&&T.recordException(m)),h()}function c(_,f){let m=this[F$];return H$.includes(_)?m.call(this,_,d(f,_,{[Me.HOOK_NAME]:`${this.pluginName} - ${_}`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo})):m.call(this,_,f)}function l(_,f){let m=this[V$];typeof _=="function"?(f=d(_,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:qo}),m.call(this,f)):(_.preValidation!=null&&(_.preValidation=d(_.preValidation,"notFoundHandler - preValidation",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:qo})),_.preHandler!=null&&(_.preHandler=d(_.preHandler,"notFoundHandler - preHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:qo})),f=d(f,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo}),m.call(this,_,f))}function p(_){for(let f of _)if(f?.routeOptions&&f.url&&f.method)return f;return null}function d(_,f,m={}){return function(...T){let S=this[$s],R=p(T);if(R===null)return S.logger.debug(`Ignoring route instrumentation because ${f} was called without a Fastify request argument`),_.call(this,...T);if(S.isEnabled()===!1||R.routeOptions.config?.otel===!1)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it is disabled`),_.call(this,...T);if(S[sd]?.({url:R.url,method:R.method})===!0)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it matches the ignore path`),_.call(this,...T);let I=R[od]??PT.active(),x=_.name?.length>0?_.name:this.pluginName??qo,F=S.tracer.startSpan(`${f} - ${x}`,{attributes:m},I);if(S._lifecycleHook!=null)try{S._lifecycleHook(F,{hookName:f,request:R,handler:x})}catch(B){S.logger.error({err:B},"Execution of lifecycleHook failed")}return PT.with(EN.setSpan(I,F),function(){try{let B=_.call(this,...T);return typeof B?.then=="function"?B.then(se=>(F.end(),se),se=>(F.setStatus({code:MT.ERROR,message:se.message}),S[id]!==!1&&F.recordException(se),F.end(),Promise.reject(se))):(F.end(),B)}catch(B){throw F.setStatus({code:MT.ERROR,message:B.message}),S[id]!==!1&&F.recordException(B),F.end(),B}},this)}}}}};gN.exports=vT;gN.exports.FastifyOtelInstrumentation=vT});var yN=E(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.SpanNames=Dr.TokenKind=Dr.AllowedOperationTypes=void 0;var SSe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(SSe=Dr.AllowedOperationTypes||(Dr.AllowedOperationTypes={}));var gSe;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(gSe=Dr.TokenKind||(Dr.TokenKind={}));var ASe;(function(t){t.EXECUTE="graphql.execute",t.PARSE="graphql.parse",t.RESOLVE="graphql.resolve",t.VALIDATE="graphql.validate",t.SCHEMA_VALIDATE="graphql.validateSchema",t.SCHEMA_PARSE="graphql.parseSchema"})(ASe=Dr.SpanNames||(Dr.SpanNames={}))});var IN=E(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});ld.AttributeNames=void 0;var RSe;(function(t){t.SOURCE="graphql.source",t.FIELD_NAME="graphql.field.name",t.FIELD_PATH="graphql.field.path",t.FIELD_TYPE="graphql.field.type",t.PARENT_NAME="graphql.parent.name",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(RSe=ld.AttributeNames||(ld.AttributeNames={}))});var kT=E(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.OTEL_GRAPHQL_DATA_SYMBOL=Ru.OTEL_PATCHED_SYMBOL=void 0;Ru.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");Ru.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var nY=E(GT=>{"use strict";Object.defineProperty(GT,"__esModule",{value:!0});GT.OPERATION_NOT_SUPPORTED=void 0;var c2e=kT();GT.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var hY=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.wrapFieldResolver=ht.wrapFields=ht.getSourceFromLocation=ht.getOperation=ht.endSpan=ht.addSpanSource=ht.addInputVariableAttributes=ht.isPromise=void 0;var yu=(b(),O(v)),Ws=yN(),fa=IN(),Yo=kT(),rY=Object.values(Ws.AllowedOperationTypes),ySe=t=>typeof t?.then=="function";ht.isPromise=ySe;var ISe=t=>typeof t=="object"&&t!==null;function ON(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{ON(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{ON(t,`${e}.${r}`,o)}):t.setAttribute(`${fa.AttributeNames.VARIABLES}${String(e)}`,n)}function OSe(t,e){Object.entries(e).forEach(([n,r])=>{ON(t,n,r)})}ht.addInputVariableAttributes=OSe;function aY(t,e,n,r,o){let s=dY(e,n,r,o);t.setAttribute(fa.AttributeNames.SOURCE,s)}ht.addSpanSource=aY;function NSe(t,e,n,r,o){let s=cY(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?lY(n):uY(n,o);return s={span:bSe(t,e,n,r,o,a)},MSe(n,o,s),{field:s,spanAdded:!0}}function bSe(t,e,n,r,o,s){let i={[fa.AttributeNames.FIELD_NAME]:r.fieldName,[fa.AttributeNames.FIELD_PATH]:o.join("."),[fa.AttributeNames.FIELD_TYPE]:r.returnType.toString(),[fa.AttributeNames.PARENT_NAME]:r.parentType.name},a=t.startSpan(`${Ws.SpanNames.RESOLVE} ${i[fa.AttributeNames.FIELD_PATH]}`,{attributes:i},s?yu.trace.setSpan(yu.context.active(),s):void 0),c=n[Yo.OTEL_GRAPHQL_DATA_SYMBOL].source,l=r.fieldNodes.find(p=>p.kind==="Field");return l&&aY(a,c.loc,e().allowValues,l.loc?.start,l.loc?.end),a}function CSe(t,e){e&&t.recordException(e),t.end()}ht.endSpan=CSe;function PSe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>rY.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>rY.indexOf(n?.operation)!==-1)}ht.getOperation=PSe;function MSe(t,e,n){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function cY(t,e){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function uY(t,e){for(let n=e.length-1;n>0;n--){let r=cY(t,e.slice(0,n));if(r)return r.span}return lY(t)}function lY(t){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].span}function xSe(t,e){let n=[],r=e;for(;r;){let o=r.key;t&&typeof o=="number"&&(o="*"),n.push(String(o)),r=r.prev}return n.reverse()}function vSe(t){return pY(`
|
|
11
|
-
`,t)}function oY(t){return pY(" ",t)}function pY(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var LSe=[Ws.TokenKind.FLOAT,Ws.TokenKind.STRING,Ws.TokenKind.INT,Ws.TokenKind.BLOCK_STRING];function dY(t,e=!1,n,r){let o="";if(t?.startToken){let s=typeof n=="number"?n:t.start,i=typeof r=="number"?r:t.end,a=t.startToken.next,c=1;for(;a;){if(a.start<s){a=a.next,c=a?.line;continue}if(a.end>i){a=a.next,c=a?.line;continue}let l=a.value||a.kind,p="";!e&&LSe.indexOf(a.kind)>=0&&(l="*"),a.kind===Ws.TokenKind.STRING&&(l=`"${l}"`),a.kind===Ws.TokenKind.EOF&&(l=""),a.line>c?(o+=vSe(a.line-c),c=a.line,p=oY(a.column-1)):a.line===a.prev?.line&&(p=oY(a.start-(a.prev?.end||0))),o+=p+l,a&&(a=a.next)}}return o}ht.getSourceFromLocation=dY;function _Y(t,e,n){if(!t||t[Yo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Yo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=mY(e,n,s.resolve)),s.type)){let i=fY(s.type);for(let a of i)_Y(a,e,n)}})}ht.wrapFields=_Y;function fY(t){return"ofType"in t?fY(t.ofType):DSe(t)?t.getTypes():USe(t)?[t]:[]}function DSe(t){return"getTypes"in t&&typeof t.getTypes=="function"}function USe(t){return"getFields"in t&&typeof t.getFields=="function"}var sY=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:yu.SpanStatusCode.ERROR,message:e.message}),t.end())},iY=(t,e)=>{e&&t.end()};function mY(t,e,n,r=!1){if(o[Yo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let l=e();if(l.ignoreTrivialResolveSpans&&r&&(ISe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Yo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let p=xSe(l.mergeItems,c&&c.path),d=p.filter(m=>typeof m=="string").length,_,f=!1;if(l.depth>=0&&l.depth<d)_=uY(a,p);else{let{field:m,spanAdded:h}=NSe(t,e,a,c,p);_=m.span,f=h}return yu.context.with(yu.trace.setSpan(yu.context.active(),_),()=>{try{let m=n.call(this,s,i,a,c);return(0,ht.isPromise)(m)?m.then(h=>(iY(_,f),h),h=>{throw sY(_,h,f),h}):(iY(_,f),m)}catch(m){throw sY(_,m,f),m}})}return o[Yo.OTEL_PATCHED_SYMBOL]=!0,o}ht.wrapFieldResolver=mY});var TY=E(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.PACKAGE_NAME=Iu.PACKAGE_VERSION=void 0;Iu.PACKAGE_VERSION="0.62.0";Iu.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var gY=E(HT=>{"use strict";Object.defineProperty(HT,"__esModule",{value:!0});HT.GraphQLInstrumentation=void 0;var Wo=(b(),O(v)),ur=ne(),pd=yN(),BT=IN(),NN=kT(),wSe=nY(),Qt=hY(),EY=TY(),SY={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},jT=[">=14.0.0 <17"],bN=class extends ur.InstrumentationBase{constructor(e={}){super(EY.PACKAGE_NAME,EY.PACKAGE_VERSION,{...SY,...e})}setConfig(e={}){super.setConfig({...SY,...e})}init(){let e=new ur.InstrumentationNodeModuleDefinition("graphql",jT);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new ur.InstrumentationNodeModuleFile("graphql/execution/execute.js",jT,e=>((0,ur.isWrapped)(e.execute)&&this._unwrap(e,"execute"),this._wrap(e,"execute",this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,"execute")})}_addPatchingParser(){return new ur.InstrumentationNodeModuleFile("graphql/language/parser.js",jT,e=>((0,ur.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new ur.InstrumentationNodeModuleFile("graphql/validation/validate.js",jT,e=>((0,ur.isWrapped)(e.validate)&&this._unwrap(e,"validate"),this._wrap(e,"validate",this._patchValidate()),e),e=>{e&&this._unwrap(e,"validate")})}_patchExecute(e){let n=this;return function(o){return function(){let i;if(arguments.length>=2){let l=arguments;i=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],e)}else{let l=arguments[0];i=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,e)}let a=(0,Qt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[NN.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[NN.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(l,p)=>{n._handleExecutionResult(c,l,p)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Qt.endSpan)(e,n);return}if((0,Qt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Qt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,ur.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Qt.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(r){return function(s,i){return e._parse(this,r,s,i)}}}_patchValidate(){let e=this;return function(r){return function(s,i,a,c,l){return e._validate(this,r,s,i,a,l,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(pd.SpanNames.PARSE);return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),i),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Qt.getOperation)(c)?c.loc&&(0,Qt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(pd.SpanNames.SCHEMA_PARSE)),(0,Qt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(pd.SpanNames.VALIDATE,{});return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(l,p)=>{o.loc||c.updateName(pd.SpanNames.SCHEMA_VALIDATE),p&&p.length&&c.recordException({name:BT.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(p)}),(0,Qt.endSpan)(c,l)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(pd.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(BT.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(BT.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=wSe.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(BT.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Qt.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Qt.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,l){if(o||(o={}),o[NN.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c};let p=a==null,d=a??l;return a=(0,Qt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),d,p),e&&((0,Qt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Qt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};HT.GraphQLInstrumentation=bN});var AY=E(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});FT.GraphQLInstrumentation=void 0;var kSe=gY();Object.defineProperty(FT,"GraphQLInstrumentation",{enumerable:!0,get:function(){return kSe.GraphQLInstrumentation}})});var bY=E(VT=>{"use strict";Object.defineProperty(VT,"__esModule",{value:!0});VT.EVENT_LISTENERS_SET=void 0;VT.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var CY=E(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0});qT.bufferTextMapGetter=void 0;qT.bufferTextMapGetter={get(t,e){if(!t)return;let n=Object.keys(t);for(let r of n)if(r===e||r.toLowerCase()===e)return t[r]?.toString()},keys(t){return t?Object.keys(t):[]}}});var PY=E(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.METRIC_MESSAGING_PROCESS_DURATION=_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=_e.MESSAGING_SYSTEM_VALUE_KAFKA=_e.MESSAGING_OPERATION_TYPE_VALUE_SEND=_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=_e.ATTR_MESSAGING_SYSTEM=_e.ATTR_MESSAGING_OPERATION_TYPE=_e.ATTR_MESSAGING_OPERATION_NAME=_e.ATTR_MESSAGING_KAFKA_OFFSET=_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=_e.ATTR_MESSAGING_DESTINATION_NAME=_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";_e.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";_e.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";_e.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";_e.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";_e.ATTR_MESSAGING_SYSTEM="messaging.system";_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";_e.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";_e.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";_e.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var MY=E(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.PACKAGE_NAME=Ou.PACKAGE_VERSION=void 0;Ou.PACKAGE_VERSION="0.23.0";Ou.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var wY=E(YT=>{"use strict";Object.defineProperty(YT,"__esModule",{value:!0});YT.KafkaJsInstrumentation=void 0;var ye=(b(),O(v)),lr=ne(),Nu=(le(),O(Ae)),xY=bY(),vY=CY(),G=PY(),LY=MY();function $T(t,e,n){return r=>{t.add(e,{...n,...r?{[Nu.ATTR_ERROR_TYPE]:r}:{}})}}function DY(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[Nu.ATTR_ERROR_TYPE]:r}:{}})}}var UY=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],CN=class extends lr.InstrumentationBase{constructor(e={}){super(LY.PACKAGE_NAME,LY.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(G.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:UY}}),this._sentMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(G.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:UY}})}init(){let e=r=>{(0,lr.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,lr.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new lr.InstrumentationNodeModuleDefinition("kafkajs",[">=0.3.0 <3"],r=>(e(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[xY.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[xY.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[Nu.ATTR_SERVER_ADDRESS]:n,[Nu.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,lr.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,lr.isWrapped)(s.transaction)&&e._unwrap(s,"transaction"),e._wrap(s,"transaction",e._getProducerTransactionPatch()),e._setKafkaEventListeners(s),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,lr.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,lr.isWrapped)(s.eachBatch)&&e._unwrap(s,"eachBatch"),e._wrap(s,"eachBatch",e._getConsumerEachBatchPatch())),n.call(this,s)}}_getConsumerEachMessagePatch(){let e=this;return n=>function(...o){let s=o[0],i=ye.propagation.extract(ye.ROOT_CONTEXT,s.message.headers,vY.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[DY(e._processDuration,Date.now(),{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),$T(e._consumedMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],l=ye.context.with(ye.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,l)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:ye.ROOT_CONTEXT,attributes:{[G.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return ye.context.with(ye.trace.setSpan(ye.context.active(),i),()=>{let a=Date.now(),c=[],l=[$T(n._consumedMessages,s.batch.messages.length,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(d=>{let _=ye.propagation.extract(ye.ROOT_CONTEXT,d.headers,vY.bufferTextMapGetter),f=ye.trace.getSpan(_)?.spanContext(),m;f&&(m={context:f}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:d,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:m,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),l.push(DY(n._processDuration,a,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let p=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,l,p)})}}}_getProducerTransactionPatch(){let e=this;return n=>function(...o){let s=e.tracer.startSpan("transaction"),i=n.apply(this,o);return i.then(a=>{let c=a.send;a.send=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendPatch()(c).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let l=a.sendBatch;a.sendBatch=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendBatchPatch()(l).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let p=a.commit;a.commit=function(...f){let m=p.apply(this,f).then(()=>{s.setStatus({code:ye.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],m)};let d=a.abort;a.abort=function(...f){let m=d.apply(this,f);return e._endSpansOnPromise([s],[],m)}}).catch(a=>{s.setStatus({code:ye.SpanStatusCode.ERROR,message:a?.message}),s.recordException(a),s.end()}),i}}_getSendBatchPatch(){let e=this;return n=>function(...o){let i=o[0].topicMessages||[],a=[],c=[];i.forEach(p=>{p.messages.forEach(d=>{a.push(e._startProducerSpan(p.topic,d)),c.push($T(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...d.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}}))})});let l=n.apply(this,o);return e._endSpansOnPromise(a,c,l)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(l=>e._startProducerSpan(s.topic,l)),a=s.messages.map(l=>$T(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...l.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(l.partition)}:{}})),c=n.apply(this,o);return e._endSpansOnPromise(i,a,c)}}_endSpansOnPromise(e,n,r){return Promise.resolve(r).then(o=>(n.forEach(s=>s()),o)).catch(o=>{let s,i=Nu.ERROR_TYPE_VALUE_OTHER;throw typeof o=="string"||o===void 0?s=o:typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"message")&&(s=o.message,i=o.constructor.name),n.forEach(a=>a(i)),e.forEach(a=>{a.setAttribute(Nu.ATTR_ERROR_TYPE,i),a.setStatus({code:ye.SpanStatusCode.ERROR,message:s})}),o}).finally(()=>{e.forEach(o=>o.end())})}_startConsumerSpan({topic:e,message:n,operationType:r,ctx:o,link:s,attributes:i}){let a=r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?ye.SpanKind.CLIENT:ye.SpanKind.CONSUMER,attributes:{...i,[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_OPERATION_TYPE]:r,[G.ATTR_MESSAGING_OPERATION_NAME]:a,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:l}=this.getConfig();return l&&n&&(0,lr.safeExecuteInTheMiddle)(()=>l(c,{topic:e,message:n}),p=>{p&&this._diag.error("consumerHook error",p)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:ye.SpanKind.PRODUCER,attributes:{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_OPERATION_TYPE]:G.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},ye.propagation.inject(ye.trace.setSpan(ye.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,lr.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};YT.KafkaJsInstrumentation=CN});var kY=E(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});WT.KafkaJsInstrumentation=void 0;var jSe=wY();Object.defineProperty(WT,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return jSe.KafkaJsInstrumentation}})});var FY=E(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.PACKAGE_NAME=bu.PACKAGE_VERSION=void 0;bu.PACKAGE_VERSION="0.58.0";bu.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var YY=E(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});zT.LruMemoizerInstrumentation=void 0;var VY=(b(),O(v)),qY=ne(),$Y=FY(),PN=class extends qY.InstrumentationBase{constructor(e={}){super($Y.PACKAGE_NAME,$Y.PACKAGE_VERSION,e)}init(){return[new qY.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <4"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?VY.context.bind(VY.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};zT.LruMemoizerInstrumentation=PN});var WY=E(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.LruMemoizerInstrumentation=void 0;var FSe=YY();Object.defineProperty(KT,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return FSe.LruMemoizerInstrumentation}})});var JY=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.METRIC_DB_CLIENT_CONNECTIONS_USAGE=De.DB_SYSTEM_VALUE_MONGODB=De.DB_SYSTEM_NAME_VALUE_MONGODB=De.ATTR_NET_PEER_PORT=De.ATTR_NET_PEER_NAME=De.ATTR_DB_SYSTEM=De.ATTR_DB_STATEMENT=De.ATTR_DB_OPERATION=De.ATTR_DB_NAME=De.ATTR_DB_MONGODB_COLLECTION=De.ATTR_DB_CONNECTION_STRING=void 0;De.ATTR_DB_CONNECTION_STRING="db.connection_string";De.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";De.ATTR_DB_NAME="db.name";De.ATTR_DB_OPERATION="db.operation";De.ATTR_DB_STATEMENT="db.statement";De.ATTR_DB_SYSTEM="db.system";De.ATTR_NET_PEER_NAME="net.peer.name";De.ATTR_NET_PEER_PORT="net.peer.port";De.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";De.DB_SYSTEM_VALUE_MONGODB="mongodb";De.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var ZY=E(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.MongodbCommandType=void 0;var qSe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(qSe=dd.MongodbCommandType||(dd.MongodbCommandType={}))});var eW=E(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.PACKAGE_NAME=Cu.PACKAGE_VERSION=void 0;Cu.PACKAGE_VERSION="0.67.0";Cu.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var rW=E(QT=>{"use strict";Object.defineProperty(QT,"__esModule",{value:!0});QT.MongoDBInstrumentation=void 0;var we=(b(),O(v)),fe=ne(),zo=(le(),O(Ae)),$n=JY(),ma=ZY(),tW=eW(),nW={requireParentSpan:!0},MN=class t extends fe.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(tW.PACKAGE_NAME,tW.PACKAGE_VERSION,{...nW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,fe.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,fe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...nW,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter($n.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsage?.add(e,{"pool.name":n,state:r})}init(){let{v3PatchConnection:e,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnect:r,v4UnpatchConnect:o}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:s,v4PatchConnectionPromise:i,v4UnpatchConnection:a}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:p,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new fe.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new fe.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,l),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new fe.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],p,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,fe.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,fe.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,fe.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,fe.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,fe.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,fe.isWrapped)(e.getMore)&&this._unwrap(e,"getMore"),this._wrap(e,"getMore",this._getV3PatchCursor()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,"insert"),this._unwrap(e,"remove"),this._unwrap(e,"update"),this._unwrap(e,"command"),this._unwrap(e,"query"),this._unwrap(e,"getMore"))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"))}}}_getV4AcquireCommand(){let e=this;return n=>function(){let o=this.sessions.length,s=n.call(this),i=this.sessions.length;return o===i?e._connCountAdd(1,e._poolName,"used"):o-1===i&&(e._connCountAdd(-1,e._poolName,"idle"),e._connCountAdd(1,e._poolName,"used")),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connCountAdd(-1,e._poolName,"used"),e._connCountAdd(1,e._poolName,"idle"),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,fe.isWrapped)(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,fe.isWrapped)(e.connect)&&this._unwrap(e,"connect"),this._wrap(e,"connect",this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,"connect")}}}_getV4ConnectionPoolCheckOut(){return e=>function(r){let o=we.context.bind(we.context.active(),r);return e.call(this,o)}}_getV4ConnectCommand(){let e=this;return n=>function(o,s){if(n.length===1){let a=n.call(this,o);return a&&typeof a.then=="function"&&a.then(()=>e.setPoolName(o),()=>{}),a}let i=function(a,c){if(a||!c){s(a,c);return}e.setPoolName(o),s(a,c)};return n.call(this,o,i)}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,"command")}}}_getV3PatchOperation(e){let n=this;return r=>function(s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=n._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,l);let f=n._getV3SpanAttributes(i,s,a[0],e),m=n._spanNameFromAttrs(f),h=n.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=n._patchEnd(h,_);return typeof c=="function"?r.call(this,s,i,a,T):r.call(this,s,i,a,c,T)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let l=we.trace.getSpan(we.context.active()),p=e._checkSkipInstrumentation(l),d=typeof a=="function"?a:c;if(p||typeof d!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let _=t._getCommandType(i),f=_===ma.MongodbCommandType.UNKNOWN?void 0:_,m=e._getV3SpanAttributes(s,o,i,f),h=e._spanNameFromAttrs(m),T=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m}),S=e._patchEnd(T,d);return typeof a=="function"?n.call(this,o,s,i,S):n.call(this,o,s,i,a,S)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=we.trace.getSpan(we.context.active()),l=e._checkSkipInstrumentation(c),p=a,d=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let _;if(!l){let m=e._getV4SpanAttributes(this,o,s,d),h=e._spanNameFromAttrs(m);_=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let f=e._patchEnd(_,p,this.id,d);return n.call(this,o,s,i,f)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=we.trace.getSpan(we.context.active()),c=e._checkSkipInstrumentation(a),l=Object.keys(i)[0],p=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let d;if(!c){let m=e._getV4SpanAttributes(this,s,i,l),h=e._spanNameFromAttrs(m);d=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let _=e._patchEnd(d,p,this.id,l),f=n.apply(this,o);return f.then(m=>_(null,m),m=>_(m)),f}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i,"find"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}static _getCommandType(e){return e.createIndexes!==void 0?ma.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?ma.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?ma.MongodbCommandType.IS_MASTER:e.count!==void 0?ma.MongodbCommandType.COUNT:e.aggregate!==void 0?ma.MongodbCommandType.AGGREGATE:ma.MongodbCommandType.UNKNOWN}_getV4SpanAttributes(e,n,r,o){let s,i;if(e){let c=typeof e.address=="string"?e.address.split(":"):"";c.length===2&&(s=c[0],i=c[1])}let a;return r?.documents&&r.documents[0]?a=r.documents[0]:r?.cursors?a=r.cursors:a=r,this._getSpanAttributes(n.db,n.collection,s,i,a,o)}_getV3SpanAttributes(e,n,r,o){let s,i;if(n&&n.s&&(s=n.s.options?.host??n.s.host,i=(n.s.options?.port??n.s.port)?.toString(),s==null||i==null)){let p=n.description?.address;if(p){let d=p.split(":");s=d[0],i=d[1]}}let[a,c]=e.toString().split("."),l=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,l,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_SYSTEM]=$n.DB_SYSTEM_VALUE_MONGODB,a[$n.ATTR_DB_NAME]=e,a[$n.ATTR_DB_MONGODB_COLLECTION]=n,a[$n.ATTR_DB_OPERATION]=i,a[$n.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_SYSTEM_NAME]=$n.DB_SYSTEM_NAME_VALUE_MONGODB,a[zo.ATTR_DB_NAMESPACE]=e,a[zo.ATTR_DB_OPERATION_NAME]=i,a[zo.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),l=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,fe.safeExecuteInTheMiddle)(()=>{let p=l(s);this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_STATEMENT]=p),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_QUERY_TEXT]=p)},p=>{p&&this._diag.error("Error running dbStatementSerializer hook",p)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&fe.SemconvStability.STABLE?n=[e[zo.ATTR_DB_OPERATION_NAME],e[zo.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||$n.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[$n.ATTR_DB_OPERATION]||"command"}`,n}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(n,r)=>typeof r!="object"||!r?"?":e.has(r)?"[Circular]":(e.add(r),r)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig();return n?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,fe.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=we.context.active(),i=this,a=!1;return function(...l){if(!a){a=!0;let p=l[0];if(e){if(p instanceof Error)e.setStatus({code:we.SpanStatusCode.ERROR,message:p.message});else{let d=l[1];i._handleExecutionResult(e,d)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return we.context.with(s,()=>n.apply(this,l))}}setPoolName(e){let n=e.hostAddress?.host,r=e.hostAddress?.port,o=e.dbName,s=`mongodb://${n}:${r}/${o}`;this._poolName=s}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};QT.MongoDBInstrumentation=MN});var oW=E(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.MongodbCommandType=void 0;var $Se;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})($Se=_d.MongodbCommandType||(_d.MongodbCommandType={}))});var sW=E(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.MongodbCommandType=Pu.MongoDBInstrumentation=void 0;var YSe=rW();Object.defineProperty(Pu,"MongoDBInstrumentation",{enumerable:!0,get:function(){return YSe.MongoDBInstrumentation}});var WSe=oW();Object.defineProperty(Pu,"MongodbCommandType",{enumerable:!0,get:function(){return WSe.MongodbCommandType}})});var vN=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.DB_SYSTEM_NAME_VALUE_MONGODB=at.ATTR_NET_PEER_PORT=at.ATTR_NET_PEER_NAME=at.ATTR_DB_USER=at.ATTR_DB_SYSTEM=at.ATTR_DB_STATEMENT=at.ATTR_DB_OPERATION=at.ATTR_DB_NAME=at.ATTR_DB_MONGODB_COLLECTION=void 0;at.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";at.ATTR_DB_NAME="db.name";at.ATTR_DB_OPERATION="db.operation";at.ATTR_DB_STATEMENT="db.statement";at.ATTR_DB_SYSTEM="db.system";at.ATTR_DB_USER="db.user";at.ATTR_NET_PEER_NAME="net.peer.name";at.ATTR_NET_PEER_PORT="net.peer.port";at.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var dW=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.handleCallbackResponse=zs.handlePromiseResponse=zs.getAttributesFromCollection=void 0;var lW=(b(),O(v)),md=ne(),fd=vN(),XT=(le(),O(Ae));function ZSe(t,e,n){let r={};return e&md.SemconvStability.OLD&&(r[fd.ATTR_DB_MONGODB_COLLECTION]=t.name,r[fd.ATTR_DB_NAME]=t.conn.name,r[fd.ATTR_DB_USER]=t.conn.user),e&md.SemconvStability.STABLE&&(r[XT.ATTR_DB_COLLECTION_NAME]=t.name,r[XT.ATTR_DB_NAMESPACE]=t.conn.name),n&md.SemconvStability.OLD&&(r[fd.ATTR_NET_PEER_NAME]=t.conn.host,r[fd.ATTR_NET_PEER_PORT]=t.conn.port),n&md.SemconvStability.STABLE&&(r[XT.ATTR_SERVER_ADDRESS]=t.conn.host,r[XT.ATTR_SERVER_PORT]=t.conn.port),r}zs.getAttributesFromCollection=ZSe;function pW(t,e={}){t.recordException(e),t.setStatus({code:lW.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
|
|
12
|
-
Mongoose Error Code: ${e.code}`:""}`})}function LN(t,e,n,r=void 0){n&&(0,md.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&lW.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function ege(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(LN(e,o,n,r),o)).catch(o=>{throw pW(e,o),o}).finally(()=>e.end()):(LN(e,t,n,r),e.end(),t)}zs.handlePromiseResponse=ege;function tge(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,l)=>(c?pW(r,c):LN(r,l,s,i),r.end(),t(c,l)),e.apply(n,o)}zs.handleCallbackResponse=tge});var _W=E(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.PACKAGE_NAME=Mu.PACKAGE_VERSION=void 0;Mu.PACKAGE_VERSION="0.60.0";Mu.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var EW=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MongooseInstrumentation=Cn._ALREADY_INSTRUMENTED=Cn._STORED_PARENT_SPAN=void 0;var Tt=(b(),O(v)),nge=Te(),DN=dW(),jt=ne(),fW=_W(),Ks=vN(),ha=(le(),O(Ae)),JT=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],rge=["remove","count","findOneAndRemove",...JT],oge=["count","findOneAndRemove",...JT],sge=[...JT];function mW(t){return t?t.startsWith("6.")||t.startsWith("5.")?rge:t.startsWith("7.")?oge:sge:JT}function hW(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function TW(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Cn._STORED_PARENT_SPAN=Symbol("stored-parent-span");Cn._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var UN=class extends jt.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(fW.PACKAGE_NAME,fW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,jt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,jt.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new jt.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <10"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),TW(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),mW(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=mW(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._unwrap(r.Model.prototype,"remove"),TW(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[ha.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[Cn._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[ha.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let l={},{dbStatementSerializer:p}=r.getConfig();if(p){let _=p(e,c);r._dbSemconvStability&jt.SemconvStability.OLD&&(l[Ks.ATTR_DB_STATEMENT]=_),r._dbSemconvStability&jt.SemconvStability.STABLE&&(l[ha.ATTR_DB_QUERY_TEXT]=_)}let d=r._startSpan(this.constructor.collection,this.constructor.modelName,e,l);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(d,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let l=c,p=i,d=a;typeof i=="function"?(l=i,p=void 0,d=void 0):typeof a=="function"&&(l=a,d=void 0);let _={},f=r.getConfig().dbStatementSerializer;if(f){let T=f(e,{condition:{_id:this._id},updates:p,options:d});r._dbSemconvStability&jt.SemconvStability.OLD&&(_[Ks.ATTR_DB_STATEMENT]=T),r._dbSemconvStability&jt.SemconvStability.STABLE&&(_[ha.ATTR_DB_QUERY_TEXT]=T)}let m=r._startSpan(this.constructor.collection,this.constructor.modelName,e,_),h=r._handleResponse(m,o,this,arguments,l,n);return h&&typeof h=="object"&&(h[Cn._ALREADY_INSTRUMENTED]=!0),h}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let l={};switch(e){case"insertMany":l.documents=i;break;case"bulkWrite":l.operations=i;break;default:l.document=i;break}a!==void 0&&(l.options=a);let p={},{dbStatementSerializer:d}=r.getConfig();if(d){let f=d(e,l);r._dbSemconvStability&jt.SemconvStability.OLD&&(p[Ks.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&jt.SemconvStability.STABLE&&(p[ha.ATTR_DB_QUERY_TEXT]=f)}let _=r._startSpan(this.collection,this.modelName,e,p);return r._handleResponse(_,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Tt.trace.getSpan(Tt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Cn._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Cn._STORED_PARENT_SPAN]=Tt.trace.getSpan(Tt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,DN.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&jt.SemconvStability.OLD&&(i[Ks.ATTR_DB_OPERATION]=r,i[Ks.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&jt.SemconvStability.STABLE&&(i[ha.ATTR_DB_OPERATION_NAME]=r,i[ha.ATTR_DB_SYSTEM_NAME]=Ks.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&jt.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Tt.SpanKind.CLIENT,attributes:i},s?Tt.trace.setSpan(Tt.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,DN.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,DN.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Tt.context.with((0,nge.suppressTracing)(Tt.context.active()),e):e()}};Cn.MongooseInstrumentation=UN});var SW=E(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.MongooseInstrumentation=void 0;var ige=EW();Object.defineProperty(ZT,"MongooseInstrumentation",{enumerable:!0,get:function(){return ige.MongooseInstrumentation}})});var IW=E(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ct.DB_SYSTEM_VALUE_MYSQL=ct.ATTR_NET_PEER_PORT=ct.ATTR_NET_PEER_NAME=ct.ATTR_DB_USER=ct.ATTR_DB_SYSTEM=ct.ATTR_DB_STATEMENT=ct.ATTR_DB_NAME=ct.ATTR_DB_CONNECTION_STRING=void 0;ct.ATTR_DB_CONNECTION_STRING="db.connection_string";ct.ATTR_DB_NAME="db.name";ct.ATTR_DB_STATEMENT="db.statement";ct.ATTR_DB_SYSTEM="db.system";ct.ATTR_DB_USER="db.user";ct.ATTR_NET_PEER_NAME="net.peer.name";ct.ATTR_NET_PEER_PORT="net.peer.port";ct.DB_SYSTEM_VALUE_MYSQL="mysql";ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var OW=E(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.AttributeNames=void 0;var cge;(function(t){t.MYSQL_VALUES="db.mysql.values"})(cge=hd.AttributeNames||(hd.AttributeNames={}))});var NW=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getPoolNameOld=Xt.arrayStringifyHelper=Xt.getSpanName=Xt.getDbValues=Xt.getDbQueryText=Xt.getJDBCString=Xt.getConfig=void 0;function uge(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}Xt.getConfig=uge;function lge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}Xt.getJDBCString=lge;function pge(t){return typeof t=="string"?t:t.sql}Xt.getDbQueryText=pge;function dge(t,e){return wN(typeof t=="string"?e:e||t.values)}Xt.getDbValues=dge;function _ge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Xt.getSpanName=_ge;function wN(t){return t?`[${t.toString()}]`:""}Xt.arrayStringifyHelper=wN;function fge(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}Xt.getPoolNameOld=fge});var bW=E(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.PACKAGE_NAME=xu.PACKAGE_VERSION=void 0;xu.PACKAGE_VERSION="0.60.0";xu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var PW=E(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.MySQLInstrumentation=void 0;var Pn=(b(),O(v)),pr=ne(),vu=(le(),O(Ae)),Ko=IW(),mge=OW(),Ta=NW(),CW=bW(),kN=class extends pr.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(CW.PACKAGE_NAME,CW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,pr.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,pr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ko.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new pr.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,pr.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,pr.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,pr.isWrapped)(e.createPoolCluster)&&this._unwrap(e,"createPoolCluster"),this._wrap(e,"createPoolCluster",this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,"createConnection"),this._unwrap(e,"createPool"),this._unwrap(e,"createPoolCluster"))})]}_patchCreateConnection(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,l=(0,Ta.getPoolNameOld)(e);r._connCountAdd(-c,l,"used"),r._connCountAdd(-a,l,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),l=a[c].pool;r._setPoolCallbacks(l,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=Pn.context.active();return function(o,s){s&&((0,pr.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Pn.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:l,database:p,user:d}=(0,Ta.getConfig)(e.config),_=parseInt(l,10),f=(0,Ta.getDbQueryText)(o);r._dbSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_DB_SYSTEM]=Ko.DB_SYSTEM_VALUE_MYSQL,a[Ko.ATTR_DB_CONNECTION_STRING]=(0,Ta.getJDBCString)(c,l,p),a[Ko.ATTR_DB_NAME]=p,a[Ko.ATTR_DB_USER]=d,a[Ko.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&pr.SemconvStability.STABLE&&(a[vu.ATTR_DB_SYSTEM_NAME]=vu.DB_SYSTEM_NAME_VALUE_MYSQL,a[vu.ATTR_DB_NAMESPACE]=p,a[vu.ATTR_DB_QUERY_TEXT]=f),r._netSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_NET_PEER_NAME]=c,isNaN(_)||(a[Ko.ATTR_NET_PEER_PORT]=_)),r._netSemconvStability&pr.SemconvStability.STABLE&&(a[vu.ATTR_SERVER_ADDRESS]=c,isNaN(_)||(a[vu.ATTR_SERVER_PORT]=_));let m=r.tracer.startSpan((0,Ta.getSpanName)(o),{kind:Pn.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let S;Array.isArray(s)?S=s:arguments[2]&&(S=[s]),m.setAttribute(mge.AttributeNames.MYSQL_VALUES,(0,Ta.getDbValues)(o,S))}let h=Array.from(arguments).findIndex(S=>typeof S=="function"),T=Pn.context.active();if(h===-1){let S=Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments));return Pn.context.bind(T,S),S.on("error",R=>m.setStatus({code:Pn.SpanStatusCode.ERROR,message:R.message})).on("end",()=>{m.end()})}else return r._wrap(arguments,h,r._patchCallbackQuery(m,T)),Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Pn.SpanStatusCode.ERROR,message:o.message}),e.end(),Pn.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Ta.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};eE.MySQLInstrumentation=kN});var MW=E(tE=>{"use strict";Object.defineProperty(tE,"__esModule",{value:!0});tE.MySQLInstrumentation=void 0;var hge=PW();Object.defineProperty(tE,"MySQLInstrumentation",{enumerable:!0,get:function(){return hge.MySQLInstrumentation}})});var GN=E(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DB_SYSTEM_VALUE_MYSQL=Ct.ATTR_NET_PEER_PORT=Ct.ATTR_NET_PEER_NAME=Ct.ATTR_DB_USER=Ct.ATTR_DB_SYSTEM=Ct.ATTR_DB_STATEMENT=Ct.ATTR_DB_NAME=Ct.ATTR_DB_CONNECTION_STRING=void 0;Ct.ATTR_DB_CONNECTION_STRING="db.connection_string";Ct.ATTR_DB_NAME="db.name";Ct.ATTR_DB_STATEMENT="db.statement";Ct.ATTR_DB_SYSTEM="db.system";Ct.ATTR_DB_USER="db.user";Ct.ATTR_NET_PEER_NAME="net.peer.name";Ct.ATTR_NET_PEER_PORT="net.peer.port";Ct.DB_SYSTEM_VALUE_MYSQL="mysql"});var jN=E(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.addSqlCommenterComment=void 0;var BN=(b(),O(v)),Ege=Te();function Sge(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function gge(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Age(t,e){if(typeof e!="string"||e.length===0||Sge(e))return e;let n=new Ege.W3CTraceContextPropagator,r={};n.inject(BN.trace.setSpan(BN.ROOT_CONTEXT,t),r,BN.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=gge(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}nE.addSqlCommenterComment=Age});var UW=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.getConnectionPrototypeToInstrument=dr.once=dr.getSpanName=dr.getQueryText=dr.getConnectionAttributes=void 0;var Td=GN(),rE=ne(),HN=(le(),O(Ae));function Rge(t,e,n){let{host:r,port:o,database:s,user:i}=yge(t),a={};e&rE.SemconvStability.OLD&&(a[Td.ATTR_DB_CONNECTION_STRING]=Ige(r,o,s),a[Td.ATTR_DB_NAME]=s,a[Td.ATTR_DB_USER]=i),e&rE.SemconvStability.STABLE&&(a[HN.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&rE.SemconvStability.OLD&&(a[Td.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[Td.ATTR_NET_PEER_PORT]=c)),n&rE.SemconvStability.STABLE&&(a[HN.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[HN.ATTR_SERVER_PORT]=c)),a}dr.getConnectionAttributes=Rge;function yge(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function Ige(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function Oge(t,e,n,r=!1,o=Nge){let[s,i]=typeof t=="string"?[t,n]:[t.sql,bge(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}dr.getQueryText=Oge;function Nge(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function bge(t){return"values"in t}function Cge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}dr.getSpanName=Cge;var Pge=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};dr.once=Pge;function Mge(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}dr.getConnectionPrototypeToInstrument=Mge});var wW=E(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.PACKAGE_NAME=Lu.PACKAGE_VERSION=void 0;Lu.PACKAGE_VERSION="0.60.0";Lu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var jW=E(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});oE.MySQL2Instrumentation=void 0;var kW=(b(),O(v)),Ur=ne(),FN=GN(),GW=jN(),Du=UW(),BW=wW(),VN=(le(),O(Ae)),qN=[">=1.4.2 <4"],$N=class extends Ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(BW.PACKAGE_NAME,BW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,Ur.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Ur.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new Ur.InstrumentationNodeModuleDefinition("mysql2",qN,s=>(n(s),s),()=>{},[new Ur.InstrumentationNodeModuleFile("mysql2/promise.js",qN,s=>(n(s),s),()=>{}),new Ur.InstrumentationNodeModuleFile("mysql2/lib/connection.js",qN,s=>{let i=(0,Du.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Du.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:l,maskStatementHook:p,responseHook:d}=o.getConfig(),_=(0,Du.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),f=(0,Du.getQueryText)(s,e,c,l,p);o._dbSemconvStability&Ur.SemconvStability.OLD&&(_[FN.ATTR_DB_SYSTEM]=FN.DB_SYSTEM_VALUE_MYSQL,_[FN.ATTR_DB_STATEMENT]=f),o._dbSemconvStability&Ur.SemconvStability.STABLE&&(_[VN.ATTR_DB_SYSTEM_NAME]=VN.DB_SYSTEM_NAME_VALUE_MYSQL,_[VN.ATTR_DB_QUERY_TEXT]=f);let m=o.tracer.startSpan((0,Du.getSpanName)(s),{kind:kW.SpanKind.CLIENT,attributes:_});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,GW.addSqlCommenterComment)(m,s):Object.assign(s,{sql:(0,GW.addSqlCommenterComment)(m,s.sql)}));let h=(0,Du.once)((T,S)=>{T?m.setStatus({code:kW.SpanStatusCode.ERROR,message:T.message}):typeof d=="function"&&(0,Ur.safeExecuteInTheMiddle)(()=>{d(m,{queryResults:S})},R=>{R&&o._diag.warn("Failed executing responseHook",R)},!0),m.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(h));let T=r.apply(this,arguments);return T.once("error",S=>{h(S)}).once("result",S=>{h(void 0,S)}),T}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(h)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(h)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};oE.MySQL2Instrumentation=$N});var HW=E(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.MySQL2Instrumentation=void 0;var xge=jW();Object.defineProperty(sE,"MySQL2Instrumentation",{enumerable:!0,get:function(){return xge.MySQL2Instrumentation}})});var YW=E(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DB_SYSTEM_VALUE_REDIS=Jt.DB_SYSTEM_NAME_VALUE_REDIS=Jt.ATTR_NET_PEER_PORT=Jt.ATTR_NET_PEER_NAME=Jt.ATTR_DB_SYSTEM=Jt.ATTR_DB_STATEMENT=Jt.ATTR_DB_CONNECTION_STRING=void 0;Jt.ATTR_DB_CONNECTION_STRING="db.connection_string";Jt.ATTR_DB_STATEMENT="db.statement";Jt.ATTR_DB_SYSTEM="db.system";Jt.ATTR_NET_PEER_NAME="net.peer.name";Jt.ATTR_NET_PEER_PORT="net.peer.port";Jt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Jt.DB_SYSTEM_VALUE_REDIS="redis"});var WW=E(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.endSpan=void 0;var Lge=(b(),O(v)),Dge=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:Lge.SpanStatusCode.ERROR,message:e.message})),t.end()};iE.endSpan=Dge});var cE=E(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.defaultDbStatementSerializer=void 0;var Uge=[{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}],wge=(t,e)=>{if(Array.isArray(e)&&e.length){let n=Uge.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};aE.defaultDbStatementSerializer=wge});var zW=E(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.PACKAGE_NAME=Uu.PACKAGE_VERSION=void 0;Uu.PACKAGE_VERSION="0.62.0";Uu.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var JW=E(uE=>{"use strict";Object.defineProperty(uE,"__esModule",{value:!0});uE.IORedisInstrumentation=void 0;var Qs=(b(),O(v)),Mn=ne(),Xs=(le(),O(Ae)),xn=YW(),KW=ne(),Ed=WW(),kge=cE(),QW=zW(),XW={requireParentSpan:!0},YN=class extends Mn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(QW.PACKAGE_NAME,QW.PACKAGE_VERSION,{...XW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Mn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...XW,...e})}init(){return[new Mn.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Mn.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Mn.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||kge.defaultDbStatementSerializer,a=Qs.trace.getSpan(Qs.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:l,port:p}=this.options,d=i(o.name,o.args);r._dbSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,c[xn.ATTR_DB_STATEMENT]=d,c[xn.ATTR_DB_CONNECTION_STRING]=`redis://${l}:${p}`),r._dbSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,c[Xs.ATTR_DB_QUERY_TEXT]=d),r._netSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_NET_PEER_NAME]=l,c[xn.ATTR_NET_PEER_PORT]=p),r._netSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_SERVER_ADDRESS]=l,c[Xs.ATTR_SERVER_PORT]=p);let _=r.tracer.startSpan(o.name,{kind:Qs.SpanKind.CLIENT,attributes:c}),{requestHook:f}=s;f&&(0,KW.safeExecuteInTheMiddle)(()=>f(_,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),m=>{m&&Qs.diag.error("ioredis instrumentation: request hook failed",m)},!0);try{let m=e.apply(this,arguments),h=o.resolve;o.resolve=function(S){(0,KW.safeExecuteInTheMiddle)(()=>s.responseHook?.(_,o.name,o.args,S),R=>{R&&Qs.diag.error("ioredis instrumentation: response hook failed",R)},!0),(0,Ed.endSpan)(_,null),h(S)};let T=o.reject;return o.reject=function(S){(0,Ed.endSpan)(_,S),T(S)},m}catch(m){throw(0,Ed.endSpan)(_,m),m}}}_traceConnection(e){let n=this;return function(){let r=Qs.trace.getSpan(Qs.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,o[xn.ATTR_DB_STATEMENT]="connect",o[xn.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,o[Xs.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_NET_PEER_NAME]=s,o[xn.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_SERVER_ADDRESS]=s,o[Xs.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Qs.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,Ed.endSpan)(a,null),c}catch(c){throw(0,Ed.endSpan)(a,c),c}}}};uE.IORedisInstrumentation=YN});var ZW=E(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.IORedisInstrumentation=void 0;var Gge=JW();Object.defineProperty(lE,"IORedisInstrumentation",{enumerable:!0,get:function(){return Gge.IORedisInstrumentation}})});var pE=E(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.PACKAGE_NAME=wu.PACKAGE_VERSION=void 0;wu.PACKAGE_VERSION="0.62.0";wu.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var ez=E(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.getTracedCreateStreamTrace=Js.getTracedCreateClient=Js.endSpan=void 0;var Sd=(b(),O(v)),Bge=(t,e)=>{e&&t.setStatus({code:Sd.SpanStatusCode.ERROR,message:e.message}),t.end()};Js.endSpan=Bge;var jge=t=>function(){let n=t.apply(this,arguments);return Sd.context.bind(Sd.context.active(),n)};Js.getTracedCreateClient=jge;var Hge=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){Sd.context.bind(Sd.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Js.getTracedCreateStreamTrace=Hge});var dE=E(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.DB_SYSTEM_VALUE_REDIS=Zt.DB_SYSTEM_NAME_VALUE_REDIS=Zt.ATTR_NET_PEER_PORT=Zt.ATTR_NET_PEER_NAME=Zt.ATTR_DB_SYSTEM=Zt.ATTR_DB_STATEMENT=Zt.ATTR_DB_CONNECTION_STRING=void 0;Zt.ATTR_DB_CONNECTION_STRING="db.connection_string";Zt.ATTR_DB_STATEMENT="db.statement";Zt.ATTR_DB_SYSTEM="db.system";Zt.ATTR_NET_PEER_NAME="net.peer.name";Zt.ATTR_NET_PEER_PORT="net.peer.port";Zt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Zt.DB_SYSTEM_VALUE_REDIS="redis"});var nz=E(fE=>{"use strict";Object.defineProperty(fE,"__esModule",{value:!0});fE.RedisInstrumentationV2_V3=void 0;var Yn=ne(),_E=ez(),tz=pE(),gd=(b(),O(v)),Ad=(le(),O(Ae)),Ea=dE(),Fge=cE(),WN=class t extends Yn.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(tz.PACKAGE_NAME,tz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Yn.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Yn.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,Yn.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Yn.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=gd.trace.getSpan(gd.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||Fge.defaultDbStatementSerializer,l={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(l,{[Ea.ATTR_DB_SYSTEM]:Ea.DB_SYSTEM_VALUE_REDIS,[Ea.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(l,{[Ad.ATTR_DB_SYSTEM_NAME]:Ea.DB_SYSTEM_NAME_VALUE_REDIS,[Ad.ATTR_DB_OPERATION_NAME]:s.command,[Ad.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let p=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:gd.SpanKind.CLIENT,attributes:l});if(this.connection_options){let _={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(_,{[Ea.ATTR_NET_PEER_NAME]:this.connection_options.host,[Ea.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(_,{[Ad.ATTR_SERVER_ADDRESS]:this.connection_options.host,[Ad.ATTR_SERVER_PORT]:this.connection_options.port}),p.setAttributes(_)}this.address&&e._semconvStability&Yn.SemconvStability.OLD&&p.setAttribute(Ea.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let d=arguments[0].callback;if(d){let _=gd.context.active();arguments[0].callback=function(m,h){if(i?.responseHook){let T=i.responseHook;(0,Yn.safeExecuteInTheMiddle)(()=>{T(p,s.command,s.args,h)},S=>{S&&e._diag.error("Error executing responseHook",S)},!0)}return(0,_E.endSpan)(p,m),gd.context.with(_,d,this,...arguments)}}try{return r.apply(this,arguments)}catch(_){throw(0,_E.endSpan)(p,_),_}}}}_getPatchCreateClient(){return function(n){return(0,_E.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,_E.getTracedCreateStreamTrace)(n)}}};fE.RedisInstrumentationV2_V3=WN});var oz=E(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.getClientAttributes=void 0;var zN=(le(),O(Ae)),ku=dE(),rz=ne();function Vge(t,e,n){let r={};return n&rz.SemconvStability.OLD&&Object.assign(r,{[ku.ATTR_DB_SYSTEM]:ku.DB_SYSTEM_VALUE_REDIS,[ku.ATTR_NET_PEER_NAME]:e?.socket?.host,[ku.ATTR_NET_PEER_PORT]:e?.socket?.port,[ku.ATTR_DB_CONNECTION_STRING]:qge(t,e?.url)}),n&rz.SemconvStability.STABLE&&Object.assign(r,{[zN.ATTR_DB_SYSTEM_NAME]:ku.DB_SYSTEM_NAME_VALUE_REDIS,[zN.ATTR_SERVER_ADDRESS]:e?.socket?.host,[zN.ATTR_SERVER_PORT]:e?.socket?.port}),r}mE.getClientAttributes=Vge;function qge(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var cz=E(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.RedisInstrumentationV4_V5=void 0;var _r=(b(),O(v)),xe=ne(),sz=oz(),$ge=cE(),iz=pE(),KN=(le(),O(Ae)),Yge=dE(),Rd=Symbol("opentelemetry.instrumentation.redis.open_spans"),az=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),QN=class t extends xe.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(iz.PACKAGE_NAME,iz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,xe.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,xe.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,xe.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,xe.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new xe.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,l){let p=e(c,l).args;return n._traceClientCommand(a,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[Rd];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[Rd];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let l=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,l,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[az]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,sz.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:_r.SpanKind.CLIENT,attributes:i});return _r.context.with(_r.trace.setSpan(_r.context.active(),a),()=>r.apply(this)).then(l=>(a.end(),l)).catch(l=>(a.recordException(l),a.setStatus({code:_r.SpanStatusCode.ERROR,message:l.message}),a.end(),Promise.reject(l)))}}}_traceClientCommand(e,n,r,o){if(_r.trace.getSpan(_r.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[az],a=o[0],c=o.slice(1),l=this.getConfig().dbStatementSerializer||$ge.defaultDbStatementSerializer,p=(0,sz.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_OPERATION_NAME]=a);try{let f=l(a,c);f!=null&&(this._semconvStability&xe.SemconvStability.OLD&&(p[Yge.ATTR_DB_STATEMENT]=f),this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_QUERY_TEXT]=f))}catch(f){this._diag.error("dbStatementSerializer throw an exception",f,{commandName:a})}let d=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:_r.SpanKind.CLIENT,attributes:p}),_=_r.context.with(_r.trace.setSpan(_r.context.active(),d),()=>e.apply(n,r));if(typeof _?.then=="function")_.then(f=>{this._endSpanWithResponse(d,a,c,f,void 0)},f=>{this._endSpanWithResponse(d,a,c,null,f)});else{let f=_;f[Rd]=f[Rd]||[],f[Rd].push({span:d,commandName:a,commandArgs:c})}return _}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:l}=e[a],p=n[a],[d,_]=p instanceof Error?[null,p]:[p,void 0];this._semconvStability&xe.SemconvStability.STABLE&&c.setAttribute(KN.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],l,d,_)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:_r.SpanStatusCode.ERROR,message:s?.message})),e.end()}};hE.RedisInstrumentationV4_V5=QN});var pz=E(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.RedisInstrumentation=void 0;var Wge=ne(),uz=pE(),zge=nz(),Kge=cz(),lz={requireParentSpan:!1},XN=class extends Wge.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...lz,...e};super(uz.PACKAGE_NAME,uz.PACKAGE_VERSION,n),this.instrumentationV2_V3=new zge.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new Kge.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...lz,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}};TE.RedisInstrumentation=XN});var dz=E(EE=>{"use strict";Object.defineProperty(EE,"__esModule",{value:!0});EE.RedisInstrumentation=void 0;var Qge=pz();Object.defineProperty(EE,"RedisInstrumentation",{enumerable:!0,get:function(){return Qge.RedisInstrumentation}})});var Rz=E(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.EVENT_LISTENERS_SET=void 0;gE.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var eb=E(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.AttributeNames=void 0;var rAe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(rAe=Od.AttributeNames||(Od.AttributeNames={}))});var tb=E(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=Se.METRIC_DB_CLIENT_CONNECTION_COUNT=Se.DB_SYSTEM_VALUE_POSTGRESQL=Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED=Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=Se.ATTR_NET_PEER_PORT=Se.ATTR_NET_PEER_NAME=Se.ATTR_DB_USER=Se.ATTR_DB_SYSTEM=Se.ATTR_DB_STATEMENT=Se.ATTR_DB_NAME=Se.ATTR_DB_CONNECTION_STRING=Se.ATTR_DB_CLIENT_CONNECTION_STATE=Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";Se.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";Se.ATTR_DB_CONNECTION_STRING="db.connection_string";Se.ATTR_DB_NAME="db.name";Se.ATTR_DB_STATEMENT="db.statement";Se.ATTR_DB_SYSTEM="db.system";Se.ATTR_DB_USER="db.user";Se.ATTR_NET_PEER_NAME="net.peer.name";Se.ATTR_NET_PEER_PORT="net.peer.port";Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";Se.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";Se.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var nb=E(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.SpanNames=void 0;var oAe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(oAe=Nd.SpanNames||(Nd.SpanNames={}))});var Pz=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.sanitizedErrorMessage=me.isObjectWithTextString=me.getErrorMessage=me.patchClientConnectCallback=me.patchCallbackPGPool=me.updateCounter=me.getPoolName=me.patchCallback=me.handleExecutionResult=me.handleConfigQuery=me.shouldSkipInstrumentation=me.getSemanticAttributesFromPoolConnection=me.getSemanticAttributesFromConnection=me.getConnectionString=me.parseAndMaskConnectionString=me.parseNormalizedOperationName=me.getQuerySpanName=void 0;var Zs=(b(),O(v)),AE=eb(),fr=(le(),O(Ae)),Ve=tb(),Sa=ne(),yz=nb();function Iz(t,e){if(!e)return yz.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:Oz(e.text);return`${yz.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}me.getQuerySpanName=Iz;function Oz(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}me.parseNormalizedOperationName=Oz;function Nz(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}me.parseAndMaskConnectionString=Nz;function rb(t){if("connectionString"in t&&t.connectionString)return Nz(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}me.getConnectionString=rb;function RE(t){if(Number.isInteger(t))return t}function bz(t,e){let n={};return e&Sa.SemconvStability.OLD&&(n={...n,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_DB_USER]:t.user,[Ve.ATTR_NET_PEER_NAME]:t.host,[Ve.ATTR_NET_PEER_PORT]:RE(t.port)}),e&Sa.SemconvStability.STABLE&&(n={...n,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:t.host,[fr.ATTR_SERVER_PORT]:RE(t.port)}),n}me.getSemanticAttributesFromConnection=bz;function sAe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[AE.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[AE.AttributeNames.MAX_CLIENT]:t.maxClient};return e&Sa.SemconvStability.OLD&&(r={...r,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Ve.ATTR_NET_PEER_PORT]:Number(n?.port)||RE(t.port),[Ve.ATTR_DB_USER]:n?.username??t.user}),e&Sa.SemconvStability.STABLE&&(r={...r,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[fr.ATTR_SERVER_PORT]:Number(n?.port)||RE(t.port)}),r}me.getSemanticAttributesFromPoolConnection=sAe;function iAe(t){return t.requireParentSpan===!0&&Zs.trace.getSpan(Zs.context.active())===void 0}me.shouldSkipInstrumentation=iAe;function aAe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=Iz(s,r),a=t.startSpan(i,{kind:Zs.SpanKind.CLIENT,attributes:bz(o,n)});if(!r)return a;if(r.text&&(n&Sa.SemconvStability.OLD&&a.setAttribute(Ve.ATTR_DB_STATEMENT,r.text),n&Sa.SemconvStability.STABLE&&a.setAttribute(fr.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(l=>l==null?"null":l instanceof Buffer?l.toString():typeof l=="object"?typeof l.toPostgres=="function"?l.toPostgres():JSON.stringify(l):l.toString());a.setAttribute(AE.AttributeNames.PG_VALUES,c)}catch(c){Zs.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(AE.AttributeNames.PG_PLAN,r.name),a}me.handleConfigQuery=aAe;function Cz(t,e,n){typeof t.responseHook=="function"&&(0,Sa.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&Zs.diag.error("Error running response hook",r)},!0)}me.handleExecutionResult=Cz;function cAe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[fr.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(yE(i)),e.setStatus({code:Zs.SpanStatusCode.ERROR,message:i.message})):Cz(t,e,a),o(),e.end(),n.call(this,i,a)}}me.patchCallback=cAe;function uAe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}me.getPoolName=uAe;function lAe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}me.updateCounter=lAe;function pAe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(yE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}me.patchCallbackPGPool=pAe;function dAe(t,e){return function(r){r&&(r instanceof Error&&t.recordException(yE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}me.patchClientConnectCallback=dAe;function _Ae(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}me.getErrorMessage=_Ae;function fAe(t){return typeof t=="object"&&typeof t?.text=="string"}me.isObjectWithTextString=fAe;function yE(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}me.sanitizedErrorMessage=yE});var Mz=E(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.PACKAGE_NAME=Gu.PACKAGE_VERSION=void 0;Gu.PACKAGE_VERSION="0.66.0";Gu.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var wz=E(OE=>{"use strict";Object.defineProperty(OE,"__esModule",{value:!0});OE.PgInstrumentation=void 0;var mn=ne(),Ie=(b(),O(v)),xz=Rz(),ke=Pz(),vz=jN(),Lz=Mz(),Dz=nb(),IE=Te(),wr=(le(),O(Ae)),bd=tb();function Bu(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var ob=class extends mn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(Lz.PACKAGE_NAME,Lz.PACKAGE_VERSION,e),this._semconvStability=(0,mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(wr.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ie.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(bd.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"}),this._connectionPendingRequests=this.meter.createUpDownCounter(bd.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new mn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new mn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new mn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=Bu(a);return this._patchPgClient(c.Client),a},a=>{let c=Bu(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new mn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=Bu(a);return(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=Bu(a);(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=Bu(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=Bu(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchClientConnectCallback(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}recordOperationDuration(e,n){let r={},o=[wr.ATTR_DB_NAMESPACE,wr.ATTR_ERROR_TYPE,wr.ATTR_SERVER_PORT,wr.ATTR_SERVER_ADDRESS,wr.ATTR_DB_OPERATION_NAME];this._semconvStability&mn.SemconvStability.OLD&&o.push(bd.ATTR_DB_SYSTEM),this._semconvStability&mn.SemconvStability.STABLE&&o.push(wr.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,IE.hrTimeToMilliseconds)((0,IE.hrTimeDuration)(n,(0,IE.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ke.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,IE.hrTime)(),i=o[0],a=typeof i=="string",c=ke.isObjectWithTextString(i),l=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,p={[bd.ATTR_DB_SYSTEM]:bd.DB_SYSTEM_VALUE_POSTGRESQL,[wr.ATTR_DB_NAMESPACE]:this.database,[wr.ATTR_SERVER_PORT]:this.connectionParameters.port,[wr.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};l?.text&&(p[wr.ATTR_DB_OPERATION_NAME]=ke.parseNormalizedOperationName(l?.text));let d=()=>{e.recordOperationDuration(p,s)},_=e.getConfig(),f=ke.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,l);if(_.addSqlCommenterCommentToQueries&&(a?o[0]=(0,vz.addSqlCommenterComment)(f,i):c&&!("name"in i)&&(o[0]={...i,text:(0,vz.addSqlCommenterComment)(f,i.text)})),o.length>0){let T=Ie.trace.getSpan(Ie.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ke.patchCallback(_,f,o[o.length-1],p,d),T&&(o[o.length-1]=Ie.context.bind(Ie.context.active(),o[o.length-1]));else if(typeof l?.callback=="function"){let S=ke.patchCallback(e.getConfig(),f,l.callback,p,d);T&&(S=Ie.context.bind(Ie.context.active(),S)),o[0].callback=S}}let{requestHook:m}=_;typeof m=="function"&&l&&(0,mn.safeExecuteInTheMiddle)(()=>{let{database:T,host:S,port:R,user:I}=this.connectionParameters;m(f,{connection:{database:T,host:S,port:R,user:I},query:{text:l.text,values:l.values,name:l.name}})},T=>{T&&e._diag.error("Error running query hook",T)},!0);let h;try{h=n.apply(this,o)}catch(T){throw T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(T)}),f.end(),T}return h instanceof Promise?h.then(T=>new Promise(S=>{ke.handleExecutionResult(e.getConfig(),f,T),d(),f.end(),S(T)})).catch(T=>new Promise((S,R)=>{T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:T.message}),d(),f.end(),R(T)})):h})}_setPoolConnectEventListeners(e){if(e[xz.EVENT_LISTENERS_SET])return;let n=ke.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[xz.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.POOL_CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchCallbackPGPool(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}};OE.PgInstrumentation=ob;function Uz(t,e){if(!(e instanceof Promise))return e;let n=e;return Ie.context.bind(Ie.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ke.sanitizedErrorMessage(r)),t.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var kz=E(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.AttributeNames=ju.PgInstrumentation=void 0;var mAe=wz();Object.defineProperty(ju,"PgInstrumentation",{enumerable:!0,get:function(){return mAe.PgInstrumentation}});var hAe=eb();Object.defineProperty(ju,"AttributeNames",{enumerable:!0,get:function(){return hAe.AttributeNames}})});var $z=E(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.SeverityNumber=void 0;var AAe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(AAe=Cd.SeverityNumber||(Cd.SeverityNumber={}))});var bE=E(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.NOOP_LOGGER=Hu.NoopLogger=void 0;var NE=class{emit(e){}};Hu.NoopLogger=NE;Hu.NOOP_LOGGER=new NE});var PE=E(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.NOOP_LOGGER_PROVIDER=Fu.NoopLoggerProvider=void 0;var RAe=bE(),CE=class{getLogger(e,n,r){return new RAe.NoopLogger}};Fu.NoopLoggerProvider=CE;Fu.NOOP_LOGGER_PROVIDER=new CE});var cb=E(ME=>{"use strict";Object.defineProperty(ME,"__esModule",{value:!0});ME.ProxyLogger=void 0;var yAe=bE(),ab=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):yAe.NOOP_LOGGER}};ME.ProxyLogger=ab});var lb=E(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});xE.ProxyLoggerProvider=void 0;var IAe=PE(),OAe=cb(),ub=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new OAe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:IAe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};xE.ProxyLoggerProvider=ub});var Yz=E(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE._globalThis=void 0;vE._globalThis=typeof globalThis=="object"?globalThis:global});var Wz=E(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE._globalThis=void 0;var NAe=Yz();Object.defineProperty(LE,"_globalThis",{enumerable:!0,get:function(){return NAe._globalThis}})});var zz=E(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE._globalThis=void 0;var bAe=Wz();Object.defineProperty(DE,"_globalThis",{enumerable:!0,get:function(){return bAe._globalThis}})});var Kz=E(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.API_BACKWARDS_COMPATIBILITY_VERSION=_o.makeGetter=_o._global=_o.GLOBAL_LOGS_API_KEY=void 0;var CAe=zz();_o.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");_o._global=CAe._globalThis;function PAe(t,e,n){return r=>r===t?e:n}_o.makeGetter=PAe;_o.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Xz=E(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.LogsAPI=void 0;var mr=Kz(),MAe=PE(),Qz=lb(),pb=class t{constructor(){this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return mr._global[mr.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(mr._global[mr.GLOBAL_LOGS_API_KEY]=(0,mr.makeGetter)(mr.API_BACKWARDS_COMPATIBILITY_VERSION,e,MAe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=mr._global[mr.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(mr._global,mr.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete mr._global[mr.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}};UE.LogsAPI=pb});var db=E(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.logs=Pt.ProxyLoggerProvider=Pt.ProxyLogger=Pt.NoopLoggerProvider=Pt.NOOP_LOGGER_PROVIDER=Pt.NoopLogger=Pt.NOOP_LOGGER=Pt.SeverityNumber=void 0;var xAe=$z();Object.defineProperty(Pt,"SeverityNumber",{enumerable:!0,get:function(){return xAe.SeverityNumber}});var Jz=bE();Object.defineProperty(Pt,"NOOP_LOGGER",{enumerable:!0,get:function(){return Jz.NOOP_LOGGER}});Object.defineProperty(Pt,"NoopLogger",{enumerable:!0,get:function(){return Jz.NoopLogger}});var Zz=PE();Object.defineProperty(Pt,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return Zz.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Pt,"NoopLoggerProvider",{enumerable:!0,get:function(){return Zz.NoopLoggerProvider}});var vAe=cb();Object.defineProperty(Pt,"ProxyLogger",{enumerable:!0,get:function(){return vAe.ProxyLogger}});var LAe=lb();Object.defineProperty(Pt,"ProxyLoggerProvider",{enumerable:!0,get:function(){return LAe.ProxyLoggerProvider}});var DAe=Xz();Pt.logs=DAe.LogsAPI.getInstance()});var eK=E(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.disableInstrumentations=Vu.enableInstrumentations=void 0;function UAe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}Vu.enableInstrumentations=UAe;function wAe(t){t.forEach(e=>e.disable())}Vu.disableInstrumentations=wAe});var rK=E(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.registerInstrumentations=void 0;var tK=(b(),O(v)),kAe=db(),nK=eK();function GAe(t){let e=t.tracerProvider||tK.trace.getTracerProvider(),n=t.meterProvider||tK.metrics.getMeterProvider(),r=t.loggerProvider||kAe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,nK.enableInstrumentations)(o,e,n,r),()=>{(0,nK.disableInstrumentations)(o)}}wE.registerInstrumentations=GAe});var dK=E(kE=>{"use strict";Object.defineProperty(kE,"__esModule",{value:!0});kE.satisfies=void 0;var hb=(b(),O(v)),cK=/^(?: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-]+)*))?$/,BAe=/^(?<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-]+)*))?$/,jAe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function HAe(t,e,n){if(!FAe(t))return hb.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=YAe(t);if(!r)return!1;let o=[],s=uK(r,e,o,n);return s&&!n?.includePrerelease?qAe(r,o):s}kE.satisfies=HAe;function FAe(t){return typeof t=="string"&&cK.test(t)}function uK(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(_b(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=_Re(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!_b(t,s,n,r))return!1;return!0}return _b(t,e,n,r)}function _b(t,e,n,r){if(e=$Ae(e,r),e.includes(" "))return uK(t,e,n,r);{let o=WAe(e);return n.push(o),VAe(t,o)}}function VAe(t,e){if(e.invalid)return!1;if(!e.version||mb(e.version))return!0;let n=sK(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=sK(r,o)}return jAe[e.op]?.includes(n)}function qAe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function $Ae(t,e){return t=t.trim(),t=pRe(t,e),t=lRe(t),t=dRe(t,e),t=t.trim(),t}function hn(t){return!t||t.toLowerCase()==="x"||t==="*"}function YAe(t){let e=t.match(cK);if(!e){hb.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function WAe(t){if(!t)return{};let e=t.match(BAe);if(!e)return hb.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function mb(t){return t==="*"||t==="x"||t==="X"}function oK(t){let e=parseInt(t,10);return isNaN(e)?t:e}function zAe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function KAe(t,e){if(mb(t)||mb(e))return 0;let[n,r]=zAe(oK(t),oK(e));return n>r?1:n<r?-1:0}function sK(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=KAe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var lK="[a-zA-Z0-9-]",pK="0|[1-9]\\d*",QAe=`\\d*[a-zA-Z-]${lK}*`,XAe="((?:<|>)?=?)",iK=`(?:${pK}|${QAe})`,JAe=`(?:-(${iK}(?:\\.${iK})*))`,aK=`${lK}+`,ZAe=`(?:\\+(${aK}(?:\\.${aK})*))`,fb=`${pK}|x|X|\\*`,Pd=`[v=\\s]*(${fb})(?:\\.(${fb})(?:\\.(${fb})(?:${JAe})?${ZAe}?)?)?`,eRe=`^${XAe}\\s*${Pd}$`,tRe=new RegExp(eRe),nRe=`^\\s*(${Pd})\\s+-\\s+(${Pd})\\s*$`,rRe=new RegExp(nRe),oRe="(?:~>?)",sRe=`^${oRe}${Pd}$`,iRe=new RegExp(sRe),aRe="(?:\\^)",cRe=`^${aRe}${Pd}$`,uRe=new RegExp(cRe);function lRe(t){let e=iRe;return t.replace(e,(n,r,o,s,i)=>{let a;return hn(r)?a="":hn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:hn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function pRe(t,e){let n=uRe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return hn(s)?l="":hn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:hn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function dRe(t,e){let n=tRe;return t.replace(n,(r,o,s,i,a,c)=>{let l=hn(s),p=l||hn(i),d=p||hn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function _Re(t,e){let n=rRe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(hn(s)?o="":hn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:hn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,hn(d)?p="":hn(_)?p=`<${+d+1}.0.0-0`:hn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var Tb=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.massUnwrap=Ht.unwrap=Ht.massWrap=Ht.wrap=void 0;var Tn=console.error.bind(console);function Md(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var fRe=(t,e,n)=>{if(!t||!t[e]){Tn("no original function "+String(e)+" to wrap");return}if(!n){Tn("no wrapper function"),Tn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Tn("original object and wrapper must be functions");return}let o=n(r,e);return Md(o,"__original",r),Md(o,"__unwrap",()=>{t[e]===o&&Md(t,e,r)}),Md(o,"__wrapped",!0),Md(t,e,o),o};Ht.wrap=fRe;var mRe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Ht.wrap)(r,o,n)})})};Ht.massWrap=mRe;var hRe=(t,e)=>{if(!t||!t[e]){Tn("no function to unwrap."),Tn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Tn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Ht.unwrap=hRe;var TRe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Ht.unwrap)(n,r)})})};Ht.massUnwrap=TRe;function xd(t){t&&t.logger&&(typeof t.logger!="function"?Tn("new logger isn't a function, not replacing"):Tn=t.logger)}Ht.default=xd;xd.wrap=Ht.wrap;xd.massWrap=Ht.massWrap;xd.unwrap=Ht.unwrap;xd.massUnwrap=Ht.massUnwrap});var _K=E(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.InstrumentationAbstract=void 0;var Eb=(b(),O(v)),ERe=db(),GE=Tb(),Sb=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=Eb.diag.createComponentLogger({namespace:e}),this._tracer=Eb.trace.getTracer(e,n),this._meter=Eb.metrics.getMeter(e,n),this._logger=ERe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=GE.wrap;_unwrap=GE.unwrap;_massWrap=GE.massWrap;_massUnwrap=GE.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};BE.InstrumentationAbstract=Sb});var fK=E(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ModuleNameTrie=ti.ModuleNameSeparator=void 0;ti.ModuleNameSeparator="/";var jE=class{hooks=[];children=new Map},gb=class{_trie=new jE;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ti.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new jE,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ti.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ti.ModuleNameTrie=gb});var hK=E(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.RequireInTheMiddleSingleton=void 0;var SRe=wi(),mK=U("path"),Ab=fK(),gRe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),Rb=class t{_moduleNameTrie=new Ab.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new SRe.Hook(null,{internals:!0},(e,n,r)=>{let o=ARe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return gRe?new t:this._instance=this._instance??new t}};HE.RequireInTheMiddleSingleton=Rb;function ARe(t){return mK.sep!==Ab.ModuleNameSeparator?t.split(mK.sep).join(Ab.ModuleNameSeparator):t}});var yb=E(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.isWrapped=ni.safeExecuteInTheMiddleAsync=ni.safeExecuteInTheMiddle=void 0;function RRe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddle=RRe;async function yRe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddleAsync=yRe;function IRe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ni.isWrapped=IRe});var SK=E(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0});FE.InstrumentationBase=void 0;var vd=U("path"),TK=U("util"),ORe=dK(),Ib=Tb(),NRe=_K(),bRe=hK(),CRe=oN(),Ld=(b(),O(v)),PRe=wi(),MRe=U("fs"),xRe=yb(),Ob=class extends NRe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=bRe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,xRe.isWrapped)(e[n])&&this._unwrap(e,n),TK.types.isProxy(e)){let o=(0,Ib.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,Ib.wrap)(e,n,r)};_unwrap=(e,n)=>TK.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,Ib.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Ld.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Ld.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Ld.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Ld.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,MRe.readFileSync)(vd.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Ld.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return EK(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=vd.normalize(r);return i.filter(l=>l.name===a).filter(l=>EK(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&vd.isAbsolute(a)){let l=vd.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=vd.isAbsolute(e.name)?new PRe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new CRe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};FE.InstrumentationBase=Ob;function EK(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,ORe.satisfies)(e,r,{includePrerelease:n}))}});var gK=E(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.normalize=void 0;var vRe=U("path");Object.defineProperty(VE,"normalize",{enumerable:!0,get:function(){return vRe.normalize}})});var AK=E(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.normalize=qu.InstrumentationBase=void 0;var LRe=SK();Object.defineProperty(qu,"InstrumentationBase",{enumerable:!0,get:function(){return LRe.InstrumentationBase}});var DRe=gK();Object.defineProperty(qu,"normalize",{enumerable:!0,get:function(){return DRe.normalize}})});var Nb=E($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.normalize=$u.InstrumentationBase=void 0;var RK=AK();Object.defineProperty($u,"InstrumentationBase",{enumerable:!0,get:function(){return RK.InstrumentationBase}});Object.defineProperty($u,"normalize",{enumerable:!0,get:function(){return RK.normalize}})});var yK=E(qE=>{"use strict";Object.defineProperty(qE,"__esModule",{value:!0});qE.InstrumentationNodeModuleDefinition=void 0;var bb=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};qE.InstrumentationNodeModuleDefinition=bb});var IK=E($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.InstrumentationNodeModuleFile=void 0;var URe=Nb(),Cb=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,URe.normalize)(e)}};$E.InstrumentationNodeModuleFile=Cb});var OK=E(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.semconvStabilityFromStr=ga.SemconvStability=void 0;var YE;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(YE=ga.SemconvStability||(ga.SemconvStability={}));function wRe(t,e){let n=YE.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=YE.DUPLICATE;break}else o.toLowerCase()===t&&(n=YE.STABLE);return n}ga.semconvStabilityFromStr=wRe});var bK=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.semconvStabilityFromStr=ut.SemconvStability=ut.safeExecuteInTheMiddleAsync=ut.safeExecuteInTheMiddle=ut.isWrapped=ut.InstrumentationNodeModuleFile=ut.InstrumentationNodeModuleDefinition=ut.InstrumentationBase=ut.registerInstrumentations=void 0;var kRe=rK();Object.defineProperty(ut,"registerInstrumentations",{enumerable:!0,get:function(){return kRe.registerInstrumentations}});var GRe=Nb();Object.defineProperty(ut,"InstrumentationBase",{enumerable:!0,get:function(){return GRe.InstrumentationBase}});var BRe=yK();Object.defineProperty(ut,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return BRe.InstrumentationNodeModuleDefinition}});var jRe=IK();Object.defineProperty(ut,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return jRe.InstrumentationNodeModuleFile}});var Pb=yb();Object.defineProperty(ut,"isWrapped",{enumerable:!0,get:function(){return Pb.isWrapped}});Object.defineProperty(ut,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddle}});Object.defineProperty(ut,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddleAsync}});var NK=OK();Object.defineProperty(ut,"SemconvStability",{enumerable:!0,get:function(){return NK.SemconvStability}});Object.defineProperty(ut,"semconvStabilityFromStr",{enumerable:!0,get:function(){return NK.semconvStabilityFromStr}})});var kK=E(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.PACKAGE_NAME=Wu.PACKAGE_VERSION=void 0;Wu.PACKAGE_VERSION="0.60.0";Wu.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Lb=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HapiLifecycleMethodNames=fo.HapiLayerType=fo.handlerPatched=fo.HapiComponentName=void 0;fo.HapiComponentName="@hapi/hapi";fo.handlerPatched=Symbol("hapi-handler-patched");fo.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};fo.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var GK=E(zE=>{"use strict";Object.defineProperty(zE,"__esModule",{value:!0});zE.ATTR_HTTP_METHOD=void 0;zE.ATTR_HTTP_METHOD="http.method"});var Db=E(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.AttributeNames=void 0;var nye;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(nye=Dd.AttributeNames||(Dd.AttributeNames={}))});var HK=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getPluginFromInput=lt.getExtMetadata=lt.getRouteMetadata=lt.isPatchableExtMethod=lt.isDirectExtInput=lt.isLifecycleExtEventObj=lt.isLifecycleExtType=lt.getPluginName=void 0;var BK=(le(),O(Ae)),rye=GK(),Ud=Lb(),ri=Db(),jK=ne();function oye(t){return t.name?t.name:t.pkg.name}lt.getPluginName=oye;var sye=t=>typeof t=="string"&&Ud.HapiLifecycleMethodNames.has(t);lt.isLifecycleExtType=sye;var iye=t=>{let e=t?.type;return e!==void 0&&(0,lt.isLifecycleExtType)(e)};lt.isLifecycleExtEventObj=iye;var aye=t=>Array.isArray(t)&&t.length<=3&&(0,lt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";lt.isDirectExtInput=aye;var cye=t=>!Array.isArray(t);lt.isPatchableExtMethod=cye;var uye=(t,e,n)=>{let r={[BK.ATTR_HTTP_ROUTE]:t.path};e&jK.SemconvStability.OLD&&(r[rye.ATTR_HTTP_METHOD]=t.method),e&jK.SemconvStability.STABLE&&(r[BK.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ri.AttributeNames.HAPI_TYPE]=Ud.HapiLayerType.PLUGIN,r[ri.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ri.AttributeNames.HAPI_TYPE]=Ud.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};lt.getRouteMetadata=uye;var lye=(t,e,n)=>{let r=`ext - ${t}`;return n&&n!=="method"&&(r=`ext - ${t} - ${n}`),e?{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:Ud.HapiLayerType.EXT,[ri.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ${r}`}:{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:Ud.HapiLayerType.EXT},name:r}};lt.getExtMetadata=lye;var pye=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;lt.getPluginFromInput=pye});var qK=E(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.HapiInstrumentation=void 0;var Wn=(b(),O(v)),FK=Te(),wd=ne(),VK=kK(),kd=Lb(),Qo=HK(),Ub=class extends wd.InstrumentationBase{_semconvStability;constructor(e={}){super(VK.PACKAGE_NAME,VK.PACKAGE_VERSION,e),this._semconvStability=(0,wd.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new wd.InstrumentationNodeModuleDefinition(kd.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,wd.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,wd.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,Qo.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Qo.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,Qo.isLifecycleExtType)(c.type)){let l=c,p=r._wrapExtMethods(l.method,c.type,n);l.method=p,i[a]=l}}return e.apply(this,s)}else if((0,Qo.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,Qo.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,Qo.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),s._wrap(a,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,Qo.isPatchableExtMethod)(e))return e[kd.handlerPatched]===!0?e:(e[kd.handlerPatched]=!0,async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await e.apply(this,i);let a=(0,Qo.getExtMetadata)(n,r,e.name),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),c),e,void 0,...i)}catch(l){throw c.recordException(l),c.setStatus({code:Wn.SpanStatusCode.ERROR,message:l.message}),l}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[kd.handlerPatched]===!0)return e;e[kd.handlerPatched]=!0;let o=s=>async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await s.call(this,...i);let a=(0,FK.getRPCMetadata)(Wn.context.active());a?.type===FK.RPCType.HTTP&&(a.route=e.path);let c=(0,Qo.getRouteMetadata)(e,r._semconvStability,n),l=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),l),()=>s.call(this,...i))}catch(p){throw l.recordException(p),l.setStatus({code:Wn.SpanStatusCode.ERROR,message:p.message}),p}finally{l.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};KE.HapiInstrumentation=Ub});var $K=E(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.AttributeNames=zu.HapiInstrumentation=void 0;var dye=qK();Object.defineProperty(zu,"HapiInstrumentation",{enumerable:!0,get:function(){return dye.HapiInstrumentation}});var _ye=Db();Object.defineProperty(zu,"AttributeNames",{enumerable:!0,get:function(){return _ye.AttributeNames}})});var JE=E(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.KoaLayerType=void 0;var Sye;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(Sye=Bd.KoaLayerType||(Bd.KoaLayerType={}))});var ZK=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.PACKAGE_NAME=Ku.PACKAGE_VERSION=void 0;Ku.PACKAGE_VERSION="0.62.0";Ku.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var wb=E(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.AttributeNames=void 0;var gye;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(gye=jd.AttributeNames||(jd.AttributeNames={}))});var t2=E(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.isLayerIgnored=Qu.getMiddlewareMetadata=void 0;var e2=JE(),ZE=wb(),Aye=(le(),O(Ae)),Rye=(t,e,n,r)=>n?{attributes:{[ZE.AttributeNames.KOA_NAME]:r?.toString(),[ZE.AttributeNames.KOA_TYPE]:e2.KoaLayerType.ROUTER,[Aye.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[ZE.AttributeNames.KOA_NAME]:e.name??"middleware",[ZE.AttributeNames.KOA_TYPE]:e2.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Qu.getMiddlewareMetadata=Rye;var yye=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Qu.isLayerIgnored=yye});var n2=E(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});eS.kLayerPatched=void 0;eS.kLayerPatched=Symbol("koa-layer-patched")});var c2=E(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});tS.KoaInstrumentation=void 0;var mo=(b(),O(v)),Hd=ne(),r2=JE(),o2=ZK(),s2=t2(),i2=Te(),a2=n2(),kb=class extends Hd.InstrumentationBase{constructor(e={}){super(o2.PACKAGE_NAME,o2.PACKAGE_VERSION,e)}init(){return new Hd.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Hd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,Hd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){mo.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?r2.KoaLayerType.ROUTER:r2.KoaLayerType.MIDDLEWARE;return e[a2.kLayerPatched]===!0||(0,s2.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(mo.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[a2.kLayerPatched]=!0,mo.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(mo.trace.getSpan(mo.context.active())===void 0)return e(s,i);let c=(0,s2.getMiddlewareMetadata)(s,e,n,r),l=this.tracer.startSpan(c.name,{attributes:c.attributes}),p=(0,i2.getRPCMetadata)(mo.context.active());p?.type===i2.RPCType.HTTP&&s._matchedRoute&&(p.route=s._matchedRoute.toString());let{requestHook:d}=this.getConfig();d&&(0,Hd.safeExecuteInTheMiddle)(()=>d(l,{context:s,middlewareLayer:e,layerType:o}),f=>{f&&mo.diag.error("koa instrumentation: request hook failed",f)},!0);let _=mo.trace.setSpan(mo.context.active(),l);return mo.context.with(_,async()=>{try{return await e(s,i)}catch(f){throw l.recordException(f),f}finally{l.end()}})})}};tS.KoaInstrumentation=kb});var u2=E(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.KoaLayerType=si.AttributeNames=si.KoaInstrumentation=void 0;var Iye=c2();Object.defineProperty(si,"KoaInstrumentation",{enumerable:!0,get:function(){return Iye.KoaInstrumentation}});var Oye=wb();Object.defineProperty(si,"AttributeNames",{enumerable:!0,get:function(){return Oye.AttributeNames}});var Nye=JE();Object.defineProperty(si,"KoaLayerType",{enumerable:!0,get:function(){return Nye.KoaLayerType}})});var Gb=E(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.ConnectNames=kr.ConnectTypes=kr.AttributeNames=void 0;var Cye;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(Cye=kr.AttributeNames||(kr.AttributeNames={}));var Pye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Pye=kr.ConnectTypes||(kr.ConnectTypes={}));var Mye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(Mye=kr.ConnectNames||(kr.ConnectNames={}))});var f2=E(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.PACKAGE_NAME=Xu.PACKAGE_VERSION=void 0;Xu.PACKAGE_VERSION="0.57.0";Xu.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var m2=E(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});nS._LAYERS_STORE_PROPERTY=void 0;nS._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var h2=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.generateRoute=ai.replaceCurrentStackRoute=ai.addNewStackLayer=void 0;var xye=(b(),O(v)),ii=m2(),vye=t=>{Array.isArray(t[ii._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ii._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ii._LAYERS_STORE_PROPERTY].push("/");let e=t[ii._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ii._LAYERS_STORE_PROPERTY].length?t[ii._LAYERS_STORE_PROPERTY].pop():xye.diag.warn("Connect: Trying to pop the stack multiple time")}};ai.addNewStackLayer=vye;var Lye=(t,e)=>{e&&t[ii._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ai.replaceCurrentStackRoute=Lye;var Dye=t=>t[ii._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ai.generateRoute=Dye});var S2=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.ConnectInstrumentation=ci.ANONYMOUS_NAME=void 0;var Uye=(b(),O(v)),T2=Te(),Ju=Gb(),E2=f2(),rS=ne(),wye=(le(),O(Ae)),Bb=h2();ci.ANONYMOUS_NAME="anonymous";var jb=class extends rS.InstrumentationBase{constructor(e={}){super(E2.PACKAGE_NAME,E2.PACKAGE_VERSION,e)}init(){return[new rS.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,rS.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,rS.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=Ju.ConnectTypes.REQUEST_HANDLER,s=Ju.ConnectNames.REQUEST_HANDLER,o=e):(r=Ju.ConnectTypes.MIDDLEWARE,s=Ju.ConnectNames.MIDDLEWARE,o=n.name||ci.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[wye.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[Ju.AttributeNames.CONNECT_TYPE]:r,[Ju.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],l=arguments[i],p=arguments[a],d=arguments[c];(0,Bb.replaceCurrentStackRoute)(l,e);let _=(0,T2.getRPCMetadata)(Uye.context.active());e&&_?.type===T2.RPCType.HTTP&&(_.route=(0,Bb.generateRoute)(l));let f="";e?f=`request handler - ${e}`:f=`middleware - ${n.name||ci.ANONYMOUS_NAME}`;let m=r._startSpan(e,n);r._diag.debug("start span",f);let h=!1;function T(){h?r._diag.debug(`span ${m.name} - already finished`):(h=!0,r._diag.debug(`finishing span ${m.name}`),m.end()),p.removeListener("close",T)}return p.addListener("close",T),arguments[c]=r._patchNext(d,T),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,Bb.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ci.ConnectInstrumentation=jb});var A2=E(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.ConnectTypes=hr.ConnectNames=hr.AttributeNames=hr.ANONYMOUS_NAME=hr.ConnectInstrumentation=void 0;var g2=S2();Object.defineProperty(hr,"ConnectInstrumentation",{enumerable:!0,get:function(){return g2.ConnectInstrumentation}});Object.defineProperty(hr,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return g2.ANONYMOUS_NAME}});var Hb=Gb();Object.defineProperty(hr,"AttributeNames",{enumerable:!0,get:function(){return Hb.AttributeNames}});Object.defineProperty(hr,"ConnectNames",{enumerable:!0,get:function(){return Hb.ConnectNames}});Object.defineProperty(hr,"ConnectTypes",{enumerable:!0,get:function(){return Hb.ConnectTypes}})});var N2=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DB_SYSTEM_VALUE_MSSQL=Mt.ATTR_NET_PEER_PORT=Mt.ATTR_NET_PEER_NAME=Mt.ATTR_DB_USER=Mt.ATTR_DB_SYSTEM=Mt.ATTR_DB_STATEMENT=Mt.ATTR_DB_SQL_TABLE=Mt.ATTR_DB_NAME=void 0;Mt.ATTR_DB_NAME="db.name";Mt.ATTR_DB_SQL_TABLE="db.sql.table";Mt.ATTR_DB_STATEMENT="db.statement";Mt.ATTR_DB_SYSTEM="db.system";Mt.ATTR_DB_USER="db.user";Mt.ATTR_NET_PEER_NAME="net.peer.name";Mt.ATTR_NET_PEER_PORT="net.peer.port";Mt.DB_SYSTEM_VALUE_MSSQL="mssql"});var b2=E(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.once=Zu.getSpanName=void 0;function Gye(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}Zu.getSpanName=Gye;var Bye=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};Zu.once=Bye});var C2=E(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.PACKAGE_NAME=el.PACKAGE_VERSION=void 0;el.PACKAGE_VERSION="0.33.0";el.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var L2=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.TediousInstrumentation=li.INJECTED_CTX=void 0;var tl=(b(),O(v)),jye=U("events"),ho=ne(),Aa=(le(),O(Ae)),ui=N2(),P2=b2(),M2=C2(),v2=Symbol("opentelemetry.instrumentation-tedious.current-database");li.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var x2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function oS(t){Object.defineProperty(this,v2,{value:t,writable:!0})}var Fb=class t extends ho.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(M2.PACKAGE_NAME,M2.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ho.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ho.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new ho.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of x2)(0,ho.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,ho.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of x2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return oS.call(this,this.config?.options?.database),this.removeListener("databaseChange",oS),this.on("databaseChange",oS),this.once("end",()=>{this.removeListener("databaseChange",oS)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||tl.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,li.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[li.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof jye.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,l=()=>c++,p=()=>a++,d=this[v2],_=(x=>x.sqlTextOrProcedure==="sp_prepare"&&x.parametersByName?.stmt?.value?x.parametersByName.stmt.value:x.sqlTextOrProcedure)(i),f={};o._dbSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_DB_SYSTEM]=ui.DB_SYSTEM_VALUE_MSSQL,f[ui.ATTR_DB_NAME]=d,f[ui.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,f[ui.ATTR_DB_STATEMENT]=_,f[ui.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&ho.SemconvStability.STABLE&&(f[Aa.ATTR_DB_NAMESPACE]=d,f[Aa.ATTR_DB_SYSTEM_NAME]=Aa.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,f[Aa.ATTR_DB_QUERY_TEXT]=_,f[Aa.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_NET_PEER_NAME]=this.config?.server,f[ui.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&ho.SemconvStability.STABLE&&(f[Aa.ATTR_SERVER_ADDRESS]=this.config?.server,f[Aa.ATTR_SERVER_PORT]=this.config?.options?.port);let m=o.tracer.startSpan((0,P2.getSpanName)(e,d,_,i.table),{kind:tl.SpanKind.CLIENT,attributes:f}),h=(0,P2.once)(x=>{i.removeListener("done",l),i.removeListener("doneInProc",l),i.removeListener("doneProc",p),i.removeListener("error",h),this.removeListener("end",h),m.setAttribute("tedious.procedure_count",a),m.setAttribute("tedious.statement_count",c),x&&m.setStatus({code:tl.SpanStatusCode.ERROR,message:x.message}),m.end()});i.on("done",l),i.on("doneInProc",l),i.on("doneProc",p),i.once("error",h),this.on("end",h),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(h)):o._diag.error("Expected request.callback to be a function");let T=()=>tl.context.with(tl.trace.setSpan(tl.context.active(),m),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return T();let I=o._buildTraceparent(m);o._injectContextInfo(this,n,I).finally(T)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};li.TediousInstrumentation=Fb});var D2=E(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});sS.TediousInstrumentation=void 0;var Hye=L2();Object.defineProperty(sS,"TediousInstrumentation",{enumerable:!0,get:function(){return Hye.TediousInstrumentation}})});var B2=E(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.PACKAGE_NAME=nl.PACKAGE_VERSION=void 0;nl.PACKAGE_VERSION="0.57.0";nl.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var H2=E(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});iS.GenericPoolInstrumentation=void 0;var rl=(b(),O(v)),Ra=ne(),j2=B2(),Vb="generic-pool",qb=class extends Ra.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(j2.PACKAGE_NAME,j2.PACKAGE_VERSION,e)}init(){return[new Ra.InstrumentationNodeModuleDefinition(Vb,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,Ra.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Ra.InstrumentationNodeModuleDefinition(Vb,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,Ra.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Ra.InstrumentationNodeModuleDefinition(Vb,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,Ra.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=rl.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return rl.context.with(rl.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=rl.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return rl.context.with(rl.trace.setSpan(i,a),()=>{e.call(this,(c,l)=>{if(a.end(),o)return o(c,l)},s)})}}};iS.GenericPoolInstrumentation=qb});var F2=E(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.GenericPoolInstrumentation=void 0;var qye=H2();Object.defineProperty(aS,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return qye.GenericPoolInstrumentation}})});var $b=E(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.ATTR_NET_PEER_PORT=To.ATTR_NET_PEER_NAME=To.ATTR_MESSAGING_SYSTEM=To.ATTR_MESSAGING_OPERATION=void 0;To.ATTR_MESSAGING_OPERATION="messaging.operation";To.ATTR_MESSAGING_SYSTEM="messaging.system";To.ATTR_NET_PEER_NAME="net.peer.name";To.ATTR_NET_PEER_PORT="net.peer.port"});var Yb=E(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ATTR_MESSAGING_CONVERSATION_ID=qe.OLD_ATTR_MESSAGING_MESSAGE_ID=qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=qe.ATTR_MESSAGING_URL=qe.ATTR_MESSAGING_PROTOCOL_VERSION=qe.ATTR_MESSAGING_PROTOCOL=qe.MESSAGING_OPERATION_VALUE_PROCESS=qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=qe.ATTR_MESSAGING_DESTINATION_KIND=qe.ATTR_MESSAGING_DESTINATION=void 0;qe.ATTR_MESSAGING_DESTINATION="messaging.destination";qe.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";qe.MESSAGING_OPERATION_VALUE_PROCESS="process";qe.ATTR_MESSAGING_PROTOCOL="messaging.protocol";qe.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";qe.ATTR_MESSAGING_URL="messaging.url";qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";qe.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";qe.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var Wb=E(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.DEFAULT_CONFIG=ya.EndOperation=void 0;var Yye;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(Yye=ya.EndOperation||(ya.EndOperation={}));ya.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var Q2=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.isConfirmChannelTracing=$e.unmarkConfirmChannelTracing=$e.markConfirmChannelTracing=$e.getConnectionAttributesFromUrl=$e.getConnectionAttributesFromServer=$e.normalizeExchange=$e.CONNECTION_ATTRIBUTES=$e.CHANNEL_CONSUME_TIMEOUT_TIMER=$e.CHANNEL_SPANS_NOT_ENDED=$e.MESSAGE_STORED_SPAN=void 0;var zb=(b(),O(v)),pi=ne(),cS=(le(),O(Ae)),Fd=$b(),uS=Yb();$e.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");$e.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");$e.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");$e.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var Kb=(0,zb.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),Wye=t=>t!==""?t:"<default>";$e.normalizeExchange=Wye;var zye=t=>t.replace(/:[^:@/]*@/,":***@"),W2=(t,e)=>t||(e==="AMQP"?5672:5671),z2=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},K2=t=>t||"localhost",Eo=(t,e,n,r)=>n?{[e]:n}:(zb.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),Kye=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Fd.ATTR_MESSAGING_SYSTEM]:e}:{}};$e.getConnectionAttributesFromServer=Kye;var Qye=(t,e)=>{let n={[uS.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=z2(r?.protocol);Object.assign(n,{...Eo(t,uS.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=K2(r?.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(t,Fd.ATTR_NET_PEER_NAME,s,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(t,cS.ATTR_SERVER_ADDRESS,s,"hostname")});let i=W2(r.port,o);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(t,Fd.ATTR_NET_PEER_PORT,i,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(t,cS.ATTR_SERVER_PORT,i,"port"))}else{let r=zye(t);n[uS.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=z2(o.protocol);Object.assign(n,{...Eo(r,uS.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=K2(o.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(r,Fd.ATTR_NET_PEER_NAME,i,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(r,cS.ATTR_SERVER_ADDRESS,i,"hostname")});let a=W2(o.port?parseInt(o.port):void 0,s);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(r,Fd.ATTR_NET_PEER_PORT,a,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(r,cS.ATTR_SERVER_PORT,a,"port"))}catch(o){zb.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};$e.getConnectionAttributesFromUrl=Qye;var Xye=t=>t.setValue(Kb,!0);$e.markConfirmChannelTracing=Xye;var Jye=t=>t.deleteValue(Kb);$e.unmarkConfirmChannelTracing=Jye;var Zye=t=>t.getValue(Kb)===!0;$e.isConfirmChannelTracing=Zye});var X2=E(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.PACKAGE_NAME=ol.PACKAGE_VERSION=void 0;ol.PACKAGE_VERSION="0.61.0";ol.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Z2=E(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.AmqplibInstrumentation=void 0;var Ge=(b(),O(v)),lS=Te(),Ee=ne(),eIe=$b(),zn=Yb(),En=Wb(),Ye=Q2(),J2=X2(),pS=[">=0.5.5 <1"],Qb=class extends Ee.InstrumentationBase{_netSemconvStability;constructor(e={}){super(J2.PACKAGE_NAME,J2.PACKAGE_VERSION,{...En.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ee.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...En.DEFAULT_CONFIG,...e})}init(){let e=new Ee.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",pS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ee.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",pS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ee.InstrumentationNodeModuleFile("amqplib/lib/connect.js",pS,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Ee.InstrumentationNodeModuleDefinition("amqplib",pS,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Ee.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Ee.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Ee.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,En.EndOperation.Ack)),(0,Ee.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,En.EndOperation.Nack)),(0,Ee.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,En.EndOperation.Reject)),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,En.EndOperation.AckAll)),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,En.EndOperation.NackAll)),(0,Ee.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Ee.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Ee.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Ee.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Ee.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Ee.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Ee.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let l=(0,Ye.getConnectionAttributesFromUrl)(o,n._netSemconvStability),p=(0,Ye.getConnectionAttributesFromServer)(c);c[Ye.CONNECTION_ATTRIBUTES]={...l,...p}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelClosed,void 0);let s=this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let l=this,p=n===En.EndOperation.Reject?a:c,d=l[Ye.CHANNEL_SPANS_NOT_ENDED]??[],_=d.findIndex(f=>f.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==En.EndOperation.Reject&&a){for(let f=0;f<=_;f++)o.endConsumerSpan(d[f].msg,e,n,p);d.splice(0,_+1)}else o.endConsumerSpan(i,e,n,p),d.splice(_,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,Ye.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:p}=r.getConfig();if(p){let d=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},p);d.unref(),c[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=d}c[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}let l=function(p){if(!p)return i.call(this,p);let d=p.properties.headers??{},_=Ge.propagation.extract(Ge.ROOT_CONTEXT,d),f=p.fields?.exchange,m;if(r._config.useLinksForConsume){let R=_?Ge.trace.getSpan(_)?.spanContext():void 0;_=void 0,R&&(m=[{context:R}])}let h=r.tracer.startSpan(`${s} process`,{kind:Ge.SpanKind.CONSUMER,attributes:{...c?.connection?.[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:f,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p.fields?.routingKey,[eIe.ATTR_MESSAGING_OPERATION]:zn.MESSAGING_OPERATION_VALUE_PROCESS,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:p?.properties.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:p?.properties.correlationId},links:m},_),{consumeHook:T}=r.getConfig();T&&(0,Ee.safeExecuteInTheMiddle)(()=>T(h,{moduleVersion:e,msg:p}),R=>{R&&Ge.diag.error("amqplib instrumentation: consumerHook error",R)},!0),a?.noAck||(c[Ye.CHANNEL_SPANS_NOT_ENDED].push({msg:p,timeOfConsume:(0,lS.hrTime)()}),p[Ye.MESSAGE_STORED_SPAN]=h);let S=_||Ge.ROOT_CONTEXT;Ge.context.with(Ge.trace.setSpan(S,h),()=>{i.call(this,p)}),a?.noAck&&(r.callConsumeEndHook(h,p,!1,En.EndOperation.AutoAck),h.end())};return arguments[1]=l,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,l){let p=this,{span:d,modifiedOptions:_}=r.createPublishSpan(r,s,i,p,c),{publishHook:f}=r.getConfig();f&&(0,Ee.safeExecuteInTheMiddle)(()=>f(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!0}),S=>{S&&Ge.diag.error("amqplib instrumentation: publishHook error",S)},!0);let m=function(S,R){try{l?.call(this,S,R)}finally{let{publishConfirmHook:I}=r.getConfig();I&&(0,Ee.safeExecuteInTheMiddle)(()=>I(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:S}),x=>{x&&Ge.diag.error("amqplib instrumentation: publishConfirmHook error",x)},!0),S&&d.setStatus({code:Ge.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),d.end()}},h=(0,Ye.markConfirmChannelTracing)(Ge.context.active()),T=[...arguments];return T[3]=_,T[4]=Ge.context.bind((0,Ye.unmarkConfirmChannelTracing)(Ge.trace.setSpan(h,d)),m),Ge.context.with(h,n.bind(this,...T))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,Ye.isConfirmChannelTracing)(Ge.context.active()))return n.apply(this,arguments);{let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,Ee.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!1}),h=>{h&&Ge.diag.error("amqplib instrumentation: publishHook error",h)},!0);let f=[...arguments];f[3]=d;let m=n.apply(this,f);return p.end(),m}}}createPublishSpan(e,n,r,o,s){let i=(0,Ye.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:Ge.SpanKind.PRODUCER,attributes:{...o.connection[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:n,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},Ge.propagation.inject(Ge.trace.setSpan(Ge.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[Ye.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Ge.SpanStatusCode.ERROR,message:r!==En.EndOperation.ChannelClosed&&r!==En.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[Ye.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[Ye.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Ee.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Ge.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,lS.hrTime)(),r=e[Ye.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,lS.hrTimeDuration)(i.timeOfConsume,n);if((0,lS.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,En.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};dS.AmqplibInstrumentation=Qb});var t4=E(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.EndOperation=di.DEFAULT_CONFIG=di.AmqplibInstrumentation=void 0;var tIe=Z2();Object.defineProperty(di,"AmqplibInstrumentation",{enumerable:!0,get:function(){return tIe.AmqplibInstrumentation}});var e4=Wb();Object.defineProperty(di,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return e4.DEFAULT_CONFIG}});Object.defineProperty(di,"EndOperation",{enumerable:!0,get:function(){return e4.EndOperation}})});b();var tq=K(OG(),1);var C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var J=globalThis;var pe="10.47.0";function cn(){return fs(J),J}function fs(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pe,e[pe]=e[pe]||{}}function Ir(t,e,n=J){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[pe]=r[pe]||{};return o[t]||(o[t]=e())}var Vl=["debug","info","warn","error","log","assert","trace"],tae="Sentry Logger ",hc={};function Qe(t){if(!("console"in J))return t();let e=J.console,n={},r=Object.keys(hc);r.forEach(o=>{let s=hc[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function nae(){AR().enabled=!0}function rae(){AR().enabled=!1}function NG(){return AR().enabled}function oae(...t){gR("log",...t)}function sae(...t){gR("warn",...t)}function iae(...t){gR("error",...t)}function gR(t,...e){C&&NG()&&Qe(()=>{J.console[t](`${tae}[${t}]:`,...e)})}function AR(){return C?Ir("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:nae,disable:rae,isEnabled:NG,log:oae,warn:sae,error:iae};var Mf="?",bG=/\(error: (.*)\)/,CG=/captureMessage|captureException/;function xf(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
|
|
13
|
-
`);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let l=bG.test(c)?c.replace(bG,"$1"):c;if(!l.match(/\S*Error: /)){for(let p of e){let d=p(l);if(d){s.push(d);break}}if(s.length>=50+o)break}}return PG(s.slice(o))}}function yR(t){return Array.isArray(t)?
|
|
5
|
+
`+s),t.push(o+"m+"+mf.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=xse()+e+" "+t[0]}function xse(){return At.inspectOpts.hideDate?"":new Date().toISOString()+" "}function vse(...t){return process.stderr.write(ff.formatWithOptions(At.inspectOpts,...t)+`
|
|
6
|
+
`)}function Lse(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function Dse(){return process.env.DEBUG}function Use(t){t.inspectOpts={};let e=Object.keys(At.inspectOpts);for(let n=0;n<e.length;n++)t.inspectOpts[e[n]]=At.inspectOpts[e[n]]}mf.exports=WA()(At);var{formatters:Lk}=mf.exports;Lk.o=function(t){return this.inspectOpts.colors=this.useColors,ff.inspect(t,this.inspectOpts).split(`
|
|
7
|
+
`).map(e=>e.trim()).join(" ")};Lk.O=function(t){return this.inspectOpts.colors=this.useColors,ff.inspect(t,this.inspectOpts)}});var Uk=E((K0e,QA)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?QA.exports=bk():QA.exports=Dk()});var hf=E((Q0e,wk)=>{"use strict";var XA=U("path").sep;wk.exports=function(t){var e=t.split(XA),n=e.lastIndexOf("node_modules");if(n!==-1&&e[n+1]){for(var r=e[n+1][0]==="@",o=r?e[n+1]+"/"+e[n+2]:e[n+1],s=r?3:2,i="",a=n+s-1,c=0;c<=a;c++)c===a?i+=e[c]:i+=e[c]+XA;for(var l="",p=e.length-1,d=n+s;d<=p;d++)d===p?l+=e[d]:l+=e[d]+XA;return{name:o,basedir:i,path:l}}}});var ki=E((X0e,eR)=>{"use strict";var pc=U("path"),yr=U("module"),ze=Uk()("require-in-the-middle"),wse=hf();eR.exports=wl;eR.exports.Hook=wl;var JA,Tf;if(yr.isBuiltin)Tf=yr.isBuiltin;else if(yr.builtinModules)Tf=t=>t.startsWith("node:")?!0:(JA===void 0&&(JA=new Set(yr.builtinModules)),JA.has(t));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var kse=/([/\\]index)?(\.js)?$/,ZA=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let r=U.cache[e];return!!(r&&this._kRitmExports in r)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let o=U.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in U.cache?U.cache[e][this._kRitmExports]=n:(ze('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function wl(t,e,n){if(!(this instanceof wl))return new wl(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof yr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof yr._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 ZA,this._unhooked=!1,this._origRequire=yr.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);ze("registering require hook"),this._require=yr.prototype.require=function(c){return r._unhooked===!0?(ze("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):a.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(c){return r._unhooked===!0?(ze("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,l){let p=c[0],d=Tf(p),_;if(d){if(_=p,p.startsWith("node:")){let R=p.slice(5);Tf(R)&&(_=R)}}else{if(l)return ze("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{_=yr._resolveFilename(p,this)}catch(R){return ze('Module._resolveFilename("%s") threw %j, calling original Module.require',p,R.message),r._origRequire.apply(this,c)}}let f,m;if(ze("processing %s module require('%s'): %s",d===!0?"core":"non-core",p,_),r._cache.has(_,d)===!0)return ze("returning already patched cached module: %s",_),r._cache.get(_,d);let h=o.has(_);h===!1&&o.add(_);let T=l?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(h===!0)return ze("module is in the process of being patched already - ignoring: %s",_),T;if(o.delete(_),d===!0){if(i===!0&&t.includes(_)===!1)return ze("ignoring core module not on whitelist: %s",_),T;f=_}else if(i===!0&&t.includes(_)){let R=pc.parse(_);f=R.name,m=R.dir}else{let R=wse(_);if(R===void 0)return ze("could not parse filename: %s",_),T;f=R.name,m=R.basedir;let I=Gse(R);ze("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",f,p,I,m);let x=!1;if(i){if(!p.startsWith(".")&&t.includes(p)&&(f=p,x=!0),!t.includes(f)&&!t.includes(I))return T;t.includes(I)&&I!==f&&(f=I,x=!0)}if(!x){let F;try{F=U.resolve(f,{paths:[m]})}catch{return ze("could not resolve module: %s",f),r._cache.set(_,T,d),T}if(F!==_)if(s===!0)f=f+pc.sep+pc.relative(m,_),ze("preparing to process require of internal file: %s",f);else return ze("ignoring require of non-main module file: %s",F),r._cache.set(_,T,d),T}}r._cache.set(_,T,d),ze("calling require hook: %s",f);let S=n(T,f,m);return r._cache.set(_,S,d),ze("returning module: %s",f),S}}wl.prototype.unhook=function(){this._unhooked=!0,this._require===yr.prototype.require?(yr.prototype.require=this._origRequire,ze("require unhook successful")):ze("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ze("process.getBuiltinModule unhook successful")):ze("process.getBuiltinModule unhook unsuccessful"))};function Gse(t){let e=pc.sep!=="/"?t.path.split(pc.sep).join("/"):t.path;return pc.posix.join(t.name,e).replace(kse,"")}});var kk=E(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ModuleNameTrie=ls.ModuleNameSeparator=void 0;ls.ModuleNameSeparator="/";var Ef=class{hooks=[];children=new Map},tR=class{_trie=new Ef;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ls.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new Ef,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ls.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ls.ModuleNameTrie=tR});var Bk=E(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.RequireInTheMiddleSingleton=void 0;var Bse=ki(),Gk=U("path"),nR=kk(),jse=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),rR=class t{_moduleNameTrie=new nR.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new Bse.Hook(null,{internals:!0},(e,n,r)=>{let o=Hse(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return jse?new t:this._instance=this._instance??new t}};Sf.RequireInTheMiddleSingleton=rR;function Hse(t){return Gk.sep!==nR.ModuleNameSeparator?t.split(Gk.sep).join(nR.ModuleNameSeparator):t}});var qk=E(kl=>{var jk=[],oR=new WeakMap,Hk=new WeakMap,Fk=new Map,Vk=[],Fse={set(t,e,n){let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Hk.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function Vse(t,e,n,r,o){Fk.set(t,o),oR.set(e,n),Hk.set(e,r);let s=new Proxy(e,Fse);jk.forEach(i=>i(t,s,o)),Vk.push([t,s,o])}kl.register=Vse;kl.importHooks=jk;kl.specifiers=Fk;kl.toHook=Vk});var cR=E((nDe,_c)=>{var $k=U("path"),qse=hf(),{fileURLToPath:$se}=U("url"),{MessageChannel:Yse}=U("worker_threads"),{isBuiltin:sR}=U("module");sR||(sR=()=>!0);var{importHooks:iR,specifiers:Wse,toHook:zse}=qk();function Yk(t){iR.push(t),zse.forEach(([e,n,r])=>t(e,n,r))}function Wk(t){let e=iR.indexOf(t);e>-1&&iR.splice(e,1)}function dc(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var aR;function Kse(){let{port1:t,port2:e}=new Yse,n=0,r;aR=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Gl(t,e,n){if(!(this instanceof Gl))return new Gl(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;aR&&Array.isArray(t)&&aR(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);sR(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=$se(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=qse(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)dc(n,s,l,void 0);else if(d===o){if(!p)dc(n,s,o,p);else if(p.endsWith(Wse.get(a)))dc(n,s,o,p);else if(r){let _=o+$k.sep+$k.relative(p,l);dc(n,s,_,p)}}else d===i&&dc(n,s,i,p);else dc(n,s,o,p)},Yk(this._iitmHook)}Gl.prototype.unhook=function(){Wk(this._iitmHook)};_c.exports=Gl;_c.exports.Hook=Gl;_c.exports.addHook=Yk;_c.exports.removeHook=Wk;_c.exports.createAddHookMessageChannel=Kse});var uR=E(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.isWrapped=ps.safeExecuteInTheMiddleAsync=ps.safeExecuteInTheMiddle=void 0;function Qse(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddle=Qse;async function Xse(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddleAsync=Xse;function Jse(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ps.isWrapped=Jse});var Qk=E(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.InstrumentationBase=void 0;var Bl=U("path"),zk=U("util"),Zse=Rk(),lR=qA(),eie=yk(),tie=Bk(),nie=cR(),jl=(b(),O(v)),rie=ki(),oie=U("fs"),sie=uR(),pR=class extends eie.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=tie.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,sie.isWrapped)(e[n])&&this._unwrap(e,n),zk.types.isProxy(e)){let o=(0,lR.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,lR.wrap)(e,n,r)};_unwrap=(e,n)=>zk.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,lR.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{jl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){jl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{jl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){jl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=e.resolve(r);e.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,oie.readFileSync)(Bl.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{jl.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return Kk(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Bl.normalize(r);return i.filter(l=>l.name===a&&Kk(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Bl.isAbsolute(a)){let l=Bl.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Bl.isAbsolute(e.name)?new rie.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new nie.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};gf.InstrumentationBase=pR;function Kk(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,Zse.satisfies)(e,r,{includePrerelease:n}))}});var Xk=E(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.normalize=void 0;var iie=U("path");Object.defineProperty(Af,"normalize",{enumerable:!0,get:function(){return iie.normalize}})});var Jk=E(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.normalize=fc.InstrumentationBase=void 0;var aie=Qk();Object.defineProperty(fc,"InstrumentationBase",{enumerable:!0,get:function(){return aie.InstrumentationBase}});var cie=Xk();Object.defineProperty(fc,"normalize",{enumerable:!0,get:function(){return cie.normalize}})});var dR=E(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.normalize=mc.InstrumentationBase=void 0;var Zk=Jk();Object.defineProperty(mc,"InstrumentationBase",{enumerable:!0,get:function(){return Zk.InstrumentationBase}});Object.defineProperty(mc,"normalize",{enumerable:!0,get:function(){return Zk.normalize}})});var eG=E(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InstrumentationNodeModuleDefinition=void 0;var _R=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};Rf.InstrumentationNodeModuleDefinition=_R});var tG=E(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.InstrumentationNodeModuleFile=void 0;var uie=dR(),fR=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,uie.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};yf.InstrumentationNodeModuleFile=fR});var nG=E(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.semconvStabilityFromStr=Gi.SemconvStability=void 0;var If;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(If=Gi.SemconvStability||(Gi.SemconvStability={}));function lie(t,e){let n=If.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=If.DUPLICATE;break}else o.toLowerCase()===t&&(n=If.STABLE);return n}Gi.semconvStabilityFromStr=lie});var ne=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.semconvStabilityFromStr=tt.SemconvStability=tt.safeExecuteInTheMiddleAsync=tt.safeExecuteInTheMiddle=tt.isWrapped=tt.InstrumentationNodeModuleFile=tt.InstrumentationNodeModuleDefinition=tt.InstrumentationBase=tt.registerInstrumentations=void 0;var pie=_k();Object.defineProperty(tt,"registerInstrumentations",{enumerable:!0,get:function(){return pie.registerInstrumentations}});var die=dR();Object.defineProperty(tt,"InstrumentationBase",{enumerable:!0,get:function(){return die.InstrumentationBase}});var _ie=eG();Object.defineProperty(tt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return _ie.InstrumentationNodeModuleDefinition}});var fie=tG();Object.defineProperty(tt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return fie.InstrumentationNodeModuleFile}});var mR=uR();Object.defineProperty(tt,"isWrapped",{enumerable:!0,get:function(){return mR.isWrapped}});Object.defineProperty(tt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddle}});Object.defineProperty(tt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddleAsync}});var rG=nG();Object.defineProperty(tt,"SemconvStability",{enumerable:!0,get:function(){return rG.SemconvStability}});Object.defineProperty(tt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return rG.semconvStabilityFromStr}})});var oG=E(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.HTTP_FLAVOR_VALUE_HTTP_1_1=q.NET_TRANSPORT_VALUE_IP_UDP=q.NET_TRANSPORT_VALUE_IP_TCP=q.ATTR_NET_TRANSPORT=q.ATTR_NET_PEER_PORT=q.ATTR_NET_PEER_NAME=q.ATTR_NET_PEER_IP=q.ATTR_NET_HOST_PORT=q.ATTR_NET_HOST_NAME=q.ATTR_NET_HOST_IP=q.ATTR_HTTP_USER_AGENT=q.ATTR_HTTP_URL=q.ATTR_HTTP_TARGET=q.ATTR_HTTP_STATUS_CODE=q.ATTR_HTTP_SERVER_NAME=q.ATTR_HTTP_SCHEME=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH=q.ATTR_HTTP_METHOD=q.ATTR_HTTP_HOST=q.ATTR_HTTP_FLAVOR=q.ATTR_HTTP_CLIENT_IP=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=q.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0;q.ATTR_USER_AGENT_SYNTHETIC_TYPE="user_agent.synthetic.type";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT="bot";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST="test";q.ATTR_HTTP_CLIENT_IP="http.client_ip";q.ATTR_HTTP_FLAVOR="http.flavor";q.ATTR_HTTP_HOST="http.host";q.ATTR_HTTP_METHOD="http.method";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH="http.request_content_length";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED="http.response_content_length_uncompressed";q.ATTR_HTTP_SCHEME="http.scheme";q.ATTR_HTTP_SERVER_NAME="http.server_name";q.ATTR_HTTP_STATUS_CODE="http.status_code";q.ATTR_HTTP_TARGET="http.target";q.ATTR_HTTP_URL="http.url";q.ATTR_HTTP_USER_AGENT="http.user_agent";q.ATTR_NET_HOST_IP="net.host.ip";q.ATTR_NET_HOST_NAME="net.host.name";q.ATTR_NET_HOST_PORT="net.host.port";q.ATTR_NET_PEER_IP="net.peer.ip";q.ATTR_NET_PEER_NAME="net.peer.name";q.ATTR_NET_PEER_PORT="net.peer.port";q.ATTR_NET_TRANSPORT="net.transport";q.NET_TRANSPORT_VALUE_IP_TCP="ip_tcp";q.NET_TRANSPORT_VALUE_IP_UDP="ip_udp";q.HTTP_FLAVOR_VALUE_HTTP_1_1="1.1"});var sG=E(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.AttributeNames=void 0;var mie;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(mie=Hl.AttributeNames||(Hl.AttributeNames={}))});var hR=E(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.DEFAULT_QUERY_STRINGS_TO_REDACT=zr.STR_REDACTED=zr.SYNTHETIC_BOT_NAMES=zr.SYNTHETIC_TEST_NAMES=void 0;zr.SYNTHETIC_TEST_NAMES=["alwayson"];zr.SYNTHETIC_BOT_NAMES=["googlebot","bingbot"];zr.STR_REDACTED="REDACTED";zr.DEFAULT_QUERY_STRINGS_TO_REDACT=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"]});var aG=E((mDe,iG)=>{"use strict";var hie=U("util");function TR(t,e){Error.captureStackTrace(this,TR),this.name=this.constructor.name,this.message=t,this.input=e}hie.inherits(TR,Error);iG.exports=TR});var uG=E((hDe,cG)=>{"use strict";function Tie(t){return t===34||t===40||t===41||t===44||t===47||t>=58&&t<=64||t>=91&&t<=93||t===123||t===125}function Eie(t){return t===33||t>=35&&t<=39||t===42||t===43||t===45||t===46||t>=48&&t<=57||t>=65&&t<=90||t>=94&&t<=122||t===124||t===126}function Sie(t){return t>=32&&t<=126}function gie(t){return t>=128&&t<=255}cG.exports={isDelimiter:Tie,isTokenChar:Eie,isExtended:gie,isPrint:Sie}});var fG=E((TDe,_G)=>{"use strict";var Aie=U("util"),hc=aG(),Of=uG(),Rie=Of.isDelimiter,lG=Of.isTokenChar,pG=Of.isExtended,yie=Of.isPrint;function dG(t){return t.replace(/\\(.)/g,"$1")}function Fl(t,e){return Aie.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function Iie(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,l,p=0;p<t.length;p++)if(l=t.charCodeAt(p),c===void 0){if(p!==0&&i===-1&&(l===32||l===9))continue;if(lG(l))i===-1&&(i=p);else if(l===61&&i!==-1)c=t.slice(i,p).toLowerCase(),i=-1;else throw new hc(Fl(t,p),t)}else if(n&&(l===9||yie(l)||pG(l)))n=!1;else if(lG(l)){if(a!==-1)throw new hc(Fl(t,p),t);i===-1&&(i=p)}else if(Rie(l)||pG(l))if(r)l===34?(r=!1,a=p):l===92?(i===-1&&(i=p),n=e=!0):i===-1&&(i=p);else if(l===34&&t.charCodeAt(p-1)===61)r=!0;else if((l===44||l===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",l===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new hc(Fl(t,p),t);else if(l===32||l===9){if(a!==-1)continue;if(r)i===-1&&(i=p);else if(i!==-1)a=p;else throw new hc(Fl(t,p),t)}else throw new hc(Fl(t,p),t);if(c===void 0||r||i===-1&&a===-1||l===32||l===9)throw new hc("Unexpected end of input",t);return i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}_G.exports=Iie});var yG=E($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.headerCapture=$.getIncomingStableRequestMetricAttributesOnResponse=$.getIncomingRequestMetricAttributesOnResponse=$.getIncomingRequestAttributesOnResponse=$.getIncomingRequestMetricAttributes=$.getIncomingRequestAttributes=$.getRemoteClientAddress=$.getOutgoingStableRequestMetricAttributesOnResponse=$.getOutgoingRequestMetricAttributesOnResponse=$.getOutgoingRequestAttributesOnResponse=$.setAttributesFromHttpKind=$.getOutgoingRequestMetricAttributes=$.getOutgoingRequestAttributes=$.extractHostnameAndPort=$.isValidOptionsType=$.getRequestInfo=$.isCompressed=$.setResponseContentLengthAttribute=$.setRequestContentLengthAttribute=$.setSpanWithError=$.satisfiesPattern=$.parseResponseStatus=$.getAbsoluteUrl=void 0;var Vl=(b(),O(v)),ae=(le(),O(Ae)),V=oG(),mG=Te(),kn=ne(),Oie=U("url"),bf=sG(),hG=hR(),Nf=hR(),Nie=fG(),bie=(t,e,n="http:",r=Array.from(Nf.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let o=t||{},s=o.protocol||n,i=(o.port||"").toString(),a=o.path||"/",c=o.host||o.hostname||e.host||"localhost";if(c.indexOf(":")===-1&&i&&i!=="80"&&i!=="443"&&(c+=`:${i}`),a.includes("?"))try{let p=new URL(a,"http://localhost"),d=r||[];for(let _ of d)p.searchParams.get(_)&&p.searchParams.set(_,Nf.STR_REDACTED);a=`${p.pathname}${p.search}`}catch{}let l=o.auth?`${Nf.STR_REDACTED}:${Nf.STR_REDACTED}@`:"";return`${s}//${l}${c}${a}`};$.getAbsoluteUrl=bie;var Cie=(t,e)=>{let n=t===Vl.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?Vl.SpanStatusCode.UNSET:Vl.SpanStatusCode.ERROR};$.parseResponseStatus=Cie;var Pie=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")};$.satisfiesPattern=Pie;var Mie=(t,e,n)=>{let r=e.message;n&kn.SemconvStability.OLD&&(t.setAttribute(bf.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(bf.AttributeNames.HTTP_ERROR_MESSAGE,r)),n&kn.SemconvStability.STABLE&&t.setAttribute(ae.ATTR_ERROR_TYPE,e.name),t.setStatus({code:Vl.SpanStatusCode.ERROR,message:r}),t.recordException(e)};$.setSpanWithError=Mie;var xie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setRequestContentLengthAttribute=xie;var vie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setResponseContentLengthAttribute=vie;function EG(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var Lie=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};$.isCompressed=Lie;function Die(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:l,origin:p,host:d}=new URL(t),_={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:l,origin:p,host:d};return r!==""&&(_.port=Number(r)),(o||s)&&(_.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),_}var Uie=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=Die(e);s=c,r=c.pathname||"/"}catch(c){i=!0,t.verbose("Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:",c),s={path:e},r=s.path||"/"}o=`${s.protocol||"http:"}//${s.host}`,n!==void 0&&Object.assign(s,n)}else if(e instanceof Oie.URL)s={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,path:`${e.pathname||""}${e.search||""}`},e.port!==""&&(s.port=Number(e.port)),(e.username||e.password)&&(s.auth=`${e.username}:${e.password}`),r=e.pathname,o=e.origin,n!==void 0&&Object.assign(s,n);else{s=Object.assign({protocol:e.host?"http:":void 0},e);let c=s.host||(s.port!=null?`${s.hostname}${s.port}`:s.hostname);if(o=`${s.protocol||"http:"}//${c}`,r=e.pathname,!r&&s.path)try{r=new URL(s.path,o).pathname||"/"}catch{r="/"}}let a=s.method?s.method.toUpperCase():"GET";return{origin:o,pathname:r,method:a,optionsParsed:s,invalidUrl:i}};$.getRequestInfo=Uie;var wie=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};$.isValidOptionsType=wie;var kie=t=>{if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let e=t.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=t.hostname||(e===null?"localhost":e[1]),r=t.port;return r||(e&&e[2]?r=e[2].substring(1):r=t.protocol==="https:"?"443":"80"),{hostname:n,port:r}};$.extractHostnameAndPort=kie;var Gie=(t,e,n,r)=>{let o=e.hostname,s=e.port,i=t.method??"GET",a=AG(i),c=t.headers||{},l=c["user-agent"],p=(0,$.getAbsoluteUrl)(t,c,`${e.component}:`,e.redactedQueryParams),d={[V.ATTR_HTTP_URL]:p,[V.ATTR_HTTP_METHOD]:i,[V.ATTR_HTTP_TARGET]:t.path||"/",[V.ATTR_NET_PEER_NAME]:o,[V.ATTR_HTTP_HOST]:c.host??`${o}:${s}`},_={[ae.ATTR_HTTP_REQUEST_METHOD]:a,[ae.ATTR_SERVER_ADDRESS]:o,[ae.ATTR_SERVER_PORT]:Number(s),[ae.ATTR_URL_FULL]:p,[ae.ATTR_USER_AGENT_ORIGINAL]:l};switch(i!==a&&(_[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=i),r&&l&&(_[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(l)),l!==void 0&&(d[V.ATTR_HTTP_USER_AGENT]=l),n){case kn.SemconvStability.STABLE:return Object.assign(_,e.hookAttributes);case kn.SemconvStability.OLD:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};$.getOutgoingRequestAttributes=Gie;var Bie=t=>{let e={};return e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_PEER_NAME]=t[V.ATTR_NET_PEER_NAME],e};$.getOutgoingRequestMetricAttributes=Bie;var jie=(t,e)=>{t&&(e[V.ATTR_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_TCP:e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_UDP)};$.setAttributesFromHttpKind=jie;var SG=t=>{let e=String(t).toLowerCase();for(let n of hG.SYNTHETIC_TEST_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let n of hG.SYNTHETIC_BOT_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT},Hie=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:l}=s;i[V.ATTR_NET_PEER_IP]=c,i[V.ATTR_NET_PEER_PORT]=l,a[ae.ATTR_NETWORK_PEER_ADDRESS]=c,a[ae.ATTR_NETWORK_PEER_PORT]=l,a[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,$.setResponseContentLengthAttribute)(t,i),n&&(i[V.ATTR_HTTP_STATUS_CODE]=n,i[bf.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,$.setAttributesFromHttpKind)(o,i),e){case kn.SemconvStability.STABLE:return a;case kn.SemconvStability.OLD:return i}return Object.assign(i,a)};$.getOutgoingRequestAttributesOnResponse=Hie;var Fie=t=>{let e={};return e[V.ATTR_NET_PEER_PORT]=t[V.ATTR_NET_PEER_PORT],e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getOutgoingRequestMetricAttributesOnResponse=Fie;var Vie=t=>{let e={};return t[ae.ATTR_NETWORK_PROTOCOL_VERSION]&&(e[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t[ae.ATTR_NETWORK_PROTOCOL_VERSION]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getOutgoingStableRequestMetricAttributesOnResponse=Vie;function ds(t,e){let n=t.split(":");if(n.length===1)return e==="http"?{host:n[0],port:"80"}:e==="https"?{host:n[0],port:"443"}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith("[")){if(n[n.length-1].endsWith("]")){if(e==="http")return{host:t,port:"80"};if(e==="https")return{host:t,port:"443"}}else if(n[n.length-2].endsWith("]"))return{host:n.slice(0,-1).join(":"),port:n[n.length-1]}}return{host:t}}function qie(t,e){let n=t.headers.forwarded;if(n){for(let s of RG(n))if(s.host)return ds(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?ds(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r,t.headers["x-forwarded-proto"][0]):ds(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?ds(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r[0],t.headers["x-forwarded-proto"][0]):ds(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?ds(o,e):null}function gG(t){let e=t.headers.forwarded;if(e){for(let o of RG(e))if(o.for)return TG(o.for)}let n=t.headers["x-forwarded-for"];if(n){let o;if(typeof n=="string"?o=n:Array.isArray(n)&&(o=n[0]),typeof o=="string")return o=o.split(",")[0].trim(),TG(o)}let r=t.socket.remoteAddress;return r||null}$.getRemoteClientAddress=gG;function TG(t){try{let{hostname:e}=new URL(`http://${t}`);return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}catch{return t}}function $ie(t,e,n){try{if(e.headers.host)return new URL(e.url??"/",`${t}://${e.headers.host}`);{let r=new URL(e.url??"/",`${t}://localhost`);return{pathname:r.pathname,search:r.search,toString:function(){return r.pathname+r.search}}}}catch(r){return n.verbose("Unable to get URL from request",r),{}}}var Yie=(t,e,n)=>{let{component:r,enableSyntheticSourceDetection:o,hookAttributes:s,semconvStability:i,serverName:a}=e,{headers:c,httpVersion:l,method:p}=t,{host:d,"user-agent":_,"x-forwarded-for":f}=c,m=$ie(r,t,n),h,T;if(i!==kn.SemconvStability.OLD){let S=AG(p),R=qie(t,r),I=gG(t);h={[ae.ATTR_HTTP_REQUEST_METHOD]:S,[ae.ATTR_URL_SCHEME]:r,[ae.ATTR_SERVER_ADDRESS]:R?.host,[ae.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[ae.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[ae.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[ae.ATTR_USER_AGENT_ORIGINAL]:_},m.pathname!=null&&(h[ae.ATTR_URL_PATH]=m.pathname),m.search&&(h[ae.ATTR_URL_QUERY]=m.search.slice(1)),I!=null&&(h[ae.ATTR_CLIENT_ADDRESS]=I),R?.port!=null&&(h[ae.ATTR_SERVER_PORT]=Number(R.port)),p!==S&&(h[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=p),o&&_&&(h[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(_))}if(i!==kn.SemconvStability.STABLE){let S=d?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost";T={[V.ATTR_HTTP_URL]:m.toString(),[V.ATTR_HTTP_HOST]:d,[V.ATTR_NET_HOST_NAME]:S,[V.ATTR_HTTP_METHOD]:p,[V.ATTR_HTTP_SCHEME]:r},typeof f=="string"&&(T[V.ATTR_HTTP_CLIENT_IP]=f.split(",")[0]),typeof a=="string"&&(T[V.ATTR_HTTP_SERVER_NAME]=a),m.pathname&&(T[V.ATTR_HTTP_TARGET]=m.pathname+m.search||"/"),_!==void 0&&(T[V.ATTR_HTTP_USER_AGENT]=_),(0,$.setRequestContentLengthAttribute)(t,T),(0,$.setAttributesFromHttpKind)(l,T)}switch(i){case kn.SemconvStability.STABLE:return Object.assign(h,s);case kn.SemconvStability.OLD:return Object.assign(T,s);default:return Object.assign(T,h,s)}};$.getIncomingRequestAttributes=Yie;var Wie=t=>{let e={};return e[V.ATTR_HTTP_SCHEME]=t[V.ATTR_HTTP_SCHEME],e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_HOST_NAME]=t[V.ATTR_NET_HOST_NAME],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getIncomingRequestMetricAttributes=Wie;var zie=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,mG.getRPCMetadata)(Vl.context.active()),c={};if(r){let{localAddress:l,localPort:p,remoteAddress:d,remotePort:_}=r;c[V.ATTR_NET_HOST_IP]=l,c[V.ATTR_NET_HOST_PORT]=p,c[V.ATTR_NET_PEER_IP]=d,c[V.ATTR_NET_PEER_PORT]=_}switch(c[V.ATTR_HTTP_STATUS_CODE]=o,c[bf.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===mG.RPCType.HTTP&&a.route!==void 0&&(c[ae.ATTR_HTTP_ROUTE]=a.route,i[ae.ATTR_HTTP_ROUTE]=a.route),n){case kn.SemconvStability.STABLE:return i;case kn.SemconvStability.OLD:return c}return Object.assign(c,i)};$.getIncomingRequestAttributesOnResponse=zie;var Kie=t=>{let e={};return e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_NET_HOST_PORT]=t[V.ATTR_NET_HOST_PORT],t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),e};$.getIncomingRequestMetricAttributesOnResponse=Kie;var Qie=t=>{let e={};return t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getIncomingStableRequestMetricAttributesOnResponse=Qie;function Xie(t,e,n){let r=new Map;for(let o=0,s=e.length;o<s;o++){let i=e[o].toLowerCase();n&kn.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll("-","_"))}return o=>{let s={};for(let i of r.keys()){let a=o(i);if(a===void 0)continue;let c=r.get(i),l=`http.${t}.header.${c}`;typeof a=="string"?s[l]=[a]:Array.isArray(a)?s[l]=a:s[l]=[a]}return s}}$.headerCapture=Xie;var Jie=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","QUERY"]);function AG(t){if(t==null)return"GET";let e=t.toUpperCase();return Jie.has(e)?e:"_OTHER"}function RG(t){try{return Nie(t)}catch{return[]}}});var IG=E(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.HttpInstrumentation=void 0;var oe=(b(),O(v)),_s=Te(),Zie=U("url"),eae=nk(),Rt=ne(),ER=U("events"),Le=(le(),O(Ae)),Ke=yG(),SR=class extends Rt.InstrumentationBase{_spanNotEnded=new WeakSet;_headerCapture;_httpPatched=!1;_httpsPatched=!1;_semconvStability=Rt.SemconvStability.OLD;constructor(e={}){super("@opentelemetry/instrumentation-http",eae.VERSION,e),this._semconvStability=(0,Rt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("http",["*"],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchOutgoingRequestFunction("http")),o=this._wrap(e,"get",this._getPatchOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("https",["*"],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchHttpsOutgoingRequestFunction("https")),o=this._wrap(e,"get",this._getPatchHttpsOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(e){return n=>this._incomingRequestFunction(e,n)}_getPatchOutgoingRequestFunction(e){return n=>this._outgoingRequestFunction(e,n)}_getPatchOutgoingGetFunction(e){return n=>function(o,...s){let i=e(o,...s);return i.end(),i}}_getPatchHttpsOutgoingRequestFunction(e){return n=>{let r=this;return function(s,...i){return e==="https"&&typeof s=="object"&&s?.constructor?.name!=="URL"&&(s=Object.assign({},s),r._setDefaultOptions(s)),r._getPatchOutgoingRequestFunction(e)(n)(s,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||"https:",e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return n=>{let r=this;return function(s,...i){return r._getPatchOutgoingGetFunction(e)(n)(s,...i)}}}_traceClientRequest(e,n,r,o,s){this.getConfig().requestHook&&this._callRequestHook(n,e);let i=!1;return e.prependListener("response",a=>{this._diag.debug("outgoingRequest on response()"),e.listenerCount("response")<=1&&a.resume();let c=(0,Ke.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ke.getOutgoingRequestMetricAttributesOnResponse)(c)),s=Object.assign(s,(0,Ke.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),n.setAttributes(this._headerCapture.client.captureRequestHeaders(p=>e.getHeader(p))),n.setAttributes(this._headerCapture.client.captureResponseHeaders(p=>a.headers[p])),oe.context.bind(oe.context.active(),a);let l=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let p;a.aborted&&!a.complete?p={code:oe.SpanStatusCode.ERROR}:p={code:(0,Ke.parseResponseStatus)(oe.SpanKind.CLIENT,a.statusCode)},n.setStatus(p),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s)};a.on("end",l),a.on(ER.errorMonitor,p=>{this._diag.debug("outgoingRequest on error()",p),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,p))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s))}),e.on(ER.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,a))}),this._diag.debug("http.ClientRequest return request"),e}_incomingRequestFunction(e,n){let r=this;return function(s,...i){if(s!=="request")return n.apply(this,[s,...i]);let a=i[0],c=i[1],l=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreIncomingRequestHook?.(a),I=>{I!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",I)},!0))return oe.context.with((0,_s.suppressTracing)(oe.context.active()),()=>(oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),n.apply(this,[s,...i])));let p=a.headers,d=(0,Ke.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability,enableSyntheticSourceDetection:r.getConfig().enableSyntheticSourceDetection||!1},r._diag);Object.assign(d,r._headerCapture.server.captureRequestHeaders(I=>a.headers[I]));let _={kind:oe.SpanKind.SERVER,attributes:d},f=(0,_s.hrTime)(),m=(0,Ke.getIncomingRequestMetricAttributes)(d),h={[Le.ATTR_HTTP_REQUEST_METHOD]:d[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_URL_SCHEME]:d[Le.ATTR_URL_SCHEME]};d[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(h[Le.ATTR_NETWORK_PROTOCOL_VERSION]=d[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let T=oe.propagation.extract(oe.ROOT_CONTEXT,p),S=r._startHttpSpan(l,_,T),R={type:_s.RPCType.HTTP,span:S};return oe.context.with((0,_s.setRPCMetadata)(oe.trace.setSpan(T,S),R),()=>{oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(S,a),r.getConfig().responseHook&&r._callResponseHook(S,c);let I=!1;return c.on("close",()=>{I||r._onServerResponseFinish(a,c,S,m,h,f)}),c.on(ER.errorMonitor,x=>{I=!0,r._onServerResponseError(S,m,h,f,x)}),(0,Rt.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),x=>{if(x)throw r._onServerResponseError(S,m,h,f,x),x})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ke.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof Zie.URL)?i.shift():void 0,{method:c,invalidUrl:l,optionsParsed:p}=(0,Ke.getRequestInfo)(r._diag,s,a);if((0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreOutgoingRequestHook?.(p),F=>{F!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",F)},!0))return n.apply(this,[p,...i]);let{hostname:d,port:_}=(0,Ke.extractHostnameAndPort)(p),f=(0,Ke.getOutgoingRequestAttributes)(p,{component:e,port:_,hostname:d,hookAttributes:r._callStartSpanHook(p,r.getConfig().startOutgoingSpanHook),redactedQueryParams:r.getConfig().redactedQueryParams},r._semconvStability,r.getConfig().enableSyntheticSourceDetection||!1),m=(0,_s.hrTime)(),h=(0,Ke.getOutgoingRequestMetricAttributes)(f),T={[Le.ATTR_HTTP_REQUEST_METHOD]:f[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_SERVER_ADDRESS]:f[Le.ATTR_SERVER_ADDRESS],[Le.ATTR_SERVER_PORT]:f[Le.ATTR_SERVER_PORT]};f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(T[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]=f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]),f[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[Le.ATTR_NETWORK_PROTOCOL_VERSION]=f[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let S={kind:oe.SpanKind.CLIENT,attributes:f},R=r._startHttpSpan(c,S),I=oe.context.active(),x=oe.trace.setSpan(I,R);return p.headers?p.headers=Object.assign({},p.headers):p.headers={},oe.propagation.inject(x,p.headers),oe.context.with(x,()=>{let F=i[i.length-1];typeof F=="function"&&(i[i.length-1]=oe.context.bind(I,F));let B=(0,Rt.safeExecuteInTheMiddle)(()=>l?n.apply(this,[s,...i]):n.apply(this,[p,...i]),se=>{if(se)throw r._onOutgoingRequestError(R,h,T,m,se),se});return r._diag.debug(`${e} instrumentation outgoingRequest`),oe.context.bind(I,B),r._traceClientRequest(B,R,m,h,T)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ke.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ke.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ke.getIncomingStableRequestMetricAttributesOnResponse)(a)),r.setAttributes(this._headerCapture.server.captureResponseHeaders(l=>n.getHeader(l))),r.setAttributes(a).setStatus({code:(0,Ke.parseResponseStatus)(oe.SpanKind.SERVER,n.statusCode)});let c=a[Le.ATTR_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,oe.SpanKind.SERVER,i,o,s)}_onOutgoingRequestError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.CLIENT,o,n,r)}_onServerResponseError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=oe.context.active()){let o=n.kind===oe.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=oe.trace.getSpan(r);return o===!0&&(!i||!oe.trace.isSpanContextValid(i.spanContext()))?s=oe.trace.wrapSpanContext(oe.INVALID_SPAN_CONTEXT):o===!0&&i?.spanContext().isRemote?s=i:s=this.tracer.startSpan(e,n,r),this._spanNotEnded.add(s),s}_closeHttpSpan(e,n,r,o,s){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let i=(0,_s.hrTimeToMilliseconds)((0,_s.hrTimeDuration)(r,(0,_s.hrTime)()));n===oe.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===oe.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,Rt.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(e){let n=this.getConfig();return{client:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}};Cf.HttpInstrumentation=SR});var OG=E(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.HttpInstrumentation=void 0;var tae=IG();Object.defineProperty(Pf,"HttpInstrumentation",{enumerable:!0,get:function(){return tae.HttpInstrumentation}})});var EI=E(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.AbstractAsyncHooksContextManager=void 0;var wpe=U("events"),kpe=["addListener","on","once","prependListener","prependOnceListener"],TI=class{bind(e,n){return n instanceof wpe.EventEmitter?this._bindEventEmitter(e,n):typeof n=="function"?this._bindFunction(e,n):n}_bindFunction(e,n){let r=this,o=function(...s){return r.with(e,()=>n.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(e,n){return this._getPatchMap(n)!==void 0||(this._createPatchMap(n),kpe.forEach(o=>{n[o]!==void 0&&(n[o]=this._patchAddListener(n,n[o],e))}),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(e,n){let r=this;return function(o,s){let i=r._getPatchMap(e)?.[o];if(i===void 0)return n.call(this,o,s);let a=i.get(s);return n.call(this,o,a||s)}}_patchRemoveAllListeners(e,n){let r=this;return function(o){let s=r._getPatchMap(e);return s!==void 0&&(arguments.length===0?r._createPatchMap(e):s[o]!==void 0&&delete s[o]),n.apply(this,arguments)}}_patchAddListener(e,n,r){let o=this;return function(s,i){if(o._wrapped)return n.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let l=o.bind(r,i);c.set(i,l),o._wrapped=!0;try{return n.call(this,s,l)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};Hm.AbstractAsyncHooksContextManager=TI});var PH=E(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.AsyncHooksContextManager=void 0;var Gpe=(b(),O(v)),Bpe=U("async_hooks"),jpe=EI(),SI=class extends jpe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=Bpe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??Gpe.ROOT_CONTEXT}with(e,n,r,...o){this._enterContext(e);try{return n.call(r,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,n){if(n==="TIMERWRAP")return;let r=this._stack[this._stack.length-1];r!==void 0&&this._contexts.set(e,r)}_destroy(e){this._contexts.delete(e)}_before(e){let n=this._contexts.get(e);n!==void 0&&this._enterContext(n)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};Fm.AsyncHooksContextManager=SI});var MH=E(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.AsyncLocalStorageContextManager=void 0;var Hpe=(b(),O(v)),Fpe=U("async_hooks"),Vpe=EI(),gI=class extends Vpe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new Fpe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??Hpe.ROOT_CONTEXT}with(e,n,r,...o){let s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Vm.AsyncLocalStorageContextManager=gI});var xH=E(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.AsyncLocalStorageContextManager=Qc.AsyncHooksContextManager=void 0;var qpe=PH();Object.defineProperty(Qc,"AsyncHooksContextManager",{enumerable:!0,get:function(){return qpe.AsyncHooksContextManager}});var $pe=MH();Object.defineProperty(Qc,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return $pe.AsyncLocalStorageContextManager}})});var AI=E(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc._clearDefaultServiceNameCache=Xc.defaultServiceName=void 0;var xp;function Ype(){if(xp===void 0)try{let t=globalThis.process.argv0;xp=t?`unknown_service:${t}`:"unknown_service"}catch{xp="unknown_service"}return xp}Xc.defaultServiceName=Ype;function Wpe(){xp=void 0}Xc._clearDefaultServiceNameCache=Wpe});var vH=E(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.isPromiseLike=void 0;var zpe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";qm.isPromiseLike=zpe});var II=E(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.defaultResource=to.emptyResource=to.resourceFromDetectedResource=to.resourceFromAttributes=void 0;var Lp=(b(),O(v)),RI=Te(),ia=(le(),O(Ae)),Kpe=AI(),vp=vH(),$m=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,n){let r=new t({},n);return r._rawAttributes=LH(e),r._asyncAttributesPending=e.filter(([o,s])=>(0,vp.isPromiseLike)(s)).length>0,r}constructor(e,n){let r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([o,s])=>((0,vp.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=LH(this._rawAttributes),this._schemaUrl=Zpe(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,(0,vp.isPromiseLike)(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Lp.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,vp.isPromiseLike)(r)){Lp.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let n=ede(this,e),r=n?{schemaUrl:n}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r)}};function yI(t,e){return $m.FromAttributeList(Object.entries(t),e)}to.resourceFromAttributes=yI;function Qpe(t,e){return new $m(t,e)}to.resourceFromDetectedResource=Qpe;function Xpe(){return yI({})}to.emptyResource=Xpe;function Jpe(){return yI({[ia.ATTR_SERVICE_NAME]:(0,Kpe.defaultServiceName)(),[ia.ATTR_TELEMETRY_SDK_LANGUAGE]:RI.SDK_INFO[ia.ATTR_TELEMETRY_SDK_LANGUAGE],[ia.ATTR_TELEMETRY_SDK_NAME]:RI.SDK_INFO[ia.ATTR_TELEMETRY_SDK_NAME],[ia.ATTR_TELEMETRY_SDK_VERSION]:RI.SDK_INFO[ia.ATTR_TELEMETRY_SDK_VERSION]})}to.defaultResource=Jpe;function LH(t){return t.map(([e,n])=>(0,vp.isPromiseLike)(n)?[e,n.catch(r=>{Lp.diag.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}function Zpe(t){if(typeof t=="string"||t===void 0)return t;Lp.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function ede(t,e){let n=t?.schemaUrl,r=e?.schemaUrl,o=n===void 0||n==="",s=r===void 0||r==="";if(o)return r;if(s||n===r)return n;Lp.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}});var UH=E(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});Ym.detectResources=void 0;var DH=(b(),O(v)),OI=II(),tde=(t={})=>(t.detectors||[]).map(n=>{try{let r=(0,OI.resourceFromDetectedResource)(n.detect(t));return DH.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return DH.diag.debug(`${n.constructor.name} failed: ${r.message}`),(0,OI.emptyResource)()}}).reduce((n,r)=>n.merge(r),(0,OI.emptyResource)());Ym.detectResources=tde});var kH=E(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});Wm.envDetector=void 0;var nde=(b(),O(v)),rde=(le(),O(Ae)),wH=Te(),NI=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){let n={},r=(0,wH.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,wH.getStringFromEnv)("OTEL_SERVICE_NAME");if(r)try{let s=this._parseResourceAttributes(r);Object.assign(n,s)}catch(s){nde.diag.debug(`EnvDetector failed: ${s instanceof Error?s.message:s}`)}return o&&(n[rde.ATTR_SERVICE_NAME]=o),{attributes:n}}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER);if(s.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${o}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[i,a]=s,c=i.trim(),l=a.trim();if(c.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${o}".`);let p,d;try{p=decodeURIComponent(c),d=decodeURIComponent(l)}catch(_){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${o}": ${_ instanceof Error?_.message:_}`)}if(p.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${p}".`);if(d.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${p}".`);n[p]=d}return n}};Wm.envDetector=new NI});var Dp=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.ATTR_WEBENGINE_VERSION=L.ATTR_WEBENGINE_NAME=L.ATTR_WEBENGINE_DESCRIPTION=L.ATTR_SERVICE_NAMESPACE=L.ATTR_SERVICE_INSTANCE_ID=L.ATTR_PROCESS_RUNTIME_VERSION=L.ATTR_PROCESS_RUNTIME_NAME=L.ATTR_PROCESS_RUNTIME_DESCRIPTION=L.ATTR_PROCESS_PID=L.ATTR_PROCESS_OWNER=L.ATTR_PROCESS_EXECUTABLE_PATH=L.ATTR_PROCESS_EXECUTABLE_NAME=L.ATTR_PROCESS_COMMAND_ARGS=L.ATTR_PROCESS_COMMAND=L.ATTR_OS_VERSION=L.ATTR_OS_TYPE=L.ATTR_K8S_POD_NAME=L.ATTR_K8S_NAMESPACE_NAME=L.ATTR_K8S_DEPLOYMENT_NAME=L.ATTR_K8S_CLUSTER_NAME=L.ATTR_HOST_TYPE=L.ATTR_HOST_NAME=L.ATTR_HOST_IMAGE_VERSION=L.ATTR_HOST_IMAGE_NAME=L.ATTR_HOST_IMAGE_ID=L.ATTR_HOST_ID=L.ATTR_HOST_ARCH=L.ATTR_CONTAINER_NAME=L.ATTR_CONTAINER_IMAGE_TAGS=L.ATTR_CONTAINER_IMAGE_NAME=L.ATTR_CONTAINER_ID=L.ATTR_CLOUD_REGION=L.ATTR_CLOUD_PROVIDER=L.ATTR_CLOUD_AVAILABILITY_ZONE=L.ATTR_CLOUD_ACCOUNT_ID=void 0;L.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";L.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";L.ATTR_CLOUD_PROVIDER="cloud.provider";L.ATTR_CLOUD_REGION="cloud.region";L.ATTR_CONTAINER_ID="container.id";L.ATTR_CONTAINER_IMAGE_NAME="container.image.name";L.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";L.ATTR_CONTAINER_NAME="container.name";L.ATTR_HOST_ARCH="host.arch";L.ATTR_HOST_ID="host.id";L.ATTR_HOST_IMAGE_ID="host.image.id";L.ATTR_HOST_IMAGE_NAME="host.image.name";L.ATTR_HOST_IMAGE_VERSION="host.image.version";L.ATTR_HOST_NAME="host.name";L.ATTR_HOST_TYPE="host.type";L.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";L.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";L.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";L.ATTR_K8S_POD_NAME="k8s.pod.name";L.ATTR_OS_TYPE="os.type";L.ATTR_OS_VERSION="os.version";L.ATTR_PROCESS_COMMAND="process.command";L.ATTR_PROCESS_COMMAND_ARGS="process.command_args";L.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";L.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";L.ATTR_PROCESS_OWNER="process.owner";L.ATTR_PROCESS_PID="process.pid";L.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";L.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";L.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";L.ATTR_SERVICE_INSTANCE_ID="service.instance.id";L.ATTR_SERVICE_NAMESPACE="service.namespace";L.ATTR_WEBENGINE_DESCRIPTION="webengine.description";L.ATTR_WEBENGINE_NAME="webengine.name";L.ATTR_WEBENGINE_VERSION="webengine.version"});var Km=E(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.execAsync=void 0;var ode=U("child_process"),sde=U("util");zm.execAsync=sde.promisify(ode.exec)});var GH=E(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.getMachineId=void 0;var ide=Km(),ade=(b(),O(v));async function cde(){try{let e=(await(0,ide.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
8
|
+
`).find(r=>r.includes("IOPlatformUUID"));if(!e)return;let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){ade.diag.debug(`error reading machine id: ${t}`)}}Qm.getMachineId=cde});var BH=E(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});Xm.getMachineId=void 0;var ude=U("fs"),lde=(b(),O(v));async function pde(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await ude.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){lde.diag.debug(`error reading machine id: ${n}`)}}Xm.getMachineId=pde});var HH=E(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.getMachineId=void 0;var dde=U("fs"),_de=Km(),jH=(b(),O(v));async function fde(){try{return(await dde.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,_de.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}}Jm.getMachineId=fde});var VH=E(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.getMachineId=void 0;var FH=U("process"),mde=Km(),hde=(b(),O(v));async function Tde(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";FH.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in FH.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,mde.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){hde.diag.debug(`error reading machine id: ${n}`)}}Zm.getMachineId=Tde});var qH=E(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.getMachineId=void 0;var Ede=(b(),O(v));async function Sde(){Ede.diag.debug("could not read machine-id: unsupported platform")}eh.getMachineId=Sde});var $H=E(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.getMachineId=void 0;var gde=U("process"),aa;async function Ade(){if(!aa)switch(gde.platform){case"darwin":aa=(await Promise.resolve().then(()=>K(GH()))).getMachineId;break;case"linux":aa=(await Promise.resolve().then(()=>K(BH()))).getMachineId;break;case"freebsd":aa=(await Promise.resolve().then(()=>K(HH()))).getMachineId;break;case"win32":aa=(await Promise.resolve().then(()=>K(VH()))).getMachineId;break;default:aa=(await Promise.resolve().then(()=>K(qH()))).getMachineId;break}return aa()}th.getMachineId=Ade});var bI=E(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.normalizeType=Jc.normalizeArch=void 0;var Rde=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Jc.normalizeArch=Rde;var yde=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Jc.normalizeType=yde});var WH=E(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.hostDetector=void 0;var CI=Dp(),YH=U("os"),Ide=$H(),Ode=bI(),PI=class{detect(e){return{attributes:{[CI.ATTR_HOST_NAME]:(0,YH.hostname)(),[CI.ATTR_HOST_ARCH]:(0,Ode.normalizeArch)((0,YH.arch)()),[CI.ATTR_HOST_ID]:(0,Ide.getMachineId)()}}}};nh.hostDetector=new PI});var QH=E(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.osDetector=void 0;var zH=Dp(),KH=U("os"),Nde=bI(),MI=class{detect(e){return{attributes:{[zH.ATTR_OS_TYPE]:(0,Nde.normalizeType)((0,KH.platform)()),[zH.ATTR_OS_VERSION]:(0,KH.release)()}}}};rh.osDetector=new MI});var XH=E(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.processDetector=void 0;var bde=(b(),O(v)),Ho=Dp(),Cde=U("os"),xI=class{detect(e){let n={[Ho.ATTR_PROCESS_PID]:process.pid,[Ho.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[Ho.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[Ho.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Ho.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[Ho.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[Ho.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Ho.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let r=Cde.userInfo();n[Ho.ATTR_PROCESS_OWNER]=r.username}catch(r){bde.diag.debug(`error obtaining process owner: ${r}`)}return{attributes:n}}};oh.processDetector=new xI});var JH=E(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.serviceInstanceIdDetector=void 0;var Pde=Dp(),Mde=U("crypto"),vI=class{detect(e){return{attributes:{[Pde.ATTR_SERVICE_INSTANCE_ID]:(0,Mde.randomUUID)()}}}};sh.serviceInstanceIdDetector=new vI});var ZH=E(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.serviceInstanceIdDetector=no.processDetector=no.osDetector=no.hostDetector=void 0;var xde=WH();Object.defineProperty(no,"hostDetector",{enumerable:!0,get:function(){return xde.hostDetector}});var vde=QH();Object.defineProperty(no,"osDetector",{enumerable:!0,get:function(){return vde.osDetector}});var Lde=XH();Object.defineProperty(no,"processDetector",{enumerable:!0,get:function(){return Lde.processDetector}});var Dde=JH();Object.defineProperty(no,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Dde.serviceInstanceIdDetector}})});var eF=E(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.serviceInstanceIdDetector=ro.processDetector=ro.osDetector=ro.hostDetector=void 0;var ih=ZH();Object.defineProperty(ro,"hostDetector",{enumerable:!0,get:function(){return ih.hostDetector}});Object.defineProperty(ro,"osDetector",{enumerable:!0,get:function(){return ih.osDetector}});Object.defineProperty(ro,"processDetector",{enumerable:!0,get:function(){return ih.processDetector}});Object.defineProperty(ro,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ih.serviceInstanceIdDetector}})});var tF=E(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.noopDetector=Zc.NoopDetector=void 0;var ah=class{detect(){return{attributes:{}}}};Zc.NoopDetector=ah;Zc.noopDetector=new ah});var nF=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.noopDetector=On.serviceInstanceIdDetector=On.processDetector=On.osDetector=On.hostDetector=On.envDetector=void 0;var Ude=kH();Object.defineProperty(On,"envDetector",{enumerable:!0,get:function(){return Ude.envDetector}});var ch=eF();Object.defineProperty(On,"hostDetector",{enumerable:!0,get:function(){return ch.hostDetector}});Object.defineProperty(On,"osDetector",{enumerable:!0,get:function(){return ch.osDetector}});Object.defineProperty(On,"processDetector",{enumerable:!0,get:function(){return ch.processDetector}});Object.defineProperty(On,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ch.serviceInstanceIdDetector}});var wde=tF();Object.defineProperty(On,"noopDetector",{enumerable:!0,get:function(){return wde.noopDetector}})});var DI=E(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.defaultServiceName=Fe.emptyResource=Fe.defaultResource=Fe.resourceFromAttributes=Fe.serviceInstanceIdDetector=Fe.processDetector=Fe.osDetector=Fe.hostDetector=Fe.envDetector=Fe.detectResources=void 0;var kde=UH();Object.defineProperty(Fe,"detectResources",{enumerable:!0,get:function(){return kde.detectResources}});var Up=nF();Object.defineProperty(Fe,"envDetector",{enumerable:!0,get:function(){return Up.envDetector}});Object.defineProperty(Fe,"hostDetector",{enumerable:!0,get:function(){return Up.hostDetector}});Object.defineProperty(Fe,"osDetector",{enumerable:!0,get:function(){return Up.osDetector}});Object.defineProperty(Fe,"processDetector",{enumerable:!0,get:function(){return Up.processDetector}});Object.defineProperty(Fe,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Up.serviceInstanceIdDetector}});var LI=II();Object.defineProperty(Fe,"resourceFromAttributes",{enumerable:!0,get:function(){return LI.resourceFromAttributes}});Object.defineProperty(Fe,"defaultResource",{enumerable:!0,get:function(){return LI.defaultResource}});Object.defineProperty(Fe,"emptyResource",{enumerable:!0,get:function(){return LI.emptyResource}});var Gde=AI();Object.defineProperty(Fe,"defaultServiceName",{enumerable:!0,get:function(){return Gde.defaultServiceName}})});var rF=E(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.ExceptionEventName=void 0;uh.ExceptionEventName="exception"});var oF=E(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.SpanImpl=void 0;var kt=(b(),O(v)),Gt=Te(),ca=(le(),O(Ae)),Bde=rF(),UI=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:kt.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let n=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Gt.otperformance.now(),this._performanceOffset=n-(this._performanceStartTime+Gt.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let r of e.links)this.addLink(r);this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return kt.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,Gt.isAttributeValue)(n))return kt.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),o&&this._attributesCount++,this)}setAttributes(e){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.setAttribute(n,e[n]);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return kt.diag.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&kt.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,Gt.isTimeInput)(n)&&((0,Gt.isTimeInput)(r)||(r=n),n=void 0);let s=(0,Gt.sanitizeAttributes)(n),{attributePerEventCountLimit:i}=this._spanLimits,a={},c=0,l=0;for(let p in s){if(!Object.prototype.hasOwnProperty.call(s,p))continue;let d=s[p];if(i!==void 0&&l>=i){c++;continue}a[p]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&kt.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,o=(0,Gt.sanitizeAttributes)(e.attributes),s={},i=0,a=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&a>=r){i++;continue}s[l]=this._truncateToSize(p),a++}let c={context:e.context};return a>0&&(c.attributes=s),i>0&&(c.droppedAttributesCount=i),this.links.push(c),this}addLinks(e){for(let n of e)this.addLink(n);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===kt.SpanStatusCode.UNSET)return this;if(this.status.code===kt.SpanStatusCode.OK)return this;let n={code:e.code};return e.code===kt.SpanStatusCode.ERROR&&(typeof e.message=="string"?n.message=e.message:e.message!=null&&kt.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=n,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){kt.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,Gt.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(kt.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&kt.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&kt.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=Gt.otperformance.now())return(0,Gt.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,Gt.millisToHrTime)(e);if(e instanceof Date)return(0,Gt.millisToHrTime)(e.getTime());if((0,Gt.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,Gt.millisToHrTime)(Date.now());let n=Gt.otperformance.now()-this._performanceStartTime;return(0,Gt.addHrTimes)(this.startTime,(0,Gt.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[ca.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[ca.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[ca.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[ca.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[ca.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[ca.ATTR_EXCEPTION_TYPE]||r[ca.ATTR_EXCEPTION_MESSAGE]?this.addEvent(Bde.ExceptionEventName,r,n):kt.diag.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);kt.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(kt.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}};lh.SpanImpl=UI});var eu=E(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.SamplingDecision=void 0;var jde;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(jde=wp.SamplingDecision||(wp.SamplingDecision={}))});var dh=E(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.AlwaysOffSampler=void 0;var Hde=eu(),wI=class{shouldSample(){return{decision:Hde.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};ph.AlwaysOffSampler=wI});var fh=E(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.AlwaysOnSampler=void 0;var Fde=eu(),kI=class{shouldSample(){return{decision:Fde.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};_h.AlwaysOnSampler=kI});var jI=E(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.ParentBasedSampler=void 0;var mh=(b(),O(v)),Vde=Te(),sF=dh(),GI=fh(),BI=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||((0,Vde.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new GI.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new GI.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new sF.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new GI.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new sF.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=mh.trace.getSpanContext(e);return!a||!(0,mh.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&mh.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&mh.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,n,r,o,s,i):this._localParentNotSampled.shouldSample(e,n,r,o,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};hh.ParentBasedSampler=BI});var FI=E(Th=>{"use strict";Object.defineProperty(Th,"__esModule",{value:!0});Th.TraceIdRatioBasedSampler=void 0;var qde=(b(),O(v)),iF=eu(),HI=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,qde.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?iF.SamplingDecision.RECORD_AND_SAMPLED:iF.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){let o=r*8,s=parseInt(e.slice(o,o+8),16);n=(n^s)>>>0}return n}};Th.TraceIdRatioBasedSampler=HI});var $I=E(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.buildSamplerFromEnv=tu.loadDefaultConfig=void 0;var qI=(b(),O(v)),oo=Te(),aF=dh(),VI=fh(),Eh=jI(),cF=FI(),so;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(so||(so={}));var Sh=1;function $de(){return{sampler:lF(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}tu.loadDefaultConfig=$de;function lF(){let t=(0,oo.getStringFromEnv)("OTEL_TRACES_SAMPLER")??so.ParentBasedAlwaysOn;switch(t){case so.AlwaysOn:return new VI.AlwaysOnSampler;case so.AlwaysOff:return new aF.AlwaysOffSampler;case so.ParentBasedAlwaysOn:return new Eh.ParentBasedSampler({root:new VI.AlwaysOnSampler});case so.ParentBasedAlwaysOff:return new Eh.ParentBasedSampler({root:new aF.AlwaysOffSampler});case so.TraceIdRatio:return new cF.TraceIdRatioBasedSampler(uF());case so.ParentBasedTraceIdRatio:return new Eh.ParentBasedSampler({root:new cF.TraceIdRatioBasedSampler(uF())});default:return qI.diag.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${so.ParentBasedAlwaysOn}".`),new Eh.ParentBasedSampler({root:new VI.AlwaysOnSampler})}}tu.buildSamplerFromEnv=lF;function uF(){let t=(0,oo.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");return t==null?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Sh}.`),Sh):t<0||t>1?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${Sh}.`),Sh):t}});var YI=E(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.reconfigureLimits=ir.mergeConfig=ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var pF=$I(),gh=Te();ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function Yde(t){let e={sampler:(0,pF.buildSamplerFromEnv)()},n=(0,pF.loadDefaultConfig)(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}ir.mergeConfig=Yde;function Wde(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??(0,gh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,gh.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??(0,gh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,gh.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:e})}ir.reconfigureLimits=Wde});var dF=E(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.BatchSpanProcessorBase=void 0;var nu=(b(),O(v)),Fo=Te(),WI=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Fo.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(nu.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,n){}onEnd(e){this._shutdownOnce.isCalled||e.spanContext().traceFlags&nu.TraceFlags.SAMPLED&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&nu.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(nu.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{let r=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,i=o;s<i;s++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{let r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);nu.context.with((0,Fo.suppressTracing)(nu.context.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(o,a=>{clearTimeout(r),a.code===Fo.ExportResultCode.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let l=o[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,Fo.globalErrorHandler)(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,Fo.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};Ah.BatchSpanProcessorBase=WI});var _F=E(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.BatchSpanProcessor=void 0;var zde=dF(),zI=class extends zde.BatchSpanProcessorBase{onShutdown(){}};Rh.BatchSpanProcessor=zI});var hF=E(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.RandomIdGenerator=void 0;var Kde=8,mF=16,KI=class{generateTraceId=fF(mF);generateSpanId=fF(Kde)};Ih.RandomIdGenerator=KI;var yh=Buffer.allocUnsafe(mF);function fF(t){return function(){for(let n=0;n<t/4;n++)yh.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(yh[n]>0);n++)n===t-1&&(yh[t-1]=1);return yh.toString("hex",0,t)}}});var TF=E(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.RandomIdGenerator=ru.BatchSpanProcessor=void 0;var Qde=_F();Object.defineProperty(ru,"BatchSpanProcessor",{enumerable:!0,get:function(){return Qde.BatchSpanProcessor}});var Xde=hF();Object.defineProperty(ru,"RandomIdGenerator",{enumerable:!0,get:function(){return Xde.RandomIdGenerator}})});var QI=E(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.RandomIdGenerator=ou.BatchSpanProcessor=void 0;var EF=TF();Object.defineProperty(ou,"BatchSpanProcessor",{enumerable:!0,get:function(){return EF.BatchSpanProcessor}});Object.defineProperty(ou,"RandomIdGenerator",{enumerable:!0,get:function(){return EF.RandomIdGenerator}})});var SF=E(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.METRIC_OTEL_SDK_SPAN_STARTED=io.METRIC_OTEL_SDK_SPAN_LIVE=io.ATTR_OTEL_SPAN_SAMPLING_RESULT=io.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;io.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";io.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";io.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";io.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var gF=E(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TracerMetrics=void 0;var Oh=eu(),kp=SF(),XI=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(kp.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(kp.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,n){let r=Zde(n);if(this.startedSpans.add(1,{[kp.ATTR_OTEL_SPAN_PARENT_ORIGIN]:Jde(e),[kp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r}),n===Oh.SamplingDecision.NOT_RECORD)return()=>{};let o={[kp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};Nh.TracerMetrics=XI;function Jde(t){return t?t.isRemote?"remote":"local":"none"}function Zde(t){switch(t){case Oh.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Oh.SamplingDecision.RECORD:return"RECORD_ONLY";case Oh.SamplingDecision.NOT_RECORD:return"DROP"}}});var AF=E(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.VERSION=void 0;bh.VERSION="2.6.1"});var RF=E(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.Tracer=void 0;var Nt=(b(),O(v)),Ch=Te(),e_e=oF(),t_e=YI(),n_e=QI(),r_e=gF(),o_e=AF(),JI=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,n,r,o){let s=(0,t_e.mergeConfig)(n);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=n.idGenerator||new n_e.RandomIdGenerator,this._resource=r,this._spanProcessor=o,this.instrumentationScope=e;let i=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace",o_e.VERSION):Nt.createNoopMeter();this._tracerMetrics=new r_e.TracerMetrics(i)}startSpan(e,n={},r=Nt.context.active()){n.root&&(r=Nt.trace.deleteSpan(r));let o=Nt.trace.getSpan(r);if((0,Ch.isTracingSuppressed)(r))return Nt.diag.debug("Instrumentation suppressed, returning Noop Span"),Nt.trace.wrapSpanContext(Nt.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),i=this._idGenerator.generateSpanId(),a,c,l;!s||!Nt.trace.isSpanContextValid(s)?c=this._idGenerator.generateTraceId():(c=s.traceId,l=s.traceState,a=s);let p=n.kind??Nt.SpanKind.INTERNAL,d=(n.links??[]).map(I=>({context:I.context,attributes:(0,Ch.sanitizeAttributes)(I.attributes)})),_=(0,Ch.sanitizeAttributes)(n.attributes),f=this._sampler.shouldSample(r,c,e,p,_,d),m=this._tracerMetrics.startSpan(s,f.decision);l=f.traceState??l;let h=f.decision===Nt.SamplingDecision.RECORD_AND_SAMPLED?Nt.TraceFlags.SAMPLED:Nt.TraceFlags.NONE,T={traceId:c,spanId:i,traceFlags:h,traceState:l};if(f.decision===Nt.SamplingDecision.NOT_RECORD)return Nt.diag.debug("Recording is off, propagating context in a non-recording span"),Nt.trace.wrapSpanContext(T);let S=(0,Ch.sanitizeAttributes)(Object.assign(_,f.attributes));return new e_e.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:T,name:e,kind:p,links:d,parentSpanContext:a,attributes:S,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Nt.context.active(),l=this.startSpan(e,s,c),p=Nt.trace.setSpan(c,l);return Nt.context.with(p,a,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};Ph.Tracer=JI});var yF=E(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.MultiSpanProcessor=void 0;var s_e=Te(),ZI=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{(0,s_e.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}onEnding(e){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(e)}onEnd(e){for(let n of this._spanProcessors)n.onEnd(e)}shutdown(){let e=[];for(let n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}};Mh.MultiSpanProcessor=ZI});var IF=E(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.BasicTracerProvider=ua.ForceFlushState=void 0;var i_e=Te(),a_e=DI(),c_e=RF(),u_e=$I(),l_e=yF(),p_e=YI(),su;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(su=ua.ForceFlushState||(ua.ForceFlushState={}));var eO=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let n=(0,i_e.merge)({},(0,u_e.loadDefaultConfig)(),(0,p_e.reconfigureLimits)(e));this._resource=n.resource??(0,a_e.defaultResource)(),this._config=Object.assign({},n,{resource:this._resource});let r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new l_e.MultiSpanProcessor(r)}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new c_e.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=su.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==su.timeout&&(s=su.resolved,o(s))}).catch(a=>{clearTimeout(i),s=su.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==su.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};ua.BasicTracerProvider=eO});var OF=E(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.ConsoleSpanExporter=void 0;var tO=Te(),nO=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,tO.hrTimeToMicroseconds)(e.startTime),duration:(0,tO.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let r of e)console.dir(this._exportInfo(r),{depth:3});if(n)return n({code:tO.ExportResultCode.SUCCESS})}};xh.ConsoleSpanExporter=nO});var bF=E(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.InMemorySpanExporter=void 0;var NF=Te(),rO=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:NF.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:NF.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};vh.InMemorySpanExporter=rO});var CF=E(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.SimpleSpanProcessor=void 0;var d_e=(b(),O(v)),Lh=Te(),oO=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Lh.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,n){}onEnd(e){if(this._shutdownOnce.isCalled||!(e.spanContext().traceFlags&d_e.TraceFlags.SAMPLED))return;let n=this._doExport(e).catch(r=>(0,Lh.globalErrorHandler)(r));this._pendingExports.add(n),n.finally(()=>this._pendingExports.delete(n))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let n=await Lh.internal._export(this._exporter,[e]);if(n.code!==Lh.ExportResultCode.SUCCESS)throw n.error??new Error(`SimpleSpanProcessor: span export failed (status ${n})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};Dh.SimpleSpanProcessor=oO});var PF=E(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.NoopSpanProcessor=void 0;var sO=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};Uh.NoopSpanProcessor=sO});var iO=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.SamplingDecision=Ce.TraceIdRatioBasedSampler=Ce.ParentBasedSampler=Ce.AlwaysOnSampler=Ce.AlwaysOffSampler=Ce.NoopSpanProcessor=Ce.SimpleSpanProcessor=Ce.InMemorySpanExporter=Ce.ConsoleSpanExporter=Ce.RandomIdGenerator=Ce.BatchSpanProcessor=Ce.BasicTracerProvider=void 0;var __e=IF();Object.defineProperty(Ce,"BasicTracerProvider",{enumerable:!0,get:function(){return __e.BasicTracerProvider}});var MF=QI();Object.defineProperty(Ce,"BatchSpanProcessor",{enumerable:!0,get:function(){return MF.BatchSpanProcessor}});Object.defineProperty(Ce,"RandomIdGenerator",{enumerable:!0,get:function(){return MF.RandomIdGenerator}});var f_e=OF();Object.defineProperty(Ce,"ConsoleSpanExporter",{enumerable:!0,get:function(){return f_e.ConsoleSpanExporter}});var m_e=bF();Object.defineProperty(Ce,"InMemorySpanExporter",{enumerable:!0,get:function(){return m_e.InMemorySpanExporter}});var h_e=CF();Object.defineProperty(Ce,"SimpleSpanProcessor",{enumerable:!0,get:function(){return h_e.SimpleSpanProcessor}});var T_e=PF();Object.defineProperty(Ce,"NoopSpanProcessor",{enumerable:!0,get:function(){return T_e.NoopSpanProcessor}});var E_e=dh();Object.defineProperty(Ce,"AlwaysOffSampler",{enumerable:!0,get:function(){return E_e.AlwaysOffSampler}});var S_e=fh();Object.defineProperty(Ce,"AlwaysOnSampler",{enumerable:!0,get:function(){return S_e.AlwaysOnSampler}});var g_e=jI();Object.defineProperty(Ce,"ParentBasedSampler",{enumerable:!0,get:function(){return g_e.ParentBasedSampler}});var A_e=FI();Object.defineProperty(Ce,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return A_e.TraceIdRatioBasedSampler}});var R_e=eu();Object.defineProperty(Ce,"SamplingDecision",{enumerable:!0,get:function(){return R_e.SamplingDecision}})});var rq=E(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.PACKAGE_NAME=lu.PACKAGE_VERSION=void 0;lu.PACKAGE_VERSION="0.24.0";lu.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var sq=E(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.UndiciInstrumentation=void 0;var DO=U("diagnostics_channel"),$me=U("url"),Yp=ne(),qn=(b(),O(v)),Kh=Te(),ot=(le(),O(Ae)),oq=rq(),UO=class extends Yp.InstrumentationBase{_recordFromReq=new WeakMap;constructor(e={}){super(oq.PACKAGE_NAME,oq.PACKAGE_VERSION,e)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs.length=0}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this.subscribeToChannel("undici:request:create",this.onRequestCreated.bind(this)),this.subscribeToChannel("undici:client:sendHeaders",this.onRequestHeaders.bind(this)),this.subscribeToChannel("undici:request:headers",this.onResponseHeaders.bind(this)),this.subscribeToChannel("undici:request:trailers",this.onDone.bind(this)),this.subscribeToChannel("undici:request:error",this.onError.bind(this)))}_updateMetricInstruments(){this._httpClientDurationHistogram=this.meter.createHistogram(ot.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:qn.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){let[r,o]=process.version.replace("v","").split(".").map(a=>Number(a)),s=r>18||r===18&&o>=19,i;if(s)DO.subscribe?.(e,n),i=()=>DO.unsubscribe?.(e,n);else{let a=DO.channel(e);a.subscribe(n),i=()=>a.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:i})}parseRequestHeaders(e){let n=new Map;if(Array.isArray(e.headers))for(let r=0;r<e.headers.length;r+=2){let o=e.headers[r],s=e.headers[r+1];typeof o=="string"&&n.set(o.toLowerCase(),s)}else if(typeof e.headers=="string"){let r=e.headers.split(`\r
|
|
9
|
+
`);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,Yp.safeExecuteInTheMiddle)(()=>!r||e.method==="CONNECT"||n.ignoreRequestHook?.(e),B=>B&&this._diag.error("caught ignoreRequestHook error: ",B),!0))return;let s=(0,Kh.hrTime)(),i;try{i=new $me.URL(e.path,e.origin)}catch(B){this._diag.warn("could not determine url.full:",B);return}let a=i.protocol.replace(":",""),c=this.getRequestMethod(e.method),l={[ot.ATTR_HTTP_REQUEST_METHOD]:c,[ot.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[ot.ATTR_URL_FULL]:i.toString(),[ot.ATTR_URL_PATH]:i.pathname,[ot.ATTR_URL_QUERY]:i.search,[ot.ATTR_URL_SCHEME]:a},p={https:"443",http:"80"},d=i.hostname,_=i.port||p[a];l[ot.ATTR_SERVER_ADDRESS]=d,_&&!isNaN(Number(_))&&(l[ot.ATTR_SERVER_PORT]=Number(_));let m=this.parseRequestHeaders(e).get("user-agent");if(m){let B=Array.isArray(m)?m[m.length-1]:m;l[ot.ATTR_USER_AGENT_ORIGINAL]=B}let h=(0,Yp.safeExecuteInTheMiddle)(()=>n.startSpanHook?.(e),B=>B&&this._diag.error("caught startSpanHook error: ",B),!0);h&&Object.entries(h).forEach(([B,se])=>{l[B]=se});let T=qn.context.active(),S=qn.trace.getSpan(T),R;n.requireParentforSpans&&(!S||!qn.trace.isSpanContextValid(S.spanContext()))?R=qn.trace.wrapSpanContext(qn.INVALID_SPAN_CONTEXT):R=this.tracer.startSpan(c==="_OTHER"?"HTTP":c,{kind:qn.SpanKind.CLIENT,attributes:l},T),(0,Yp.safeExecuteInTheMiddle)(()=>n.requestHook?.(R,e),B=>B&&this._diag.error("caught requestHook error: ",B),!0);let I=qn.trace.setSpan(qn.context.active(),R),x={};qn.propagation.inject(I,x);let F=Object.entries(x);for(let B=0;B<F.length;B++){let[se,ve]=F[B];typeof e.addHeader=="function"?e.addHeader(se,ve):typeof e.headers=="string"?e.headers+=`${se}: ${ve}\r
|
|
10
|
+
`:Array.isArray(e.headers)&&e.headers.push(se,ve)}this._recordFromReq.set(e,{span:R,attributes:l,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[ot.ATTR_NETWORK_PEER_ADDRESS]:i,[ot.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let l=new Set(o.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=this.parseRequestHeaders(e);for(let[d,_]of p.entries())if(l.has(d)){let f=Array.isArray(_)?_:[_];c[`http.request.header.${d}`]=f}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[ot.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();if((0,Yp.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),c=>c&&this._diag.error("caught responseHook error: ",c),!0),a.headersToSpanAttributes?.responseHeaders){let c=new Set;a.headersToSpanAttributes?.responseHeaders.forEach(l=>c.add(l.toLowerCase()));for(let l=0;l<n.headers.length;l=l+2){let p=n.headers[l].toString().toLowerCase(),d=n.headers[l+1];if(c.has(p)){let _=`http.response.header.${p}`;Object.hasOwn(i,_)?i[_].push(d.toString()):i[_]=[d.toString()]}}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?qn.SpanStatusCode.ERROR:qn.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:qn.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[ot.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[ot.ATTR_HTTP_RESPONSE_STATUS_CODE,ot.ATTR_HTTP_REQUEST_METHOD,ot.ATTR_SERVER_ADDRESS,ot.ATTR_SERVER_PORT,ot.ATTR_URL_SCHEME,ot.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,Kh.hrTimeToMilliseconds)((0,Kh.hrTimeDuration)(n,(0,Kh.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};Qh.UndiciInstrumentation=UO});var iq=E(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.UndiciInstrumentation=void 0;var Yme=sq();Object.defineProperty(Xh,"UndiciInstrumentation",{enumerable:!0,get:function(){return Yme.UndiciInstrumentation}})});var Jh=E(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.ExpressLayerType=void 0;var Jme;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Jme=Wp.ExpressLayerType||(Wp.ExpressLayerType={}))});var Zh=E(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.AttributeNames=void 0;var Zme;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(Zme=zp.AttributeNames||(zp.AttributeNames={}))});var wO=E(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu._LAYERS_STORE_PROPERTY=pu.kLayerPatched=void 0;pu.kLayerPatched=Symbol("express-layer-patched");pu._LAYERS_STORE_PROPERTY="__ot_middlewares"});var _q=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getActualMatchedRoute=st.getConstructedRoute=st.getLayerPath=st.asErrorAndMessage=st.isLayerIgnored=st.getLayerMetadata=st.getRouterPath=st.storeLayerPath=void 0;var kO=Jh(),du=Zh(),la=wO(),ehe=(t,e)=>(Array.isArray(t[la._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,la._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[la._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));st.storeLayerPath=ehe;var the=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,st.getRouterPath)(t,n):t};st.getRouterPath=the;var nhe=(t,e,n)=>{if(e.name==="router"){let r=(0,st.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[du.AttributeNames.EXPRESS_NAME]:o,[du.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[du.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[du.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[du.AttributeNames.EXPRESS_NAME]:e.name,[du.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};st.getLayerMetadata=nhe;var rhe=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},ohe=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(rhe(t,r))return!0}catch{}return!1};st.isLayerIgnored=ohe;var she=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];st.asErrorAndMessage=she;var ihe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>pq(n)||"").join(","):pq(e)};st.getLayerPath=ihe;var pq=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function dq(t){let n=(Array.isArray(t[la._LAYERS_STORE_PROPERTY])?t[la._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}st.getConstructedRoute=dq;function ahe(t){let e=Array.isArray(t[la._LAYERS_STORE_PROPERTY])?t[la._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=dq(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||che(r))?r:void 0}st.getActualMatchedRoute=ahe;function che(t){return t.includes(":")||t.includes("*")}});var fq=E(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.PACKAGE_NAME=_u.PACKAGE_VERSION=void 0;_u.PACKAGE_VERSION="0.62.0";_u.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var Sq=E(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});tT.ExpressInstrumentation=void 0;var mq=Te(),Nn=(b(),O(v)),hq=Jh(),Tq=Zh(),uo=_q(),Eq=fq(),fu=ne(),uhe=(le(),O(Ae)),eT=wO(),GO=class extends fu.InstrumentationBase{constructor(e={}){super(Eq.PACKAGE_NAME,Eq.PACKAGE_VERSION,e)}init(){return[new fu.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,fu.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,fu.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,fu.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,uo.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[eT.kLayerPatched]!==!0&&(e[eT.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,uo.storeLayerPath)(i,n),l=(0,uo.getConstructedRoute)(i),p=(0,uo.getActualMatchedRoute)(i),d={[uhe.ATTR_HTTP_ROUTE]:p},_=(0,uo.getLayerMetadata)(l,e,n),f=_.attributes[Tq.AttributeNames.EXPRESS_TYPE],m=(0,mq.getRPCMetadata)(Nn.context.active());if(m?.type===mq.RPCType.HTTP&&(m.route=p),(0,uo.isLayerIgnored)(_.name,f,r.getConfig()))return f===hq.ExpressLayerType.MIDDLEWARE&&i[eT._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(Nn.trace.getSpan(Nn.context.active())===void 0)return o.apply(this,arguments);let h=r._getSpanName({request:i,layerType:f,route:l},_.name),T=r.tracer.startSpan(h,{attributes:Object.assign(d,_.attributes)}),S=Nn.context.active(),R=Nn.trace.setSpan(S,T),{requestHook:I}=r.getConfig();I&&(0,fu.safeExecuteInTheMiddle)(()=>I(T,{request:i,layerType:f,route:l}),ve=>{ve&&Nn.diag.error("express instrumentation: request hook failed",ve)},!0);let x=!1;_.attributes[Tq.AttributeNames.EXPRESS_TYPE]===hq.ExpressLayerType.ROUTER&&(T.end(),x=!0,R=S);let F=()=>{x===!1&&(x=!0,T.end())},B=Array.from(arguments),se=B.findIndex(ve=>typeof ve=="function");se>=0&&(arguments[se]=function(){let ve=arguments[0],on=![void 0,null,"route","router"].includes(ve);if(!x&&on){let[Ya,Wa]=(0,uo.asErrorAndMessage)(ve);T.recordException(Ya),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Wa})}x===!1&&(x=!0,i.res?.removeListener("finish",F),T.end()),!(i.route&&on)&&c&&i[eT._LAYERS_STORE_PROPERTY].pop();let Io=B[se],ss=Nn.context.active(),Ii=Nn.trace.getSpan(S),Et=Ii?Nn.trace.setSpan(ss,Ii):ss;return Nn.context.bind(Et,Io).apply(this,arguments)});try{return Nn.context.bind(R,o).apply(this,arguments)}catch(ve){let[on,Io]=(0,uo.asErrorAndMessage)(ve);throw T.recordException(on),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Io}),ve}finally{x||a.once("finish",F)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return Nn.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};tT.ExpressInstrumentation=GO});var gq=E(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.AttributeNames=Hs.ExpressLayerType=Hs.ExpressInstrumentation=void 0;var lhe=Sq();Object.defineProperty(Hs,"ExpressInstrumentation",{enumerable:!0,get:function(){return lhe.ExpressInstrumentation}});var phe=Jh();Object.defineProperty(Hs,"ExpressLayerType",{enumerable:!0,get:function(){return phe.ExpressLayerType}});var dhe=Zh();Object.defineProperty(Hs,"AttributeNames",{enumerable:!0,get:function(){return dhe.AttributeNames}})});var Oq=E(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.SeverityNumber=void 0;var hhe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(hhe=Kp.SeverityNumber||(Kp.SeverityNumber={}))});var oT=E(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.NOOP_LOGGER=mu.NoopLogger=void 0;var rT=class{emit(e){}};mu.NoopLogger=rT;mu.NOOP_LOGGER=new rT});var Nq=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.API_BACKWARDS_COMPATIBILITY_VERSION=lo.makeGetter=lo._global=lo.GLOBAL_LOGS_API_KEY=void 0;lo.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");lo._global=globalThis;function The(t,e,n){return r=>r===t?e:n}lo.makeGetter=The;lo.API_BACKWARDS_COMPATIBILITY_VERSION=1});var BO=E(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.NOOP_LOGGER_PROVIDER=hu.NoopLoggerProvider=void 0;var Ehe=oT(),sT=class{getLogger(e,n,r){return new Ehe.NoopLogger}};hu.NoopLoggerProvider=sT;hu.NOOP_LOGGER_PROVIDER=new sT});var bq=E(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});iT.ProxyLogger=void 0;var She=oT(),jO=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):She.NOOP_LOGGER}};iT.ProxyLogger=jO});var Cq=E(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.ProxyLoggerProvider=void 0;var ghe=BO(),Ahe=bq(),HO=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Ahe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:ghe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};aT.ProxyLoggerProvider=HO});var Mq=E(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.LogsAPI=void 0;var ar=Nq(),Rhe=BO(),Pq=Cq(),FO=class t{constructor(){this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ar._global[ar.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ar._global[ar.GLOBAL_LOGS_API_KEY]=(0,ar.makeGetter)(ar.API_BACKWARDS_COMPATIBILITY_VERSION,e,Rhe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=ar._global[ar.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ar._global,ar.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete ar._global[ar.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}};cT.LogsAPI=FO});var VO=E(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.logs=po.NoopLogger=po.NOOP_LOGGER=po.SeverityNumber=void 0;var yhe=Oq();Object.defineProperty(po,"SeverityNumber",{enumerable:!0,get:function(){return yhe.SeverityNumber}});var xq=oT();Object.defineProperty(po,"NOOP_LOGGER",{enumerable:!0,get:function(){return xq.NOOP_LOGGER}});Object.defineProperty(po,"NoopLogger",{enumerable:!0,get:function(){return xq.NoopLogger}});var Ihe=Mq();po.logs=Ihe.LogsAPI.getInstance()});var vq=E(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.disableInstrumentations=Tu.enableInstrumentations=void 0;function Ohe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}Tu.enableInstrumentations=Ohe;function Nhe(t){t.forEach(e=>e.disable())}Tu.disableInstrumentations=Nhe});var Uq=E(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.registerInstrumentations=void 0;var Lq=(b(),O(v)),bhe=VO(),Dq=vq();function Che(t){let e=t.tracerProvider||Lq.trace.getTracerProvider(),n=t.meterProvider||Lq.metrics.getMeterProvider(),r=t.loggerProvider||bhe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,Dq.enableInstrumentations)(o,e,n,r),()=>{(0,Dq.disableInstrumentations)(o)}}uT.registerInstrumentations=Che});var qq=E(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});lT.satisfies=void 0;var WO=(b(),O(v)),jq=/^(?: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-]+)*))?$/,Phe=/^(?<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-]+)*))?$/,Mhe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function xhe(t,e,n){if(!vhe(t))return WO.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=whe(t);if(!r)return!1;let o=[],s=Hq(r,e,o,n);return s&&!n?.includePrerelease?Dhe(r,o):s}lT.satisfies=xhe;function vhe(t){return typeof t=="string"&&jq.test(t)}function Hq(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(qO(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=rTe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!qO(t,s,n,r))return!1;return!0}return qO(t,e,n,r)}function qO(t,e,n,r){if(e=Uhe(e,r),e.includes(" "))return Hq(t,e,n,r);{let o=khe(e);return n.push(o),Lhe(t,o)}}function Lhe(t,e){if(e.invalid)return!1;if(!e.version||YO(e.version))return!0;let n=kq(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=kq(r,o)}return Mhe[e.op]?.includes(n)}function Dhe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Uhe(t,e){return t=t.trim(),t=tTe(t,e),t=eTe(t),t=nTe(t,e),t=t.trim(),t}function _n(t){return!t||t.toLowerCase()==="x"||t==="*"}function whe(t){let e=t.match(jq);if(!e){WO.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function khe(t){if(!t)return{};let e=t.match(Phe);if(!e)return WO.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function YO(t){return t==="*"||t==="x"||t==="X"}function wq(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Ghe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Bhe(t,e){if(YO(t)||YO(e))return 0;let[n,r]=Ghe(wq(t),wq(e));return n>r?1:n<r?-1:0}function kq(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Bhe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var Fq="[a-zA-Z0-9-]",Vq="0|[1-9]\\d*",jhe=`\\d*[a-zA-Z-]${Fq}*`,Hhe="((?:<|>)?=?)",Gq=`(?:${Vq}|${jhe})`,Fhe=`(?:-(${Gq}(?:\\.${Gq})*))`,Bq=`${Fq}+`,Vhe=`(?:\\+(${Bq}(?:\\.${Bq})*))`,$O=`${Vq}|x|X|\\*`,Qp=`[v=\\s]*(${$O})(?:\\.(${$O})(?:\\.(${$O})(?:${Fhe})?${Vhe}?)?)?`,qhe=`^${Hhe}\\s*${Qp}$`,$he=new RegExp(qhe),Yhe=`^\\s*(${Qp})\\s+-\\s+(${Qp})\\s*$`,Whe=new RegExp(Yhe),zhe="(?:~>?)",Khe=`^${zhe}${Qp}$`,Qhe=new RegExp(Khe),Xhe="(?:\\^)",Jhe=`^${Xhe}${Qp}$`,Zhe=new RegExp(Jhe);function eTe(t){let e=Qhe;return t.replace(e,(n,r,o,s,i)=>{let a;return _n(r)?a="":_n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:_n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function tTe(t,e){let n=Zhe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return _n(s)?l="":_n(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:_n(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function nTe(t,e){let n=$he;return t.replace(n,(r,o,s,i,a,c)=>{let l=_n(s),p=l||_n(i),d=p||_n(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function rTe(t,e){let n=Whe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(_n(s)?o="":_n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:_n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,_n(d)?p="":_n(_)?p=`<${+d+1}.0.0-0`:_n(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var zO=E(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.massUnwrap=Bt.unwrap=Bt.massWrap=Bt.wrap=void 0;var fn=console.error.bind(console);function Xp(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var oTe=(t,e,n)=>{if(!t||!t[e]){fn("no original function "+String(e)+" to wrap");return}if(!n){fn("no wrapper function"),fn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){fn("original object and wrapper must be functions");return}let o=n(r,e);return Xp(o,"__original",r),Xp(o,"__unwrap",()=>{t[e]===o&&Xp(t,e,r)}),Xp(o,"__wrapped",!0),Xp(t,e,o),o};Bt.wrap=oTe;var sTe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Bt.wrap)(r,o,n)})})};Bt.massWrap=sTe;var iTe=(t,e)=>{if(!t||!t[e]){fn("no function to unwrap."),fn(new Error().stack);return}let n=t[e];if(!n.__unwrap)fn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Bt.unwrap=iTe;var aTe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Bt.unwrap)(n,r)})})};Bt.massUnwrap=aTe;function Jp(t){t&&t.logger&&(typeof t.logger!="function"?fn("new logger isn't a function, not replacing"):fn=t.logger)}Bt.default=Jp;Jp.wrap=Bt.wrap;Jp.massWrap=Bt.massWrap;Jp.unwrap=Bt.unwrap;Jp.massUnwrap=Bt.massUnwrap});var $q=E(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});dT.InstrumentationAbstract=void 0;var KO=(b(),O(v)),cTe=VO(),pT=zO(),QO=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=KO.diag.createComponentLogger({namespace:e}),this._tracer=KO.trace.getTracer(e,n),this._meter=KO.metrics.getMeter(e,n),this._logger=cTe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=pT.wrap;_unwrap=pT.unwrap;_massWrap=pT.massWrap;_massUnwrap=pT.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};dT.InstrumentationAbstract=QO});var Yq=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ModuleNameTrie=Fs.ModuleNameSeparator=void 0;Fs.ModuleNameSeparator="/";var _T=class{hooks=[];children=new Map},XO=class{_trie=new _T;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Fs.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new _T,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(Fs.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};Fs.ModuleNameTrie=XO});var zq=E(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.RequireInTheMiddleSingleton=void 0;var uTe=ki(),Wq=U("path"),JO=Yq(),lTe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),ZO=class t{_moduleNameTrie=new JO.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new uTe.Hook(null,{internals:!0},(e,n,r)=>{let o=pTe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return lTe?new t:this._instance=this._instance??new t}};fT.RequireInTheMiddleSingleton=ZO;function pTe(t){return Wq.sep!==JO.ModuleNameSeparator?t.split(Wq.sep).join(JO.ModuleNameSeparator):t}});var Zq=E(Zp=>{var Kq=[],eN=new WeakMap,Qq=new WeakMap,Xq=new Map,Jq=[],dTe={set(t,e,n){let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Qq.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function _Te(t,e,n,r,o){Xq.set(t,o),eN.set(e,n),Qq.set(e,r);let s=new Proxy(e,dTe);Kq.forEach(i=>i(t,s,o)),Jq.push([t,s,o])}Zp.register=_Te;Zp.importHooks=Kq;Zp.specifiers=Xq;Zp.toHook=Jq});var oN=E((AKe,Su)=>{var e$=U("path"),fTe=hf(),{fileURLToPath:mTe}=U("url"),{MessageChannel:hTe}=U("worker_threads"),{isBuiltin:tN}=U("module");tN||(tN=()=>!0);var{importHooks:nN,specifiers:TTe,toHook:ETe}=Zq();function t$(t){nN.push(t),ETe.forEach(([e,n,r])=>t(e,n,r))}function n$(t){let e=nN.indexOf(t);e>-1&&nN.splice(e,1)}function Eu(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var rN;function STe(){let{port1:t,port2:e}=new hTe,n=0,r;rN=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function ed(t,e,n){if(!(this instanceof ed))return new ed(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;rN&&Array.isArray(t)&&rN(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);tN(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=mTe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=fTe(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)Eu(n,s,l,void 0);else if(d===o){if(!p)Eu(n,s,o,p);else if(p.endsWith(TTe.get(a)))Eu(n,s,o,p);else if(r){let _=o+e$.sep+e$.relative(p,l);Eu(n,s,_,p)}}else d===i&&Eu(n,s,i,p);else Eu(n,s,o,p)},t$(this._iitmHook)}ed.prototype.unhook=function(){n$(this._iitmHook)};Su.exports=ed;Su.exports.Hook=ed;Su.exports.addHook=t$;Su.exports.removeHook=n$;Su.exports.createAddHookMessageChannel=STe});var sN=E(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isWrapped=Vs.safeExecuteInTheMiddleAsync=Vs.safeExecuteInTheMiddle=void 0;function gTe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddle=gTe;async function ATe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddleAsync=ATe;function RTe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Vs.isWrapped=RTe});var s$=E(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.InstrumentationBase=void 0;var td=U("path"),r$=U("util"),yTe=qq(),iN=zO(),ITe=$q(),OTe=zq(),NTe=oN(),nd=(b(),O(v)),bTe=ki(),CTe=U("fs"),PTe=sN(),aN=class extends ITe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=OTe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,PTe.isWrapped)(e[n])&&this._unwrap(e,n),r$.types.isProxy(e)){let o=(0,iN.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,iN.wrap)(e,n,r)};_unwrap=(e,n)=>r$.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,iN.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,CTe.readFileSync)(td.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{nd.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return o$(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=td.normalize(r);return i.filter(l=>l.name===a&&o$(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&td.isAbsolute(a)){let l=td.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=td.isAbsolute(e.name)?new bTe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new NTe.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};mT.InstrumentationBase=aN;function o$(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,yTe.satisfies)(e,r,{includePrerelease:n}))}});var i$=E(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.normalize=void 0;var MTe=U("path");Object.defineProperty(hT,"normalize",{enumerable:!0,get:function(){return MTe.normalize}})});var a$=E(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.normalize=gu.InstrumentationBase=void 0;var xTe=s$();Object.defineProperty(gu,"InstrumentationBase",{enumerable:!0,get:function(){return xTe.InstrumentationBase}});var vTe=i$();Object.defineProperty(gu,"normalize",{enumerable:!0,get:function(){return vTe.normalize}})});var cN=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.normalize=Au.InstrumentationBase=void 0;var c$=a$();Object.defineProperty(Au,"InstrumentationBase",{enumerable:!0,get:function(){return c$.InstrumentationBase}});Object.defineProperty(Au,"normalize",{enumerable:!0,get:function(){return c$.normalize}})});var u$=E(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.InstrumentationNodeModuleDefinition=void 0;var uN=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};TT.InstrumentationNodeModuleDefinition=uN});var l$=E(ET=>{"use strict";Object.defineProperty(ET,"__esModule",{value:!0});ET.InstrumentationNodeModuleFile=void 0;var LTe=cN(),lN=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,LTe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};ET.InstrumentationNodeModuleFile=lN});var p$=E(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.semconvStabilityFromStr=pa.SemconvStability=void 0;var ST;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(ST=pa.SemconvStability||(pa.SemconvStability={}));function DTe(t,e){let n=ST.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=ST.DUPLICATE;break}else o.toLowerCase()===t&&(n=ST.STABLE);return n}pa.semconvStabilityFromStr=DTe});var _$=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.semconvStabilityFromStr=it.SemconvStability=it.safeExecuteInTheMiddleAsync=it.safeExecuteInTheMiddle=it.isWrapped=it.InstrumentationNodeModuleFile=it.InstrumentationNodeModuleDefinition=it.InstrumentationBase=it.registerInstrumentations=void 0;var UTe=Uq();Object.defineProperty(it,"registerInstrumentations",{enumerable:!0,get:function(){return UTe.registerInstrumentations}});var wTe=cN();Object.defineProperty(it,"InstrumentationBase",{enumerable:!0,get:function(){return wTe.InstrumentationBase}});var kTe=u$();Object.defineProperty(it,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return kTe.InstrumentationNodeModuleDefinition}});var GTe=l$();Object.defineProperty(it,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return GTe.InstrumentationNodeModuleFile}});var pN=sN();Object.defineProperty(it,"isWrapped",{enumerable:!0,get:function(){return pN.isWrapped}});Object.defineProperty(it,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddle}});Object.defineProperty(it,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddleAsync}});var d$=p$();Object.defineProperty(it,"SemconvStability",{enumerable:!0,get:function(){return d$.SemconvStability}});Object.defineProperty(it,"semconvStabilityFromStr",{enumerable:!0,get:function(){return d$.semconvStabilityFromStr}})});var f$=E((vKe,BTe)=>{BTe.exports={name:"@fastify/otel",version:"0.18.0",description:"Official Fastify OpenTelemetry Instrumentation",main:"index.js",type:"commonjs",types:"types/index.d.ts",scripts:{lint:"eslint","lint:fix":"eslint --fix",test:"npm run test:all && npm run test:typescript","test:unit":"c8 --100 node --test","test:all":"npm run test:v4 && npm run test:v5","test:v4":"cross-env FASTIFY_VERSION=fastifyv4 npm run test:unit","test:v5":"cross-env FASTIFY_VERSION=fastify npm run test:unit","test:coverage":"c8 node --test && c8 report --reporter=html","test:typescript":"tsd"},repository:{type:"git",url:"git+https://github.com/fastify/otel.git"},keywords:["plugin","helper","fastify","instrumentation","otel","opentelemetry"],author:"Carlos Fuentes - @metcoder95 (https://metcoder.dev)",license:"MIT",bugs:{url:"https://github.com/fastify/otel/issues"},homepage:"https://github.com/fastify/otel#readme",funding:[{type:"github",url:"https://github.com/sponsors/fastify"},{type:"opencollective",url:"https://opencollective.com/fastify"}],devDependencies:{"@fastify/type-provider-typebox":"^6.1.0","@opentelemetry/context-async-hooks":"^2.0.0","@opentelemetry/contrib-test-utils":"^0.59.0","@opentelemetry/instrumentation-http":"^0.212.0","@opentelemetry/propagator-jaeger":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.2.0","@types/node":"^25.0.3",c8:"^11.0.0","cross-env":"^10.0.0",eslint:"^9.16.0",fastify:"^5.1.0","fastify-plugin":"^5.1.0",fastifyv4:"npm:fastify@^4.0.0",neostandard:"^0.12.0",tsd:"^0.33.0"},dependencies:{"@opentelemetry/core":"^2.0.0","@opentelemetry/instrumentation":"^0.212.0","@opentelemetry/semantic-conventions":"^1.28.0",minimatch:"^10.2.4"},peerDependencies:{"@opentelemetry/api":"^1.9.0"},tsd:{directory:"types"}}});var h$=E(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.range=da.balanced=void 0;var jTe=(t,e,n)=>{let r=t instanceof RegExp?m$(t,n):t,o=e instanceof RegExp?m$(e,n):e,s=r!==null&&o!=null&&(0,da.range)(r,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+o.length)}};da.balanced=jTe;var m$=(t,e)=>{let n=e.match(t);return n?n[0]:null},HTe=(t,e,n)=>{let r,o,s,i,a,c=n.indexOf(t),l=n.indexOf(e,c+1),p=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;p>=0&&!a;){if(p===c)r.push(p),c=n.indexOf(t,p+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else o=r.pop(),o!==void 0&&o<s&&(s=o,i=l),l=n.indexOf(e,p+1);p=c<l&&c>=0?c:l}r.length&&i!==void 0&&(a=[s,i])}return a};da.range=HTe});var y$=E(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.EXPANSION_MAX=void 0;Ru.expand=eEe;var T$=h$(),E$="\0SLASH"+Math.random()+"\0",S$="\0OPEN"+Math.random()+"\0",_N="\0CLOSE"+Math.random()+"\0",g$="\0COMMA"+Math.random()+"\0",A$="\0PERIOD"+Math.random()+"\0",FTe=new RegExp(E$,"g"),VTe=new RegExp(S$,"g"),qTe=new RegExp(_N,"g"),$Te=new RegExp(g$,"g"),YTe=new RegExp(A$,"g"),WTe=/\\\\/g,zTe=/\\{/g,KTe=/\\}/g,QTe=/\\,/g,XTe=/\\\./g;Ru.EXPANSION_MAX=1e5;function dN(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function JTe(t){return t.replace(WTe,E$).replace(zTe,S$).replace(KTe,_N).replace(QTe,g$).replace(XTe,A$)}function ZTe(t){return t.replace(FTe,"\\").replace(VTe,"{").replace(qTe,"}").replace($Te,",").replace(YTe,".")}function R$(t){if(!t)return[""];let e=[],n=(0,T$.balanced)("{","}",t);if(!n)return t.split(",");let{pre:r,body:o,post:s}=n,i=r.split(",");i[i.length-1]+="{"+o+"}";let a=R$(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function eEe(t,e={}){if(!t)return[];let{max:n=Ru.EXPANSION_MAX}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),rd(JTe(t),n,!0).map(ZTe)}function tEe(t){return"{"+t+"}"}function nEe(t){return/^-?0\d/.test(t)}function rEe(t,e){return t<=e}function oEe(t,e){return t>=e}function rd(t,e,n){let r=[],o=(0,T$.balanced)("{","}",t);if(!o)return[t];let s=o.pre,i=o.post.length?rd(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(let a=0;a<i.length&&a<e;a++){let c=s+"{"+o.body+"}"+i[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),l=a||c,p=o.body.indexOf(",")>=0;if(!l&&!p)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+_N+o.post,rd(t,e,!0)):[t];let d;if(l)d=o.body.split(/\.\./);else if(d=R$(o.body),d.length===1&&d[0]!==void 0&&(d=rd(d[0],e,!1).map(tEe),d.length===1))return i.map(f=>o.pre+d[0]+f);let _;if(l&&d[0]!==void 0&&d[1]!==void 0){let f=dN(d[0]),m=dN(d[1]),h=Math.max(d[0].length,d[1].length),T=d.length===3&&d[2]!==void 0?Math.abs(dN(d[2])):1,S=rEe;m<f&&(T*=-1,S=oEe);let I=d.some(nEe);_=[];for(let x=f;S(x,m);x+=T){let F;if(c)F=String.fromCharCode(x),F==="\\"&&(F="");else if(F=String(x),I){let B=h-F.length;if(B>0){let se=new Array(B+1).join("0");x<0?F="-"+se+F.slice(1):F=se+F}}_.push(F)}}else{_=[];for(let f=0;f<d.length;f++)_.push.apply(_,rd(d[f],e,!1))}for(let f=0;f<_.length;f++)for(let m=0;m<i.length&&r.length<e;m++){let h=s+_[f]+i[m];(!n||l||h)&&r.push(h)}}return r}});var I$=E(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.assertValidPattern=void 0;var sEe=1024*64,iEe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>sEe)throw new TypeError("pattern is too long")};gT.assertValidPattern=iEe});var N$=E(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});AT.parseClass=void 0;var aEe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},od=t=>t.replace(/[[\]\\-]/g,"\\$&"),cEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),O$=t=>t.join(""),uEe=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,l=!1,p=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+1){l=!0,s++;continue}if(h==="]"&&i&&!c){p=s+1;break}if(i=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[S,R,I]]of Object.entries(aEe))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-n,!0];s+=T.length,I?o.push(S):r.push(S),a=a||R;continue e}}if(c=!1,d){h>d?r.push(od(d)+"-"+od(h)):h===d&&r.push(od(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(od(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(od(h)),s++}if(p<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[cEe(h),!1,p-n,!1]}let _="["+(l?"^":"")+O$(r)+"]",f="["+(l?"":"^")+O$(o)+"]";return[r.length&&o.length?"("+_+"|"+f+")":r.length?_:f,a,p-n,!0]};AT.parseClass=uEe});var yT=E(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.unescape=void 0;var lEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");RT.unescape=lEe});var hN=E(bT=>{"use strict";var bn;Object.defineProperty(bT,"__esModule",{value:!0});bT.AST=void 0;var pEe=N$(),IT=yT(),dEe=new Set(["!","?","+","*","@"]),fN=t=>dEe.has(t),b$=t=>fN(t.type),_Ee=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),fEe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),mEe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),C$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),hEe="(?!(?:^|/)\\.\\.?(?:$|/))",OT="(?!\\.)",TEe=new Set(["[","."]),EEe=new Set(["..","."]),SEe=new Set("().*{}+?[]^$\\!"),gEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mN="[^/]",P$=mN+"*?",M$=mN+"+?",AEe=0,NT=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;id=++AEe;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#i=this.#e.map(e=>String(e)).join("")}#T(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let o=n.#a+1;!r.type&&o<r.#e.length;o++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[o])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof bn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof bn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new bn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#p(e,n,r,o,s){let i=o.maxExtglobRecursion??2,a=!1,c=!1,l=-1,p=!1;if(n.type===null){let h=r,T="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,T+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(p=!0):S==="]"&&!(h===l+2&&p)&&(c=!1),T+=S;continue}else if(S==="["){c=!0,l=h,p=!1,T+=S;continue}if(!o.noext&&fN(S)&&e.charAt(h)==="("&&s<=i){n.push(T),T="";let I=new bn(S,n);h=bn.#p(e,I,h,o,s+1),n.push(I);continue}T+=S}return n.push(T),h}let d=r+1,_=new bn(null,n),f=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(p=!0):h==="]"&&!(d===l+2&&p)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,p=!1,m+=h;continue}if(!o.noext&&fN(h)&&e.charAt(d)==="("&&(s<=i||n&&n.#d(h))){let S=n&&n.#d(h)?0:1;_.push(m),m="";let R=new bn(h,_);_.push(R),d=bn.#p(e,R,d,o,s+S);continue}if(h==="|"){_.push(m),m="",f.push(_),_=new bn(null,n);continue}if(h===")")return m===""&&n.#e.length===0&&(n.#l=!0),_.push(m),m="",n.push(...f,_),d;m+=h}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],d}#E(e){return this.#f(e,fEe)}#f(e,n=_Ee){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#d(r.type,n)}#d(e,n=mEe){return!!n.get(this.type)?.includes(e)}#S(e,n){let r=e.#e[0],o=new bn(null,r,this.options);o.#e.push(""),r.push(o),this.#m(e,n)}#m(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let o of r.#e)typeof o=="object"&&(o.#t=this);this.#i=void 0}#g(e){return!!C$.get(this.type)?.has(e)}#A(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type)}#R(e){let n=C$.get(this.type),r=e.#e[0],o=n?.get(r.type);if(!o)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=o,this.#i=void 0,this.#l=!1}static fromGlob(e,n={}){let r=new bn(null,void 0,n);return bn.#p(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#_(),this.#T()),!b$(this)){let c=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),l=this.#e.map(f=>{let[m,h,T,S]=typeof f=="string"?bn.#y(f,this.#r,c):f.toRegExpSource(e);return this.#r=this.#r||T,this.#o=this.#o||S,m}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&EEe.has(this.#e[0]))){let m=TEe,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!n&&!e&&m.has(l.charAt(0));p=h?hEe:T?OT:""}let d="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(d="(?:$|\\/)"),[p+l+d,(0,IT.unescape)(l),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#e=[c],l.type=null,l.#r=void 0,[c,(0,IT.unescape)(this.toString()),!1,!1]}let i=!r||e||n||!OT?"":this.#h(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?OT:"")+M$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?OT:"")+P$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,(0,IT.unescape)(s),this.#r=!!this.#r,this.#o]}#_(){if(b$(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let o=this.#e[r];typeof o=="object"&&(o.#_(),this.#f(o)?(n=!1,this.#m(o,r)):this.#E(o)?(n=!1,this.#S(o,r)):this.#A(o)&&(n=!1,this.#R(o)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#_();this.#i=void 0}#h(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#y(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(o){o=!1,s+=(SEe.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?M$:P$,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(l==="["){let[p,d,_,f]=(0,pEe.parseClass)(e,c);if(_){s+=p,i=i||d,c+=_-1,n=n||f;continue}}if(l==="?"){s+=mN,n=!0;continue}s+=gEe(l)}return[s,(0,IT.unescape)(e),!!n,i]}};bT.AST=NT;bn=NT});var TN=E(CT=>{"use strict";Object.defineProperty(CT,"__esModule",{value:!0});CT.escape=void 0;var REe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");CT.escape=REe});var k$=E(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var yEe=y$(),PT=I$(),L$=hN(),IEe=TN(),OEe=yT(),NEe=(t,e,n={})=>((0,PT.assertValidPattern)(e),!n.nocomment&&e.charAt(0)==="#"?!1:new _a(e,n).match(t));k.minimatch=NEe;var bEe=/^\*+([^+@!?\*\[\(]*)$/,CEe=t=>e=>!e.startsWith(".")&&e.endsWith(t),PEe=t=>e=>e.endsWith(t),MEe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),xEe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),vEe=/^\*+\.\*+$/,LEe=t=>!t.startsWith(".")&&t.includes("."),DEe=t=>t!=="."&&t!==".."&&t.includes("."),UEe=/^\.\*+$/,wEe=t=>t!=="."&&t!==".."&&t.startsWith("."),kEe=/^\*+$/,GEe=t=>t.length!==0&&!t.startsWith("."),BEe=t=>t.length!==0&&t!=="."&&t!=="..",jEe=/^\?+([^+@!?\*\[\(]*)?$/,HEe=([t,e=""])=>{let n=D$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},FEe=([t,e=""])=>{let n=U$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},VEe=([t,e=""])=>{let n=U$([t]);return e?r=>n(r)&&r.endsWith(e):n},qEe=([t,e=""])=>{let n=D$([t]);return e?r=>n(r)&&r.endsWith(e):n},D$=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},U$=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},w$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",x$={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=w$==="win32"?x$.win32.sep:x$.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var $Ee="[^/]",YEe=$Ee+"*?",WEe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zEe="(?:(?!(?:\\/|^)\\.).)*?",KEe=(t,e={})=>n=>(0,k.minimatch)(n,t,e);k.filter=KEe;k.minimatch.filter=k.filter;var cr=(t,e={})=>Object.assign({},t,e),QEe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return k.minimatch;let e=k.minimatch;return Object.assign((r,o,s={})=>e(r,o,cr(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,cr(t,s))}static defaults(o){return e.defaults(cr(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,cr(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,cr(t,s))}},unescape:(r,o={})=>e.unescape(r,cr(t,o)),escape:(r,o={})=>e.escape(r,cr(t,o)),filter:(r,o={})=>e.filter(r,cr(t,o)),defaults:r=>e.defaults(cr(t,r)),makeRe:(r,o={})=>e.makeRe(r,cr(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,cr(t,o)),match:(r,o,s={})=>e.match(r,o,cr(t,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=QEe;k.minimatch.defaults=k.defaults;var XEe=(t,e={})=>((0,PT.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,yEe.expand)(t,{max:e.braceExpandMax}));k.braceExpand=XEe;k.minimatch.braceExpand=k.braceExpand;var JEe=(t,e={})=>new _a(t,e).makeRe();k.makeRe=JEe;k.minimatch.makeRe=k.makeRe;var ZEe=(t,e,n={})=>{let r=new _a(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};k.match=ZEe;k.minimatch.match=k.match;var v$=/[?*]|[+@!]\(.*?\)|\[|\]/,eSe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_a=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){(0,PT.assertValidPattern)(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||w$,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!v$.test(s[2]))&&!v$.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],l=r[o+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(o,1);let p=r.slice(0);p[o]="**",e.push(p),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,_=p?3:l?0:void 0;if(typeof d=="number"&&typeof _=="number"){let[f,m]=[e[d],n[_]];f.toLowerCase()===m.toLowerCase()&&(n[_]=f,s=_,o=d)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(k.GLOBSTAR)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(k.GLOBSTAR,s),a=n.lastIndexOf(k.GLOBSTAR),[c,l,p]=r?[n.slice(s,i),n.slice(i+1),[]]:[n.slice(s,i),n.slice(i+1,a),n.slice(a+1)];if(c.length){let R=e.slice(o,o+c.length);if(!this.#o(R,c,r,0,0))return!1;o+=c.length,s+=c.length}let d=0;if(p.length){if(p.length+o>e.length)return!1;let R=e.length-p.length;if(this.#o(e,p,r,R,0))d=p.length;else{if(e[e.length-1]!==""||o+p.length===e.length||(R--,!this.#o(e,p,r,R,0)))return!1;d=p.length+1}}if(!l.length){let R=!!d;for(let I=o;I<e.length-d;I++){let x=String(e[I]);if(R=!0,x==="."||x===".."||!this.options.dot&&x.startsWith("."))return!1}return r||R}let _=[[[],0]],f=_[0],m=0,h=[0];for(let R of l)R===k.GLOBSTAR?(h.push(m),f=[[],0],_.push(f)):(f[0].push(R),m++);let T=_.length-1,S=e.length-d;for(let R of _)R[1]=S-(h[T--]+R[0].length);return!!this.#r(e,_,o,0,r,0,!!d)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let d=r;d<e.length;d++){a=!0;let _=e[d];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return a}let[l,p]=c;for(;r<=p;){if(this.#o(e.slice(0,r+l.length),l,s,r,0)&&i<this.maxGlobstarRecursion){let f=this.#r(e,n,r+l.length,o+1,s,i+1,a);if(f!==!1)return f}let _=e[r];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,l;for(i=o,a=s,l=e.length,c=n.length;i<l&&a<c;i++,a++){this.debug("matchOne loop");let p=n[a],d=e[i];if(this.debug(n,p,d),p===!1||p===k.GLOBSTAR)return!1;let _;if(typeof p=="string"?(_=d===p,this.debug("string match",p,d,_)):(_=p.test(d),this.debug("pattern match",p,d,_)),!_)return!1}if(i===l&&a===c)return!0;if(i===l)return r;if(a===c)return i===l-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,PT.assertValidPattern)(e);let n=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let r,o=null;(r=e.match(kEe))?o=n.dot?BEe:GEe:(r=e.match(bEe))?o=(n.nocase?n.dot?xEe:MEe:n.dot?PEe:CEe)(r[1]):(r=e.match(jEe))?o=(n.nocase?n.dot?FEe:HEe:n.dot?VEe:qEe)(r):(r=e.match(vEe))?o=n.dot?DEe:LEe:(r=e.match(UEe))&&(o=wEe);let s=L$.AST.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?YEe:n.dot?WEe:zEe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let _ of d.flags.split(""))o.add(_);return typeof d=="string"?eSe(d):d===k.GLOBSTAR?k.GLOBSTAR:d._src});l.forEach((d,_)=>{let f=l[_+1],m=l[_-1];d!==k.GLOBSTAR||m===k.GLOBSTAR||(m===void 0?f!==void 0&&f!==k.GLOBSTAR?l[_+1]="(?:\\/|"+r+"\\/)?"+f:l[_]=r:f===void 0?l[_-1]=m+"(?:\\/|\\/"+r+")?":f!==k.GLOBSTAR&&(l[_-1]=m+"(?:\\/|\\/"+r+"\\/)"+f,l[_+1]=k.GLOBSTAR))});let p=l.filter(d=>d!==k.GLOBSTAR);if(this.partial&&p.length>=1){let d=[];for(let _=1;_<=p.length;_++)d.push(p.slice(0,_).join("/"));return"(?:"+d.join("|")+")"}return p.join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.partial&&(s="^(?:\\/|"+i+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],l=o;if(r.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=_a;var tSe=hN();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return tSe.AST}});var nSe=TN();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return nSe.escape}});var rSe=yT();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return rSe.unescape}});k.minimatch.AST=L$.AST;k.minimatch.Minimatch=_a;k.minimatch.escape=IEe.escape;k.minimatch.unescape=OEe.unescape});var q$=E((VKe,gN)=>{"use strict";var G$=U("node:diagnostics_channel"),{context:MT,trace:EN,SpanStatusCode:xT,propagation:SN,diag:oSe}=(b(),O(v)),{getRPCMetadata:sSe,RPCType:iSe}=Te(),{ATTR_HTTP_ROUTE:vT,ATTR_HTTP_RESPONSE_STATUS_CODE:B$,ATTR_HTTP_REQUEST_METHOD:aSe,ATTR_URL_PATH:cSe}=(le(),O(Ae)),{InstrumentationBase:uSe}=_$(),{version:lSe,name:j$}=f$(),pSe=">=4.0.0 <6",H$=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Me={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},qs={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},qo="anonymous",$s=Symbol("fastify otel instance"),Ys=Symbol("fastify otel request spans"),sd=Symbol("fastify otel request context"),F$=Symbol("fastify otel addhook original"),V$=Symbol("fastify otel setnotfound original"),id=Symbol("fastify otel ignore path"),ad=Symbol("fastify otel record exceptions"),LT=class extends uSe{logger=null;_requestHook=null;_lifecycleHook=null;constructor(e){if(super(j$,lSe,e),this.logger=oSe.createComponentLogger({namespace:j$}),this[id]=null,this[ad]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!="boolean")throw new TypeError("recordExceptions must be a boolean");this[ad]=e.recordExceptions}if(typeof e?.requestHook=="function"&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook=="function"&&(this._lifecycleHook=e.lifecycleHook),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=null;this[id]=o=>typeof n=="function"?n(o):(r==null&&(r=k$().minimatch),r(o.url,n))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let n=(r,o,s)=>{s()};n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",e.fastify.register(n)},G$.subscribe("fastify.initialization",this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(G$.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:pSe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate($s,e),r.decorate(F$,r.addHook),r.decorate(V$,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let f=this[sd],m=this[Ys];return{enabled:this.routeOptions.config?.otel!==!1,span:m,tracer:e.tracer,context:f,inject:(h,T)=>SN.inject(f,h,T),extract:(h,T)=>SN.extract(f,h,T)}}),r.decorateRequest(Ys,null),r.decorateRequest(sd,null),r.addHook("onRoute",function(f){if(e[id]?.(f)===!0){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it matches the ignore path`);return}if(f.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it is disabled`);return}for(let m of H$)if(f[m]!=null){let h=f[m];if(typeof h=="function")f[m]=d(h,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[vT]:f.url,[Me.HOOK_CALLBACK_NAME]:h.name?.length>0?h.name:qo});else if(Array.isArray(h)){let T=[];for(let S of h)T.push(d(S,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[vT]:f.url,[Me.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:qo}));f[m]=T}}f.onSend!=null?f.onSend=Array.isArray(f.onSend)?[...f.onSend,i]:[f.onSend,i]:f.onSend=i,f.onError!=null?f.onError=Array.isArray(f.onError)?[...f.onError,a]:[f.onError,a]:f.onError=a,f.handler=d(f.handler,"handler",{[Me.HOOK_NAME]:`${this.pluginName} - route-handler`,[Me.FASTIFY_TYPE]:qs.HANDLER,[vT]:f.url,[Me.HOOK_CALLBACK_NAME]:f.handler.name.length>0?f.handler.name:qo})}),r.addHook("onRequest",function(f,m,h){if(this[$s].isEnabled()===!1||f.routeOptions.config?.otel===!1)return h();if(this[$s][id]?.({url:f.url,method:f.method})===!0)return this[$s].logger.debug(`Ignoring request ${f.method} ${f.url} because it matches the ignore path`),h();let T=MT.active();EN.getSpan(T)==null&&(T=SN.extract(T,f.headers));let S=sSe(T);f.routeOptions.url!=null&&S?.type===iSe.HTTP&&(S.route=f.routeOptions.url);let R={[Me.ROOT]:"@fastify/otel",[aSe]:f.method,[cSe]:f.url};f.routeOptions.url!=null&&(R[vT]=f.routeOptions.url);let I=this[$s].tracer.startSpan("request",{attributes:R},T);try{this[$s]._requestHook?.(I,f)}catch(x){this[$s].logger.error({err:x},"requestHook threw")}f[sd]=EN.setSpan(T,I),f[Ys]=I,MT.with(f[sd],()=>{h()})}),r.addHook("onResponse",function(f,m,h){let T=f[Ys];T!=null&&(T.setAttributes({[B$]:m.statusCode}),T.end()),f[Ys]=null,h()}),r.addHook=c,r.setNotFoundHandler=l,s();function i(_,f,m,h){let T=_[Ys];T!=null&&(f.statusCode>=500&&T.setStatus({code:xT.ERROR}),T.setAttributes({[B$]:f.statusCode}),T.end()),_[Ys]=null,h(null,m)}function a(_,f,m,h){let T=_[Ys];T!=null&&(T.setStatus({code:xT.ERROR,message:m.message}),e[ad]!==!1&&T.recordException(m)),h()}function c(_,f){let m=this[F$];return H$.includes(_)?m.call(this,_,d(f,_,{[Me.HOOK_NAME]:`${this.pluginName} - ${_}`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo})):m.call(this,_,f)}function l(_,f){let m=this[V$];typeof _=="function"?(f=d(_,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:qo}),m.call(this,f)):(_.preValidation!=null&&(_.preValidation=d(_.preValidation,"notFoundHandler - preValidation",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:qo})),_.preHandler!=null&&(_.preHandler=d(_.preHandler,"notFoundHandler - preHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:qo})),f=d(f,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo}),m.call(this,_,f))}function p(_){for(let f of _)if(f?.routeOptions&&f.url&&f.method)return f;return null}function d(_,f,m={}){return function(...T){let S=this[$s],R=p(T);if(R===null)return S.logger.debug(`Ignoring route instrumentation because ${f} was called without a Fastify request argument`),_.call(this,...T);if(S.isEnabled()===!1||R.routeOptions.config?.otel===!1)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it is disabled`),_.call(this,...T);if(S[id]?.({url:R.url,method:R.method})===!0)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it matches the ignore path`),_.call(this,...T);let I=R[sd]??MT.active(),x=_.name?.length>0?_.name:this.pluginName??qo,F=S.tracer.startSpan(`${f} - ${x}`,{attributes:m},I);if(S._lifecycleHook!=null)try{S._lifecycleHook(F,{hookName:f,request:R,handler:x})}catch(B){S.logger.error({err:B},"Execution of lifecycleHook failed")}return MT.with(EN.setSpan(I,F),function(){try{let B=_.call(this,...T);return typeof B?.then=="function"?B.then(se=>(F.end(),se),se=>(F.setStatus({code:xT.ERROR,message:se.message}),S[ad]!==!1&&F.recordException(se),F.end(),Promise.reject(se))):(F.end(),B)}catch(B){throw F.setStatus({code:xT.ERROR,message:B.message}),S[ad]!==!1&&F.recordException(B),F.end(),B}},this)}}}}};gN.exports=LT;gN.exports.FastifyOtelInstrumentation=LT});var yN=E(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.SpanNames=Dr.TokenKind=Dr.AllowedOperationTypes=void 0;var gSe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(gSe=Dr.AllowedOperationTypes||(Dr.AllowedOperationTypes={}));var ASe;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(ASe=Dr.TokenKind||(Dr.TokenKind={}));var RSe;(function(t){t.EXECUTE="graphql.execute",t.PARSE="graphql.parse",t.RESOLVE="graphql.resolve",t.VALIDATE="graphql.validate",t.SCHEMA_VALIDATE="graphql.validateSchema",t.SCHEMA_PARSE="graphql.parseSchema"})(RSe=Dr.SpanNames||(Dr.SpanNames={}))});var IN=E(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.AttributeNames=void 0;var ySe;(function(t){t.SOURCE="graphql.source",t.FIELD_NAME="graphql.field.name",t.FIELD_PATH="graphql.field.path",t.FIELD_TYPE="graphql.field.type",t.PARENT_NAME="graphql.parent.name",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(ySe=pd.AttributeNames||(pd.AttributeNames={}))});var GT=E(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.OTEL_GRAPHQL_DATA_SYMBOL=yu.OTEL_PATCHED_SYMBOL=void 0;yu.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");yu.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var nY=E(BT=>{"use strict";Object.defineProperty(BT,"__esModule",{value:!0});BT.OPERATION_NOT_SUPPORTED=void 0;var u2e=GT();BT.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var hY=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.wrapFieldResolver=ht.wrapFields=ht.getSourceFromLocation=ht.getOperation=ht.endSpan=ht.addSpanSource=ht.addInputVariableAttributes=ht.isPromise=void 0;var Iu=(b(),O(v)),Ws=yN(),ma=IN(),Yo=GT(),rY=Object.values(Ws.AllowedOperationTypes),ISe=t=>typeof t?.then=="function";ht.isPromise=ISe;var OSe=t=>typeof t=="object"&&t!==null;function ON(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{ON(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{ON(t,`${e}.${r}`,o)}):t.setAttribute(`${ma.AttributeNames.VARIABLES}${String(e)}`,n)}function NSe(t,e){Object.entries(e).forEach(([n,r])=>{ON(t,n,r)})}ht.addInputVariableAttributes=NSe;function aY(t,e,n,r,o){let s=dY(e,n,r,o);t.setAttribute(ma.AttributeNames.SOURCE,s)}ht.addSpanSource=aY;function bSe(t,e,n,r,o){let s=cY(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?lY(n):uY(n,o);return s={span:CSe(t,e,n,r,o,a)},xSe(n,o,s),{field:s,spanAdded:!0}}function CSe(t,e,n,r,o,s){let i={[ma.AttributeNames.FIELD_NAME]:r.fieldName,[ma.AttributeNames.FIELD_PATH]:o.join("."),[ma.AttributeNames.FIELD_TYPE]:r.returnType.toString(),[ma.AttributeNames.PARENT_NAME]:r.parentType.name},a=t.startSpan(`${Ws.SpanNames.RESOLVE} ${i[ma.AttributeNames.FIELD_PATH]}`,{attributes:i},s?Iu.trace.setSpan(Iu.context.active(),s):void 0),c=n[Yo.OTEL_GRAPHQL_DATA_SYMBOL].source,l=r.fieldNodes.find(p=>p.kind==="Field");return l&&aY(a,c.loc,e().allowValues,l.loc?.start,l.loc?.end),a}function PSe(t,e){e&&t.recordException(e),t.end()}ht.endSpan=PSe;function MSe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>rY.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>rY.indexOf(n?.operation)!==-1)}ht.getOperation=MSe;function xSe(t,e,n){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function cY(t,e){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function uY(t,e){for(let n=e.length-1;n>0;n--){let r=cY(t,e.slice(0,n));if(r)return r.span}return lY(t)}function lY(t){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].span}function vSe(t,e){let n=[],r=e;for(;r;){let o=r.key;t&&typeof o=="number"&&(o="*"),n.push(String(o)),r=r.prev}return n.reverse()}function LSe(t){return pY(`
|
|
11
|
+
`,t)}function oY(t){return pY(" ",t)}function pY(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var DSe=[Ws.TokenKind.FLOAT,Ws.TokenKind.STRING,Ws.TokenKind.INT,Ws.TokenKind.BLOCK_STRING];function dY(t,e=!1,n,r){let o="";if(t?.startToken){let s=typeof n=="number"?n:t.start,i=typeof r=="number"?r:t.end,a=t.startToken.next,c=1;for(;a;){if(a.start<s){a=a.next,c=a?.line;continue}if(a.end>i){a=a.next,c=a?.line;continue}let l=a.value||a.kind,p="";!e&&DSe.indexOf(a.kind)>=0&&(l="*"),a.kind===Ws.TokenKind.STRING&&(l=`"${l}"`),a.kind===Ws.TokenKind.EOF&&(l=""),a.line>c?(o+=LSe(a.line-c),c=a.line,p=oY(a.column-1)):a.line===a.prev?.line&&(p=oY(a.start-(a.prev?.end||0))),o+=p+l,a&&(a=a.next)}}return o}ht.getSourceFromLocation=dY;function _Y(t,e,n){if(!t||t[Yo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Yo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=mY(e,n,s.resolve)),s.type)){let i=fY(s.type);for(let a of i)_Y(a,e,n)}})}ht.wrapFields=_Y;function fY(t){return"ofType"in t?fY(t.ofType):USe(t)?t.getTypes():wSe(t)?[t]:[]}function USe(t){return"getTypes"in t&&typeof t.getTypes=="function"}function wSe(t){return"getFields"in t&&typeof t.getFields=="function"}var sY=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:Iu.SpanStatusCode.ERROR,message:e.message}),t.end())},iY=(t,e)=>{e&&t.end()};function mY(t,e,n,r=!1){if(o[Yo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let l=e();if(l.ignoreTrivialResolveSpans&&r&&(OSe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Yo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let p=vSe(l.mergeItems,c&&c.path),d=p.filter(m=>typeof m=="string").length,_,f=!1;if(l.depth>=0&&l.depth<d)_=uY(a,p);else{let{field:m,spanAdded:h}=bSe(t,e,a,c,p);_=m.span,f=h}return Iu.context.with(Iu.trace.setSpan(Iu.context.active(),_),()=>{try{let m=n.call(this,s,i,a,c);return(0,ht.isPromise)(m)?m.then(h=>(iY(_,f),h),h=>{throw sY(_,h,f),h}):(iY(_,f),m)}catch(m){throw sY(_,m,f),m}})}return o[Yo.OTEL_PATCHED_SYMBOL]=!0,o}ht.wrapFieldResolver=mY});var TY=E(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.PACKAGE_NAME=Ou.PACKAGE_VERSION=void 0;Ou.PACKAGE_VERSION="0.62.0";Ou.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var gY=E(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});FT.GraphQLInstrumentation=void 0;var Wo=(b(),O(v)),ur=ne(),dd=yN(),jT=IN(),NN=GT(),kSe=nY(),Qt=hY(),EY=TY(),SY={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},HT=[">=14.0.0 <17"],bN=class extends ur.InstrumentationBase{constructor(e={}){super(EY.PACKAGE_NAME,EY.PACKAGE_VERSION,{...SY,...e})}setConfig(e={}){super.setConfig({...SY,...e})}init(){let e=new ur.InstrumentationNodeModuleDefinition("graphql",HT);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new ur.InstrumentationNodeModuleFile("graphql/execution/execute.js",HT,e=>((0,ur.isWrapped)(e.execute)&&this._unwrap(e,"execute"),this._wrap(e,"execute",this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,"execute")})}_addPatchingParser(){return new ur.InstrumentationNodeModuleFile("graphql/language/parser.js",HT,e=>((0,ur.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new ur.InstrumentationNodeModuleFile("graphql/validation/validate.js",HT,e=>((0,ur.isWrapped)(e.validate)&&this._unwrap(e,"validate"),this._wrap(e,"validate",this._patchValidate()),e),e=>{e&&this._unwrap(e,"validate")})}_patchExecute(e){let n=this;return function(o){return function(){let i;if(arguments.length>=2){let l=arguments;i=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],e)}else{let l=arguments[0];i=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,e)}let a=(0,Qt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[NN.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[NN.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(l,p)=>{n._handleExecutionResult(c,l,p)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Qt.endSpan)(e,n);return}if((0,Qt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Qt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,ur.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Qt.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(r){return function(s,i){return e._parse(this,r,s,i)}}}_patchValidate(){let e=this;return function(r){return function(s,i,a,c,l){return e._validate(this,r,s,i,a,l,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(dd.SpanNames.PARSE);return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),i),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Qt.getOperation)(c)?c.loc&&(0,Qt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(dd.SpanNames.SCHEMA_PARSE)),(0,Qt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(dd.SpanNames.VALIDATE,{});return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(l,p)=>{o.loc||c.updateName(dd.SpanNames.SCHEMA_VALIDATE),p&&p.length&&c.recordException({name:jT.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(p)}),(0,Qt.endSpan)(c,l)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(dd.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(jT.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(jT.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=kSe.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(jT.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Qt.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Qt.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,l){if(o||(o={}),o[NN.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c};let p=a==null,d=a??l;return a=(0,Qt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),d,p),e&&((0,Qt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Qt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};FT.GraphQLInstrumentation=bN});var AY=E(VT=>{"use strict";Object.defineProperty(VT,"__esModule",{value:!0});VT.GraphQLInstrumentation=void 0;var GSe=gY();Object.defineProperty(VT,"GraphQLInstrumentation",{enumerable:!0,get:function(){return GSe.GraphQLInstrumentation}})});var bY=E(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0});qT.EVENT_LISTENERS_SET=void 0;qT.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var CY=E($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0});$T.bufferTextMapGetter=void 0;$T.bufferTextMapGetter={get(t,e){if(!t)return;let n=Object.keys(t);for(let r of n)if(r===e||r.toLowerCase()===e)return t[r]?.toString()},keys(t){return t?Object.keys(t):[]}}});var PY=E(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.METRIC_MESSAGING_PROCESS_DURATION=_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=_e.MESSAGING_SYSTEM_VALUE_KAFKA=_e.MESSAGING_OPERATION_TYPE_VALUE_SEND=_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=_e.ATTR_MESSAGING_SYSTEM=_e.ATTR_MESSAGING_OPERATION_TYPE=_e.ATTR_MESSAGING_OPERATION_NAME=_e.ATTR_MESSAGING_KAFKA_OFFSET=_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=_e.ATTR_MESSAGING_DESTINATION_NAME=_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";_e.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";_e.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";_e.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";_e.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";_e.ATTR_MESSAGING_SYSTEM="messaging.system";_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";_e.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";_e.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";_e.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var MY=E(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.PACKAGE_NAME=Nu.PACKAGE_VERSION=void 0;Nu.PACKAGE_VERSION="0.23.0";Nu.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var wY=E(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});WT.KafkaJsInstrumentation=void 0;var ye=(b(),O(v)),lr=ne(),bu=(le(),O(Ae)),xY=bY(),vY=CY(),G=PY(),LY=MY();function YT(t,e,n){return r=>{t.add(e,{...n,...r?{[bu.ATTR_ERROR_TYPE]:r}:{}})}}function DY(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[bu.ATTR_ERROR_TYPE]:r}:{}})}}var UY=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],CN=class extends lr.InstrumentationBase{constructor(e={}){super(LY.PACKAGE_NAME,LY.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(G.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:UY}}),this._sentMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(G.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:UY}})}init(){let e=r=>{(0,lr.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,lr.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new lr.InstrumentationNodeModuleDefinition("kafkajs",[">=0.3.0 <3"],r=>(e(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[xY.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[xY.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[bu.ATTR_SERVER_ADDRESS]:n,[bu.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,lr.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,lr.isWrapped)(s.transaction)&&e._unwrap(s,"transaction"),e._wrap(s,"transaction",e._getProducerTransactionPatch()),e._setKafkaEventListeners(s),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,lr.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,lr.isWrapped)(s.eachBatch)&&e._unwrap(s,"eachBatch"),e._wrap(s,"eachBatch",e._getConsumerEachBatchPatch())),n.call(this,s)}}_getConsumerEachMessagePatch(){let e=this;return n=>function(...o){let s=o[0],i=ye.propagation.extract(ye.ROOT_CONTEXT,s.message.headers,vY.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[DY(e._processDuration,Date.now(),{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),YT(e._consumedMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],l=ye.context.with(ye.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,l)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:ye.ROOT_CONTEXT,attributes:{[G.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return ye.context.with(ye.trace.setSpan(ye.context.active(),i),()=>{let a=Date.now(),c=[],l=[YT(n._consumedMessages,s.batch.messages.length,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(d=>{let _=ye.propagation.extract(ye.ROOT_CONTEXT,d.headers,vY.bufferTextMapGetter),f=ye.trace.getSpan(_)?.spanContext(),m;f&&(m={context:f}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:d,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:m,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),l.push(DY(n._processDuration,a,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let p=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,l,p)})}}}_getProducerTransactionPatch(){let e=this;return n=>function(...o){let s=e.tracer.startSpan("transaction"),i=n.apply(this,o);return i.then(a=>{let c=a.send;a.send=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendPatch()(c).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let l=a.sendBatch;a.sendBatch=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendBatchPatch()(l).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let p=a.commit;a.commit=function(...f){let m=p.apply(this,f).then(()=>{s.setStatus({code:ye.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],m)};let d=a.abort;a.abort=function(...f){let m=d.apply(this,f);return e._endSpansOnPromise([s],[],m)}}).catch(a=>{s.setStatus({code:ye.SpanStatusCode.ERROR,message:a?.message}),s.recordException(a),s.end()}),i}}_getSendBatchPatch(){let e=this;return n=>function(...o){let i=o[0].topicMessages||[],a=[],c=[];i.forEach(p=>{p.messages.forEach(d=>{a.push(e._startProducerSpan(p.topic,d)),c.push(YT(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...d.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}}))})});let l=n.apply(this,o);return e._endSpansOnPromise(a,c,l)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(l=>e._startProducerSpan(s.topic,l)),a=s.messages.map(l=>YT(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...l.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(l.partition)}:{}})),c=n.apply(this,o);return e._endSpansOnPromise(i,a,c)}}_endSpansOnPromise(e,n,r){return Promise.resolve(r).then(o=>(n.forEach(s=>s()),o)).catch(o=>{let s,i=bu.ERROR_TYPE_VALUE_OTHER;throw typeof o=="string"||o===void 0?s=o:typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"message")&&(s=o.message,i=o.constructor.name),n.forEach(a=>a(i)),e.forEach(a=>{a.setAttribute(bu.ATTR_ERROR_TYPE,i),a.setStatus({code:ye.SpanStatusCode.ERROR,message:s})}),o}).finally(()=>{e.forEach(o=>o.end())})}_startConsumerSpan({topic:e,message:n,operationType:r,ctx:o,link:s,attributes:i}){let a=r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?ye.SpanKind.CLIENT:ye.SpanKind.CONSUMER,attributes:{...i,[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_OPERATION_TYPE]:r,[G.ATTR_MESSAGING_OPERATION_NAME]:a,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:l}=this.getConfig();return l&&n&&(0,lr.safeExecuteInTheMiddle)(()=>l(c,{topic:e,message:n}),p=>{p&&this._diag.error("consumerHook error",p)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:ye.SpanKind.PRODUCER,attributes:{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_OPERATION_TYPE]:G.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},ye.propagation.inject(ye.trace.setSpan(ye.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,lr.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};WT.KafkaJsInstrumentation=CN});var kY=E(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});zT.KafkaJsInstrumentation=void 0;var HSe=wY();Object.defineProperty(zT,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return HSe.KafkaJsInstrumentation}})});var FY=E(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.PACKAGE_NAME=Cu.PACKAGE_VERSION=void 0;Cu.PACKAGE_VERSION="0.58.0";Cu.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var YY=E(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.LruMemoizerInstrumentation=void 0;var VY=(b(),O(v)),qY=ne(),$Y=FY(),PN=class extends qY.InstrumentationBase{constructor(e={}){super($Y.PACKAGE_NAME,$Y.PACKAGE_VERSION,e)}init(){return[new qY.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <4"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?VY.context.bind(VY.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};KT.LruMemoizerInstrumentation=PN});var WY=E(QT=>{"use strict";Object.defineProperty(QT,"__esModule",{value:!0});QT.LruMemoizerInstrumentation=void 0;var VSe=YY();Object.defineProperty(QT,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return VSe.LruMemoizerInstrumentation}})});var JY=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.METRIC_DB_CLIENT_CONNECTIONS_USAGE=De.DB_SYSTEM_VALUE_MONGODB=De.DB_SYSTEM_NAME_VALUE_MONGODB=De.ATTR_NET_PEER_PORT=De.ATTR_NET_PEER_NAME=De.ATTR_DB_SYSTEM=De.ATTR_DB_STATEMENT=De.ATTR_DB_OPERATION=De.ATTR_DB_NAME=De.ATTR_DB_MONGODB_COLLECTION=De.ATTR_DB_CONNECTION_STRING=void 0;De.ATTR_DB_CONNECTION_STRING="db.connection_string";De.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";De.ATTR_DB_NAME="db.name";De.ATTR_DB_OPERATION="db.operation";De.ATTR_DB_STATEMENT="db.statement";De.ATTR_DB_SYSTEM="db.system";De.ATTR_NET_PEER_NAME="net.peer.name";De.ATTR_NET_PEER_PORT="net.peer.port";De.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";De.DB_SYSTEM_VALUE_MONGODB="mongodb";De.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var ZY=E(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.MongodbCommandType=void 0;var $Se;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})($Se=_d.MongodbCommandType||(_d.MongodbCommandType={}))});var eW=E(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.PACKAGE_NAME=Pu.PACKAGE_VERSION=void 0;Pu.PACKAGE_VERSION="0.67.0";Pu.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var rW=E(XT=>{"use strict";Object.defineProperty(XT,"__esModule",{value:!0});XT.MongoDBInstrumentation=void 0;var we=(b(),O(v)),fe=ne(),zo=(le(),O(Ae)),$n=JY(),ha=ZY(),tW=eW(),nW={requireParentSpan:!0},MN=class t extends fe.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(tW.PACKAGE_NAME,tW.PACKAGE_VERSION,{...nW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,fe.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,fe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...nW,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter($n.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsage?.add(e,{"pool.name":n,state:r})}init(){let{v3PatchConnection:e,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnect:r,v4UnpatchConnect:o}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:s,v4PatchConnectionPromise:i,v4UnpatchConnection:a}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:p,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new fe.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new fe.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,l),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new fe.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],p,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,fe.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,fe.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,fe.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,fe.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,fe.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,fe.isWrapped)(e.getMore)&&this._unwrap(e,"getMore"),this._wrap(e,"getMore",this._getV3PatchCursor()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,"insert"),this._unwrap(e,"remove"),this._unwrap(e,"update"),this._unwrap(e,"command"),this._unwrap(e,"query"),this._unwrap(e,"getMore"))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"))}}}_getV4AcquireCommand(){let e=this;return n=>function(){let o=this.sessions.length,s=n.call(this),i=this.sessions.length;return o===i?e._connCountAdd(1,e._poolName,"used"):o-1===i&&(e._connCountAdd(-1,e._poolName,"idle"),e._connCountAdd(1,e._poolName,"used")),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connCountAdd(-1,e._poolName,"used"),e._connCountAdd(1,e._poolName,"idle"),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,fe.isWrapped)(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,fe.isWrapped)(e.connect)&&this._unwrap(e,"connect"),this._wrap(e,"connect",this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,"connect")}}}_getV4ConnectionPoolCheckOut(){return e=>function(r){let o=we.context.bind(we.context.active(),r);return e.call(this,o)}}_getV4ConnectCommand(){let e=this;return n=>function(o,s){if(n.length===1){let a=n.call(this,o);return a&&typeof a.then=="function"&&a.then(()=>e.setPoolName(o),()=>{}),a}let i=function(a,c){if(a||!c){s(a,c);return}e.setPoolName(o),s(a,c)};return n.call(this,o,i)}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,"command")}}}_getV3PatchOperation(e){let n=this;return r=>function(s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=n._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,l);let f=n._getV3SpanAttributes(i,s,a[0],e),m=n._spanNameFromAttrs(f),h=n.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=n._patchEnd(h,_);return typeof c=="function"?r.call(this,s,i,a,T):r.call(this,s,i,a,c,T)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let l=we.trace.getSpan(we.context.active()),p=e._checkSkipInstrumentation(l),d=typeof a=="function"?a:c;if(p||typeof d!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let _=t._getCommandType(i),f=_===ha.MongodbCommandType.UNKNOWN?void 0:_,m=e._getV3SpanAttributes(s,o,i,f),h=e._spanNameFromAttrs(m),T=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m}),S=e._patchEnd(T,d);return typeof a=="function"?n.call(this,o,s,i,S):n.call(this,o,s,i,a,S)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=we.trace.getSpan(we.context.active()),l=e._checkSkipInstrumentation(c),p=a,d=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let _;if(!l){let m=e._getV4SpanAttributes(this,o,s,d),h=e._spanNameFromAttrs(m);_=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let f=e._patchEnd(_,p,this.id,d);return n.call(this,o,s,i,f)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=we.trace.getSpan(we.context.active()),c=e._checkSkipInstrumentation(a),l=Object.keys(i)[0],p=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let d;if(!c){let m=e._getV4SpanAttributes(this,s,i,l),h=e._spanNameFromAttrs(m);d=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let _=e._patchEnd(d,p,this.id,l),f=n.apply(this,o);return f.then(m=>_(null,m),m=>_(m)),f}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i,"find"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}static _getCommandType(e){return e.createIndexes!==void 0?ha.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?ha.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?ha.MongodbCommandType.IS_MASTER:e.count!==void 0?ha.MongodbCommandType.COUNT:e.aggregate!==void 0?ha.MongodbCommandType.AGGREGATE:ha.MongodbCommandType.UNKNOWN}_getV4SpanAttributes(e,n,r,o){let s,i;if(e){let c=typeof e.address=="string"?e.address.split(":"):"";c.length===2&&(s=c[0],i=c[1])}let a;return r?.documents&&r.documents[0]?a=r.documents[0]:r?.cursors?a=r.cursors:a=r,this._getSpanAttributes(n.db,n.collection,s,i,a,o)}_getV3SpanAttributes(e,n,r,o){let s,i;if(n&&n.s&&(s=n.s.options?.host??n.s.host,i=(n.s.options?.port??n.s.port)?.toString(),s==null||i==null)){let p=n.description?.address;if(p){let d=p.split(":");s=d[0],i=d[1]}}let[a,c]=e.toString().split("."),l=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,l,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_SYSTEM]=$n.DB_SYSTEM_VALUE_MONGODB,a[$n.ATTR_DB_NAME]=e,a[$n.ATTR_DB_MONGODB_COLLECTION]=n,a[$n.ATTR_DB_OPERATION]=i,a[$n.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_SYSTEM_NAME]=$n.DB_SYSTEM_NAME_VALUE_MONGODB,a[zo.ATTR_DB_NAMESPACE]=e,a[zo.ATTR_DB_OPERATION_NAME]=i,a[zo.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),l=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,fe.safeExecuteInTheMiddle)(()=>{let p=l(s);this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_STATEMENT]=p),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_QUERY_TEXT]=p)},p=>{p&&this._diag.error("Error running dbStatementSerializer hook",p)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&fe.SemconvStability.STABLE?n=[e[zo.ATTR_DB_OPERATION_NAME],e[zo.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||$n.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[$n.ATTR_DB_OPERATION]||"command"}`,n}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(n,r)=>typeof r!="object"||!r?"?":e.has(r)?"[Circular]":(e.add(r),r)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig();return n?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,fe.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=we.context.active(),i=this,a=!1;return function(...l){if(!a){a=!0;let p=l[0];if(e){if(p instanceof Error)e.setStatus({code:we.SpanStatusCode.ERROR,message:p.message});else{let d=l[1];i._handleExecutionResult(e,d)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return we.context.with(s,()=>n.apply(this,l))}}setPoolName(e){let n=e.hostAddress?.host,r=e.hostAddress?.port,o=e.dbName,s=`mongodb://${n}:${r}/${o}`;this._poolName=s}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};XT.MongoDBInstrumentation=MN});var oW=E(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});fd.MongodbCommandType=void 0;var YSe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(YSe=fd.MongodbCommandType||(fd.MongodbCommandType={}))});var sW=E(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.MongodbCommandType=Mu.MongoDBInstrumentation=void 0;var WSe=rW();Object.defineProperty(Mu,"MongoDBInstrumentation",{enumerable:!0,get:function(){return WSe.MongoDBInstrumentation}});var zSe=oW();Object.defineProperty(Mu,"MongodbCommandType",{enumerable:!0,get:function(){return zSe.MongodbCommandType}})});var vN=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.DB_SYSTEM_NAME_VALUE_MONGODB=at.ATTR_NET_PEER_PORT=at.ATTR_NET_PEER_NAME=at.ATTR_DB_USER=at.ATTR_DB_SYSTEM=at.ATTR_DB_STATEMENT=at.ATTR_DB_OPERATION=at.ATTR_DB_NAME=at.ATTR_DB_MONGODB_COLLECTION=void 0;at.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";at.ATTR_DB_NAME="db.name";at.ATTR_DB_OPERATION="db.operation";at.ATTR_DB_STATEMENT="db.statement";at.ATTR_DB_SYSTEM="db.system";at.ATTR_DB_USER="db.user";at.ATTR_NET_PEER_NAME="net.peer.name";at.ATTR_NET_PEER_PORT="net.peer.port";at.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var dW=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.handleCallbackResponse=zs.handlePromiseResponse=zs.getAttributesFromCollection=void 0;var lW=(b(),O(v)),hd=ne(),md=vN(),JT=(le(),O(Ae));function ege(t,e,n){let r={};return e&hd.SemconvStability.OLD&&(r[md.ATTR_DB_MONGODB_COLLECTION]=t.name,r[md.ATTR_DB_NAME]=t.conn.name,r[md.ATTR_DB_USER]=t.conn.user),e&hd.SemconvStability.STABLE&&(r[JT.ATTR_DB_COLLECTION_NAME]=t.name,r[JT.ATTR_DB_NAMESPACE]=t.conn.name),n&hd.SemconvStability.OLD&&(r[md.ATTR_NET_PEER_NAME]=t.conn.host,r[md.ATTR_NET_PEER_PORT]=t.conn.port),n&hd.SemconvStability.STABLE&&(r[JT.ATTR_SERVER_ADDRESS]=t.conn.host,r[JT.ATTR_SERVER_PORT]=t.conn.port),r}zs.getAttributesFromCollection=ege;function pW(t,e={}){t.recordException(e),t.setStatus({code:lW.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
|
|
12
|
+
Mongoose Error Code: ${e.code}`:""}`})}function LN(t,e,n,r=void 0){n&&(0,hd.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&lW.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function tge(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(LN(e,o,n,r),o)).catch(o=>{throw pW(e,o),o}).finally(()=>e.end()):(LN(e,t,n,r),e.end(),t)}zs.handlePromiseResponse=tge;function nge(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,l)=>(c?pW(r,c):LN(r,l,s,i),r.end(),t(c,l)),e.apply(n,o)}zs.handleCallbackResponse=nge});var _W=E(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.PACKAGE_NAME=xu.PACKAGE_VERSION=void 0;xu.PACKAGE_VERSION="0.60.0";xu.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var EW=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MongooseInstrumentation=Cn._ALREADY_INSTRUMENTED=Cn._STORED_PARENT_SPAN=void 0;var Tt=(b(),O(v)),rge=Te(),DN=dW(),jt=ne(),fW=_W(),Ks=vN(),Ta=(le(),O(Ae)),ZT=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],oge=["remove","count","findOneAndRemove",...ZT],sge=["count","findOneAndRemove",...ZT],ige=[...ZT];function mW(t){return t?t.startsWith("6.")||t.startsWith("5.")?oge:t.startsWith("7.")?sge:ige:ZT}function hW(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function TW(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Cn._STORED_PARENT_SPAN=Symbol("stored-parent-span");Cn._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var UN=class extends jt.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(fW.PACKAGE_NAME,fW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,jt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,jt.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new jt.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <10"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),TW(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),mW(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=mW(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._unwrap(r.Model.prototype,"remove"),TW(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[Ta.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[Cn._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[Ta.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let l={},{dbStatementSerializer:p}=r.getConfig();if(p){let _=p(e,c);r._dbSemconvStability&jt.SemconvStability.OLD&&(l[Ks.ATTR_DB_STATEMENT]=_),r._dbSemconvStability&jt.SemconvStability.STABLE&&(l[Ta.ATTR_DB_QUERY_TEXT]=_)}let d=r._startSpan(this.constructor.collection,this.constructor.modelName,e,l);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(d,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let l=c,p=i,d=a;typeof i=="function"?(l=i,p=void 0,d=void 0):typeof a=="function"&&(l=a,d=void 0);let _={},f=r.getConfig().dbStatementSerializer;if(f){let T=f(e,{condition:{_id:this._id},updates:p,options:d});r._dbSemconvStability&jt.SemconvStability.OLD&&(_[Ks.ATTR_DB_STATEMENT]=T),r._dbSemconvStability&jt.SemconvStability.STABLE&&(_[Ta.ATTR_DB_QUERY_TEXT]=T)}let m=r._startSpan(this.constructor.collection,this.constructor.modelName,e,_),h=r._handleResponse(m,o,this,arguments,l,n);return h&&typeof h=="object"&&(h[Cn._ALREADY_INSTRUMENTED]=!0),h}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let l={};switch(e){case"insertMany":l.documents=i;break;case"bulkWrite":l.operations=i;break;default:l.document=i;break}a!==void 0&&(l.options=a);let p={},{dbStatementSerializer:d}=r.getConfig();if(d){let f=d(e,l);r._dbSemconvStability&jt.SemconvStability.OLD&&(p[Ks.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&jt.SemconvStability.STABLE&&(p[Ta.ATTR_DB_QUERY_TEXT]=f)}let _=r._startSpan(this.collection,this.modelName,e,p);return r._handleResponse(_,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Tt.trace.getSpan(Tt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Cn._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Cn._STORED_PARENT_SPAN]=Tt.trace.getSpan(Tt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,DN.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&jt.SemconvStability.OLD&&(i[Ks.ATTR_DB_OPERATION]=r,i[Ks.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&jt.SemconvStability.STABLE&&(i[Ta.ATTR_DB_OPERATION_NAME]=r,i[Ta.ATTR_DB_SYSTEM_NAME]=Ks.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&jt.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Tt.SpanKind.CLIENT,attributes:i},s?Tt.trace.setSpan(Tt.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,DN.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,DN.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Tt.context.with((0,rge.suppressTracing)(Tt.context.active()),e):e()}};Cn.MongooseInstrumentation=UN});var SW=E(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.MongooseInstrumentation=void 0;var age=EW();Object.defineProperty(eE,"MongooseInstrumentation",{enumerable:!0,get:function(){return age.MongooseInstrumentation}})});var IW=E(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ct.DB_SYSTEM_VALUE_MYSQL=ct.ATTR_NET_PEER_PORT=ct.ATTR_NET_PEER_NAME=ct.ATTR_DB_USER=ct.ATTR_DB_SYSTEM=ct.ATTR_DB_STATEMENT=ct.ATTR_DB_NAME=ct.ATTR_DB_CONNECTION_STRING=void 0;ct.ATTR_DB_CONNECTION_STRING="db.connection_string";ct.ATTR_DB_NAME="db.name";ct.ATTR_DB_STATEMENT="db.statement";ct.ATTR_DB_SYSTEM="db.system";ct.ATTR_DB_USER="db.user";ct.ATTR_NET_PEER_NAME="net.peer.name";ct.ATTR_NET_PEER_PORT="net.peer.port";ct.DB_SYSTEM_VALUE_MYSQL="mysql";ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var OW=E(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});Td.AttributeNames=void 0;var uge;(function(t){t.MYSQL_VALUES="db.mysql.values"})(uge=Td.AttributeNames||(Td.AttributeNames={}))});var NW=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getPoolNameOld=Xt.arrayStringifyHelper=Xt.getSpanName=Xt.getDbValues=Xt.getDbQueryText=Xt.getJDBCString=Xt.getConfig=void 0;function lge(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}Xt.getConfig=lge;function pge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}Xt.getJDBCString=pge;function dge(t){return typeof t=="string"?t:t.sql}Xt.getDbQueryText=dge;function _ge(t,e){return wN(typeof t=="string"?e:e||t.values)}Xt.getDbValues=_ge;function fge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Xt.getSpanName=fge;function wN(t){return t?`[${t.toString()}]`:""}Xt.arrayStringifyHelper=wN;function mge(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}Xt.getPoolNameOld=mge});var bW=E(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.PACKAGE_NAME=vu.PACKAGE_VERSION=void 0;vu.PACKAGE_VERSION="0.60.0";vu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var PW=E(tE=>{"use strict";Object.defineProperty(tE,"__esModule",{value:!0});tE.MySQLInstrumentation=void 0;var Pn=(b(),O(v)),pr=ne(),Lu=(le(),O(Ae)),Ko=IW(),hge=OW(),Ea=NW(),CW=bW(),kN=class extends pr.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(CW.PACKAGE_NAME,CW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,pr.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,pr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ko.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new pr.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,pr.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,pr.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,pr.isWrapped)(e.createPoolCluster)&&this._unwrap(e,"createPoolCluster"),this._wrap(e,"createPoolCluster",this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,"createConnection"),this._unwrap(e,"createPool"),this._unwrap(e,"createPoolCluster"))})]}_patchCreateConnection(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,l=(0,Ea.getPoolNameOld)(e);r._connCountAdd(-c,l,"used"),r._connCountAdd(-a,l,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),l=a[c].pool;r._setPoolCallbacks(l,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=Pn.context.active();return function(o,s){s&&((0,pr.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Pn.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:l,database:p,user:d}=(0,Ea.getConfig)(e.config),_=parseInt(l,10),f=(0,Ea.getDbQueryText)(o);r._dbSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_DB_SYSTEM]=Ko.DB_SYSTEM_VALUE_MYSQL,a[Ko.ATTR_DB_CONNECTION_STRING]=(0,Ea.getJDBCString)(c,l,p),a[Ko.ATTR_DB_NAME]=p,a[Ko.ATTR_DB_USER]=d,a[Ko.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&pr.SemconvStability.STABLE&&(a[Lu.ATTR_DB_SYSTEM_NAME]=Lu.DB_SYSTEM_NAME_VALUE_MYSQL,a[Lu.ATTR_DB_NAMESPACE]=p,a[Lu.ATTR_DB_QUERY_TEXT]=f),r._netSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_NET_PEER_NAME]=c,isNaN(_)||(a[Ko.ATTR_NET_PEER_PORT]=_)),r._netSemconvStability&pr.SemconvStability.STABLE&&(a[Lu.ATTR_SERVER_ADDRESS]=c,isNaN(_)||(a[Lu.ATTR_SERVER_PORT]=_));let m=r.tracer.startSpan((0,Ea.getSpanName)(o),{kind:Pn.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let S;Array.isArray(s)?S=s:arguments[2]&&(S=[s]),m.setAttribute(hge.AttributeNames.MYSQL_VALUES,(0,Ea.getDbValues)(o,S))}let h=Array.from(arguments).findIndex(S=>typeof S=="function"),T=Pn.context.active();if(h===-1){let S=Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments));return Pn.context.bind(T,S),S.on("error",R=>m.setStatus({code:Pn.SpanStatusCode.ERROR,message:R.message})).on("end",()=>{m.end()})}else return r._wrap(arguments,h,r._patchCallbackQuery(m,T)),Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Pn.SpanStatusCode.ERROR,message:o.message}),e.end(),Pn.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Ea.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};tE.MySQLInstrumentation=kN});var MW=E(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.MySQLInstrumentation=void 0;var Tge=PW();Object.defineProperty(nE,"MySQLInstrumentation",{enumerable:!0,get:function(){return Tge.MySQLInstrumentation}})});var GN=E(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DB_SYSTEM_VALUE_MYSQL=Ct.ATTR_NET_PEER_PORT=Ct.ATTR_NET_PEER_NAME=Ct.ATTR_DB_USER=Ct.ATTR_DB_SYSTEM=Ct.ATTR_DB_STATEMENT=Ct.ATTR_DB_NAME=Ct.ATTR_DB_CONNECTION_STRING=void 0;Ct.ATTR_DB_CONNECTION_STRING="db.connection_string";Ct.ATTR_DB_NAME="db.name";Ct.ATTR_DB_STATEMENT="db.statement";Ct.ATTR_DB_SYSTEM="db.system";Ct.ATTR_DB_USER="db.user";Ct.ATTR_NET_PEER_NAME="net.peer.name";Ct.ATTR_NET_PEER_PORT="net.peer.port";Ct.DB_SYSTEM_VALUE_MYSQL="mysql"});var jN=E(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.addSqlCommenterComment=void 0;var BN=(b(),O(v)),Sge=Te();function gge(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function Age(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Rge(t,e){if(typeof e!="string"||e.length===0||gge(e))return e;let n=new Sge.W3CTraceContextPropagator,r={};n.inject(BN.trace.setSpan(BN.ROOT_CONTEXT,t),r,BN.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=Age(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}rE.addSqlCommenterComment=Rge});var UW=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.getConnectionPrototypeToInstrument=dr.once=dr.getSpanName=dr.getQueryText=dr.getConnectionAttributes=void 0;var Ed=GN(),oE=ne(),HN=(le(),O(Ae));function yge(t,e,n){let{host:r,port:o,database:s,user:i}=Ige(t),a={};e&oE.SemconvStability.OLD&&(a[Ed.ATTR_DB_CONNECTION_STRING]=Oge(r,o,s),a[Ed.ATTR_DB_NAME]=s,a[Ed.ATTR_DB_USER]=i),e&oE.SemconvStability.STABLE&&(a[HN.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&oE.SemconvStability.OLD&&(a[Ed.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[Ed.ATTR_NET_PEER_PORT]=c)),n&oE.SemconvStability.STABLE&&(a[HN.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[HN.ATTR_SERVER_PORT]=c)),a}dr.getConnectionAttributes=yge;function Ige(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function Oge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function Nge(t,e,n,r=!1,o=bge){let[s,i]=typeof t=="string"?[t,n]:[t.sql,Cge(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}dr.getQueryText=Nge;function bge(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function Cge(t){return"values"in t}function Pge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}dr.getSpanName=Pge;var Mge=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};dr.once=Mge;function xge(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}dr.getConnectionPrototypeToInstrument=xge});var wW=E(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.PACKAGE_NAME=Du.PACKAGE_VERSION=void 0;Du.PACKAGE_VERSION="0.60.0";Du.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var jW=E(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.MySQL2Instrumentation=void 0;var kW=(b(),O(v)),Ur=ne(),FN=GN(),GW=jN(),Uu=UW(),BW=wW(),VN=(le(),O(Ae)),qN=[">=1.4.2 <4"],$N=class extends Ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(BW.PACKAGE_NAME,BW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,Ur.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Ur.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new Ur.InstrumentationNodeModuleDefinition("mysql2",qN,s=>(n(s),s),()=>{},[new Ur.InstrumentationNodeModuleFile("mysql2/promise.js",qN,s=>(n(s),s),()=>{}),new Ur.InstrumentationNodeModuleFile("mysql2/lib/connection.js",qN,s=>{let i=(0,Uu.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Uu.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:l,maskStatementHook:p,responseHook:d}=o.getConfig(),_=(0,Uu.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),f=(0,Uu.getQueryText)(s,e,c,l,p);o._dbSemconvStability&Ur.SemconvStability.OLD&&(_[FN.ATTR_DB_SYSTEM]=FN.DB_SYSTEM_VALUE_MYSQL,_[FN.ATTR_DB_STATEMENT]=f),o._dbSemconvStability&Ur.SemconvStability.STABLE&&(_[VN.ATTR_DB_SYSTEM_NAME]=VN.DB_SYSTEM_NAME_VALUE_MYSQL,_[VN.ATTR_DB_QUERY_TEXT]=f);let m=o.tracer.startSpan((0,Uu.getSpanName)(s),{kind:kW.SpanKind.CLIENT,attributes:_});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,GW.addSqlCommenterComment)(m,s):Object.assign(s,{sql:(0,GW.addSqlCommenterComment)(m,s.sql)}));let h=(0,Uu.once)((T,S)=>{T?m.setStatus({code:kW.SpanStatusCode.ERROR,message:T.message}):typeof d=="function"&&(0,Ur.safeExecuteInTheMiddle)(()=>{d(m,{queryResults:S})},R=>{R&&o._diag.warn("Failed executing responseHook",R)},!0),m.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(h));let T=r.apply(this,arguments);return T.once("error",S=>{h(S)}).once("result",S=>{h(void 0,S)}),T}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(h)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(h)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};sE.MySQL2Instrumentation=$N});var HW=E(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.MySQL2Instrumentation=void 0;var vge=jW();Object.defineProperty(iE,"MySQL2Instrumentation",{enumerable:!0,get:function(){return vge.MySQL2Instrumentation}})});var YW=E(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DB_SYSTEM_VALUE_REDIS=Jt.DB_SYSTEM_NAME_VALUE_REDIS=Jt.ATTR_NET_PEER_PORT=Jt.ATTR_NET_PEER_NAME=Jt.ATTR_DB_SYSTEM=Jt.ATTR_DB_STATEMENT=Jt.ATTR_DB_CONNECTION_STRING=void 0;Jt.ATTR_DB_CONNECTION_STRING="db.connection_string";Jt.ATTR_DB_STATEMENT="db.statement";Jt.ATTR_DB_SYSTEM="db.system";Jt.ATTR_NET_PEER_NAME="net.peer.name";Jt.ATTR_NET_PEER_PORT="net.peer.port";Jt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Jt.DB_SYSTEM_VALUE_REDIS="redis"});var WW=E(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.endSpan=void 0;var Dge=(b(),O(v)),Uge=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:Dge.SpanStatusCode.ERROR,message:e.message})),t.end()};aE.endSpan=Uge});var uE=E(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0});cE.defaultDbStatementSerializer=void 0;var wge=[{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}],kge=(t,e)=>{if(Array.isArray(e)&&e.length){let n=wge.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};cE.defaultDbStatementSerializer=kge});var zW=E(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.PACKAGE_NAME=wu.PACKAGE_VERSION=void 0;wu.PACKAGE_VERSION="0.62.0";wu.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var JW=E(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.IORedisInstrumentation=void 0;var Qs=(b(),O(v)),Mn=ne(),Xs=(le(),O(Ae)),xn=YW(),KW=ne(),Sd=WW(),Gge=uE(),QW=zW(),XW={requireParentSpan:!0},YN=class extends Mn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(QW.PACKAGE_NAME,QW.PACKAGE_VERSION,{...XW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Mn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...XW,...e})}init(){return[new Mn.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Mn.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Mn.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||Gge.defaultDbStatementSerializer,a=Qs.trace.getSpan(Qs.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:l,port:p}=this.options,d=i(o.name,o.args);r._dbSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,c[xn.ATTR_DB_STATEMENT]=d,c[xn.ATTR_DB_CONNECTION_STRING]=`redis://${l}:${p}`),r._dbSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,c[Xs.ATTR_DB_QUERY_TEXT]=d),r._netSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_NET_PEER_NAME]=l,c[xn.ATTR_NET_PEER_PORT]=p),r._netSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_SERVER_ADDRESS]=l,c[Xs.ATTR_SERVER_PORT]=p);let _=r.tracer.startSpan(o.name,{kind:Qs.SpanKind.CLIENT,attributes:c}),{requestHook:f}=s;f&&(0,KW.safeExecuteInTheMiddle)(()=>f(_,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),m=>{m&&Qs.diag.error("ioredis instrumentation: request hook failed",m)},!0);try{let m=e.apply(this,arguments),h=o.resolve;o.resolve=function(S){(0,KW.safeExecuteInTheMiddle)(()=>s.responseHook?.(_,o.name,o.args,S),R=>{R&&Qs.diag.error("ioredis instrumentation: response hook failed",R)},!0),(0,Sd.endSpan)(_,null),h(S)};let T=o.reject;return o.reject=function(S){(0,Sd.endSpan)(_,S),T(S)},m}catch(m){throw(0,Sd.endSpan)(_,m),m}}}_traceConnection(e){let n=this;return function(){let r=Qs.trace.getSpan(Qs.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,o[xn.ATTR_DB_STATEMENT]="connect",o[xn.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,o[Xs.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_NET_PEER_NAME]=s,o[xn.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_SERVER_ADDRESS]=s,o[Xs.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Qs.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,Sd.endSpan)(a,null),c}catch(c){throw(0,Sd.endSpan)(a,c),c}}}};lE.IORedisInstrumentation=YN});var ZW=E(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0});pE.IORedisInstrumentation=void 0;var Bge=JW();Object.defineProperty(pE,"IORedisInstrumentation",{enumerable:!0,get:function(){return Bge.IORedisInstrumentation}})});var dE=E(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.PACKAGE_NAME=ku.PACKAGE_VERSION=void 0;ku.PACKAGE_VERSION="0.62.0";ku.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var ez=E(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.getTracedCreateStreamTrace=Js.getTracedCreateClient=Js.endSpan=void 0;var gd=(b(),O(v)),jge=(t,e)=>{e&&t.setStatus({code:gd.SpanStatusCode.ERROR,message:e.message}),t.end()};Js.endSpan=jge;var Hge=t=>function(){let n=t.apply(this,arguments);return gd.context.bind(gd.context.active(),n)};Js.getTracedCreateClient=Hge;var Fge=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){gd.context.bind(gd.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Js.getTracedCreateStreamTrace=Fge});var _E=E(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.DB_SYSTEM_VALUE_REDIS=Zt.DB_SYSTEM_NAME_VALUE_REDIS=Zt.ATTR_NET_PEER_PORT=Zt.ATTR_NET_PEER_NAME=Zt.ATTR_DB_SYSTEM=Zt.ATTR_DB_STATEMENT=Zt.ATTR_DB_CONNECTION_STRING=void 0;Zt.ATTR_DB_CONNECTION_STRING="db.connection_string";Zt.ATTR_DB_STATEMENT="db.statement";Zt.ATTR_DB_SYSTEM="db.system";Zt.ATTR_NET_PEER_NAME="net.peer.name";Zt.ATTR_NET_PEER_PORT="net.peer.port";Zt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Zt.DB_SYSTEM_VALUE_REDIS="redis"});var nz=E(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.RedisInstrumentationV2_V3=void 0;var Yn=ne(),fE=ez(),tz=dE(),Ad=(b(),O(v)),Rd=(le(),O(Ae)),Sa=_E(),Vge=uE(),WN=class t extends Yn.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(tz.PACKAGE_NAME,tz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Yn.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Yn.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,Yn.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Yn.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=Ad.trace.getSpan(Ad.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||Vge.defaultDbStatementSerializer,l={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(l,{[Sa.ATTR_DB_SYSTEM]:Sa.DB_SYSTEM_VALUE_REDIS,[Sa.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(l,{[Rd.ATTR_DB_SYSTEM_NAME]:Sa.DB_SYSTEM_NAME_VALUE_REDIS,[Rd.ATTR_DB_OPERATION_NAME]:s.command,[Rd.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let p=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:Ad.SpanKind.CLIENT,attributes:l});if(this.connection_options){let _={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(_,{[Sa.ATTR_NET_PEER_NAME]:this.connection_options.host,[Sa.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(_,{[Rd.ATTR_SERVER_ADDRESS]:this.connection_options.host,[Rd.ATTR_SERVER_PORT]:this.connection_options.port}),p.setAttributes(_)}this.address&&e._semconvStability&Yn.SemconvStability.OLD&&p.setAttribute(Sa.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let d=arguments[0].callback;if(d){let _=Ad.context.active();arguments[0].callback=function(m,h){if(i?.responseHook){let T=i.responseHook;(0,Yn.safeExecuteInTheMiddle)(()=>{T(p,s.command,s.args,h)},S=>{S&&e._diag.error("Error executing responseHook",S)},!0)}return(0,fE.endSpan)(p,m),Ad.context.with(_,d,this,...arguments)}}try{return r.apply(this,arguments)}catch(_){throw(0,fE.endSpan)(p,_),_}}}}_getPatchCreateClient(){return function(n){return(0,fE.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,fE.getTracedCreateStreamTrace)(n)}}};mE.RedisInstrumentationV2_V3=WN});var oz=E(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.getClientAttributes=void 0;var zN=(le(),O(Ae)),Gu=_E(),rz=ne();function qge(t,e,n){let r={};return n&rz.SemconvStability.OLD&&Object.assign(r,{[Gu.ATTR_DB_SYSTEM]:Gu.DB_SYSTEM_VALUE_REDIS,[Gu.ATTR_NET_PEER_NAME]:e?.socket?.host,[Gu.ATTR_NET_PEER_PORT]:e?.socket?.port,[Gu.ATTR_DB_CONNECTION_STRING]:$ge(t,e?.url)}),n&rz.SemconvStability.STABLE&&Object.assign(r,{[zN.ATTR_DB_SYSTEM_NAME]:Gu.DB_SYSTEM_NAME_VALUE_REDIS,[zN.ATTR_SERVER_ADDRESS]:e?.socket?.host,[zN.ATTR_SERVER_PORT]:e?.socket?.port}),r}hE.getClientAttributes=qge;function $ge(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var cz=E(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.RedisInstrumentationV4_V5=void 0;var _r=(b(),O(v)),xe=ne(),sz=oz(),Yge=uE(),iz=dE(),KN=(le(),O(Ae)),Wge=_E(),yd=Symbol("opentelemetry.instrumentation.redis.open_spans"),az=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),QN=class t extends xe.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(iz.PACKAGE_NAME,iz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,xe.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,xe.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,xe.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,xe.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new xe.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,l){let p=e(c,l).args;return n._traceClientCommand(a,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[yd];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[yd];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let l=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,l,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[az]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,sz.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:_r.SpanKind.CLIENT,attributes:i});return _r.context.with(_r.trace.setSpan(_r.context.active(),a),()=>r.apply(this)).then(l=>(a.end(),l)).catch(l=>(a.recordException(l),a.setStatus({code:_r.SpanStatusCode.ERROR,message:l.message}),a.end(),Promise.reject(l)))}}}_traceClientCommand(e,n,r,o){if(_r.trace.getSpan(_r.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[az],a=o[0],c=o.slice(1),l=this.getConfig().dbStatementSerializer||Yge.defaultDbStatementSerializer,p=(0,sz.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_OPERATION_NAME]=a);try{let f=l(a,c);f!=null&&(this._semconvStability&xe.SemconvStability.OLD&&(p[Wge.ATTR_DB_STATEMENT]=f),this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_QUERY_TEXT]=f))}catch(f){this._diag.error("dbStatementSerializer throw an exception",f,{commandName:a})}let d=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:_r.SpanKind.CLIENT,attributes:p}),_=_r.context.with(_r.trace.setSpan(_r.context.active(),d),()=>e.apply(n,r));if(typeof _?.then=="function")_.then(f=>{this._endSpanWithResponse(d,a,c,f,void 0)},f=>{this._endSpanWithResponse(d,a,c,null,f)});else{let f=_;f[yd]=f[yd]||[],f[yd].push({span:d,commandName:a,commandArgs:c})}return _}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:l}=e[a],p=n[a],[d,_]=p instanceof Error?[null,p]:[p,void 0];this._semconvStability&xe.SemconvStability.STABLE&&c.setAttribute(KN.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],l,d,_)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:_r.SpanStatusCode.ERROR,message:s?.message})),e.end()}};TE.RedisInstrumentationV4_V5=QN});var pz=E(EE=>{"use strict";Object.defineProperty(EE,"__esModule",{value:!0});EE.RedisInstrumentation=void 0;var zge=ne(),uz=dE(),Kge=nz(),Qge=cz(),lz={requireParentSpan:!1},XN=class extends zge.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...lz,...e};super(uz.PACKAGE_NAME,uz.PACKAGE_VERSION,n),this.instrumentationV2_V3=new Kge.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new Qge.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...lz,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}};EE.RedisInstrumentation=XN});var dz=E(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE.RedisInstrumentation=void 0;var Xge=pz();Object.defineProperty(SE,"RedisInstrumentation",{enumerable:!0,get:function(){return Xge.RedisInstrumentation}})});var Rz=E(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.EVENT_LISTENERS_SET=void 0;AE.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var eb=E(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.AttributeNames=void 0;var oAe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(oAe=Nd.AttributeNames||(Nd.AttributeNames={}))});var tb=E(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=Se.METRIC_DB_CLIENT_CONNECTION_COUNT=Se.DB_SYSTEM_VALUE_POSTGRESQL=Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED=Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=Se.ATTR_NET_PEER_PORT=Se.ATTR_NET_PEER_NAME=Se.ATTR_DB_USER=Se.ATTR_DB_SYSTEM=Se.ATTR_DB_STATEMENT=Se.ATTR_DB_NAME=Se.ATTR_DB_CONNECTION_STRING=Se.ATTR_DB_CLIENT_CONNECTION_STATE=Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";Se.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";Se.ATTR_DB_CONNECTION_STRING="db.connection_string";Se.ATTR_DB_NAME="db.name";Se.ATTR_DB_STATEMENT="db.statement";Se.ATTR_DB_SYSTEM="db.system";Se.ATTR_DB_USER="db.user";Se.ATTR_NET_PEER_NAME="net.peer.name";Se.ATTR_NET_PEER_PORT="net.peer.port";Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";Se.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";Se.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var nb=E(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.SpanNames=void 0;var sAe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(sAe=bd.SpanNames||(bd.SpanNames={}))});var Pz=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.sanitizedErrorMessage=me.isObjectWithTextString=me.getErrorMessage=me.patchClientConnectCallback=me.patchCallbackPGPool=me.updateCounter=me.getPoolName=me.patchCallback=me.handleExecutionResult=me.handleConfigQuery=me.shouldSkipInstrumentation=me.getSemanticAttributesFromPoolConnection=me.getSemanticAttributesFromConnection=me.getConnectionString=me.parseAndMaskConnectionString=me.parseNormalizedOperationName=me.getQuerySpanName=void 0;var Zs=(b(),O(v)),RE=eb(),fr=(le(),O(Ae)),Ve=tb(),ga=ne(),yz=nb();function Iz(t,e){if(!e)return yz.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:Oz(e.text);return`${yz.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}me.getQuerySpanName=Iz;function Oz(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}me.parseNormalizedOperationName=Oz;function Nz(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}me.parseAndMaskConnectionString=Nz;function rb(t){if("connectionString"in t&&t.connectionString)return Nz(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}me.getConnectionString=rb;function yE(t){if(Number.isInteger(t))return t}function bz(t,e){let n={};return e&ga.SemconvStability.OLD&&(n={...n,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_DB_USER]:t.user,[Ve.ATTR_NET_PEER_NAME]:t.host,[Ve.ATTR_NET_PEER_PORT]:yE(t.port)}),e&ga.SemconvStability.STABLE&&(n={...n,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:t.host,[fr.ATTR_SERVER_PORT]:yE(t.port)}),n}me.getSemanticAttributesFromConnection=bz;function iAe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[RE.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[RE.AttributeNames.MAX_CLIENT]:t.maxClient};return e&ga.SemconvStability.OLD&&(r={...r,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Ve.ATTR_NET_PEER_PORT]:Number(n?.port)||yE(t.port),[Ve.ATTR_DB_USER]:n?.username??t.user}),e&ga.SemconvStability.STABLE&&(r={...r,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[fr.ATTR_SERVER_PORT]:Number(n?.port)||yE(t.port)}),r}me.getSemanticAttributesFromPoolConnection=iAe;function aAe(t){return t.requireParentSpan===!0&&Zs.trace.getSpan(Zs.context.active())===void 0}me.shouldSkipInstrumentation=aAe;function cAe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=Iz(s,r),a=t.startSpan(i,{kind:Zs.SpanKind.CLIENT,attributes:bz(o,n)});if(!r)return a;if(r.text&&(n&ga.SemconvStability.OLD&&a.setAttribute(Ve.ATTR_DB_STATEMENT,r.text),n&ga.SemconvStability.STABLE&&a.setAttribute(fr.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(l=>l==null?"null":l instanceof Buffer?l.toString():typeof l=="object"?typeof l.toPostgres=="function"?l.toPostgres():JSON.stringify(l):l.toString());a.setAttribute(RE.AttributeNames.PG_VALUES,c)}catch(c){Zs.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(RE.AttributeNames.PG_PLAN,r.name),a}me.handleConfigQuery=cAe;function Cz(t,e,n){typeof t.responseHook=="function"&&(0,ga.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&Zs.diag.error("Error running response hook",r)},!0)}me.handleExecutionResult=Cz;function uAe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[fr.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(IE(i)),e.setStatus({code:Zs.SpanStatusCode.ERROR,message:i.message})):Cz(t,e,a),o(),e.end(),n.call(this,i,a)}}me.patchCallback=uAe;function lAe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}me.getPoolName=lAe;function pAe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}me.updateCounter=pAe;function dAe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(IE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}me.patchCallbackPGPool=dAe;function _Ae(t,e){return function(r){r&&(r instanceof Error&&t.recordException(IE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}me.patchClientConnectCallback=_Ae;function fAe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}me.getErrorMessage=fAe;function mAe(t){return typeof t=="object"&&typeof t?.text=="string"}me.isObjectWithTextString=mAe;function IE(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}me.sanitizedErrorMessage=IE});var Mz=E(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.PACKAGE_NAME=Bu.PACKAGE_VERSION=void 0;Bu.PACKAGE_VERSION="0.66.0";Bu.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var wz=E(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.PgInstrumentation=void 0;var mn=ne(),Ie=(b(),O(v)),xz=Rz(),ke=Pz(),vz=jN(),Lz=Mz(),Dz=nb(),OE=Te(),wr=(le(),O(Ae)),Cd=tb();function ju(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var ob=class extends mn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(Lz.PACKAGE_NAME,Lz.PACKAGE_VERSION,e),this._semconvStability=(0,mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(wr.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ie.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(Cd.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"}),this._connectionPendingRequests=this.meter.createUpDownCounter(Cd.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new mn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new mn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new mn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=ju(a);return this._patchPgClient(c.Client),a},a=>{let c=ju(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new mn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=ju(a);return(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=ju(a);(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=ju(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=ju(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchClientConnectCallback(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}recordOperationDuration(e,n){let r={},o=[wr.ATTR_DB_NAMESPACE,wr.ATTR_ERROR_TYPE,wr.ATTR_SERVER_PORT,wr.ATTR_SERVER_ADDRESS,wr.ATTR_DB_OPERATION_NAME];this._semconvStability&mn.SemconvStability.OLD&&o.push(Cd.ATTR_DB_SYSTEM),this._semconvStability&mn.SemconvStability.STABLE&&o.push(wr.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,OE.hrTimeToMilliseconds)((0,OE.hrTimeDuration)(n,(0,OE.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ke.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,OE.hrTime)(),i=o[0],a=typeof i=="string",c=ke.isObjectWithTextString(i),l=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,p={[Cd.ATTR_DB_SYSTEM]:Cd.DB_SYSTEM_VALUE_POSTGRESQL,[wr.ATTR_DB_NAMESPACE]:this.database,[wr.ATTR_SERVER_PORT]:this.connectionParameters.port,[wr.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};l?.text&&(p[wr.ATTR_DB_OPERATION_NAME]=ke.parseNormalizedOperationName(l?.text));let d=()=>{e.recordOperationDuration(p,s)},_=e.getConfig(),f=ke.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,l);if(_.addSqlCommenterCommentToQueries&&(a?o[0]=(0,vz.addSqlCommenterComment)(f,i):c&&!("name"in i)&&(o[0]={...i,text:(0,vz.addSqlCommenterComment)(f,i.text)})),o.length>0){let T=Ie.trace.getSpan(Ie.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ke.patchCallback(_,f,o[o.length-1],p,d),T&&(o[o.length-1]=Ie.context.bind(Ie.context.active(),o[o.length-1]));else if(typeof l?.callback=="function"){let S=ke.patchCallback(e.getConfig(),f,l.callback,p,d);T&&(S=Ie.context.bind(Ie.context.active(),S)),o[0].callback=S}}let{requestHook:m}=_;typeof m=="function"&&l&&(0,mn.safeExecuteInTheMiddle)(()=>{let{database:T,host:S,port:R,user:I}=this.connectionParameters;m(f,{connection:{database:T,host:S,port:R,user:I},query:{text:l.text,values:l.values,name:l.name}})},T=>{T&&e._diag.error("Error running query hook",T)},!0);let h;try{h=n.apply(this,o)}catch(T){throw T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(T)}),f.end(),T}return h instanceof Promise?h.then(T=>new Promise(S=>{ke.handleExecutionResult(e.getConfig(),f,T),d(),f.end(),S(T)})).catch(T=>new Promise((S,R)=>{T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:T.message}),d(),f.end(),R(T)})):h})}_setPoolConnectEventListeners(e){if(e[xz.EVENT_LISTENERS_SET])return;let n=ke.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[xz.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.POOL_CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchCallbackPGPool(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}};NE.PgInstrumentation=ob;function Uz(t,e){if(!(e instanceof Promise))return e;let n=e;return Ie.context.bind(Ie.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ke.sanitizedErrorMessage(r)),t.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var kz=E(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.AttributeNames=Hu.PgInstrumentation=void 0;var hAe=wz();Object.defineProperty(Hu,"PgInstrumentation",{enumerable:!0,get:function(){return hAe.PgInstrumentation}});var TAe=eb();Object.defineProperty(Hu,"AttributeNames",{enumerable:!0,get:function(){return TAe.AttributeNames}})});var $z=E(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.SeverityNumber=void 0;var RAe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(RAe=Pd.SeverityNumber||(Pd.SeverityNumber={}))});var CE=E(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.NOOP_LOGGER=Fu.NoopLogger=void 0;var bE=class{emit(e){}};Fu.NoopLogger=bE;Fu.NOOP_LOGGER=new bE});var ME=E(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.NOOP_LOGGER_PROVIDER=Vu.NoopLoggerProvider=void 0;var yAe=CE(),PE=class{getLogger(e,n,r){return new yAe.NoopLogger}};Vu.NoopLoggerProvider=PE;Vu.NOOP_LOGGER_PROVIDER=new PE});var cb=E(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});xE.ProxyLogger=void 0;var IAe=CE(),ab=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):IAe.NOOP_LOGGER}};xE.ProxyLogger=ab});var lb=E(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE.ProxyLoggerProvider=void 0;var OAe=ME(),NAe=cb(),ub=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new NAe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:OAe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};vE.ProxyLoggerProvider=ub});var Yz=E(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE._globalThis=void 0;LE._globalThis=typeof globalThis=="object"?globalThis:global});var Wz=E(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE._globalThis=void 0;var bAe=Yz();Object.defineProperty(DE,"_globalThis",{enumerable:!0,get:function(){return bAe._globalThis}})});var zz=E(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE._globalThis=void 0;var CAe=Wz();Object.defineProperty(UE,"_globalThis",{enumerable:!0,get:function(){return CAe._globalThis}})});var Kz=E(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.API_BACKWARDS_COMPATIBILITY_VERSION=_o.makeGetter=_o._global=_o.GLOBAL_LOGS_API_KEY=void 0;var PAe=zz();_o.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");_o._global=PAe._globalThis;function MAe(t,e,n){return r=>r===t?e:n}_o.makeGetter=MAe;_o.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Xz=E(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.LogsAPI=void 0;var mr=Kz(),xAe=ME(),Qz=lb(),pb=class t{constructor(){this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return mr._global[mr.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(mr._global[mr.GLOBAL_LOGS_API_KEY]=(0,mr.makeGetter)(mr.API_BACKWARDS_COMPATIBILITY_VERSION,e,xAe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=mr._global[mr.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(mr._global,mr.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete mr._global[mr.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}};wE.LogsAPI=pb});var db=E(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.logs=Pt.ProxyLoggerProvider=Pt.ProxyLogger=Pt.NoopLoggerProvider=Pt.NOOP_LOGGER_PROVIDER=Pt.NoopLogger=Pt.NOOP_LOGGER=Pt.SeverityNumber=void 0;var vAe=$z();Object.defineProperty(Pt,"SeverityNumber",{enumerable:!0,get:function(){return vAe.SeverityNumber}});var Jz=CE();Object.defineProperty(Pt,"NOOP_LOGGER",{enumerable:!0,get:function(){return Jz.NOOP_LOGGER}});Object.defineProperty(Pt,"NoopLogger",{enumerable:!0,get:function(){return Jz.NoopLogger}});var Zz=ME();Object.defineProperty(Pt,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return Zz.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Pt,"NoopLoggerProvider",{enumerable:!0,get:function(){return Zz.NoopLoggerProvider}});var LAe=cb();Object.defineProperty(Pt,"ProxyLogger",{enumerable:!0,get:function(){return LAe.ProxyLogger}});var DAe=lb();Object.defineProperty(Pt,"ProxyLoggerProvider",{enumerable:!0,get:function(){return DAe.ProxyLoggerProvider}});var UAe=Xz();Pt.logs=UAe.LogsAPI.getInstance()});var eK=E(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.disableInstrumentations=qu.enableInstrumentations=void 0;function wAe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}qu.enableInstrumentations=wAe;function kAe(t){t.forEach(e=>e.disable())}qu.disableInstrumentations=kAe});var rK=E(kE=>{"use strict";Object.defineProperty(kE,"__esModule",{value:!0});kE.registerInstrumentations=void 0;var tK=(b(),O(v)),GAe=db(),nK=eK();function BAe(t){let e=t.tracerProvider||tK.trace.getTracerProvider(),n=t.meterProvider||tK.metrics.getMeterProvider(),r=t.loggerProvider||GAe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,nK.enableInstrumentations)(o,e,n,r),()=>{(0,nK.disableInstrumentations)(o)}}kE.registerInstrumentations=BAe});var dK=E(GE=>{"use strict";Object.defineProperty(GE,"__esModule",{value:!0});GE.satisfies=void 0;var hb=(b(),O(v)),cK=/^(?: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-]+)*))?$/,jAe=/^(?<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-]+)*))?$/,HAe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function FAe(t,e,n){if(!VAe(t))return hb.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=WAe(t);if(!r)return!1;let o=[],s=uK(r,e,o,n);return s&&!n?.includePrerelease?$Ae(r,o):s}GE.satisfies=FAe;function VAe(t){return typeof t=="string"&&cK.test(t)}function uK(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(_b(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=fRe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!_b(t,s,n,r))return!1;return!0}return _b(t,e,n,r)}function _b(t,e,n,r){if(e=YAe(e,r),e.includes(" "))return uK(t,e,n,r);{let o=zAe(e);return n.push(o),qAe(t,o)}}function qAe(t,e){if(e.invalid)return!1;if(!e.version||mb(e.version))return!0;let n=sK(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=sK(r,o)}return HAe[e.op]?.includes(n)}function $Ae(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function YAe(t,e){return t=t.trim(),t=dRe(t,e),t=pRe(t),t=_Re(t,e),t=t.trim(),t}function hn(t){return!t||t.toLowerCase()==="x"||t==="*"}function WAe(t){let e=t.match(cK);if(!e){hb.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function zAe(t){if(!t)return{};let e=t.match(jAe);if(!e)return hb.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function mb(t){return t==="*"||t==="x"||t==="X"}function oK(t){let e=parseInt(t,10);return isNaN(e)?t:e}function KAe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function QAe(t,e){if(mb(t)||mb(e))return 0;let[n,r]=KAe(oK(t),oK(e));return n>r?1:n<r?-1:0}function sK(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=QAe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var lK="[a-zA-Z0-9-]",pK="0|[1-9]\\d*",XAe=`\\d*[a-zA-Z-]${lK}*`,JAe="((?:<|>)?=?)",iK=`(?:${pK}|${XAe})`,ZAe=`(?:-(${iK}(?:\\.${iK})*))`,aK=`${lK}+`,eRe=`(?:\\+(${aK}(?:\\.${aK})*))`,fb=`${pK}|x|X|\\*`,Md=`[v=\\s]*(${fb})(?:\\.(${fb})(?:\\.(${fb})(?:${ZAe})?${eRe}?)?)?`,tRe=`^${JAe}\\s*${Md}$`,nRe=new RegExp(tRe),rRe=`^\\s*(${Md})\\s+-\\s+(${Md})\\s*$`,oRe=new RegExp(rRe),sRe="(?:~>?)",iRe=`^${sRe}${Md}$`,aRe=new RegExp(iRe),cRe="(?:\\^)",uRe=`^${cRe}${Md}$`,lRe=new RegExp(uRe);function pRe(t){let e=aRe;return t.replace(e,(n,r,o,s,i)=>{let a;return hn(r)?a="":hn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:hn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function dRe(t,e){let n=lRe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return hn(s)?l="":hn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:hn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function _Re(t,e){let n=nRe;return t.replace(n,(r,o,s,i,a,c)=>{let l=hn(s),p=l||hn(i),d=p||hn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function fRe(t,e){let n=oRe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(hn(s)?o="":hn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:hn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,hn(d)?p="":hn(_)?p=`<${+d+1}.0.0-0`:hn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var Tb=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.massUnwrap=Ht.unwrap=Ht.massWrap=Ht.wrap=void 0;var Tn=console.error.bind(console);function xd(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var mRe=(t,e,n)=>{if(!t||!t[e]){Tn("no original function "+String(e)+" to wrap");return}if(!n){Tn("no wrapper function"),Tn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Tn("original object and wrapper must be functions");return}let o=n(r,e);return xd(o,"__original",r),xd(o,"__unwrap",()=>{t[e]===o&&xd(t,e,r)}),xd(o,"__wrapped",!0),xd(t,e,o),o};Ht.wrap=mRe;var hRe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Ht.wrap)(r,o,n)})})};Ht.massWrap=hRe;var TRe=(t,e)=>{if(!t||!t[e]){Tn("no function to unwrap."),Tn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Tn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Ht.unwrap=TRe;var ERe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Ht.unwrap)(n,r)})})};Ht.massUnwrap=ERe;function vd(t){t&&t.logger&&(typeof t.logger!="function"?Tn("new logger isn't a function, not replacing"):Tn=t.logger)}Ht.default=vd;vd.wrap=Ht.wrap;vd.massWrap=Ht.massWrap;vd.unwrap=Ht.unwrap;vd.massUnwrap=Ht.massUnwrap});var _K=E(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.InstrumentationAbstract=void 0;var Eb=(b(),O(v)),SRe=db(),BE=Tb(),Sb=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=Eb.diag.createComponentLogger({namespace:e}),this._tracer=Eb.trace.getTracer(e,n),this._meter=Eb.metrics.getMeter(e,n),this._logger=SRe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=BE.wrap;_unwrap=BE.unwrap;_massWrap=BE.massWrap;_massUnwrap=BE.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};jE.InstrumentationAbstract=Sb});var fK=E(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ModuleNameTrie=ti.ModuleNameSeparator=void 0;ti.ModuleNameSeparator="/";var HE=class{hooks=[];children=new Map},gb=class{_trie=new HE;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ti.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new HE,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ti.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ti.ModuleNameTrie=gb});var hK=E(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0});FE.RequireInTheMiddleSingleton=void 0;var gRe=ki(),mK=U("path"),Ab=fK(),ARe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),Rb=class t{_moduleNameTrie=new Ab.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new gRe.Hook(null,{internals:!0},(e,n,r)=>{let o=RRe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return ARe?new t:this._instance=this._instance??new t}};FE.RequireInTheMiddleSingleton=Rb;function RRe(t){return mK.sep!==Ab.ModuleNameSeparator?t.split(mK.sep).join(Ab.ModuleNameSeparator):t}});var yb=E(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.isWrapped=ni.safeExecuteInTheMiddleAsync=ni.safeExecuteInTheMiddle=void 0;function yRe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddle=yRe;async function IRe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddleAsync=IRe;function ORe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ni.isWrapped=ORe});var SK=E(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.InstrumentationBase=void 0;var Ld=U("path"),TK=U("util"),NRe=dK(),Ib=Tb(),bRe=_K(),CRe=hK(),PRe=oN(),Dd=(b(),O(v)),MRe=ki(),xRe=U("fs"),vRe=yb(),Ob=class extends bRe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=CRe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,vRe.isWrapped)(e[n])&&this._unwrap(e,n),TK.types.isProxy(e)){let o=(0,Ib.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,Ib.wrap)(e,n,r)};_unwrap=(e,n)=>TK.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,Ib.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Dd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Dd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Dd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Dd.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,xRe.readFileSync)(Ld.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Dd.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return EK(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Ld.normalize(r);return i.filter(l=>l.name===a).filter(l=>EK(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Ld.isAbsolute(a)){let l=Ld.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Ld.isAbsolute(e.name)?new MRe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new PRe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};VE.InstrumentationBase=Ob;function EK(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,NRe.satisfies)(e,r,{includePrerelease:n}))}});var gK=E(qE=>{"use strict";Object.defineProperty(qE,"__esModule",{value:!0});qE.normalize=void 0;var LRe=U("path");Object.defineProperty(qE,"normalize",{enumerable:!0,get:function(){return LRe.normalize}})});var AK=E($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.normalize=$u.InstrumentationBase=void 0;var DRe=SK();Object.defineProperty($u,"InstrumentationBase",{enumerable:!0,get:function(){return DRe.InstrumentationBase}});var URe=gK();Object.defineProperty($u,"normalize",{enumerable:!0,get:function(){return URe.normalize}})});var Nb=E(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.normalize=Yu.InstrumentationBase=void 0;var RK=AK();Object.defineProperty(Yu,"InstrumentationBase",{enumerable:!0,get:function(){return RK.InstrumentationBase}});Object.defineProperty(Yu,"normalize",{enumerable:!0,get:function(){return RK.normalize}})});var yK=E($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.InstrumentationNodeModuleDefinition=void 0;var bb=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};$E.InstrumentationNodeModuleDefinition=bb});var IK=E(YE=>{"use strict";Object.defineProperty(YE,"__esModule",{value:!0});YE.InstrumentationNodeModuleFile=void 0;var wRe=Nb(),Cb=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,wRe.normalize)(e)}};YE.InstrumentationNodeModuleFile=Cb});var OK=E(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.semconvStabilityFromStr=Aa.SemconvStability=void 0;var WE;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(WE=Aa.SemconvStability||(Aa.SemconvStability={}));function kRe(t,e){let n=WE.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=WE.DUPLICATE;break}else o.toLowerCase()===t&&(n=WE.STABLE);return n}Aa.semconvStabilityFromStr=kRe});var bK=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.semconvStabilityFromStr=ut.SemconvStability=ut.safeExecuteInTheMiddleAsync=ut.safeExecuteInTheMiddle=ut.isWrapped=ut.InstrumentationNodeModuleFile=ut.InstrumentationNodeModuleDefinition=ut.InstrumentationBase=ut.registerInstrumentations=void 0;var GRe=rK();Object.defineProperty(ut,"registerInstrumentations",{enumerable:!0,get:function(){return GRe.registerInstrumentations}});var BRe=Nb();Object.defineProperty(ut,"InstrumentationBase",{enumerable:!0,get:function(){return BRe.InstrumentationBase}});var jRe=yK();Object.defineProperty(ut,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return jRe.InstrumentationNodeModuleDefinition}});var HRe=IK();Object.defineProperty(ut,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return HRe.InstrumentationNodeModuleFile}});var Pb=yb();Object.defineProperty(ut,"isWrapped",{enumerable:!0,get:function(){return Pb.isWrapped}});Object.defineProperty(ut,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddle}});Object.defineProperty(ut,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddleAsync}});var NK=OK();Object.defineProperty(ut,"SemconvStability",{enumerable:!0,get:function(){return NK.SemconvStability}});Object.defineProperty(ut,"semconvStabilityFromStr",{enumerable:!0,get:function(){return NK.semconvStabilityFromStr}})});var kK=E(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.PACKAGE_NAME=zu.PACKAGE_VERSION=void 0;zu.PACKAGE_VERSION="0.60.0";zu.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Lb=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HapiLifecycleMethodNames=fo.HapiLayerType=fo.handlerPatched=fo.HapiComponentName=void 0;fo.HapiComponentName="@hapi/hapi";fo.handlerPatched=Symbol("hapi-handler-patched");fo.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};fo.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var GK=E(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.ATTR_HTTP_METHOD=void 0;KE.ATTR_HTTP_METHOD="http.method"});var Db=E(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});Ud.AttributeNames=void 0;var rye;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(rye=Ud.AttributeNames||(Ud.AttributeNames={}))});var HK=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getPluginFromInput=lt.getExtMetadata=lt.getRouteMetadata=lt.isPatchableExtMethod=lt.isDirectExtInput=lt.isLifecycleExtEventObj=lt.isLifecycleExtType=lt.getPluginName=void 0;var BK=(le(),O(Ae)),oye=GK(),wd=Lb(),ri=Db(),jK=ne();function sye(t){return t.name?t.name:t.pkg.name}lt.getPluginName=sye;var iye=t=>typeof t=="string"&&wd.HapiLifecycleMethodNames.has(t);lt.isLifecycleExtType=iye;var aye=t=>{let e=t?.type;return e!==void 0&&(0,lt.isLifecycleExtType)(e)};lt.isLifecycleExtEventObj=aye;var cye=t=>Array.isArray(t)&&t.length<=3&&(0,lt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";lt.isDirectExtInput=cye;var uye=t=>!Array.isArray(t);lt.isPatchableExtMethod=uye;var lye=(t,e,n)=>{let r={[BK.ATTR_HTTP_ROUTE]:t.path};e&jK.SemconvStability.OLD&&(r[oye.ATTR_HTTP_METHOD]=t.method),e&jK.SemconvStability.STABLE&&(r[BK.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ri.AttributeNames.HAPI_TYPE]=wd.HapiLayerType.PLUGIN,r[ri.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ri.AttributeNames.HAPI_TYPE]=wd.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};lt.getRouteMetadata=lye;var pye=(t,e,n)=>{let r=`ext - ${t}`;return n&&n!=="method"&&(r=`ext - ${t} - ${n}`),e?{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:wd.HapiLayerType.EXT,[ri.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ${r}`}:{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:wd.HapiLayerType.EXT},name:r}};lt.getExtMetadata=pye;var dye=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;lt.getPluginFromInput=dye});var qK=E(QE=>{"use strict";Object.defineProperty(QE,"__esModule",{value:!0});QE.HapiInstrumentation=void 0;var Wn=(b(),O(v)),FK=Te(),kd=ne(),VK=kK(),Gd=Lb(),Qo=HK(),Ub=class extends kd.InstrumentationBase{_semconvStability;constructor(e={}){super(VK.PACKAGE_NAME,VK.PACKAGE_VERSION,e),this._semconvStability=(0,kd.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new kd.InstrumentationNodeModuleDefinition(Gd.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,kd.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,kd.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,Qo.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Qo.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,Qo.isLifecycleExtType)(c.type)){let l=c,p=r._wrapExtMethods(l.method,c.type,n);l.method=p,i[a]=l}}return e.apply(this,s)}else if((0,Qo.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,Qo.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,Qo.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),s._wrap(a,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,Qo.isPatchableExtMethod)(e))return e[Gd.handlerPatched]===!0?e:(e[Gd.handlerPatched]=!0,async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await e.apply(this,i);let a=(0,Qo.getExtMetadata)(n,r,e.name),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),c),e,void 0,...i)}catch(l){throw c.recordException(l),c.setStatus({code:Wn.SpanStatusCode.ERROR,message:l.message}),l}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[Gd.handlerPatched]===!0)return e;e[Gd.handlerPatched]=!0;let o=s=>async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await s.call(this,...i);let a=(0,FK.getRPCMetadata)(Wn.context.active());a?.type===FK.RPCType.HTTP&&(a.route=e.path);let c=(0,Qo.getRouteMetadata)(e,r._semconvStability,n),l=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),l),()=>s.call(this,...i))}catch(p){throw l.recordException(p),l.setStatus({code:Wn.SpanStatusCode.ERROR,message:p.message}),p}finally{l.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};QE.HapiInstrumentation=Ub});var $K=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AttributeNames=Ku.HapiInstrumentation=void 0;var _ye=qK();Object.defineProperty(Ku,"HapiInstrumentation",{enumerable:!0,get:function(){return _ye.HapiInstrumentation}});var fye=Db();Object.defineProperty(Ku,"AttributeNames",{enumerable:!0,get:function(){return fye.AttributeNames}})});var ZE=E(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.KoaLayerType=void 0;var gye;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(gye=jd.KoaLayerType||(jd.KoaLayerType={}))});var ZK=E(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.PACKAGE_NAME=Qu.PACKAGE_VERSION=void 0;Qu.PACKAGE_VERSION="0.62.0";Qu.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var wb=E(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.AttributeNames=void 0;var Aye;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(Aye=Hd.AttributeNames||(Hd.AttributeNames={}))});var t2=E(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.isLayerIgnored=Xu.getMiddlewareMetadata=void 0;var e2=ZE(),eS=wb(),Rye=(le(),O(Ae)),yye=(t,e,n,r)=>n?{attributes:{[eS.AttributeNames.KOA_NAME]:r?.toString(),[eS.AttributeNames.KOA_TYPE]:e2.KoaLayerType.ROUTER,[Rye.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[eS.AttributeNames.KOA_NAME]:e.name??"middleware",[eS.AttributeNames.KOA_TYPE]:e2.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Xu.getMiddlewareMetadata=yye;var Iye=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Xu.isLayerIgnored=Iye});var n2=E(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});tS.kLayerPatched=void 0;tS.kLayerPatched=Symbol("koa-layer-patched")});var c2=E(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});nS.KoaInstrumentation=void 0;var mo=(b(),O(v)),Fd=ne(),r2=ZE(),o2=ZK(),s2=t2(),i2=Te(),a2=n2(),kb=class extends Fd.InstrumentationBase{constructor(e={}){super(o2.PACKAGE_NAME,o2.PACKAGE_VERSION,e)}init(){return new Fd.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Fd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,Fd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){mo.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?r2.KoaLayerType.ROUTER:r2.KoaLayerType.MIDDLEWARE;return e[a2.kLayerPatched]===!0||(0,s2.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(mo.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[a2.kLayerPatched]=!0,mo.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(mo.trace.getSpan(mo.context.active())===void 0)return e(s,i);let c=(0,s2.getMiddlewareMetadata)(s,e,n,r),l=this.tracer.startSpan(c.name,{attributes:c.attributes}),p=(0,i2.getRPCMetadata)(mo.context.active());p?.type===i2.RPCType.HTTP&&s._matchedRoute&&(p.route=s._matchedRoute.toString());let{requestHook:d}=this.getConfig();d&&(0,Fd.safeExecuteInTheMiddle)(()=>d(l,{context:s,middlewareLayer:e,layerType:o}),f=>{f&&mo.diag.error("koa instrumentation: request hook failed",f)},!0);let _=mo.trace.setSpan(mo.context.active(),l);return mo.context.with(_,async()=>{try{return await e(s,i)}catch(f){throw l.recordException(f),f}finally{l.end()}})})}};nS.KoaInstrumentation=kb});var u2=E(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.KoaLayerType=si.AttributeNames=si.KoaInstrumentation=void 0;var Oye=c2();Object.defineProperty(si,"KoaInstrumentation",{enumerable:!0,get:function(){return Oye.KoaInstrumentation}});var Nye=wb();Object.defineProperty(si,"AttributeNames",{enumerable:!0,get:function(){return Nye.AttributeNames}});var bye=ZE();Object.defineProperty(si,"KoaLayerType",{enumerable:!0,get:function(){return bye.KoaLayerType}})});var Gb=E(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.ConnectNames=kr.ConnectTypes=kr.AttributeNames=void 0;var Pye;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(Pye=kr.AttributeNames||(kr.AttributeNames={}));var Mye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Mye=kr.ConnectTypes||(kr.ConnectTypes={}));var xye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(xye=kr.ConnectNames||(kr.ConnectNames={}))});var f2=E(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.PACKAGE_NAME=Ju.PACKAGE_VERSION=void 0;Ju.PACKAGE_VERSION="0.57.0";Ju.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var m2=E(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});rS._LAYERS_STORE_PROPERTY=void 0;rS._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var h2=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.generateRoute=ai.replaceCurrentStackRoute=ai.addNewStackLayer=void 0;var vye=(b(),O(v)),ii=m2(),Lye=t=>{Array.isArray(t[ii._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ii._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ii._LAYERS_STORE_PROPERTY].push("/");let e=t[ii._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ii._LAYERS_STORE_PROPERTY].length?t[ii._LAYERS_STORE_PROPERTY].pop():vye.diag.warn("Connect: Trying to pop the stack multiple time")}};ai.addNewStackLayer=Lye;var Dye=(t,e)=>{e&&t[ii._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ai.replaceCurrentStackRoute=Dye;var Uye=t=>t[ii._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ai.generateRoute=Uye});var S2=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.ConnectInstrumentation=ci.ANONYMOUS_NAME=void 0;var wye=(b(),O(v)),T2=Te(),Zu=Gb(),E2=f2(),oS=ne(),kye=(le(),O(Ae)),Bb=h2();ci.ANONYMOUS_NAME="anonymous";var jb=class extends oS.InstrumentationBase{constructor(e={}){super(E2.PACKAGE_NAME,E2.PACKAGE_VERSION,e)}init(){return[new oS.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,oS.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,oS.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=Zu.ConnectTypes.REQUEST_HANDLER,s=Zu.ConnectNames.REQUEST_HANDLER,o=e):(r=Zu.ConnectTypes.MIDDLEWARE,s=Zu.ConnectNames.MIDDLEWARE,o=n.name||ci.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[kye.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[Zu.AttributeNames.CONNECT_TYPE]:r,[Zu.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],l=arguments[i],p=arguments[a],d=arguments[c];(0,Bb.replaceCurrentStackRoute)(l,e);let _=(0,T2.getRPCMetadata)(wye.context.active());e&&_?.type===T2.RPCType.HTTP&&(_.route=(0,Bb.generateRoute)(l));let f="";e?f=`request handler - ${e}`:f=`middleware - ${n.name||ci.ANONYMOUS_NAME}`;let m=r._startSpan(e,n);r._diag.debug("start span",f);let h=!1;function T(){h?r._diag.debug(`span ${m.name} - already finished`):(h=!0,r._diag.debug(`finishing span ${m.name}`),m.end()),p.removeListener("close",T)}return p.addListener("close",T),arguments[c]=r._patchNext(d,T),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,Bb.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ci.ConnectInstrumentation=jb});var A2=E(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.ConnectTypes=hr.ConnectNames=hr.AttributeNames=hr.ANONYMOUS_NAME=hr.ConnectInstrumentation=void 0;var g2=S2();Object.defineProperty(hr,"ConnectInstrumentation",{enumerable:!0,get:function(){return g2.ConnectInstrumentation}});Object.defineProperty(hr,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return g2.ANONYMOUS_NAME}});var Hb=Gb();Object.defineProperty(hr,"AttributeNames",{enumerable:!0,get:function(){return Hb.AttributeNames}});Object.defineProperty(hr,"ConnectNames",{enumerable:!0,get:function(){return Hb.ConnectNames}});Object.defineProperty(hr,"ConnectTypes",{enumerable:!0,get:function(){return Hb.ConnectTypes}})});var N2=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DB_SYSTEM_VALUE_MSSQL=Mt.ATTR_NET_PEER_PORT=Mt.ATTR_NET_PEER_NAME=Mt.ATTR_DB_USER=Mt.ATTR_DB_SYSTEM=Mt.ATTR_DB_STATEMENT=Mt.ATTR_DB_SQL_TABLE=Mt.ATTR_DB_NAME=void 0;Mt.ATTR_DB_NAME="db.name";Mt.ATTR_DB_SQL_TABLE="db.sql.table";Mt.ATTR_DB_STATEMENT="db.statement";Mt.ATTR_DB_SYSTEM="db.system";Mt.ATTR_DB_USER="db.user";Mt.ATTR_NET_PEER_NAME="net.peer.name";Mt.ATTR_NET_PEER_PORT="net.peer.port";Mt.DB_SYSTEM_VALUE_MSSQL="mssql"});var b2=E(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.once=el.getSpanName=void 0;function Bye(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}el.getSpanName=Bye;var jye=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};el.once=jye});var C2=E(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.PACKAGE_NAME=tl.PACKAGE_VERSION=void 0;tl.PACKAGE_VERSION="0.33.0";tl.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var L2=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.TediousInstrumentation=li.INJECTED_CTX=void 0;var nl=(b(),O(v)),Hye=U("events"),ho=ne(),Ra=(le(),O(Ae)),ui=N2(),P2=b2(),M2=C2(),v2=Symbol("opentelemetry.instrumentation-tedious.current-database");li.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var x2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function sS(t){Object.defineProperty(this,v2,{value:t,writable:!0})}var Fb=class t extends ho.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(M2.PACKAGE_NAME,M2.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ho.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ho.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new ho.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of x2)(0,ho.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,ho.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of x2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return sS.call(this,this.config?.options?.database),this.removeListener("databaseChange",sS),this.on("databaseChange",sS),this.once("end",()=>{this.removeListener("databaseChange",sS)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||nl.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,li.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[li.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof Hye.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,l=()=>c++,p=()=>a++,d=this[v2],_=(x=>x.sqlTextOrProcedure==="sp_prepare"&&x.parametersByName?.stmt?.value?x.parametersByName.stmt.value:x.sqlTextOrProcedure)(i),f={};o._dbSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_DB_SYSTEM]=ui.DB_SYSTEM_VALUE_MSSQL,f[ui.ATTR_DB_NAME]=d,f[ui.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,f[ui.ATTR_DB_STATEMENT]=_,f[ui.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&ho.SemconvStability.STABLE&&(f[Ra.ATTR_DB_NAMESPACE]=d,f[Ra.ATTR_DB_SYSTEM_NAME]=Ra.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,f[Ra.ATTR_DB_QUERY_TEXT]=_,f[Ra.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_NET_PEER_NAME]=this.config?.server,f[ui.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&ho.SemconvStability.STABLE&&(f[Ra.ATTR_SERVER_ADDRESS]=this.config?.server,f[Ra.ATTR_SERVER_PORT]=this.config?.options?.port);let m=o.tracer.startSpan((0,P2.getSpanName)(e,d,_,i.table),{kind:nl.SpanKind.CLIENT,attributes:f}),h=(0,P2.once)(x=>{i.removeListener("done",l),i.removeListener("doneInProc",l),i.removeListener("doneProc",p),i.removeListener("error",h),this.removeListener("end",h),m.setAttribute("tedious.procedure_count",a),m.setAttribute("tedious.statement_count",c),x&&m.setStatus({code:nl.SpanStatusCode.ERROR,message:x.message}),m.end()});i.on("done",l),i.on("doneInProc",l),i.on("doneProc",p),i.once("error",h),this.on("end",h),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(h)):o._diag.error("Expected request.callback to be a function");let T=()=>nl.context.with(nl.trace.setSpan(nl.context.active(),m),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return T();let I=o._buildTraceparent(m);o._injectContextInfo(this,n,I).finally(T)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};li.TediousInstrumentation=Fb});var D2=E(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});iS.TediousInstrumentation=void 0;var Fye=L2();Object.defineProperty(iS,"TediousInstrumentation",{enumerable:!0,get:function(){return Fye.TediousInstrumentation}})});var B2=E(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.PACKAGE_NAME=rl.PACKAGE_VERSION=void 0;rl.PACKAGE_VERSION="0.57.0";rl.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var H2=E(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.GenericPoolInstrumentation=void 0;var ol=(b(),O(v)),ya=ne(),j2=B2(),Vb="generic-pool",qb=class extends ya.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(j2.PACKAGE_NAME,j2.PACKAGE_VERSION,e)}init(){return[new ya.InstrumentationNodeModuleDefinition(Vb,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,ya.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new ya.InstrumentationNodeModuleDefinition(Vb,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,ya.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new ya.InstrumentationNodeModuleDefinition(Vb,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,ya.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=ol.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return ol.context.with(ol.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=ol.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return ol.context.with(ol.trace.setSpan(i,a),()=>{e.call(this,(c,l)=>{if(a.end(),o)return o(c,l)},s)})}}};aS.GenericPoolInstrumentation=qb});var F2=E(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.GenericPoolInstrumentation=void 0;var $ye=H2();Object.defineProperty(cS,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return $ye.GenericPoolInstrumentation}})});var $b=E(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.ATTR_NET_PEER_PORT=To.ATTR_NET_PEER_NAME=To.ATTR_MESSAGING_SYSTEM=To.ATTR_MESSAGING_OPERATION=void 0;To.ATTR_MESSAGING_OPERATION="messaging.operation";To.ATTR_MESSAGING_SYSTEM="messaging.system";To.ATTR_NET_PEER_NAME="net.peer.name";To.ATTR_NET_PEER_PORT="net.peer.port"});var Yb=E(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ATTR_MESSAGING_CONVERSATION_ID=qe.OLD_ATTR_MESSAGING_MESSAGE_ID=qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=qe.ATTR_MESSAGING_URL=qe.ATTR_MESSAGING_PROTOCOL_VERSION=qe.ATTR_MESSAGING_PROTOCOL=qe.MESSAGING_OPERATION_VALUE_PROCESS=qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=qe.ATTR_MESSAGING_DESTINATION_KIND=qe.ATTR_MESSAGING_DESTINATION=void 0;qe.ATTR_MESSAGING_DESTINATION="messaging.destination";qe.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";qe.MESSAGING_OPERATION_VALUE_PROCESS="process";qe.ATTR_MESSAGING_PROTOCOL="messaging.protocol";qe.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";qe.ATTR_MESSAGING_URL="messaging.url";qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";qe.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";qe.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var Wb=E(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.DEFAULT_CONFIG=Ia.EndOperation=void 0;var Wye;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(Wye=Ia.EndOperation||(Ia.EndOperation={}));Ia.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var Q2=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.isConfirmChannelTracing=$e.unmarkConfirmChannelTracing=$e.markConfirmChannelTracing=$e.getConnectionAttributesFromUrl=$e.getConnectionAttributesFromServer=$e.normalizeExchange=$e.CONNECTION_ATTRIBUTES=$e.CHANNEL_CONSUME_TIMEOUT_TIMER=$e.CHANNEL_SPANS_NOT_ENDED=$e.MESSAGE_STORED_SPAN=void 0;var zb=(b(),O(v)),pi=ne(),uS=(le(),O(Ae)),Vd=$b(),lS=Yb();$e.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");$e.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");$e.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");$e.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var Kb=(0,zb.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),zye=t=>t!==""?t:"<default>";$e.normalizeExchange=zye;var Kye=t=>t.replace(/:[^:@/]*@/,":***@"),W2=(t,e)=>t||(e==="AMQP"?5672:5671),z2=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},K2=t=>t||"localhost",Eo=(t,e,n,r)=>n?{[e]:n}:(zb.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),Qye=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Vd.ATTR_MESSAGING_SYSTEM]:e}:{}};$e.getConnectionAttributesFromServer=Qye;var Xye=(t,e)=>{let n={[lS.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=z2(r?.protocol);Object.assign(n,{...Eo(t,lS.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=K2(r?.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(t,Vd.ATTR_NET_PEER_NAME,s,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(t,uS.ATTR_SERVER_ADDRESS,s,"hostname")});let i=W2(r.port,o);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(t,Vd.ATTR_NET_PEER_PORT,i,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(t,uS.ATTR_SERVER_PORT,i,"port"))}else{let r=Kye(t);n[lS.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=z2(o.protocol);Object.assign(n,{...Eo(r,lS.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=K2(o.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(r,Vd.ATTR_NET_PEER_NAME,i,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(r,uS.ATTR_SERVER_ADDRESS,i,"hostname")});let a=W2(o.port?parseInt(o.port):void 0,s);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(r,Vd.ATTR_NET_PEER_PORT,a,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(r,uS.ATTR_SERVER_PORT,a,"port"))}catch(o){zb.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};$e.getConnectionAttributesFromUrl=Xye;var Jye=t=>t.setValue(Kb,!0);$e.markConfirmChannelTracing=Jye;var Zye=t=>t.deleteValue(Kb);$e.unmarkConfirmChannelTracing=Zye;var eIe=t=>t.getValue(Kb)===!0;$e.isConfirmChannelTracing=eIe});var X2=E(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.PACKAGE_NAME=sl.PACKAGE_VERSION=void 0;sl.PACKAGE_VERSION="0.61.0";sl.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Z2=E(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});_S.AmqplibInstrumentation=void 0;var Ge=(b(),O(v)),pS=Te(),Ee=ne(),tIe=$b(),zn=Yb(),En=Wb(),Ye=Q2(),J2=X2(),dS=[">=0.5.5 <1"],Qb=class extends Ee.InstrumentationBase{_netSemconvStability;constructor(e={}){super(J2.PACKAGE_NAME,J2.PACKAGE_VERSION,{...En.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ee.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...En.DEFAULT_CONFIG,...e})}init(){let e=new Ee.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",dS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ee.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",dS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ee.InstrumentationNodeModuleFile("amqplib/lib/connect.js",dS,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Ee.InstrumentationNodeModuleDefinition("amqplib",dS,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Ee.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Ee.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Ee.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,En.EndOperation.Ack)),(0,Ee.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,En.EndOperation.Nack)),(0,Ee.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,En.EndOperation.Reject)),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,En.EndOperation.AckAll)),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,En.EndOperation.NackAll)),(0,Ee.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Ee.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Ee.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Ee.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Ee.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Ee.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Ee.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let l=(0,Ye.getConnectionAttributesFromUrl)(o,n._netSemconvStability),p=(0,Ye.getConnectionAttributesFromServer)(c);c[Ye.CONNECTION_ATTRIBUTES]={...l,...p}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelClosed,void 0);let s=this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let l=this,p=n===En.EndOperation.Reject?a:c,d=l[Ye.CHANNEL_SPANS_NOT_ENDED]??[],_=d.findIndex(f=>f.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==En.EndOperation.Reject&&a){for(let f=0;f<=_;f++)o.endConsumerSpan(d[f].msg,e,n,p);d.splice(0,_+1)}else o.endConsumerSpan(i,e,n,p),d.splice(_,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,Ye.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:p}=r.getConfig();if(p){let d=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},p);d.unref(),c[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=d}c[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}let l=function(p){if(!p)return i.call(this,p);let d=p.properties.headers??{},_=Ge.propagation.extract(Ge.ROOT_CONTEXT,d),f=p.fields?.exchange,m;if(r._config.useLinksForConsume){let R=_?Ge.trace.getSpan(_)?.spanContext():void 0;_=void 0,R&&(m=[{context:R}])}let h=r.tracer.startSpan(`${s} process`,{kind:Ge.SpanKind.CONSUMER,attributes:{...c?.connection?.[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:f,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p.fields?.routingKey,[tIe.ATTR_MESSAGING_OPERATION]:zn.MESSAGING_OPERATION_VALUE_PROCESS,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:p?.properties.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:p?.properties.correlationId},links:m},_),{consumeHook:T}=r.getConfig();T&&(0,Ee.safeExecuteInTheMiddle)(()=>T(h,{moduleVersion:e,msg:p}),R=>{R&&Ge.diag.error("amqplib instrumentation: consumerHook error",R)},!0),a?.noAck||(c[Ye.CHANNEL_SPANS_NOT_ENDED].push({msg:p,timeOfConsume:(0,pS.hrTime)()}),p[Ye.MESSAGE_STORED_SPAN]=h);let S=_||Ge.ROOT_CONTEXT;Ge.context.with(Ge.trace.setSpan(S,h),()=>{i.call(this,p)}),a?.noAck&&(r.callConsumeEndHook(h,p,!1,En.EndOperation.AutoAck),h.end())};return arguments[1]=l,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,l){let p=this,{span:d,modifiedOptions:_}=r.createPublishSpan(r,s,i,p,c),{publishHook:f}=r.getConfig();f&&(0,Ee.safeExecuteInTheMiddle)(()=>f(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!0}),S=>{S&&Ge.diag.error("amqplib instrumentation: publishHook error",S)},!0);let m=function(S,R){try{l?.call(this,S,R)}finally{let{publishConfirmHook:I}=r.getConfig();I&&(0,Ee.safeExecuteInTheMiddle)(()=>I(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:S}),x=>{x&&Ge.diag.error("amqplib instrumentation: publishConfirmHook error",x)},!0),S&&d.setStatus({code:Ge.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),d.end()}},h=(0,Ye.markConfirmChannelTracing)(Ge.context.active()),T=[...arguments];return T[3]=_,T[4]=Ge.context.bind((0,Ye.unmarkConfirmChannelTracing)(Ge.trace.setSpan(h,d)),m),Ge.context.with(h,n.bind(this,...T))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,Ye.isConfirmChannelTracing)(Ge.context.active()))return n.apply(this,arguments);{let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,Ee.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!1}),h=>{h&&Ge.diag.error("amqplib instrumentation: publishHook error",h)},!0);let f=[...arguments];f[3]=d;let m=n.apply(this,f);return p.end(),m}}}createPublishSpan(e,n,r,o,s){let i=(0,Ye.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:Ge.SpanKind.PRODUCER,attributes:{...o.connection[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:n,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},Ge.propagation.inject(Ge.trace.setSpan(Ge.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[Ye.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Ge.SpanStatusCode.ERROR,message:r!==En.EndOperation.ChannelClosed&&r!==En.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[Ye.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[Ye.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Ee.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Ge.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,pS.hrTime)(),r=e[Ye.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,pS.hrTimeDuration)(i.timeOfConsume,n);if((0,pS.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,En.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};_S.AmqplibInstrumentation=Qb});var t4=E(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.EndOperation=di.DEFAULT_CONFIG=di.AmqplibInstrumentation=void 0;var nIe=Z2();Object.defineProperty(di,"AmqplibInstrumentation",{enumerable:!0,get:function(){return nIe.AmqplibInstrumentation}});var e4=Wb();Object.defineProperty(di,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return e4.DEFAULT_CONFIG}});Object.defineProperty(di,"EndOperation",{enumerable:!0,get:function(){return e4.EndOperation}})});b();var tq=K(OG(),1);var C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var J=globalThis;var pe="10.47.0";function cn(){return fs(J),J}function fs(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pe,e[pe]=e[pe]||{}}function Ir(t,e,n=J){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[pe]=r[pe]||{};return o[t]||(o[t]=e())}var ql=["debug","info","warn","error","log","assert","trace"],nae="Sentry Logger ",Tc={};function Qe(t){if(!("console"in J))return t();let e=J.console,n={},r=Object.keys(Tc);r.forEach(o=>{let s=Tc[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function rae(){AR().enabled=!0}function oae(){AR().enabled=!1}function NG(){return AR().enabled}function sae(...t){gR("log",...t)}function iae(...t){gR("warn",...t)}function aae(...t){gR("error",...t)}function gR(t,...e){C&&NG()&&Qe(()=>{J.console[t](`${nae}[${t}]:`,...e)})}function AR(){return C?Ir("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:rae,disable:oae,isEnabled:NG,log:sae,warn:iae,error:aae};var xf="?",bG=/\(error: (.*)\)/,CG=/captureMessage|captureException/;function vf(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
|
|
13
|
+
`);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let l=bG.test(c)?c.replace(bG,"$1"):c;if(!l.match(/\S*Error: /)){for(let p of e){let d=p(l);if(d){s.push(d);break}}if(s.length>=50+o)break}}return PG(s.slice(o))}}function yR(t){return Array.isArray(t)?vf(...t):t}function PG(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(Mf(e).function||"")&&e.pop(),e.reverse(),CG.test(Mf(e).function||"")&&(e.pop(),CG.test(Mf(e).function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||Mf(e).filename,function:n.function||xf}))}function Mf(t){return t[t.length-1]||{}}var RR="<anonymous>";function $l(t){try{return!t||typeof t!="function"?RR:t.name||RR}catch{return RR}}function Lf(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function MG(t){let e=t?.startsWith("file://")?t.slice(7):t;return e?.match(/\/[A-Z]:/)&&(e=e.slice(1)),e}var Df={},xG={};function Ec(t,e){Df[t]=Df[t]||[],Df[t].push(e)}function Sc(t,e){if(!xG[t]){xG[t]=!0;try{e()}catch(n){C&&g.error(`Error while instrumenting ${t}`,n)}}}function gc(t,e){let n=t&&Df[t];if(n)for(let r of n)try{r(e)}catch(o){C&&g.error(`Error while triggering instrumentation handler.
|
|
14
14
|
Type: ${t}
|
|
15
|
-
Name: ${
|
|
16
|
-
Error:`,o)}}var IR=null;function vG(t){let e="error";Tc(e,t),Ec(e,aae)}function aae(){IR=J.onerror,J.onerror=function(t,e,n,r,o){return Sc("error",{column:r,error:o,line:n,msg:t,url:e}),IR?IR.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}var OR=null;function LG(t){let e="unhandledrejection";Tc(e,t),Ec(e,cae)}function cae(){OR=J.onunhandledrejection,J.onunhandledrejection=function(t){return Sc("unhandledrejection",t),OR?OR.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var DG=Object.prototype.toString;function Kr(t){switch(DG.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Qr(t,Error)}}function Df(t,e){return DG.call(t)===`[object ${e}]`}function NR(t){return Df(t,"ErrorEvent")}function ms(t){return Df(t,"String")}function gc(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function $l(t){return t===null||gc(t)||typeof t!="object"&&typeof t!="function"}function Mo(t){return Df(t,"Object")}function bR(t){return typeof Event<"u"&&Qr(t,Event)}function CR(t){return typeof Element<"u"&&Qr(t,Element)}function PR(t){return Df(t,"RegExp")}function Lt(t){return!!(t?.then&&typeof t.then=="function")}function MR(t){return Mo(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Qr(t,e){try{return t instanceof e}catch{return!1}}function Yl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}var uae=J,lae=80;function UG(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,l,p=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||lae;for(;n&&s++<r&&(l=pae(n,p),!(l==="html"||s>1&&i+o.length*c+l.length>=d));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function pae(t,e){let n=t,r=[];if(!n?.tagName)return"";if(uae.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let o=e?.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let s=n.className;if(s&&ms(s)){let i=s.split(/\s+/);for(let a of i)r.push(`.${a}`)}}for(let s of["aria-label","type","name","title","alt"]){let i=n.getAttribute(s);i&&r.push(`[${s}="${i}"]`)}return r.join("")}function xR(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&GG(o,r);try{t[e]=o}catch{C&&g.log(`Failed to replace method "${e}" in object`,t)}}function nt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{C&&g.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function GG(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,nt(t,"__sentry_original__",e)}catch{}}function vR(t){return t.__sentry_original__}function Uf(t){if(Kr(t))return{message:t.message,name:t.name,stack:t.stack,...kG(t)};if(bR(t)){let e={type:t.type,target:wG(t.target),currentTarget:wG(t.currentTarget),...kG(t)};return typeof CustomEvent<"u"&&Qr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function wG(t){try{return CR(t)?UG(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function kG(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function LR(t){let e=Object.keys(Uf(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var Ac;function Gi(t){if(Ac!==void 0)return Ac?Ac(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Ac=n[e],Ac(t)):(Ac=null,t())}function yt(){return Gi(()=>Math.random())}function Zn(){return Gi(()=>Date.now())}function hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function DR(t,e){let n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function UR(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{Yl(o)?n.push(vf(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function xo(t,e,n=!1){return ms(t)?PR(e)?e.test(t):ms(e)?n?t===e:t.includes(e):!1:!1}function Ts(t,e=[],n=!1){return e.some(r=>xo(t,r,n))}function dae(){let t=J;return t.crypto||t.msCrypto}var wR;function _ae(){return yt()*16}function _t(t=dae()){try{if(t?.randomUUID)return Gi(()=>t.randomUUID()).replace(/-/g,"")}catch{}return wR||(wR="10000000100040008000"+1e11),wR.replace(/[018]/g,e=>(e^(_ae()&15)>>e/4).toString(16))}function BG(t){return t.exception?.values?.[0]}function Es(t){let{message:e,event_id:n}=t;if(e)return e;let r=BG(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function GR(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function Rc(t,e){let n=BG(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o?.data,...e.data};n.mechanism.data=s}}var fae=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function kR(t){return parseInt(t||"",10)}function BR(t){let e=t.match(fae)||[],n=kR(e[1]),r=kR(e[2]),o=kR(e[3]);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:e[4]}}function wf(t){if(jG(t))return!0;try{nt(t,"__sentry_captured__",!0)}catch{}return!1}function jG(t){try{return t.__sentry_captured__}catch{}}var FG=1e3;function vo(){return Zn()/FG}function mae(){let{performance:t}=J;if(!t?.now||!t.timeOrigin)return vo;let e=t.timeOrigin;return()=>(e+Gi(()=>t.now()))/FG}var HG;function Ss(){return(HG??(HG=mae()))()}function VG(t){let e=Ss(),n={sid:_t(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>hae(n)};return t&&Lo(n,t),n}function Lo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ss(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:_t()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function qG(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Lo(t,n)}function hae(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function gs(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let r={...t};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=gs(r[o],e[o],n-1));return r}function zt(){return _t()}function Kt(){return _t().substring(16)}var jR="_sentrySpan";function Bi(t,e){e?nt(t,jR,e):delete t[jR]}function ji(t){return t[jR]}var Tae=100,An=class t{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:zt(),sampleRand:yt()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Bi(e,ji(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,r=n instanceof t?n.getScopeData():Mo(n)?e:void 0,{tags:o,attributes:s,extra:i,user:a,contexts:c,level:l,fingerprint:p=[],propagationContext:d,conversationId:_}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),_&&(this._conversationId=_),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,Bi(this,void 0),this._attachments=[],this.setPropagationContext({traceId:zt(),sampleRand:yt()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:Tae;if(r<=0)return this;let o={timestamp:vo(),...e,message:e.message?hs(e.message,2048):e.message};return this._breadcrumbs.push(o),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(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ji(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=gs(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture message!"),o;let s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=e.event_id||n?.event_id||_t();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(C&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function yc(){return Ir("defaultCurrentScope",()=>new An)}function er(){return Ir("defaultIsolationScope",()=>new An)}var $G=t=>t instanceof Promise&&!t[YG],YG=Symbol("chained PromiseLike"),kf=(t,e,n)=>{let r=t.then(o=>(e(o),o),o=>{throw n(o),o});return $G(r)&&$G(t)?r:Eae(t,r)},Eae=(t,e)=>{let n=!1;for(let r in t){if(r in e)continue;n=!0;let o=t[r];typeof o=="function"?Object.defineProperty(e,r,{value:(...s)=>o.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=o}return n&&Object.assign(e,{[YG]:!0}),e};var HR=class{constructor(e,n){let r;e?r=e:r=new An;let o;n?o=n:o=new An,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return Lt(r)?kf(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 e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ic(){let t=cn(),e=fs(t);return e.stack=e.stack||new HR(yc(),er())}function Sae(t){return Ic().withScope(t)}function gae(t,e){let n=Ic();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function WG(t){return Ic().withScope(()=>t(Ic().getIsolationScope()))}function zG(){return{withIsolationScope:WG,withScope:Sae,withSetScope:gae,withSetIsolationScope:(t,e)=>WG(e),getCurrentScope:()=>Ic().getScope(),getIsolationScope:()=>Ic().getIsolationScope()}}function FR(t){let e=cn(),n=fs(e);n.acs=t}function Or(t){let e=fs(t);return e.acs?e.acs:zG()}var KG;function QG(){return KG?.()}function VR(){return KG!==void 0}function he(){let t=cn();return Or(t).getCurrentScope()}function ue(){let t=cn();return Or(t).getIsolationScope()}function Gf(){return Ir("globalScope",()=>new An)}function Gn(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function Wl(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function H(){return he().getClient()}function Hi(t){let e=QG();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:s}=n,i={trace_id:r,span_id:s||Kt()};return o&&(i.parent_span_id=o),i}var Ue="sentry.source",Nr="sentry.sample_rate",qR="sentry.previous_trace_sample_rate",ee="sentry.op",W="sentry.origin";var $R="sentry.measurement_unit",YR="sentry.measurement_value",tr="sentry.custom_span_name",Oc="sentry.profile_id",Nc="sentry.exclusive_time",WR="cache.hit",zR="cache.key",KR="cache.item_size",QR="http.request.method",As="url.full";var XR="gen_ai.conversation.id";function Do(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){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(t>=500&&t<600)switch(t){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"}}var XG="_sentryScope",JG="_sentryIsolationScope";function Aae(t){try{let e=J.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function Rae(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function zl(t,e,n){t&&(nt(t,JG,Aae(n)),nt(t,XG,e))}function br(t){let e=t;return{scope:e[XG],isolationScope:Rae(e[JG])}}var Xr="sentry-";var eB=8192;function Uo(t){let e=Vi(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.startsWith(Xr)){let i=o.slice(Xr.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Fi(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Xr}${r}`]=o),n),{});return Bf(e)}function Vi(t){if(!(!t||!ms(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=ZG(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):ZG(t)}function ZG(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let r=e.slice(0,n),o=e.slice(n+1);return[r,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function Bf(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{let s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>eB?(C&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}var yae=/^o(\d+)\./,Iae=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Oae(t){return t==="http"||t==="https"}function Bn(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function Nae(t){let e=Iae.exec(t);if(!e){Qe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",l=a,p=l.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),l=p.pop()),l){let d=l.match(/^\d+/);d&&(l=d[0])}return tB({host:s,pass:o,path:c,projectId:l,port:i,protocol:n,publicKey:r})}function tB(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function bae(t){if(!C)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(g.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Oae(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Cae(t){return t.match(yae)?.[1]}function jf(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},r;return e.orgId?r=String(e.orgId):n&&(r=Cae(n)),r}function nB(t){let e=typeof t=="string"?Nae(t):tB(t);if(!(!e||!bae(e)))return e}function jn(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var Hf=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function rB(t){if(!t)return;let e=t.match(Hf);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Kl(t,e){let n=rB(t),r=Uo(e);if(!n?.traceId)return{traceId:zt(),sampleRand:yt()};let o=Pae(n,r);r&&(r.sample_rand=o.toString());let{traceId:s,parentSpanId:i,parentSampled:a}=n;return{traceId:s,parentSpanId:i,sampled:a,dsc:r||{},sampleRand:o}}function Rs(t=zt(),e=Kt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function ys(t=zt(),e=Kt(),n){return`00-${t}-${e}-${n?"01":"00"}`}function Pae(t,e){let n=jn(e?.sample_rand);if(n!==void 0)return n;let r=jn(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?yt()*r:r+yt()*(1-r):yt()}function JR(t,e){let n=jf(t);return e&&n&&e!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${e}, SDK options: ${n})`),!1):(t.getOptions().strictTraceContinuation||!1)&&(e&&!n||!e&&n)?(g.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${e}, Sentry client: ${n})`),!1):!0}var Vf=0,qf=1,oB=!1;function iB(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=Y(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function Is(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:Y(t).parent_span_id,s=br(t).scope,i=r?s?.getPropagationContext().propagationSpanId||Kt():e;return{parent_span_id:o,span_id:i,trace_id:n}}function $f(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return Rs(e,n,r)}function aB(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return ys(e,n,r)}function qi(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...o},attributes:s})=>({span_id:e,trace_id:n,sampled:r===qf,attributes:s,...o}))}function Rn(t){return typeof t=="number"?sB(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?sB(t.getTime()):Ss()}function sB(t){return t>9999999999?t/1e3:t}function Y(t){if(vae(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(xae(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:l,start_timestamp:Rn(o),timestamp:Rn(i)||void 0,status:$i(a),op:r[ee],origin:r[W],links:qi(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function xae(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function vae(t){return typeof t.getSpanJSON=="function"}function Cr(t){let{traceFlags:e}=t.spanContext();return e===qf}function $i(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}var Ql="_sentryChildSpans",ZR="_sentryRootSpan";function bc(t,e){let n=t[ZR]||t;nt(e,ZR,n),t[Ql]?t[Ql].add(e):nt(t,Ql,new Set([e]))}function Yf(t){let e=new Set;function n(r){if(!e.has(r)&&Cr(r)){e.add(r);let o=r[Ql]?Array.from(r[Ql]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function je(t){return t[ZR]||t}function nr(){let t=cn(),e=Or(t);return e.getActiveSpan?e.getActiveSpan():ji(he())}function Xl(){oB||(Qe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),oB=!0)}var cB=!1;function uB(){if(cB)return;function t(){let e=nr(),n=e&&je(e);if(n){let r="internal_error";C&&g.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",cB=!0,vG(t),LG(t)}function Xe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||H()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function lB(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Jl(t,e){if(!e?.length||!t.description)return!1;for(let n of e){if(Lae(n)){if(xo(t.description,n))return C&&lB(t),!0;continue}if(!n.name&&!n.op)continue;let r=n.name?xo(t.description,n.name):!0,o=n.op?t.op&&xo(t.op,n.op):!0;if(r&&o)return C&&lB(t),!0}return!1}function pB(t,e){let n=e.parent_span_id,r=e.span_id;if(n)for(let o of t)o.parent_span_id===r&&(o.parent_span_id=n)}function Lae(t){return typeof t=="string"||t instanceof RegExp}var Cc="production";var dB="_frozenDsc";function Wf(t,e){nt(t,dB,e)}function ey(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o={environment:n.environment||Cc,release:n.release,public_key:r,trace_id:t,org_id:jf(e)};return e.emit("createDsc",o),o}function Jr(t,e){let n=e.getPropagationContext();return n.dsc||ey(n.traceId,t)}function Je(t){let e=H();if(!e)return{};let n=je(t),r=Y(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[Nr]??o[qR];function a(m){return(typeof i=="number"||typeof i=="string")&&(m.sample_rate=`${i}`),m}let c=n[dB];if(c)return a(c);let l=s?.get("sentry.dsc"),p=l&&Uo(l);if(p)return a(p);let d=ey(t.spanContext().traceId,e),_=o[Ue],f=r.description;return _!=="url"&&f&&(d.transaction=f),Xe()&&(d.sampled=String(Cr(n)),d.sample_rand=s?.get("sentry.sample_rand")??br(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}var Os=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Vf}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function Pr(t,e=100,n=1/0){try{return ty("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function ny(t,e=3,n=100*1024){let r=Pr(t,e);return kae(r)>n?ny(t,e-1,n):r}function ty(t,e,n=1/0,r=1/0,o=Gae()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=Dae(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let l=e;if(l&&typeof l.toJSON=="function")try{let f=l.toJSON();return ty("",f,c-1,r,o)}catch{}let p=Array.isArray(e)?[]:{},d=0,_=Uf(e);for(let f in _){if(!Object.prototype.hasOwnProperty.call(_,f))continue;if(d>=r){p[f]="[MaxProperties ~]";break}let m=_[f];p[f]=ty(f,m,c-1,r,o),d++}return i(e),p}function Dae(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Yl(e))return vf(e);if(MR(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${ql(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=Uae(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Uae(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function wae(t){return~-encodeURI(t).split(/%..|./).length}function kae(t){return wae(JSON.stringify(t))}function Gae(){let t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function un(t,e=[]){return[t,e]}function oy(t,e){let[n,r]=t;return[n,[...r,e]]}function Zl(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function sy(t,e){return Zl(t,(n,r)=>e.includes(r))}function ry(t){let e=fs(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function ep(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[ry(r),s]:r.push(typeof s=="string"?ry(s):s)}for(let s of n){let[i,a]=s;if(o(`
|
|
15
|
+
Name: ${$l(r)}
|
|
16
|
+
Error:`,o)}}var IR=null;function vG(t){let e="error";Ec(e,t),Sc(e,cae)}function cae(){IR=J.onerror,J.onerror=function(t,e,n,r,o){return gc("error",{column:r,error:o,line:n,msg:t,url:e}),IR?IR.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}var OR=null;function LG(t){let e="unhandledrejection";Ec(e,t),Sc(e,uae)}function uae(){OR=J.onunhandledrejection,J.onunhandledrejection=function(t){return gc("unhandledrejection",t),OR?OR.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var DG=Object.prototype.toString;function Kr(t){switch(DG.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Qr(t,Error)}}function Uf(t,e){return DG.call(t)===`[object ${e}]`}function NR(t){return Uf(t,"ErrorEvent")}function ms(t){return Uf(t,"String")}function Ac(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yl(t){return t===null||Ac(t)||typeof t!="object"&&typeof t!="function"}function Mo(t){return Uf(t,"Object")}function bR(t){return typeof Event<"u"&&Qr(t,Event)}function CR(t){return typeof Element<"u"&&Qr(t,Element)}function PR(t){return Uf(t,"RegExp")}function Lt(t){return!!(t?.then&&typeof t.then=="function")}function MR(t){return Mo(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Qr(t,e){try{return t instanceof e}catch{return!1}}function Wl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}var lae=J,pae=80;function UG(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,l,p=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||pae;for(;n&&s++<r&&(l=dae(n,p),!(l==="html"||s>1&&i+o.length*c+l.length>=d));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function dae(t,e){let n=t,r=[];if(!n?.tagName)return"";if(lae.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let o=e?.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let s=n.className;if(s&&ms(s)){let i=s.split(/\s+/);for(let a of i)r.push(`.${a}`)}}for(let s of["aria-label","type","name","title","alt"]){let i=n.getAttribute(s);i&&r.push(`[${s}="${i}"]`)}return r.join("")}function xR(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&GG(o,r);try{t[e]=o}catch{C&&g.log(`Failed to replace method "${e}" in object`,t)}}function nt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{C&&g.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function GG(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,nt(t,"__sentry_original__",e)}catch{}}function vR(t){return t.__sentry_original__}function wf(t){if(Kr(t))return{message:t.message,name:t.name,stack:t.stack,...kG(t)};if(bR(t)){let e={type:t.type,target:wG(t.target),currentTarget:wG(t.currentTarget),...kG(t)};return typeof CustomEvent<"u"&&Qr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function wG(t){try{return CR(t)?UG(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function kG(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function LR(t){let e=Object.keys(wf(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var Rc;function Bi(t){if(Rc!==void 0)return Rc?Rc(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Rc=n[e],Rc(t)):(Rc=null,t())}function yt(){return Bi(()=>Math.random())}function Zn(){return Bi(()=>Date.now())}function hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function DR(t,e){let n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function UR(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{Wl(o)?n.push(Lf(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function xo(t,e,n=!1){return ms(t)?PR(e)?e.test(t):ms(e)?n?t===e:t.includes(e):!1:!1}function Ts(t,e=[],n=!1){return e.some(r=>xo(t,r,n))}function _ae(){let t=J;return t.crypto||t.msCrypto}var wR;function fae(){return yt()*16}function _t(t=_ae()){try{if(t?.randomUUID)return Bi(()=>t.randomUUID()).replace(/-/g,"")}catch{}return wR||(wR="10000000100040008000"+1e11),wR.replace(/[018]/g,e=>(e^(fae()&15)>>e/4).toString(16))}function BG(t){return t.exception?.values?.[0]}function Es(t){let{message:e,event_id:n}=t;if(e)return e;let r=BG(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function GR(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function yc(t,e){let n=BG(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o?.data,...e.data};n.mechanism.data=s}}var mae=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function kR(t){return parseInt(t||"",10)}function BR(t){let e=t.match(mae)||[],n=kR(e[1]),r=kR(e[2]),o=kR(e[3]);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:e[4]}}function kf(t){if(jG(t))return!0;try{nt(t,"__sentry_captured__",!0)}catch{}return!1}function jG(t){try{return t.__sentry_captured__}catch{}}var FG=1e3;function vo(){return Zn()/FG}function hae(){let{performance:t}=J;if(!t?.now||!t.timeOrigin)return vo;let e=t.timeOrigin;return()=>(e+Bi(()=>t.now()))/FG}var HG;function Ss(){return(HG??(HG=hae()))()}function VG(t){let e=Ss(),n={sid:_t(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Tae(n)};return t&&Lo(n,t),n}function Lo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ss(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:_t()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function qG(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Lo(t,n)}function Tae(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function gs(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let r={...t};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=gs(r[o],e[o],n-1));return r}function zt(){return _t()}function Kt(){return _t().substring(16)}var jR="_sentrySpan";function ji(t,e){e?nt(t,jR,e):delete t[jR]}function Hi(t){return t[jR]}var Eae=100,An=class t{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:zt(),sampleRand:yt()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,ji(e,Hi(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,r=n instanceof t?n.getScopeData():Mo(n)?e:void 0,{tags:o,attributes:s,extra:i,user:a,contexts:c,level:l,fingerprint:p=[],propagationContext:d,conversationId:_}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),_&&(this._conversationId=_),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,ji(this,void 0),this._attachments=[],this.setPropagationContext({traceId:zt(),sampleRand:yt()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:Eae;if(r<=0)return this;let o={timestamp:vo(),...e,message:e.message?hs(e.message,2048):e.message};return this._breadcrumbs.push(o),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(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Hi(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=gs(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture message!"),o;let s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=e.event_id||n?.event_id||_t();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(C&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function Ic(){return Ir("defaultCurrentScope",()=>new An)}function er(){return Ir("defaultIsolationScope",()=>new An)}var $G=t=>t instanceof Promise&&!t[YG],YG=Symbol("chained PromiseLike"),Gf=(t,e,n)=>{let r=t.then(o=>(e(o),o),o=>{throw n(o),o});return $G(r)&&$G(t)?r:Sae(t,r)},Sae=(t,e)=>{let n=!1;for(let r in t){if(r in e)continue;n=!0;let o=t[r];typeof o=="function"?Object.defineProperty(e,r,{value:(...s)=>o.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=o}return n&&Object.assign(e,{[YG]:!0}),e};var HR=class{constructor(e,n){let r;e?r=e:r=new An;let o;n?o=n:o=new An,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return Lt(r)?Gf(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 e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Oc(){let t=cn(),e=fs(t);return e.stack=e.stack||new HR(Ic(),er())}function gae(t){return Oc().withScope(t)}function Aae(t,e){let n=Oc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function WG(t){return Oc().withScope(()=>t(Oc().getIsolationScope()))}function zG(){return{withIsolationScope:WG,withScope:gae,withSetScope:Aae,withSetIsolationScope:(t,e)=>WG(e),getCurrentScope:()=>Oc().getScope(),getIsolationScope:()=>Oc().getIsolationScope()}}function FR(t){let e=cn(),n=fs(e);n.acs=t}function Or(t){let e=fs(t);return e.acs?e.acs:zG()}var KG;function QG(){return KG?.()}function VR(){return KG!==void 0}function he(){let t=cn();return Or(t).getCurrentScope()}function ue(){let t=cn();return Or(t).getIsolationScope()}function Bf(){return Ir("globalScope",()=>new An)}function Gn(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function zl(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function H(){return he().getClient()}function Fi(t){let e=QG();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:s}=n,i={trace_id:r,span_id:s||Kt()};return o&&(i.parent_span_id=o),i}var Ue="sentry.source",Nr="sentry.sample_rate",qR="sentry.previous_trace_sample_rate",ee="sentry.op",W="sentry.origin";var $R="sentry.measurement_unit",YR="sentry.measurement_value",tr="sentry.custom_span_name",Nc="sentry.profile_id",bc="sentry.exclusive_time",WR="cache.hit",zR="cache.key",KR="cache.item_size",QR="http.request.method",As="url.full";var XR="gen_ai.conversation.id";function Do(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){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(t>=500&&t<600)switch(t){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"}}var XG="_sentryScope",JG="_sentryIsolationScope";function Rae(t){try{let e=J.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function yae(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function Kl(t,e,n){t&&(nt(t,JG,Rae(n)),nt(t,XG,e))}function br(t){let e=t;return{scope:e[XG],isolationScope:yae(e[JG])}}var Xr="sentry-";var eB=8192;function Uo(t){let e=qi(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.startsWith(Xr)){let i=o.slice(Xr.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Vi(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Xr}${r}`]=o),n),{});return jf(e)}function qi(t){if(!(!t||!ms(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=ZG(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):ZG(t)}function ZG(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let r=e.slice(0,n),o=e.slice(n+1);return[r,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function jf(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{let s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>eB?(C&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}var Iae=/^o(\d+)\./,Oae=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Nae(t){return t==="http"||t==="https"}function Bn(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function bae(t){let e=Oae.exec(t);if(!e){Qe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",l=a,p=l.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),l=p.pop()),l){let d=l.match(/^\d+/);d&&(l=d[0])}return tB({host:s,pass:o,path:c,projectId:l,port:i,protocol:n,publicKey:r})}function tB(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Cae(t){if(!C)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(g.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Nae(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Pae(t){return t.match(Iae)?.[1]}function Hf(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},r;return e.orgId?r=String(e.orgId):n&&(r=Pae(n)),r}function nB(t){let e=typeof t=="string"?bae(t):tB(t);if(!(!e||!Cae(e)))return e}function jn(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var Ff=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function rB(t){if(!t)return;let e=t.match(Ff);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Ql(t,e){let n=rB(t),r=Uo(e);if(!n?.traceId)return{traceId:zt(),sampleRand:yt()};let o=Mae(n,r);r&&(r.sample_rand=o.toString());let{traceId:s,parentSpanId:i,parentSampled:a}=n;return{traceId:s,parentSpanId:i,sampled:a,dsc:r||{},sampleRand:o}}function Rs(t=zt(),e=Kt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function ys(t=zt(),e=Kt(),n){return`00-${t}-${e}-${n?"01":"00"}`}function Mae(t,e){let n=jn(e?.sample_rand);if(n!==void 0)return n;let r=jn(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?yt()*r:r+yt()*(1-r):yt()}function JR(t,e){let n=Hf(t);return e&&n&&e!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${e}, SDK options: ${n})`),!1):(t.getOptions().strictTraceContinuation||!1)&&(e&&!n||!e&&n)?(g.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${e}, Sentry client: ${n})`),!1):!0}var qf=0,$f=1,oB=!1;function iB(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=Y(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function Is(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:Y(t).parent_span_id,s=br(t).scope,i=r?s?.getPropagationContext().propagationSpanId||Kt():e;return{parent_span_id:o,span_id:i,trace_id:n}}function Yf(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return Rs(e,n,r)}function aB(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return ys(e,n,r)}function $i(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...o},attributes:s})=>({span_id:e,trace_id:n,sampled:r===$f,attributes:s,...o}))}function Rn(t){return typeof t=="number"?sB(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?sB(t.getTime()):Ss()}function sB(t){return t>9999999999?t/1e3:t}function Y(t){if(Lae(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(vae(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:l,start_timestamp:Rn(o),timestamp:Rn(i)||void 0,status:Yi(a),op:r[ee],origin:r[W],links:$i(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function vae(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Lae(t){return typeof t.getSpanJSON=="function"}function Cr(t){let{traceFlags:e}=t.spanContext();return e===$f}function Yi(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}var Xl="_sentryChildSpans",ZR="_sentryRootSpan";function Cc(t,e){let n=t[ZR]||t;nt(e,ZR,n),t[Xl]?t[Xl].add(e):nt(t,Xl,new Set([e]))}function Wf(t){let e=new Set;function n(r){if(!e.has(r)&&Cr(r)){e.add(r);let o=r[Xl]?Array.from(r[Xl]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function je(t){return t[ZR]||t}function nr(){let t=cn(),e=Or(t);return e.getActiveSpan?e.getActiveSpan():Hi(he())}function Jl(){oB||(Qe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),oB=!0)}var cB=!1;function uB(){if(cB)return;function t(){let e=nr(),n=e&&je(e);if(n){let r="internal_error";C&&g.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",cB=!0,vG(t),LG(t)}function Xe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||H()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function lB(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Zl(t,e){if(!e?.length||!t.description)return!1;for(let n of e){if(Dae(n)){if(xo(t.description,n))return C&&lB(t),!0;continue}if(!n.name&&!n.op)continue;let r=n.name?xo(t.description,n.name):!0,o=n.op?t.op&&xo(t.op,n.op):!0;if(r&&o)return C&&lB(t),!0}return!1}function pB(t,e){let n=e.parent_span_id,r=e.span_id;if(n)for(let o of t)o.parent_span_id===r&&(o.parent_span_id=n)}function Dae(t){return typeof t=="string"||t instanceof RegExp}var Pc="production";var dB="_frozenDsc";function zf(t,e){nt(t,dB,e)}function ey(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o={environment:n.environment||Pc,release:n.release,public_key:r,trace_id:t,org_id:Hf(e)};return e.emit("createDsc",o),o}function Jr(t,e){let n=e.getPropagationContext();return n.dsc||ey(n.traceId,t)}function Je(t){let e=H();if(!e)return{};let n=je(t),r=Y(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[Nr]??o[qR];function a(m){return(typeof i=="number"||typeof i=="string")&&(m.sample_rate=`${i}`),m}let c=n[dB];if(c)return a(c);let l=s?.get("sentry.dsc"),p=l&&Uo(l);if(p)return a(p);let d=ey(t.spanContext().traceId,e),_=o[Ue],f=r.description;return _!=="url"&&f&&(d.transaction=f),Xe()&&(d.sampled=String(Cr(n)),d.sample_rand=s?.get("sentry.sample_rand")??br(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}var Os=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:qf}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function Pr(t,e=100,n=1/0){try{return ty("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function ny(t,e=3,n=100*1024){let r=Pr(t,e);return Gae(r)>n?ny(t,e-1,n):r}function ty(t,e,n=1/0,r=1/0,o=Bae()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=Uae(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let l=e;if(l&&typeof l.toJSON=="function")try{let f=l.toJSON();return ty("",f,c-1,r,o)}catch{}let p=Array.isArray(e)?[]:{},d=0,_=wf(e);for(let f in _){if(!Object.prototype.hasOwnProperty.call(_,f))continue;if(d>=r){p[f]="[MaxProperties ~]";break}let m=_[f];p[f]=ty(f,m,c-1,r,o),d++}return i(e),p}function Uae(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Wl(e))return Lf(e);if(MR(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${$l(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=wae(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function wae(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function kae(t){return~-encodeURI(t).split(/%..|./).length}function Gae(t){return kae(JSON.stringify(t))}function Bae(){let t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function un(t,e=[]){return[t,e]}function oy(t,e){let[n,r]=t;return[n,[...r,e]]}function ep(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function sy(t,e){return ep(t,(n,r)=>e.includes(r))}function ry(t){let e=fs(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function tp(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[ry(r),s]:r.push(typeof s=="string"?ry(s):s)}for(let s of n){let[i,a]=s;if(o(`
|
|
17
17
|
${JSON.stringify(i)}
|
|
18
|
-
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Pr(a))}o(c)}}return typeof r=="string"?r:
|
|
18
|
+
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Pr(a))}o(c)}}return typeof r=="string"?r:jae(r)}function jae(t){let e=t.reduce((o,s)=>o+s.length,0),n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function iy(t){return[{type:"span"},t]}function ay(t){let e=typeof t.data=="string"?ry(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var _B={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 Hae(t){return t in _B}function Kf(t){return Hae(t)?_B[t]:t}function Qf(t){if(!t?.sdk)return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function cy(t,e,n,r){let o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Bn(r)},...o&&{trace:o}}}function Fae(t,e){if(!e)return t;let n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0},t}function fB(t,e,n,r){let o=Qf(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:Bn(e)}},i="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return un(s,[i])}function mB(t,e,n,r){let o=Qf(n),s=t.type&&t.type!=="replay_event"?t.type:"event";Fae(t,n?.sdk);let i=cy(t,o,r,e);return delete t.sdkProcessingMetadata,un(i,[[{type:s},t]])}function hB(t,e){function n(f){return!!f.trace_id&&!!f.public_key}let r=Je(t[0]),o=e?.getDsn(),s=e?.getOptions().tunnel,i={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&o&&{dsn:Bn(o)}},{beforeSendSpan:a,ignoreSpans:c}=e?.getOptions()||{},l=c?.length?t.filter(f=>!Zl(Y(f),c)):t,p=t.length-l.length;p&&e?.recordDroppedEvent("before_send","span",p);let d=a?f=>{let m=Y(f),h=a(m);return h||(Jl(),m)}:Y,_=[];for(let f of l){let m=d(f);m&&_.push(iy(m))}return un(i,_)}function np(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Y(t),{spanId:o}=t.spanContext(),s=Cr(t),i=je(t),a=i===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,l=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!a){let{op:p,description:d}=Y(i);l.push(`root ID: ${i.spanContext().spanId}`),p&&l.push(`root op: ${p}`),d&&l.push(`root description: ${d}`)}g.log(`${c}
|
|
19
19
|
${l.join(`
|
|
20
|
-
`)}`)}function np(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >"}=Y(t),{spanId:r}=t.spanContext(),s=je(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;g.log(i)}function Yi(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[$R],s=r[YR];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var TB=1e3,Pc=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt(),this._startTime=e.startTimestamp||Ss(),this._links=e.links,this._attributes={},this.setAttributes({[W]:"manual",[ee]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?qf:Vf}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=Rn(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Ue,"custom"),this}end(e){this._endTime||(this._endTime=Rn(e),np(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ee],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:$i(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[W],profile_id:this._attributes[Oc],exclusive_time:this._attributes[Nc],measurements:Yi(this._events),is_segment:this._isStandaloneSpan&&je(this)===this||void 0,segment_id:this._isStandaloneSpan?je(this).spanContext().spanId:void 0,links:qi(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){C&&g.log("[Tracing] Adding an event to span:",e);let o=EB(n)?n:r||Ss(),s=EB(n)?{}:n||{},i={name:e,time:Rn(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=H();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===je(this)))return;if(this._isStandaloneSpan){this._sampled?Vae(hB([this],e)):(C&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}let r=this._convertSpanToTransaction();r&&(br(this).scope||he()).captureEvent(r)}_convertSpanToTransaction(){if(!SB(Y(this)))return;this._name||(C&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=br(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=Yf(this).filter(p=>p!==this&&!Fae(p)).map(p=>Y(p)).filter(SB),i=this._attributes[Ue];delete this._attributes[tr],s.forEach(p=>{delete p.data[tr]});let a={contexts:{trace:iB(this)},spans:s.length>TB?s.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,TB):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Je(this)},request:r,...i&&{transaction_info:{source:i}}},c=Yi(this._events);return c&&Object.keys(c).length&&(C&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function EB(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function SB(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function Fae(t){return t instanceof Pc&&t.isStandaloneSpan()}function Vae(t){let e=H();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Mr(t,e,n=()=>{},r=()=>{}){let o;try{o=t()}catch(s){throw e(s),n(),s}return qae(o,e,n,r)}function qae(t,e,n,r){return Lt(t)?kf(t,o=>{n(),r(o)},o=>{e(o),n()}):(n(),r(t),t)}function rp(t,e,n){if(!Xe(t))return[!1];let r,o;typeof t.tracesSampler=="function"?(o=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?o=e.parentSampled:typeof t.tracesSampleRate<"u"&&(o=t.tracesSampleRate,r=!0);let s=jn(o);if(s===void 0)return C&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!s)return C&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];let i=n<s;return i||C&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var Qf="__SENTRY_SUPPRESS_TRACING__";function xr(t,e){let n=op();if(n.startSpan)return n.startSpan(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return Bi(l,_),Mr(()=>e(_),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})},()=>{_.end()})}))}function It(t,e){let n=op();if(n.startSpanManual)return n.startSpanManual(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return Bi(l,_),Mr(()=>e(_,()=>_.end()),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})})}))}function Xf(t){let e=op();if(e.startInactiveSpan)return e.startInactiveSpan(t);let n=ly(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?i=>Gn(t.scope,i):o!==void 0?i=>Mc(o,i):i=>i())(()=>{let i=he(),a=py(i,o);return t.onlyIfParent&&!a?new Os:uy({parentSpan:a,spanArguments:n,forceTransaction:r,scope:i})})}function Mc(t,e){let n=op();return n.withActiveSpan?n.withActiveSpan(t,e):Gn(r=>(Bi(r,t||void 0),e(r)))}function xc(t){let e=op();return e.suppressTracing?e.suppressTracing(t):Gn(n=>{n.setSDKProcessingMetadata({[Qf]:!0});let r=t();return n.setSDKProcessingMetadata({[Qf]:void 0}),r})}function uy({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Xe()){let i=new Os;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...Je(i)};Wf(i,a)}return i}let o=ue(),s;if(t&&!n)s=$ae(t,r,e),bc(t,s);else if(t){let i=Je(t),{traceId:a,spanId:c}=t.spanContext(),l=Cr(t);s=gB({traceId:a,parentSpanId:c,...e},r,l),Wf(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};s=gB({traceId:i,parentSpanId:c,...e},r,l),a&&Wf(s,a)}return tp(s),zl(s,r,o),s}function ly(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=Rn(t.startTime),delete r.startTime,r}return n}function op(){let t=cn();return Or(t)}function gB(t,e,n){let r=H(),o=r?.getOptions()||{},{name:s=""}=t,i={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",i,{decision:!1});let a=i.parentSampled??n,c=i.spanAttributes,l=e.getPropagationContext(),[p,d,_]=e.getScopeData().sdkProcessingMetadata[Qf]?[!1]:rp(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:jn(l.dsc?.sample_rate)},l.sampleRand),f=new Pc({...t,attributes:{[Ue]:"custom",[Nr]:d!==void 0&&_?d:void 0,...c},sampled:p});return!p&&r&&(C&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",f),f}function $ae(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[Qf]?!1:Cr(t),i=s?new Pc({...n,parentSpanId:r,traceId:o,sampled:s}):new Os({traceId:o});bc(t,i);let a=H();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function py(t,e){if(e)return e;if(e===null)return;let n=ji(t);if(!n)return;let r=H();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?je(n):n}function AB(t){return t!==void 0?e=>Mc(t,e):e=>e()}var dy=0,RB=1,yB=2;function wo(t){return new Jf(e=>{e(t)})}function vc(t){return new Jf((e,n)=>{n(t)})}var Jf=class t{constructor(e){this._state=dy,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}_executeHandlers(){if(this._state===dy)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===RB&&n[1](this._value),this._state===yB&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===dy){if(Lt(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(RB,s)},o=s=>{n(yB,s)};try{e(r,o)}catch(s){o(s)}}};function IB(t,e,n,r=0){try{let o=_y(e,n,t,r);return Lt(o)?o:wo(o)}catch(o){return vc(o)}}function _y(t,e,n,r){let o=n[r];if(!t||!o)return t;let s=o({...t},e);return C&&s===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),Lt(s)?s.then(i=>_y(i,e,n,r+1)):_y(s,e,n,r+1)}var Wi,OB,NB,Ns;function bB(t){let e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};let r=e?Object.keys(e):[],o=n?Object.keys(n):[];if(Ns&&r.length===OB&&o.length===NB)return Ns;OB=r.length,NB=o.length,Ns={},Wi||(Wi={});let s=(i,a)=>{for(let c of i){let l=a[c],p=Wi?.[c];if(p&&Ns&&l)Ns[p[0]]=l,Wi&&(Wi[c]=[p[0],l]);else if(l){let d=t(c);for(let _=d.length-1;_>=0;_--){let m=d[_]?.filename;if(m&&Ns&&Wi){Ns[m]=l,Wi[c]=[m,l];break}}}}};return e&&s(r,e),n&&s(o,n),Ns}function PB(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;Yae(t,e),r&&Kae(t,r),Qae(t,n),Wae(t,o),zae(t,s)}function CB(t,e){let{extra:n,tags:r,attributes:o,user:s,contexts:i,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:_,propagationContext:f,transactionName:m,span:h}=e;sp(t,"extra",n),sp(t,"tags",r),sp(t,"attributes",o),sp(t,"user",s),sp(t,"contexts",i),t.sdkProcessingMetadata=gs(t.sdkProcessingMetadata,c,2),a&&(t.level=a),m&&(t.transactionName=m),h&&(t.span=h),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),_.length&&(t.attachments=[...t.attachments,..._]),t.propagationContext={...t.propagationContext,...f}}function sp(t,e,n){t[e]=gs(t[e],n,1)}function Zf(t,e){let n=Gf().getScopeData();return t&&CB(n,t.getScopeData()),e&&CB(n,e.getScopeData()),n}function Yae(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(o).length&&(t.user={...o,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function Wae(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function zae(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Kae(t,e){t.contexts={trace:Is(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Je(e),...t.sdkProcessingMetadata};let n=je(e),r=Y(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Qae(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function MB(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||_t(),timestamp:e.timestamp||vo()},l=n.integrations||t.integrations.map(S=>S.name);Xae(c,t),ece(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Jae(c,t.stackParser);let p=nce(r,n.captureContext);n.mechanism&&Rc(c,n.mechanism);let d=o?o.getEventProcessors():[],_=Zf(s,p),f=[...n.attachments||[],..._.attachments];f.length&&(n.attachments=f),PB(c,_);let m=[...d,..._.eventProcessors];return(n.data&&n.data.__sentry__===!0?wo(c):IB(m,c,n)).then(S=>(S&&Zae(S),typeof i=="number"&&i>0?tce(S,i,a):S))}function Xae(t,e){let{environment:n,release:r,dist:o,maxValueLength:s}=e;t.environment=t.environment||n||Cc,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&s&&(i.url=hs(i.url,s)),s&&t.exception?.values?.forEach(a=>{a.value&&(a.value=hs(a.value,s))})}function Jae(t,e){let n=bB(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function Zae(t){let e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function ece(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function tce(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))},...t.user&&{user:Pr(t.user,e,n)},...t.contexts&&{contexts:Pr(t.contexts,e,n)},...t.extra&&{extra:Pr(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pr(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Pr(t.contexts.flags,3,n)),r}function nce(t,e){if(!e)return t;let n=t?t.clone():new An;return n.update(e),n}function xB(t){if(t)return rce(t)?{captureContext:t}:sce(t)?{captureContext:t}:t}function rce(t){return t instanceof An||typeof t=="function"}var oce=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function sce(t){return Object.keys(t).some(e=>oce.includes(e))}function te(t,e){return he().captureException(t,xB(e))}function em(t,e){return he().captureEvent(t,e)}function tm(t,e){ue().setTag(t,e)}async function nm(t){let e=H();return e?e.flush(t):(C&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function rm(t){let e=H();return e?e.close(t):(C&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function om(){let t=H();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function sm(t){let e=ue(),{user:n}=Zf(e,he()),{userAgent:r}=J.navigator||{},o=VG({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&Lo(s,{status:"exited"}),ip(),e.setSession(o),o}function ip(){let t=ue(),n=he().getSession()||t.getSession();n&&qG(n),ice(),t.setSession()}function ice(){let t=ue(),e=H(),n=t.getSession();n&&e&&e.captureSession(n)}var ace="7";function cce(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function uce(t){return`${cce(t)}${t.projectId}/envelope/`}function lce(t,e){let n={sentry_version:ace};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function vB(t,e,n){return e||`${uce(t)}?${lce(t,n)}`}var fy=[];function pce(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function my(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){let o=n(e);r=Array.isArray(o)?o:[o]}else r=e;return pce(r)}function LB(t,e){let n={};return e.forEach(r=>{r&&Ty(t,r,n)}),n}function hy(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Ty(t,e,n){if(n[e.name]){C&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!fy.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),fy.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}C&&g.log(`Integration installed: ${e.name}`)}function DB(t,e){return e?Gn(e,()=>{let n=nr(),r=n?Is(n):Hi(e);return[n?Je(n):Jr(t,e),r]}):[void 0,void 0]}function dce(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function UB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[dce(t)])}function Lc(t,e){let n=e??_ce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=UB(n,r._metadata,r.tunnel,t.getDsn());wB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function _ce(t){return wB().get(t)}function wB(){return Ir("clientToLogBufferMap",()=>new WeakMap)}function fce(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function kB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[fce(t)])}function GB(t,e){let n=e??mce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=kB(n,r._metadata,r.tunnel,t.getDsn());BB().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(o)}function mce(t){return BB().get(t)}function BB(){return Ir("clientToMetricBufferMap",()=>new WeakMap)}function im(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var ap=Symbol.for("SentryBufferFullError");function Dc(t=100){let e=new Set;function n(){return e.size<t}function r(i){e.delete(i)}function o(i){if(!n())return vc(ap);let a=i();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(i){if(!e.size)return wo(!0);let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!i)return a;let c=[a,new Promise(l=>im(setTimeout(()=>l(!1),i)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:o,drain:s}}var hce=60*1e3;function Tce(t,e=Zn()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?hce:r-e}function Ece(t,e){return t[e]||t.all||0}function jB(t,e,n=Zn()){return Ece(t,e)>n}function HB(t,{statusCode:e,headers:n},r=Zn()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,l,,,p]=a.split(":",5),d=parseInt(c,10),_=(isNaN(d)?60:d)*1e3;if(!l)o.all=r+_;else for(let f of l.split(";"))f==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[f]=r+_):o[f]=r+_}else i?o.all=r+Tce(i,r):e===429&&(o.all=r+60*1e3);return o}var cp=64;function up(t,e,n=Dc(t.bufferSize||cp)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(Zl(i,(d,_)=>{let f=zf(_);jB(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});let c=un(i[0],a),l=d=>{if(sy(c,["client_report"])){C&&g.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}Zl(c,(_,f)=>{t.recordDroppedEvent(d,zf(f))})},p=()=>e({body:ep(c)}).then(d=>d.statusCode===413?(C&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),d):(C&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&g.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=HB(r,d),d),d=>{throw l("network_error"),C&&g.error("Encountered error running transport request:",d),d});return n.add(p).then(d=>d,d=>{if(d===ap)return C&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:o}}function FB(t,e,n){let r=[{type:"client_report"},{timestamp:n||vo(),discarded_events:t}];return un(e?{dsn:e}:{},[r])}function am(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function VB(t){let{trace_id:e,parent_span_id:n,span_id:r,status:o,origin:s,data:i,op:a}=t.contexts?.trace??{};return{data:i??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:o,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:i?.[Oc],exclusive_time:i?.[Nc],measurements:t.measurements,is_segment:!0}}function qB(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[Oc]:t.profile_id},...t.exclusive_time&&{[Nc]:t.exclusive_time}}}},measurements:t.measurements}}var $B="Not capturing exception because it's already been captured.",YB="Discarded session because of missing or non-string release",JB=Symbol.for("SentryInternalError"),ZB=Symbol.for("SentryDoNotSendEventError"),Sce=5e3;function cm(t){return{message:t,[JB]:!0}}function Ey(t){return{message:t,[ZB]:!0}}function WB(t){return!!t&&typeof t=="object"&&JB in t}function zB(t){return!!t&&typeof t=="object"&&ZB in t}function KB(t,e,n,r,o){let s=0,i,a=!1;t.on(n,()=>{s=0,clearTimeout(i),a=!1}),t.on(e,c=>{s+=r(c),s>=8e5?o(t):a||(a=!0,i=im(setTimeout(()=>{o(t)},Sce)))}),t.on("flush",()=>{o(t)})}var um=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Dc(e.transportOptions?.bufferSize??cp),e.dsn?this._dsn=nB(e.dsn):C&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=vB(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&KB(this,"afterCaptureLog","flushLogs",yce,Lc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&KB(this,"afterCaptureMetric","flushMetrics",Rce,GB)}captureException(e,n,r){let o=_t();if(wf(e))return C&&g.log($B),o;let s={event_id:o,...n};return this._process(()=>this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r)).then(i=>i),"error"),s.event_id}captureMessage(e,n,r,o){let s={event_id:_t(),...r},i=gc(e)?e:String(e),a=$l(e),c=a?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(()=>c.then(l=>this._captureEvent(l,s,o)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){let o=_t();if(n?.originalException&&wf(n.originalException))return C&&g.log($B),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope,l=QB(e.type);return this._process(()=>this._captureEvent(e,s,a||r,c),l),s.event_id}captureSession(e){this.sendSession(e),Lo(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let n=this._transport;if(!n)return!0;this.emit("flush");let r=await this._isClientDoneProcessing(e),o=await n.flush(e);return r&&o}async close(e){Lc(this);let n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];Ty(this,e,this._integrations),n||hy(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=mB(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])r=oy(r,ay(o));this.sendEnvelope(r).then(o=>this.emit("afterSendEvent",e,o))}sendSession(e){let{release:n,environment:r=Cc}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){C&&g.warn(YB);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){C&&g.warn(YB);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=fB(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){let o=`${e}:${n}`;C&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(e,n){let r=this._hooks[e]=this._hooks[e]||new Set,o=(...s)=>n(...s);return r.add(o),()=>{r.delete(o)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return C&&g.error("Error while sending envelope:",n),{}}return C&&g.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=LB(this,e),hy(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0,r=!1;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Lo(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){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(e,n,r,o){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i?.length&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),MB(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Hi(r)},...a.contexts};let c=Jr(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=he(),o=ue()){return C&&Sy(e)&&g.log(`Captured error event \`${am(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{C&&(zB(s)?g.log(s.message):WB(s)?g.warn(s.message):g.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=e1(e),c=Sy(e),p=`before send for type \`${e.type||"error"}\``,d=typeof i>"u"?void 0:jn(i);if(c&&typeof d=="number"&&yt()>d)return this.recordDroppedEvent("sample_rate","error"),vc(Ey(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let _=QB(e.type);return this._prepareEvent(e,n,r,o).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",_),Ey("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;let h=Ace(this,s,f,n);return gce(h,p)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",_),a){let S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw Ey(`${p} returned \`null\`, will not send event.`)}let m=r.getSession()||o.getSession();if(c&&m&&this._updateSessionFromEvent(m,f),a){let T=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,S=f.spans?f.spans.length:0,R=T-S;R>0&&this.recordDroppedEvent("before_send","span",R)}let h=f.transaction_info;if(a&&h&&f.transaction!==e.transaction){let T="custom";f.transaction_info={...h,source:T}}return this.sendEvent(f,n),f}).then(null,f=>{throw zB(f)||WB(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),cm(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
21
|
-
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===ap&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{let[o,s]=n.split(":");return{reason:o,category:s,quantity:r}})}_flushOutcomes(){C&&g.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){C&&g.log("No outcomes to send");return}if(!this._dsn){C&&g.log("No dsn provided, will not send outcomes");return}C&&g.log("Sending outcomes:",e);let n=FB(e,this._options.tunnel&&Bn(this._dsn));this.sendEnvelope(n)}};function QB(t){return t==="replay_event"?"replay":t||"error"}function gce(t,e){let n=`${e} must return \`null\` or a valid event.`;if(Lt(t))return t.then(r=>{if(!Mo(r)&&r!==null)throw cm(n);return r},r=>{throw cm(`${e} rejected with ${r}`)});if(!Mo(t)&&t!==null)throw cm(n);return t}function Ace(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i,ignoreSpans:a}=e,c=n;if(Sy(c)&&o)return o(c,r);if(e1(c)){if(i||a){let l=VB(c);if(a?.length&&Jl(l,a))return null;if(i){let p=i(l);p?c=gs(n,qB(p)):Xl()}if(c.spans){let p=[],d=c.spans;for(let f of d){if(a?.length&&Jl(f,a)){pB(d,f);continue}if(i){let m=i(f);m?p.push(m):(Xl(),p.push(f))}else p.push(f)}let _=c.spans.length-p.length;_&&t.recordDroppedEvent("before_send","span",_),c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(c,r)}}return c}function Sy(t){return t.type===void 0}function e1(t){return t.type==="transaction"}function Rce(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+t1(t.attributes)}function yce(t){let e=0;return t.message&&(e+=t.message.length*2),e+t1(t.attributes)}function t1(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*XB(n[0]):$l(n)?e+=XB(n):e+=100}),e}function XB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function n1(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n?.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=Bn(o)),e&&(s.trace=e);let i=Ice(t);return un(s,[i])}function Ice(t){return[{type:"check_in"},t]}function r1(t){let e=t._metadata?.sdk,n=e?.name&&e?.version?`${e?.name}/${e?.version}`:void 0;t.transportOptions={...t.transportOptions,headers:{...n&&{"user-agent":n},...t.transportOptions?.headers}}}function o1(t,e){return t(e.stack||"",1)}function Oce(t){return Kr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function Nce(t){return Oce(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function gy(t,e){let n={type:e.name||e.constructor.name,value:Nce(e)},r=o1(t,e);return r.length&&(n.stacktrace={frames:r}),n}function bce(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function Cce(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=LR(t);if(NR(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=Pce(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function Pce(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Mce(t,e,n,r){if(Kr(n))return[n,void 0];if(e.synthetic=!0,Mo(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:ny(n,s)},a=bce(n);if(a)return[a,i];let c=Cce(n),l=r?.syntheticException||new Error(c);return l.message=c,[l,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function s1(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=Mce(t,s,n,r),c={exception:{values:[gy(e,i)]}};return a&&(c.extra=a),GR(c,void 0,void 0),Rc(c,s),{...c,event_id:r?.event_id}}function i1(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=o1(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},Rc(s,{synthetic:!0}))}if(gc(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}var lp=class extends um{constructor(e){uB(),r1(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,n){let r=s1(this,this._options.stackParser,e,n);return r.level="error",wo(r)}eventFromMessage(e,n="info",r){return wo(i1(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return a1(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&a1(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:_t();if(!this._isEnabled())return C&&g.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,l={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(l.duration=e.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,d]=DB(this,r);d&&(l.contexts={trace:d});let _=n1(l,p,this.getSdkMetadata(),c,this.getDsn());return C&&g.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(_),o}dispose(){C&&g.log("Disposing client...");for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Dc(cp)}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function a1(t){let e=ue().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}var Ay=new Set;function Ry(t){t.forEach(e=>{Ay.add(e),C&&g.log(`AI provider "${e}" wrapping will be skipped`)})}function zi(t){return Ay.has(t)}function yy(){Ay.clear(),C&&g.log("Cleared AI provider skip registrations")}var xce=new Set(["false","f","n","no","off","0"]),vce=new Set(["true","t","y","yes","on","1"]);function Uc(t,e){let n=String(t).toLowerCase();return xce.has(n)?!1:vce.has(n)?!0:e?.strict?null:!!t}var Lce="thismessage:/";function Iy(t){return"isRelative"in t}function pp(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=e??(n?Lce:void 0);try{if("canParse"in URL&&!URL.canParse(t,r))return;let o=new URL(t,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function c1(t){if(Iy(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function Dce(t,e,n,r){let o=n?.method?.toUpperCase()??"GET",s=r||(t?e==="client"?c1(t):t.pathname:"/");return`${o} ${s}`}function Oy(t,e,n,r,o){let s={[W]:n,[Ue]:"url"};return o&&(s[e==="server"?"http.route":"url.template"]=o,s[Ue]="route"),r?.method&&(s[QR]=r.method.toUpperCase()),t&&(t.search&&(s["url.query"]=t.search),t.hash&&(s["url.fragment"]=t.hash),t.pathname&&(s["url.path"]=t.pathname,t.pathname==="/"&&(s[Ue]="route")),Iy(t)||(s[As]=t.href,t.port&&(s["url.port"]=t.port),t.protocol&&(s["url.scheme"]=t.protocol),t.hostname&&(s[e==="server"?"server.address":"url.domain"]=t.hostname))),[Dce(t,e,r,o),s]}function bs(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ko(t){return t.split(/[?#]/,1)[0]}function Cs(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}function wc(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=t.includes(";base64,"),s=t.indexOf(","),i="";if(e&&s!==-1){let a=t.slice(s+1);i=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${o?",base64":""}${i?`,${i}`:""}`}return t}function Ki(t,e,n=[e],r="npm"){let o=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${e}`,o.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:pe})),o.version=pe)}function kc(t={}){let e=t.client||H();if(!om()||!e)return{};let n=cn(),r=Or(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||he(),s=t.span||nr();if(!s&&VR())return{};let i=s?$f(s):Uce(o),a=s?Je(s):Jr(e,o),c=Fi(a);if(!Hf.test(i))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":i,baggage:c};return t.propagateTraceparent&&(p.traceparent=s?aB(s):wce(o)),p}function Uce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Rs(e,r,n)}function wce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return ys(e,r,n)}var u1="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Qi(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return C&&!r&&g.log(u1,t),r;let o=Ts(t,e);return n?.set(t,o),C&&!o&&g.log(u1,t),o}function Ny(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=t(),r}function l(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function p(){return o!==void 0||s!==void 0?c():r}function d(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return d.cancel=l,d.flush=p,d}function _1(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function dp(t){let e=t.headers||{},r=(typeof e["x-forwarded-host"]=="string"?e["x-forwarded-host"]:void 0)||(typeof e.host=="string"?e.host:void 0),s=(typeof e["x-forwarded-proto"]=="string"?e["x-forwarded-proto"]:void 0)||t.protocol||(t.socket?.encrypted?"https":"http"),i=t.url||"",a=kce({url:i,host:r,protocol:s}),c=t.body||void 0,l=t.cookies;return{url:a,method:t.method,query_string:f1(i),headers:_1(e),cookies:l,data:c}}function kce({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}var l1=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","set-cookie","cookie"],Gce=["x-forwarded-","-user"];function lm(t,e=!1,n="request"){let r={};try{Object.entries(t).forEach(([o,s])=>{if(s==null)return;let i=o.toLowerCase();if((i==="cookie"||i==="set-cookie")&&typeof s=="string"&&s!==""){let c=i==="set-cookie",l=s.indexOf(";"),p=c&&l!==-1?s.substring(0,l):s,d=c?[p]:p.split("; ");for(let _ of d){let f=_.indexOf("="),m=f!==-1?_.substring(0,f):_,h=f!==-1?_.substring(f+1):"",T=m.toLowerCase();d1(r,i,T,h,e,n)}}else d1(r,i,"",s,e,n)})}catch{}return r}function p1(t){return t.replace(/-/g,"_")}function d1(t,e,n,r,o,s){let i=Bce(n||e,r,o);if(i==null)return;let a=`http.${s}.header.${p1(e)}${n?`.${p1(n)}`:""}`;t[a]=i}function Bce(t,e,n){if(n?l1.some(o=>t.includes(o)):[...Gce,...l1].some(o=>t.includes(o)))return"[Filtered]";if(Array.isArray(e))return e.map(o=>o!=null?String(o):o).join(";");if(typeof e=="string")return e}function f1(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var jce=100;function rr(t,e){let n=H(),r=ue();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=jce}=n.getOptions();if(s<=0)return;let a={timestamp:vo(),...t},c=o?Qe(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var m1,Hce="FunctionToString",h1=new WeakMap,Fce=()=>({name:Hce,setupOnce(){m1=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=vR(this),n=h1.has(H())&&e!==void 0?e:this;return m1.apply(n,t)}}catch{}},setup(t){h1.set(t,!0)}}),pm=Fce;var Vce=[/^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$/],qce="EventFilters",by=(t={})=>{let e;return{name:qce,setup(n){let r=n.getOptions();e=T1(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=T1(t,s)}return $ce(n,e)?null:n}}},_m=(t={})=>({...by(t),name:"InboundFilters"});function T1(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Vce],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function $ce(t,e){if(t.type){if(t.type==="transaction"&&Wce(t,e.ignoreTransactions))return C&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
-
Event: ${Es(t)}`),!0}else{if(
|
|
23
|
-
Event: ${Es(t)}`),!0;if(
|
|
24
|
-
Event: ${Es(t)}`),!0;if(
|
|
20
|
+
`)}`)}function rp(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >"}=Y(t),{spanId:r}=t.spanContext(),s=je(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;g.log(i)}function Wi(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[$R],s=r[YR];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var TB=1e3,Mc=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt(),this._startTime=e.startTimestamp||Ss(),this._links=e.links,this._attributes={},this.setAttributes({[W]:"manual",[ee]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?$f:qf}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=Rn(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Ue,"custom"),this}end(e){this._endTime||(this._endTime=Rn(e),rp(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ee],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Yi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[W],profile_id:this._attributes[Nc],exclusive_time:this._attributes[bc],measurements:Wi(this._events),is_segment:this._isStandaloneSpan&&je(this)===this||void 0,segment_id:this._isStandaloneSpan?je(this).spanContext().spanId:void 0,links:$i(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){C&&g.log("[Tracing] Adding an event to span:",e);let o=EB(n)?n:r||Ss(),s=EB(n)?{}:n||{},i={name:e,time:Rn(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=H();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===je(this)))return;if(this._isStandaloneSpan){this._sampled?qae(hB([this],e)):(C&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}let r=this._convertSpanToTransaction();r&&(br(this).scope||he()).captureEvent(r)}_convertSpanToTransaction(){if(!SB(Y(this)))return;this._name||(C&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=br(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=Wf(this).filter(p=>p!==this&&!Vae(p)).map(p=>Y(p)).filter(SB),i=this._attributes[Ue];delete this._attributes[tr],s.forEach(p=>{delete p.data[tr]});let a={contexts:{trace:iB(this)},spans:s.length>TB?s.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,TB):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Je(this)},request:r,...i&&{transaction_info:{source:i}}},c=Wi(this._events);return c&&Object.keys(c).length&&(C&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function EB(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function SB(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function Vae(t){return t instanceof Mc&&t.isStandaloneSpan()}function qae(t){let e=H();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Mr(t,e,n=()=>{},r=()=>{}){let o;try{o=t()}catch(s){throw e(s),n(),s}return $ae(o,e,n,r)}function $ae(t,e,n,r){return Lt(t)?Gf(t,o=>{n(),r(o)},o=>{e(o),n()}):(n(),r(t),t)}function op(t,e,n){if(!Xe(t))return[!1];let r,o;typeof t.tracesSampler=="function"?(o=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?o=e.parentSampled:typeof t.tracesSampleRate<"u"&&(o=t.tracesSampleRate,r=!0);let s=jn(o);if(s===void 0)return C&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!s)return C&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];let i=n<s;return i||C&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var Xf="__SENTRY_SUPPRESS_TRACING__";function xr(t,e){let n=sp();if(n.startSpan)return n.startSpan(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return ji(l,_),Mr(()=>e(_),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})},()=>{_.end()})}))}function It(t,e){let n=sp();if(n.startSpanManual)return n.startSpanManual(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return ji(l,_),Mr(()=>e(_,()=>_.end()),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})})}))}function Jf(t){let e=sp();if(e.startInactiveSpan)return e.startInactiveSpan(t);let n=ly(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?i=>Gn(t.scope,i):o!==void 0?i=>xc(o,i):i=>i())(()=>{let i=he(),a=py(i,o);return t.onlyIfParent&&!a?new Os:uy({parentSpan:a,spanArguments:n,forceTransaction:r,scope:i})})}function xc(t,e){let n=sp();return n.withActiveSpan?n.withActiveSpan(t,e):Gn(r=>(ji(r,t||void 0),e(r)))}function vc(t){let e=sp();return e.suppressTracing?e.suppressTracing(t):Gn(n=>{n.setSDKProcessingMetadata({[Xf]:!0});let r=t();return n.setSDKProcessingMetadata({[Xf]:void 0}),r})}function uy({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Xe()){let i=new Os;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...Je(i)};zf(i,a)}return i}let o=ue(),s;if(t&&!n)s=Yae(t,r,e),Cc(t,s);else if(t){let i=Je(t),{traceId:a,spanId:c}=t.spanContext(),l=Cr(t);s=gB({traceId:a,parentSpanId:c,...e},r,l),zf(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};s=gB({traceId:i,parentSpanId:c,...e},r,l),a&&zf(s,a)}return np(s),Kl(s,r,o),s}function ly(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=Rn(t.startTime),delete r.startTime,r}return n}function sp(){let t=cn();return Or(t)}function gB(t,e,n){let r=H(),o=r?.getOptions()||{},{name:s=""}=t,i={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",i,{decision:!1});let a=i.parentSampled??n,c=i.spanAttributes,l=e.getPropagationContext(),[p,d,_]=e.getScopeData().sdkProcessingMetadata[Xf]?[!1]:op(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:jn(l.dsc?.sample_rate)},l.sampleRand),f=new Mc({...t,attributes:{[Ue]:"custom",[Nr]:d!==void 0&&_?d:void 0,...c},sampled:p});return!p&&r&&(C&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",f),f}function Yae(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[Xf]?!1:Cr(t),i=s?new Mc({...n,parentSpanId:r,traceId:o,sampled:s}):new Os({traceId:o});Cc(t,i);let a=H();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function py(t,e){if(e)return e;if(e===null)return;let n=Hi(t);if(!n)return;let r=H();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?je(n):n}function AB(t){return t!==void 0?e=>xc(t,e):e=>e()}var dy=0,RB=1,yB=2;function wo(t){return new Zf(e=>{e(t)})}function Lc(t){return new Zf((e,n)=>{n(t)})}var Zf=class t{constructor(e){this._state=dy,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}_executeHandlers(){if(this._state===dy)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===RB&&n[1](this._value),this._state===yB&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===dy){if(Lt(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(RB,s)},o=s=>{n(yB,s)};try{e(r,o)}catch(s){o(s)}}};function IB(t,e,n,r=0){try{let o=_y(e,n,t,r);return Lt(o)?o:wo(o)}catch(o){return Lc(o)}}function _y(t,e,n,r){let o=n[r];if(!t||!o)return t;let s=o({...t},e);return C&&s===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),Lt(s)?s.then(i=>_y(i,e,n,r+1)):_y(s,e,n,r+1)}var zi,OB,NB,Ns;function bB(t){let e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};let r=e?Object.keys(e):[],o=n?Object.keys(n):[];if(Ns&&r.length===OB&&o.length===NB)return Ns;OB=r.length,NB=o.length,Ns={},zi||(zi={});let s=(i,a)=>{for(let c of i){let l=a[c],p=zi?.[c];if(p&&Ns&&l)Ns[p[0]]=l,zi&&(zi[c]=[p[0],l]);else if(l){let d=t(c);for(let _=d.length-1;_>=0;_--){let m=d[_]?.filename;if(m&&Ns&&zi){Ns[m]=l,zi[c]=[m,l];break}}}}};return e&&s(r,e),n&&s(o,n),Ns}function PB(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;Wae(t,e),r&&Qae(t,r),Xae(t,n),zae(t,o),Kae(t,s)}function CB(t,e){let{extra:n,tags:r,attributes:o,user:s,contexts:i,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:_,propagationContext:f,transactionName:m,span:h}=e;ip(t,"extra",n),ip(t,"tags",r),ip(t,"attributes",o),ip(t,"user",s),ip(t,"contexts",i),t.sdkProcessingMetadata=gs(t.sdkProcessingMetadata,c,2),a&&(t.level=a),m&&(t.transactionName=m),h&&(t.span=h),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),_.length&&(t.attachments=[...t.attachments,..._]),t.propagationContext={...t.propagationContext,...f}}function ip(t,e,n){t[e]=gs(t[e],n,1)}function em(t,e){let n=Bf().getScopeData();return t&&CB(n,t.getScopeData()),e&&CB(n,e.getScopeData()),n}function Wae(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(o).length&&(t.user={...o,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function zae(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Kae(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Qae(t,e){t.contexts={trace:Is(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Je(e),...t.sdkProcessingMetadata};let n=je(e),r=Y(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Xae(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function MB(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||_t(),timestamp:e.timestamp||vo()},l=n.integrations||t.integrations.map(S=>S.name);Jae(c,t),tce(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Zae(c,t.stackParser);let p=rce(r,n.captureContext);n.mechanism&&yc(c,n.mechanism);let d=o?o.getEventProcessors():[],_=em(s,p),f=[...n.attachments||[],..._.attachments];f.length&&(n.attachments=f),PB(c,_);let m=[...d,..._.eventProcessors];return(n.data&&n.data.__sentry__===!0?wo(c):IB(m,c,n)).then(S=>(S&&ece(S),typeof i=="number"&&i>0?nce(S,i,a):S))}function Jae(t,e){let{environment:n,release:r,dist:o,maxValueLength:s}=e;t.environment=t.environment||n||Pc,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&s&&(i.url=hs(i.url,s)),s&&t.exception?.values?.forEach(a=>{a.value&&(a.value=hs(a.value,s))})}function Zae(t,e){let n=bB(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function ece(t){let e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function tce(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function nce(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))},...t.user&&{user:Pr(t.user,e,n)},...t.contexts&&{contexts:Pr(t.contexts,e,n)},...t.extra&&{extra:Pr(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pr(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Pr(t.contexts.flags,3,n)),r}function rce(t,e){if(!e)return t;let n=t?t.clone():new An;return n.update(e),n}function xB(t){if(t)return oce(t)?{captureContext:t}:ice(t)?{captureContext:t}:t}function oce(t){return t instanceof An||typeof t=="function"}var sce=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function ice(t){return Object.keys(t).some(e=>sce.includes(e))}function te(t,e){return he().captureException(t,xB(e))}function tm(t,e){return he().captureEvent(t,e)}function nm(t,e){ue().setTag(t,e)}async function rm(t){let e=H();return e?e.flush(t):(C&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function om(t){let e=H();return e?e.close(t):(C&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function sm(){let t=H();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function im(t){let e=ue(),{user:n}=em(e,he()),{userAgent:r}=J.navigator||{},o=VG({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&Lo(s,{status:"exited"}),ap(),e.setSession(o),o}function ap(){let t=ue(),n=he().getSession()||t.getSession();n&&qG(n),ace(),t.setSession()}function ace(){let t=ue(),e=H(),n=t.getSession();n&&e&&e.captureSession(n)}var cce="7";function uce(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function lce(t){return`${uce(t)}${t.projectId}/envelope/`}function pce(t,e){let n={sentry_version:cce};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function vB(t,e,n){return e||`${lce(t)}?${pce(t,n)}`}var fy=[];function dce(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function my(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){let o=n(e);r=Array.isArray(o)?o:[o]}else r=e;return dce(r)}function LB(t,e){let n={};return e.forEach(r=>{r&&Ty(t,r,n)}),n}function hy(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Ty(t,e,n){if(n[e.name]){C&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!fy.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),fy.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}C&&g.log(`Integration installed: ${e.name}`)}function DB(t,e){return e?Gn(e,()=>{let n=nr(),r=n?Is(n):Fi(e);return[n?Je(n):Jr(t,e),r]}):[void 0,void 0]}function _ce(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function UB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[_ce(t)])}function Dc(t,e){let n=e??fce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=UB(n,r._metadata,r.tunnel,t.getDsn());wB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function fce(t){return wB().get(t)}function wB(){return Ir("clientToLogBufferMap",()=>new WeakMap)}function mce(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function kB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[mce(t)])}function GB(t,e){let n=e??hce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=kB(n,r._metadata,r.tunnel,t.getDsn());BB().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(o)}function hce(t){return BB().get(t)}function BB(){return Ir("clientToMetricBufferMap",()=>new WeakMap)}function am(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var cp=Symbol.for("SentryBufferFullError");function Uc(t=100){let e=new Set;function n(){return e.size<t}function r(i){e.delete(i)}function o(i){if(!n())return Lc(cp);let a=i();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(i){if(!e.size)return wo(!0);let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!i)return a;let c=[a,new Promise(l=>am(setTimeout(()=>l(!1),i)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:o,drain:s}}var Tce=60*1e3;function Ece(t,e=Zn()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?Tce:r-e}function Sce(t,e){return t[e]||t.all||0}function jB(t,e,n=Zn()){return Sce(t,e)>n}function HB(t,{statusCode:e,headers:n},r=Zn()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,l,,,p]=a.split(":",5),d=parseInt(c,10),_=(isNaN(d)?60:d)*1e3;if(!l)o.all=r+_;else for(let f of l.split(";"))f==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[f]=r+_):o[f]=r+_}else i?o.all=r+Ece(i,r):e===429&&(o.all=r+60*1e3);return o}var up=64;function lp(t,e,n=Uc(t.bufferSize||up)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(ep(i,(d,_)=>{let f=Kf(_);jB(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});let c=un(i[0],a),l=d=>{if(sy(c,["client_report"])){C&&g.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}ep(c,(_,f)=>{t.recordDroppedEvent(d,Kf(f))})},p=()=>e({body:tp(c)}).then(d=>d.statusCode===413?(C&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),d):(C&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&g.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=HB(r,d),d),d=>{throw l("network_error"),C&&g.error("Encountered error running transport request:",d),d});return n.add(p).then(d=>d,d=>{if(d===cp)return C&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:o}}function FB(t,e,n){let r=[{type:"client_report"},{timestamp:n||vo(),discarded_events:t}];return un(e?{dsn:e}:{},[r])}function cm(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function VB(t){let{trace_id:e,parent_span_id:n,span_id:r,status:o,origin:s,data:i,op:a}=t.contexts?.trace??{};return{data:i??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:o,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:i?.[Nc],exclusive_time:i?.[bc],measurements:t.measurements,is_segment:!0}}function qB(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[Nc]:t.profile_id},...t.exclusive_time&&{[bc]:t.exclusive_time}}}},measurements:t.measurements}}var $B="Not capturing exception because it's already been captured.",YB="Discarded session because of missing or non-string release",JB=Symbol.for("SentryInternalError"),ZB=Symbol.for("SentryDoNotSendEventError"),gce=5e3;function um(t){return{message:t,[JB]:!0}}function Ey(t){return{message:t,[ZB]:!0}}function WB(t){return!!t&&typeof t=="object"&&JB in t}function zB(t){return!!t&&typeof t=="object"&&ZB in t}function KB(t,e,n,r,o){let s=0,i,a=!1;t.on(n,()=>{s=0,clearTimeout(i),a=!1}),t.on(e,c=>{s+=r(c),s>=8e5?o(t):a||(a=!0,i=am(setTimeout(()=>{o(t)},gce)))}),t.on("flush",()=>{o(t)})}var lm=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Uc(e.transportOptions?.bufferSize??up),e.dsn?this._dsn=nB(e.dsn):C&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=vB(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&KB(this,"afterCaptureLog","flushLogs",Ice,Dc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&KB(this,"afterCaptureMetric","flushMetrics",yce,GB)}captureException(e,n,r){let o=_t();if(kf(e))return C&&g.log($B),o;let s={event_id:o,...n};return this._process(()=>this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r)).then(i=>i),"error"),s.event_id}captureMessage(e,n,r,o){let s={event_id:_t(),...r},i=Ac(e)?e:String(e),a=Yl(e),c=a?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(()=>c.then(l=>this._captureEvent(l,s,o)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){let o=_t();if(n?.originalException&&kf(n.originalException))return C&&g.log($B),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope,l=QB(e.type);return this._process(()=>this._captureEvent(e,s,a||r,c),l),s.event_id}captureSession(e){this.sendSession(e),Lo(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let n=this._transport;if(!n)return!0;this.emit("flush");let r=await this._isClientDoneProcessing(e),o=await n.flush(e);return r&&o}async close(e){Dc(this);let n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];Ty(this,e,this._integrations),n||hy(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=mB(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])r=oy(r,ay(o));this.sendEnvelope(r).then(o=>this.emit("afterSendEvent",e,o))}sendSession(e){let{release:n,environment:r=Pc}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){C&&g.warn(YB);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){C&&g.warn(YB);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=fB(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){let o=`${e}:${n}`;C&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(e,n){let r=this._hooks[e]=this._hooks[e]||new Set,o=(...s)=>n(...s);return r.add(o),()=>{r.delete(o)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return C&&g.error("Error while sending envelope:",n),{}}return C&&g.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=LB(this,e),hy(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0,r=!1;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Lo(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){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(e,n,r,o){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i?.length&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),MB(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Fi(r)},...a.contexts};let c=Jr(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=he(),o=ue()){return C&&Sy(e)&&g.log(`Captured error event \`${cm(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{C&&(zB(s)?g.log(s.message):WB(s)?g.warn(s.message):g.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=e1(e),c=Sy(e),p=`before send for type \`${e.type||"error"}\``,d=typeof i>"u"?void 0:jn(i);if(c&&typeof d=="number"&&yt()>d)return this.recordDroppedEvent("sample_rate","error"),Lc(Ey(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let _=QB(e.type);return this._prepareEvent(e,n,r,o).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",_),Ey("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;let h=Rce(this,s,f,n);return Ace(h,p)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",_),a){let S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw Ey(`${p} returned \`null\`, will not send event.`)}let m=r.getSession()||o.getSession();if(c&&m&&this._updateSessionFromEvent(m,f),a){let T=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,S=f.spans?f.spans.length:0,R=T-S;R>0&&this.recordDroppedEvent("before_send","span",R)}let h=f.transaction_info;if(a&&h&&f.transaction!==e.transaction){let T="custom";f.transaction_info={...h,source:T}}return this.sendEvent(f,n),f}).then(null,f=>{throw zB(f)||WB(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),um(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
21
|
+
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===cp&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{let[o,s]=n.split(":");return{reason:o,category:s,quantity:r}})}_flushOutcomes(){C&&g.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){C&&g.log("No outcomes to send");return}if(!this._dsn){C&&g.log("No dsn provided, will not send outcomes");return}C&&g.log("Sending outcomes:",e);let n=FB(e,this._options.tunnel&&Bn(this._dsn));this.sendEnvelope(n)}};function QB(t){return t==="replay_event"?"replay":t||"error"}function Ace(t,e){let n=`${e} must return \`null\` or a valid event.`;if(Lt(t))return t.then(r=>{if(!Mo(r)&&r!==null)throw um(n);return r},r=>{throw um(`${e} rejected with ${r}`)});if(!Mo(t)&&t!==null)throw um(n);return t}function Rce(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i,ignoreSpans:a}=e,c=n;if(Sy(c)&&o)return o(c,r);if(e1(c)){if(i||a){let l=VB(c);if(a?.length&&Zl(l,a))return null;if(i){let p=i(l);p?c=gs(n,qB(p)):Jl()}if(c.spans){let p=[],d=c.spans;for(let f of d){if(a?.length&&Zl(f,a)){pB(d,f);continue}if(i){let m=i(f);m?p.push(m):(Jl(),p.push(f))}else p.push(f)}let _=c.spans.length-p.length;_&&t.recordDroppedEvent("before_send","span",_),c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(c,r)}}return c}function Sy(t){return t.type===void 0}function e1(t){return t.type==="transaction"}function yce(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+t1(t.attributes)}function Ice(t){let e=0;return t.message&&(e+=t.message.length*2),e+t1(t.attributes)}function t1(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*XB(n[0]):Yl(n)?e+=XB(n):e+=100}),e}function XB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function n1(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n?.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=Bn(o)),e&&(s.trace=e);let i=Oce(t);return un(s,[i])}function Oce(t){return[{type:"check_in"},t]}function r1(t){let e=t._metadata?.sdk,n=e?.name&&e?.version?`${e?.name}/${e?.version}`:void 0;t.transportOptions={...t.transportOptions,headers:{...n&&{"user-agent":n},...t.transportOptions?.headers}}}function o1(t,e){return t(e.stack||"",1)}function Nce(t){return Kr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function bce(t){return Nce(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function gy(t,e){let n={type:e.name||e.constructor.name,value:bce(e)},r=o1(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Cce(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function Pce(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=LR(t);if(NR(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=Mce(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function Mce(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function xce(t,e,n,r){if(Kr(n))return[n,void 0];if(e.synthetic=!0,Mo(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:ny(n,s)},a=Cce(n);if(a)return[a,i];let c=Pce(n),l=r?.syntheticException||new Error(c);return l.message=c,[l,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function s1(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=xce(t,s,n,r),c={exception:{values:[gy(e,i)]}};return a&&(c.extra=a),GR(c,void 0,void 0),yc(c,s),{...c,event_id:r?.event_id}}function i1(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=o1(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},yc(s,{synthetic:!0}))}if(Ac(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}var pp=class extends lm{constructor(e){uB(),r1(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,n){let r=s1(this,this._options.stackParser,e,n);return r.level="error",wo(r)}eventFromMessage(e,n="info",r){return wo(i1(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return a1(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&a1(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:_t();if(!this._isEnabled())return C&&g.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,l={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(l.duration=e.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,d]=DB(this,r);d&&(l.contexts={trace:d});let _=n1(l,p,this.getSdkMetadata(),c,this.getDsn());return C&&g.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(_),o}dispose(){C&&g.log("Disposing client...");for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Uc(up)}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function a1(t){let e=ue().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}var Ay=new Set;function Ry(t){t.forEach(e=>{Ay.add(e),C&&g.log(`AI provider "${e}" wrapping will be skipped`)})}function Ki(t){return Ay.has(t)}function yy(){Ay.clear(),C&&g.log("Cleared AI provider skip registrations")}var vce=new Set(["false","f","n","no","off","0"]),Lce=new Set(["true","t","y","yes","on","1"]);function wc(t,e){let n=String(t).toLowerCase();return vce.has(n)?!1:Lce.has(n)?!0:e?.strict?null:!!t}var Dce="thismessage:/";function Iy(t){return"isRelative"in t}function dp(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=e??(n?Dce:void 0);try{if("canParse"in URL&&!URL.canParse(t,r))return;let o=new URL(t,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function c1(t){if(Iy(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function Uce(t,e,n,r){let o=n?.method?.toUpperCase()??"GET",s=r||(t?e==="client"?c1(t):t.pathname:"/");return`${o} ${s}`}function Oy(t,e,n,r,o){let s={[W]:n,[Ue]:"url"};return o&&(s[e==="server"?"http.route":"url.template"]=o,s[Ue]="route"),r?.method&&(s[QR]=r.method.toUpperCase()),t&&(t.search&&(s["url.query"]=t.search),t.hash&&(s["url.fragment"]=t.hash),t.pathname&&(s["url.path"]=t.pathname,t.pathname==="/"&&(s[Ue]="route")),Iy(t)||(s[As]=t.href,t.port&&(s["url.port"]=t.port),t.protocol&&(s["url.scheme"]=t.protocol),t.hostname&&(s[e==="server"?"server.address":"url.domain"]=t.hostname))),[Uce(t,e,r,o),s]}function bs(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ko(t){return t.split(/[?#]/,1)[0]}function Cs(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}function kc(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=t.includes(";base64,"),s=t.indexOf(","),i="";if(e&&s!==-1){let a=t.slice(s+1);i=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${o?",base64":""}${i?`,${i}`:""}`}return t}function Qi(t,e,n=[e],r="npm"){let o=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${e}`,o.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:pe})),o.version=pe)}function Gc(t={}){let e=t.client||H();if(!sm()||!e)return{};let n=cn(),r=Or(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||he(),s=t.span||nr();if(!s&&VR())return{};let i=s?Yf(s):wce(o),a=s?Je(s):Jr(e,o),c=Vi(a);if(!Ff.test(i))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":i,baggage:c};return t.propagateTraceparent&&(p.traceparent=s?aB(s):kce(o)),p}function wce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Rs(e,r,n)}function kce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return ys(e,r,n)}var u1="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Xi(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return C&&!r&&g.log(u1,t),r;let o=Ts(t,e);return n?.set(t,o),C&&!o&&g.log(u1,t),o}function Ny(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=t(),r}function l(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function p(){return o!==void 0||s!==void 0?c():r}function d(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return d.cancel=l,d.flush=p,d}function _1(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function _p(t){let e=t.headers||{},r=(typeof e["x-forwarded-host"]=="string"?e["x-forwarded-host"]:void 0)||(typeof e.host=="string"?e.host:void 0),s=(typeof e["x-forwarded-proto"]=="string"?e["x-forwarded-proto"]:void 0)||t.protocol||(t.socket?.encrypted?"https":"http"),i=t.url||"",a=Gce({url:i,host:r,protocol:s}),c=t.body||void 0,l=t.cookies;return{url:a,method:t.method,query_string:f1(i),headers:_1(e),cookies:l,data:c}}function Gce({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}var l1=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","set-cookie","cookie"],Bce=["x-forwarded-","-user"];function pm(t,e=!1,n="request"){let r={};try{Object.entries(t).forEach(([o,s])=>{if(s==null)return;let i=o.toLowerCase();if((i==="cookie"||i==="set-cookie")&&typeof s=="string"&&s!==""){let c=i==="set-cookie",l=s.indexOf(";"),p=c&&l!==-1?s.substring(0,l):s,d=c?[p]:p.split("; ");for(let _ of d){let f=_.indexOf("="),m=f!==-1?_.substring(0,f):_,h=f!==-1?_.substring(f+1):"",T=m.toLowerCase();d1(r,i,T,h,e,n)}}else d1(r,i,"",s,e,n)})}catch{}return r}function p1(t){return t.replace(/-/g,"_")}function d1(t,e,n,r,o,s){let i=jce(n||e,r,o);if(i==null)return;let a=`http.${s}.header.${p1(e)}${n?`.${p1(n)}`:""}`;t[a]=i}function jce(t,e,n){if(n?l1.some(o=>t.includes(o)):[...Bce,...l1].some(o=>t.includes(o)))return"[Filtered]";if(Array.isArray(e))return e.map(o=>o!=null?String(o):o).join(";");if(typeof e=="string")return e}function f1(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var Hce=100;function rr(t,e){let n=H(),r=ue();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=Hce}=n.getOptions();if(s<=0)return;let a={timestamp:vo(),...t},c=o?Qe(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var m1,Fce="FunctionToString",h1=new WeakMap,Vce=()=>({name:Fce,setupOnce(){m1=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=vR(this),n=h1.has(H())&&e!==void 0?e:this;return m1.apply(n,t)}}catch{}},setup(t){h1.set(t,!0)}}),dm=Vce;var qce=[/^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$/],$ce="EventFilters",by=(t={})=>{let e;return{name:$ce,setup(n){let r=n.getOptions();e=T1(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=T1(t,s)}return Yce(n,e)?null:n}}},fm=(t={})=>({...by(t),name:"InboundFilters"});function T1(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:qce],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Yce(t,e){if(t.type){if(t.type==="transaction"&&zce(t,e.ignoreTransactions))return C&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
22
|
+
Event: ${Es(t)}`),!0}else{if(Wce(t,e.ignoreErrors))return C&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
23
|
+
Event: ${Es(t)}`),!0;if(Jce(t))return C&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
24
|
+
Event: ${Es(t)}`),!0;if(Kce(t,e.denyUrls))return C&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
25
25
|
Event: ${Es(t)}.
|
|
26
|
-
Url: ${
|
|
26
|
+
Url: ${_m(t)}`),!0;if(!Qce(t,e.allowUrls))return C&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
27
27
|
Event: ${Es(t)}.
|
|
28
|
-
Url: ${dm(t)}`),!0}return!1}function Yce(t,e){return e?.length?am(t).some(n=>Ts(n,e)):!1}function Wce(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Ts(n,e):!1}function zce(t,e){if(!e?.length)return!1;let n=dm(t);return n?Ts(n,e):!1}function Kce(t,e){if(!e?.length)return!0;let n=dm(t);return n?Ts(n,e):!0}function Qce(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function dm(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Qce(n):null}catch{return C&&g.error(`Cannot extract url for event ${Es(t)}`),null}}function Xce(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function g1(t,e,n,r,o,s){if(!o.exception?.values||!s||!Qr(s.originalException,Error))return;let i=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;i&&(o.exception.values=Cy(t,e,r,s.originalException,n,o.exception.values,i,0))}function Cy(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(Qr(r[o],Error)){E1(i,a,r);let l=t(e,r[o]),p=c.length;S1(l,o,p,a),c=Cy(t,e,n,r[o],o,[l,...c],l,p)}return A1(r)&&r.errors.forEach((l,p)=>{if(Qr(l,Error)){E1(i,a,r);let d=t(e,l),_=c.length;S1(d,`errors[${p}]`,_,a),c=Cy(t,e,n,l,o,[d,...c],d,_)}}),c}function A1(t){return Array.isArray(t.errors)}function E1(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...A1(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function S1(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var Jce="cause",Zce=5,eue="LinkedErrors",tue=(t={})=>{let e=t.limit||Zce,n=t.key||Jce;return{name:eue,preprocessEvent(r,o,s){let i=s.getOptions();g1(gy,i.stackParser,n,e,r,o)}}},fm=tue;function R1(t){let e={},n=0;for(;n<t.length;){let r=t.indexOf("=",n);if(r===-1)break;let o=t.indexOf(";",n);if(o===-1)o=t.length;else if(o<r){n=t.lastIndexOf(";",r-1)+1;continue}let s=t.slice(n,r).trim();if(e[s]===void 0){let i=t.slice(r+1,o).trim();i.charCodeAt(0)===34&&(i=i.slice(1,-1));try{e[s]=i.indexOf("%")!==-1?decodeURIComponent(i):i}catch{e[s]=i}}n=o+1}return e}var Py=["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 y1(t){let e={};for(let s of Object.keys(t))e[s.toLowerCase()]=t[s];return Py.map(s=>{let i=e[s.toLowerCase()],a=Array.isArray(i)?i.join(";"):i;return s==="Forwarded"?nue(a):a?.split(",").map(c=>c.trim())}).reduce((s,i)=>i?s.concat(i):s,[]).find(s=>s!==null&&rue(s))||null}function nue(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function rue(t){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(t)}var oue={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},sue="RequestData",iue=(t={})=>{let e={...oue,...t.include};return{name:sue,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&aue(n,i,{ipAddress:a},c),n}}},mm=iue;function aue(t,e,n,r){if(t.request={...t.request,...cue(e,r)},r.ip){let o=e.headers&&y1(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function cue(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||Py.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?R1(r.cookie):void 0);n.cookies=o||{}}return e.query_string&&(n.query_string=t.query_string),e.data&&(n.data=t.data),n}function I1(t){let e="console";Tc(e,t),Ec(e,uue)}function uue(){"console"in J&&Vl.forEach(function(t){t in J.console&&xR(J.console,t,function(e){return hc[t]=e,function(...n){Sc("console",{args:n,level:t}),hc[t]?.apply(J.console,n)}})})}function O1(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var lue=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function pue(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=lue.exec(e);return n?n.slice(1):[]}function My(t){let e=pue(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var due=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,hm=Symbol("sentryPostgresConnectionContext"),xy=Symbol.for("sentry.instrumented.postgresjs"),_ue=Symbol.for("sentry.query.from.instrumented.sql");function Ly(t,e){return!t||typeof t!="function"?(C&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),t):vy(t,{requireParentSpan:!0,...e})}function vy(t,e,n){if(t[xy])return t;let r=new Proxy(t,{apply(o,s,i){let a=Reflect.apply(o,s,i);return a&&typeof a=="object"&&"handle"in a&&b1(a,r,e),a},get(o,s){let i=o[s];return typeof s!="string"||typeof i!="function"?i:s==="unsafe"||s==="file"?fue(i,o,r,e):s==="begin"||s==="reserve"?mue(i,o,r,e):i}});return n?r[hm]=n:gue(t,r),t[xy]=!0,r[xy]=!0,r}function fue(t,e,n,r){return function(...o){let s=Reflect.apply(t,e,o);return s&&typeof s=="object"&&"handle"in s&&b1(s,n,r),s}}function mue(t,e,n,r){return function(...o){let s=n[hm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(t,e,o);return p&&typeof p.then=="function"?p.then(d=>vy(d,r,s)):p}let a=o.length===1?o[0]:o[1],c=function(p){let d=vy(p,r,s);return a(d)},l=o.length===1?[c]:[o[0],c];return Reflect.apply(t,e,l)}}function b1(t,e,n){if(t.handle?.__sentryWrapped)return;t[_ue]=!0;let r=t.handle,o=async function(...s){if(!hue(n))return r.apply(this,s);let i=Tue(t.strings),a=Eue(i);return It({name:a||"postgresjs.query",op:"db"},c=>{c.setAttribute(W,"auto.db.postgresjs"),c.setAttributes({"db.system.name":"postgres","db.query.text":a});let l=e?e[hm]:void 0;if(Sue(c,l),n.requestHook)try{n.requestHook(c,a,l)}catch(d){c.setAttribute("sentry.hook.error","requestHook failed"),C&&g.error("Error in requestHook for PostgresJs instrumentation:",d)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(d,_,f)=>{try{N1(c,a,f?.[0]?.command),c.end()}catch(m){C&&g.error("Error ending span in resolve callback:",m)}return Reflect.apply(d,_,f)}}),p.reject=new Proxy(p.reject,{apply:(d,_,f)=>{try{c.setStatus({code:2,message:f?.[0]?.message||"unknown_error"}),c.setAttribute("db.response.status_code",f?.[0]?.code||"unknown"),c.setAttribute("error.type",f?.[0]?.name||"unknown"),N1(c,a),c.end()}catch(m){C&&g.error("Error ending span in reject callback:",m)}return Reflect.apply(d,_,f)}});try{return r.apply(this,s)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})};o.__sentryWrapped=!0,t.handle=o}function hue(t){return nr()!==void 0||!t.requireParentSpan}function Tue(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((e,n,r)=>r===0?n:`${e}$${r}${n}`,"")}function Eue(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"}function Sue(t,e){if(e&&(e.ATTR_DB_NAMESPACE&&t.setAttribute("db.namespace",e.ATTR_DB_NAMESPACE),e.ATTR_SERVER_ADDRESS&&t.setAttribute("server.address",e.ATTR_SERVER_ADDRESS),e.ATTR_SERVER_PORT!==void 0)){let n=parseInt(e.ATTR_SERVER_PORT,10);isNaN(n)||t.setAttribute("server.port",n)}}function N1(t,e,n){if(n){t.setAttribute("db.operation.name",n);return}let r=e?.match(due);r?.[1]&&t.setAttribute("db.operation.name",r[1].toUpperCase())}function gue(t,e){let n=t;if(!n.options||typeof n.options!="object")return;let r=n.options,o=r.host?.[0]||"localhost",s=r.port?.[0]||5432,i={ATTR_DB_NAMESPACE:typeof r.database=="string"&&r.database!==""?r.database:void 0,ATTR_SERVER_ADDRESS:o,ATTR_SERVER_PORT:String(s)};e[hm]=i}var Aue="Console",Tm=(t={})=>{let e=new Set(t.levels||Vl);return{name:Aue,setup(n){I1(({args:r,level:o})=>{H()!==n||!e.has(o)||Rue(o,r)})}}};function Rue(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:O1(t),message:C1(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${C1(r)}`:"Assertion failed",n.data.arguments=r}else return;rr(n,{input:e,level:t})}function C1(t){return"util"in J&&typeof J.util.format=="function"?J.util.format(...t):UR(t," ")}var yue="ConversationId",Iue=()=>({name:yue,setup(t){t.on("spanStart",e=>{let n=he().getScopeData(),r=ue().getScopeData(),o=n.conversationId||r.conversationId;o&&e.setAttribute(XR,o)})}}),Dy=Iue;var P1="gen_ai.prompt",Ps="gen_ai.system",He="gen_ai.request.model",Gc="gen_ai.request.stream",Ms="gen_ai.request.temperature",Bc="gen_ai.request.max_tokens",xs="gen_ai.request.frequency_penalty",jc="gen_ai.request.presence_penalty",vs="gen_ai.request.top_p",Em="gen_ai.request.top_k",M1="gen_ai.request.encoding_format",x1="gen_ai.request.dimensions",yn="gen_ai.response.finish_reasons",ft="gen_ai.response.model",or="gen_ai.response.id",v1="gen_ai.response.stop_reason",Pe="gen_ai.usage.input_tokens",Ze="gen_ai.usage.output_tokens",ln="gen_ai.usage.total_tokens",Dt="gen_ai.operation.name",pn="sentry.sdk_meta.gen_ai.input.messages.original_length",Ut="gen_ai.input.messages",L1="gen_ai.output.messages",Hn="gen_ai.system_instructions",rt="gen_ai.response.text",Zr="gen_ai.request.available_tools",Xi="gen_ai.response.streaming",Ot="gen_ai.response.tool_calls",Uy="gen_ai.agent.name",D1="gen_ai.pipeline.name",_p="gen_ai.conversation.id",U1="gen_ai.usage.cache_creation_input_tokens",w1="gen_ai.usage.cache_read_input_tokens",wy="gen_ai.usage.input_tokens.cache_write",Ls="gen_ai.usage.input_tokens.cached",Sm="gen_ai.invoke_agent",k1="gen_ai.generate_text",G1="gen_ai.stream_text",B1="gen_ai.generate_object",j1="gen_ai.stream_object",Hc="gen_ai.embeddings.input",H1="gen_ai.embeddings",F1="gen_ai.embeddings",V1="gen_ai.rerank",q1="gen_ai.execute_tool",Ji="gen_ai.tool.name",ky="gen_ai.tool.call.id",Gy="gen_ai.tool.type",gm="gen_ai.tool.input",Am="gen_ai.tool.output",$1="gen_ai.tool.description",By="openai.response.id",jy="openai.response.model",Hy="openai.response.timestamp",Y1="openai.usage.completion_tokens",W1="openai.usage.prompt_tokens",Fy="anthropic.response.timestamp";var fp=new Map,Vy=new Set(["ai.generateText","ai.streamText","ai.generateObject","ai.streamObject"]),qy=new Set(["ai.generateText.doGenerate","ai.streamText.doStream","ai.generateObject.doGenerate","ai.streamObject.doStream"]),z1=new Set(["ai.embed.doEmbed","ai.embedMany.doEmbed"]),K1=new Set(["ai.rerank.doRerank"]),Q1={"ai.embed.doEmbed":"embeddings","ai.embedMany.doEmbed":"embeddings","ai.rerank.doRerank":"rerank"};function Ds(t){return!t||typeof t!="object"?!1:Nue(t)||J1(t)||Oue(t)||Z1(t)||ej(t)||bue(t)||Cue(t)||Pue(t)||Mue(t)||xue(t)||vue(t)||Lue(t)}function Oue(t){return"image_url"in t?typeof t.image_url=="string"?t.image_url.startsWith("data:"):X1(t):!1}function X1(t){return"image_url"in t&&!!t.image_url&&typeof t.image_url=="object"&&"url"in t.image_url&&typeof t.image_url.url=="string"&&t.image_url.url.startsWith("data:")}function Nue(t){return"type"in t&&typeof t.type=="string"&&"source"in t&&Ds(t.source)}function J1(t){return"inlineData"in t&&!!t.inlineData&&typeof t.inlineData=="object"&&"data"in t.inlineData&&typeof t.inlineData.data=="string"}function Z1(t){return"type"in t&&t.type==="input_audio"&&"input_audio"in t&&!!t.input_audio&&typeof t.input_audio=="object"&&"data"in t.input_audio&&typeof t.input_audio.data=="string"}function ej(t){return"type"in t&&t.type==="file"&&"file"in t&&!!t.file&&typeof t.file=="object"&&"file_data"in t.file&&typeof t.file.file_data=="string"}function bue(t){return"media_type"in t&&typeof t.media_type=="string"&&"data"in t}function Cue(t){return"type"in t&&t.type==="file"&&"mediaType"in t&&typeof t.mediaType=="string"&&"data"in t&&typeof t.data=="string"&&!t.data.startsWith("http://")&&!t.data.startsWith("https://")}function Pue(t){return"type"in t&&t.type==="image"&&"image"in t&&typeof t.image=="string"&&!t.image.startsWith("http://")&&!t.image.startsWith("https://")}function Mue(t){return"type"in t&&(t.type==="blob"||t.type==="base64")}function xue(t){return"b64_json"in t}function vue(t){return"type"in t&&"result"in t&&t.type==="image_generation"}function Lue(t){return"uri"in t&&typeof t.uri=="string"&&t.uri.startsWith("data:")}var mp="[Blob substitute]",Due=["image_url","data","content","b64_json","result","uri","image"];function Zi(t){let e={...t};Ds(e.source)&&(e.source=Zi(e.source)),J1(t)&&(e.inlineData={...t.inlineData,data:mp}),X1(t)&&(e.image_url={...t.image_url,url:mp}),Z1(t)&&(e.input_audio={...t.input_audio,data:mp}),ej(t)&&(e.file={...t.file,file_data:mp});for(let n of Due)typeof e[n]=="string"&&(e[n]=mp);return e}var nj=2e4,Rm=t=>new TextEncoder().encode(t).length,Yy=t=>Rm(JSON.stringify(t));function ym(t,e){if(Rm(t)<=e)return t;let n=0,r=t.length,o="";for(;n<=r;){let s=Math.floor((n+r)/2),i=t.slice(0,s);Rm(i)<=e?(o=i,n=s+1):r=s-1}return o}function Uue(t){return typeof t=="string"?t:"text"in t&&typeof t.text=="string"?t.text:""}function tj(t,e){return typeof t=="string"?e:{...t,text:e}}function wue(t){return t!==null&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function rj(t){return t!==null&&typeof t=="object"&&"content"in t&&Array.isArray(t.content)}function oj(t){return t!==null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)&&t.parts.length>0}function kue(t,e){let n={...t,content:""},r=Yy(n),o=e-r;if(o<=0)return[];let s=ym(t.content,o);return[{...t,content:s}]}function Gue(t){return"parts"in t&&Array.isArray(t.parts)?{key:"parts",items:t.parts}:"content"in t&&Array.isArray(t.content)?{key:"content",items:t.content}:{key:null,items:[]}}function Bue(t,e){let{key:n,items:r}=Gue(t);if(n===null||r.length===0)return[];let o=r.map(c=>tj(c,"")),s=Yy({...t,[n]:o}),i=e-s;if(i<=0)return[];let a=[];for(let c of r){let l=Uue(c),p=Rm(l);if(p<=i)a.push(c),i-=p;else if(a.length===0){let d=ym(l,i);d&&a.push(tj(c,d));break}else break}return a.length<=0?[]:[{...t,[n]:a}]}function jue(t,e){if(!t)return[];if(typeof t=="string"){let n=ym(t,e);return n?[n]:[]}return typeof t!="object"?[]:wue(t)?kue(t,e):rj(t)||oj(t)?Bue(t,e):[]}function $y(t){return t.map(n=>{let r;return n&&typeof n=="object"&&(rj(n)?r={...n,content:$y(n.content)}:"content"in n&&Ds(n.content)&&(r={...n,content:Zi(n.content)}),oj(n)&&(r={...r??n,parts:$y(n.parts)}),Ds(r)?r=Zi(r):Ds(n)&&(r=Zi(n))),r??n})}function Hue(t,e){if(!Array.isArray(t)||t.length===0)return t;let n=e-2,r=t[t.length-1],o=$y([r]),s=o[0];return Yy(s)<=n?o:jue(s,n)}function Us(t){return Hue(t,nj)}function sj(t){return ym(t,nj)}function eo(t){let e=!!H()?.getOptions().sendDefaultPii;return{...t,recordInputs:t?.recordInputs??e,recordOutputs:t?.recordOutputs??e}}function Fc(t,e){return t?`${t}.${e}`:e}function hp(t,e,n,r,o){if(e!==void 0&&t.setAttributes({[Pe]:e}),n!==void 0&&t.setAttributes({[Ze]:n}),e!==void 0||n!==void 0||r!==void 0||o!==void 0){let s=(e??0)+(n??0)+(r??0)+(o??0);t.setAttributes({[ln]:s})}}function ea(t){if(typeof t=="string")return sj(t);if(Array.isArray(t)){let e=Us(t);return JSON.stringify(e)}return JSON.stringify(t)}function Fn(t){if(!Array.isArray(t))return{systemInstructions:void 0,filteredMessages:t};let e=t.findIndex(i=>i&&typeof i=="object"&&"role"in i&&i.role==="system");if(e===-1)return{systemInstructions:void 0,filteredMessages:t};let n=t[e],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:t};let o=JSON.stringify([{type:"text",content:r}]),s=[...t.slice(0,e),...t.slice(e+1)];return{systemInstructions:o,filteredMessages:s}}async function Fue(t,e,n){let r=t.catch(i=>{throw te(i,{mechanism:{handled:!1,type:n}}),i}),o=await e,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:o}:o}function Vc(t,e,n){return Lt(t)?new Proxy(t,{get(r,o){let i=o in Promise.prototype||o===Symbol.toStringTag?e:r,a=Reflect.get(i,o);return o==="withResponse"&&typeof a=="function"?function(){let l=a.call(r);return Fue(l,e,n)}:typeof a=="function"?a.bind(i):a}}):e}var Im="operation.name",ij="ai.operationId",Om="ai.prompt",aj="ai.schema",cj="ai.response.object",Wy="ai.values",zy="ai.response.text",Ky="ai.response.toolCalls",uj="ai.response.finishReason",ta="ai.prompt.messages",qc="ai.prompt.tools",Tp="ai.model.id",lj="ai.response.providerMetadata",pj="ai.usage.cachedInputTokens",dj="ai.telemetry.functionId",_j="ai.usage.completionTokens",fj="ai.usage.promptTokens",mj="ai.usage.tokens",Qy="ai.toolCall.name",Xy="ai.toolCall.id",hj="ai.toolCall.args",Tj="ai.toolCall.result";function Sj(t,e){let n=t.parent_span_id;if(!n)return;let r=t.data[Pe],o=t.data[Ze];if(typeof r=="number"||typeof o=="number"){let s=e.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(s.inputTokens+=r),typeof o=="number"&&(s.outputTokens+=o),e.set(n,s)}}function Jy(t,e){let n=e.get(t.span_id);!n||!t.data||(n.inputTokens>0&&(t.data[Pe]=n.inputTokens),n.outputTokens>0&&(t.data[Ze]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(t.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function Vue(t){let e=new Map;for(let n of t){let r=n.data[Zr];if(typeof r=="string")try{let o=JSON.parse(r);for(let s of o)s.name&&s.description&&!e.has(s.name)&&e.set(s.name,s.description)}catch{}}return e}function gj(t,e){let n=Vue(t);for(let r of t){if(r.op==="gen_ai.execute_tool"){let o=r.data[Ji];if(typeof o=="string"){let s=n.get(o);s&&(r.data[$1]=s)}}r.op==="gen_ai.invoke_agent"&&Jy(r,e)}}function Zy(t){return fp.get(t)}function eI(t){fp.delete(t)}function Aj(t){let e=t.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(e)}function Ej(t){return t.filter(e=>!!e&&typeof e=="object"&&"role"in e&&"content"in e)}function que(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"){let{messages:n}=e,{prompt:r,system:o}=e,s=[];if(typeof o=="string"&&s.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return s.push(...Ej(n)),s;if(Array.isArray(r))return s.push(...Ej(r)),s;if(typeof r=="string"&&s.push({role:"user",content:r}),s.length>0)return s}}catch{}return[]}function Rj(t,e){if(typeof e[Om]=="string"&&!e[Ut]&&!e[ta]){let n=e[Om],r=que(n);if(r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0,a=ea(s);t.setAttributes({[Om]:a,[Ut]:a,[pn]:i})}}else if(typeof e[ta]=="string")try{let n=JSON.parse(e[ta]);if(Array.isArray(n)){let{systemInstructions:r,filteredMessages:o}=Fn(n);r&&t.setAttribute(Hn,r);let s=Array.isArray(o)?o.length:0,i=ea(o);t.setAttributes({[ta]:i,[Ut]:i,[pn]:s})}}catch{}}function yj(t){switch(t){case"ai.generateText":case"ai.streamText":case"ai.generateObject":case"ai.streamObject":return Sm;case"ai.generateText.doGenerate":return k1;case"ai.streamText.doStream":return G1;case"ai.generateObject.doGenerate":return B1;case"ai.streamObject.doStream":return j1;case"ai.embed.doEmbed":return H1;case"ai.embedMany.doEmbed":return F1;case"ai.rerank.doRerank":return V1;case"ai.toolCall":return q1;default:return t.startsWith("ai.stream")?"ai.run":void 0}}function $ue(t){return Vy.has(t)?"invoke_agent":qy.has(t)?"generate_content":z1.has(t)?"embeddings":K1.has(t)?"rerank":t==="ai.toolCall"?"execute_tool":t}function Yue(t){let{data:e,description:n}=Y(t);if(n){if(e[Qy]&&e[Xy]&&n==="ai.toolCall"){Xue(t,e);return}!e[ij]&&!n.startsWith("ai.")||Jue(t,n,e)}}function Wue(t){if(t.type==="transaction"&&t.spans){let e=new Map;for(let r of t.spans)Que(r),Sj(r,e);gj(t.spans,e);let n=t.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Jy(n,e)}return t}function zue(t){if(typeof t!="string")return"stop";switch(t){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return t;default:return t}}function Kue(t){let e=t[zy],n=t[Ky],r=t[uj];if(e==null&&n==null)return;let o=[];if(typeof e=="string"&&e.length>0&&o.push({type:"text",content:e}),n!=null)try{let s=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(s)){for(let i of s){let a=i.input??i.args;o.push({type:"tool_call",id:i.toolCallId,name:i.toolName,arguments:typeof a=="string"?a:JSON.stringify(a??{})})}delete t[Ky]}}catch{}if(o.length>0){let s={role:"assistant",parts:o,finish_reason:zue(r)};t[L1]=JSON.stringify([s]),delete t[zy]}}function Que(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){if(t.status&&t.status!=="ok"&&(t.status="internal_error"),wt(e,_j,Ze),wt(e,fj,Pe),wt(e,pj,Ls),wt(e,"ai.usage.inputTokens",Pe),wt(e,"ai.usage.outputTokens",Ze),wt(e,mj,Pe),wt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),typeof e[Pe]=="number"&&typeof e[Ls]=="number"&&(e[Pe]=e[Pe]+e[Ls]),typeof e[Pe]=="number"){let r=typeof e[Ze]=="number"?e[Ze]:0;e[ln]=r+e[Pe]}if(e[qc]&&Array.isArray(e[qc])&&(e[qc]=Aj(e[qc])),e[Im]){let r=$ue(e[Im]);e[Dt]=r,delete e[Im]}if(wt(e,ta,Ut),Kue(e),wt(e,cj,"gen_ai.response.object"),wt(e,qc,"gen_ai.request.available_tools"),wt(e,hj,gm),wt(e,Tj,Am),wt(e,aj,"gen_ai.request.schema"),wt(e,Tp,He),Array.isArray(e[Wy])){let r=e[Wy].map(o=>{try{return JSON.parse(o)}catch{return o}});e[Hc]=r.length===1?r[0]:JSON.stringify(r)}Zue(e);for(let r of Object.keys(e))r.startsWith("ai.")&&wt(e,r,`vercel.${r}`)}}function wt(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function Xue(t,e){t.setAttribute(W,"auto.vercelai.otel"),t.setAttribute(ee,"gen_ai.execute_tool"),t.setAttribute(Dt,"execute_tool"),wt(e,Qy,Ji),wt(e,Xy,ky);let n=e[ky];typeof n=="string"&&fp.set(n,t.spanContext()),e[Gy]||t.setAttribute(Gy,"function");let r=e[Ji];r&&t.updateName(`execute_tool ${r}`)}function Jue(t,e,n){t.setAttribute(W,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[dj];o&&typeof o=="string"&&t.setAttribute("gen_ai.function_id",o),Rj(t,n),n[Tp]&&!n[ft]&&t.setAttribute(ft,n[Tp]),t.setAttribute("ai.streaming",e.includes("stream"));let s=yj(e);if(s&&t.setAttribute(ee,s),Vy.has(e)){o&&typeof o=="string"?t.updateName(`invoke_agent ${o}`):t.updateName("invoke_agent");return}let i=n[Tp];if(i){let a=qy.has(e)?"generate_content":Q1[e];a&&t.updateName(`${a} ${i}`)}}function Nm(t){t.on("spanStart",Yue),t.addEventProcessor(Object.assign(Wue,{id:"VercelAiEventProcessor"}))}function Zue(t){let e=t[lj];if(e)try{let n=JSON.parse(e),r=n.openai??n.azure;if(r&&(vr(t,Ls,r.cachedPromptTokens),vr(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),vr(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),vr(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),t["gen_ai.conversation.id"]||vr(t,"gen_ai.conversation.id",r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;vr(t,Ls,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;vr(t,wy,s)}n.bedrock?.usage&&(vr(t,Ls,n.bedrock.usage.cacheReadInputTokens),vr(t,wy,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(vr(t,Ls,n.deepseek.promptCacheHitTokens),vr(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function vr(t,e,n){n!=null&&(t[e]=n)}var ws="OpenAI",Ij={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},ele=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],Oj=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...ele];function Nj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function bj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function Cj(t){if(t===null||typeof t!="object"||!("object"in t))return!1;let e=t;return e.object==="list"&&typeof e.model=="string"&&e.model.toLowerCase().includes("embedding")}function Pj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="conversation"}function Mj(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.startsWith("response.")}function xj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion.chunk"}function vj(t,e,n){if(bm(t,e.id,e.model,e.created),e.usage&&Ep(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let r=e.choices.map(o=>o.finish_reason).filter(o=>o!==null);if(r.length>0&&t.setAttributes({[yn]:JSON.stringify(r)}),n){let o=e.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Lj(t,e,n){if(bm(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[yn]:JSON.stringify([e.status])}),e.usage&&Ep(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens),n){let r=e;if(Array.isArray(r.output)&&r.output.length>0){let o=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Dj(t,e){t.setAttributes({[jy]:e.model,[ft]:e.model}),e.usage&&Ep(t,e.usage.prompt_tokens,void 0,e.usage.total_tokens)}function Uj(t,e){let{id:n,created_at:r}=e;t.setAttributes({[By]:n,[or]:n,[_p]:n}),r&&t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function Ep(t,e,n,r){e!==void 0&&t.setAttributes({[W1]:e,[Pe]:e}),n!==void 0&&t.setAttributes({[Y1]:n,[Ze]:n}),r!==void 0&&t.setAttributes({[ln]:r})}function bm(t,e,n,r){t.setAttributes({[By]:e,[or]:e}),t.setAttributes({[jy]:n,[ft]:n}),t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function tle(t){if("conversation"in t&&typeof t.conversation=="string")return t.conversation;if("previous_response_id"in t&&typeof t.previous_response_id=="string")return t.previous_response_id}function wj(t){let e={[He]:t.model??"unknown"};"temperature"in t&&(e[Ms]=t.temperature),"top_p"in t&&(e[vs]=t.top_p),"frequency_penalty"in t&&(e[xs]=t.frequency_penalty),"presence_penalty"in t&&(e[jc]=t.presence_penalty),"stream"in t&&(e[Gc]=t.stream),"encoding_format"in t&&(e[M1]=t.encoding_format),"dimensions"in t&&(e[x1]=t.dimensions);let n=tle(t);return n&&(e[_p]=n),e}function nle(t,e){for(let n of t){let r=n.index;if(!(r===void 0||!n.function))if(!(r in e.chatCompletionToolCalls))e.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=e.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function rle(t,e,n){e.responseId=t.id??e.responseId,e.responseModel=t.model??e.responseModel,e.responseTimestamp=t.created??e.responseTimestamp,t.usage&&(e.promptTokens=t.usage.prompt_tokens,e.completionTokens=t.usage.completion_tokens,e.totalTokens=t.usage.total_tokens);for(let r of t.choices??[])n&&(r.delta?.content&&e.responseTexts.push(r.delta.content),r.delta?.tool_calls&&nle(r.delta.tool_calls,e)),r.finish_reason&&e.finishReasons.push(r.finish_reason)}function ole(t,e,n,r){if(!(t&&typeof t=="object")){e.eventTypes.push("unknown:non-object");return}if(t instanceof Error){r.setStatus({code:2,message:"internal_error"}),te(t,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in t))return;let o=t;if(!Oj.includes(o.type)){e.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&e.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){e.responseTexts.push(o.delta);return}if("response"in o){let{response:s}=o;e.responseId=s.id??e.responseId,e.responseModel=s.model??e.responseModel,e.responseTimestamp=s.created_at??e.responseTimestamp,s.usage&&(e.promptTokens=s.usage.input_tokens,e.completionTokens=s.usage.output_tokens,e.totalTokens=s.usage.total_tokens),s.status&&e.finishReasons.push(s.status),n&&s.output_text&&e.responseTexts.push(s.output_text)}}async function*kj(t,e,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of t)xj(o)?rle(o,r,n):Mj(o)&&ole(o,r,n,e),yield o}finally{bm(e,r.responseId,r.responseModel,r.responseTimestamp),Ep(e,r.promptTokens,r.completionTokens,r.totalTokens),e.setAttributes({[Xi]:!0}),r.finishReasons.length&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&e.setAttributes({[rt]:r.responseTexts.join("")});let s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&e.setAttributes({[Ot]:JSON.stringify(s)}),e.end()}}function sle(t){let e=Array.isArray(t.tools)?t.tools:[],r=t.web_search_options&&typeof t.web_search_options=="object"?[{type:"web_search_options",...t.web_search_options}]:[],o=[...e,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(s){C&&g.error("Failed to serialize OpenAI tools:",s);return}}function ile(t,e){let n={[Ps]:"openai",[Dt]:e,[W]:"auto.ai.openai"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0],o=sle(r);o&&(n[Zr]=o),Object.assign(n,wj(r))}else n[He]="unknown";return n}function ale(t,e,n){if(!e||typeof e!="object")return;let r=e;if(Nj(r)){if(vj(t,r,n),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[rt]:JSON.stringify(o)})}}else bj(r)?(Lj(t,r,n),n&&r.output_text&&t.setAttributes({[rt]:r.output_text})):Cj(r)?Dj(t,r):Pj(r)&&Uj(t,r)}function Gj(t,e,n){if(n==="embeddings"&&"input"in e){let a=e.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;t.setAttribute(Hc,typeof a=="string"?a:JSON.stringify(a));return}let r="input"in e?e.input:"messages"in e?e.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=ea(s);t.setAttribute(Ut,i),Array.isArray(s)?t.setAttribute(pn,s.length):t.setAttribute(pn,1)}function cle(t,e,n,r,o){return function(...i){let a=n.operation,c=ile(i,a),l=c[He]||"unknown",p=i[0],d=p&&typeof p=="object"&&p.stream===!0,_={name:`${a} ${l}`,op:`gen_ai.${a}`,attributes:c};if(d){let h,T=It(_,S=>(h=t.apply(r,i),o.recordInputs&&p&&Gj(S,p,a),(async()=>{try{let R=await h;return kj(R,S,o.recordOutputs??!1)}catch(R){throw S.setStatus({code:2,message:"internal_error"}),te(R,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:e}}}),S.end(),R}})()));return Vc(h,T,"auto.ai.openai")}let f,m=xr(_,h=>(f=t.apply(r,i),o.recordInputs&&p&&Gj(h,p,a),f.then(T=>(ale(h,T,o.recordOutputs),T),T=>{throw te(T,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:e}}}),T})));return Vc(f,m,"auto.ai.openai")}}function Bj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Fc(e,String(o)),a=Ij[i];return typeof s=="function"&&a?cle(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?Bj(s,i,n):s}})}function Cm(t,e){return Bj(t,"",eo(e))}var ks="Anthropic_AI",jj={"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 Hj(t,e){if(Array.isArray(e)&&e.length===0)return;let{systemInstructions:n,filteredMessages:r}=Fn(e);n&&t.setAttributes({[Hn]:n});let o=Array.isArray(r)?r.length:1;t.setAttributes({[Ut]:ea(r),[pn]:o})}var ule={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 tI(t){return t&&ule[t]||"internal_error"}function Fj(t,e){e.error&&(t.setStatus({code:2,message:tI(e.error.type)}),te(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Vj(t){let{system:e,messages:n,input:r}=t,o=typeof e=="string"?[{role:"system",content:t.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,i=Array.isArray(n)?n:n!=null?[n]:[],a=s??i;return[...o,...a]}function lle(t,e){return"type"in t&&typeof t.type=="string"&&t.type==="error"?(e.setStatus({code:2,message:tI(t.error?.type)}),te(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function ple(t,e){if(t.type==="message_delta"&&t.usage&&"output_tokens"in t.usage&&typeof t.usage.output_tokens=="number"&&(e.completionTokens=t.usage.output_tokens),t.message){let n=t.message;n.id&&(e.responseId=n.id),n.model&&(e.responseModel=n.model),n.stop_reason&&e.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(e.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(e.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(e.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function dle(t,e){t.type!=="content_block_start"||typeof t.index!="number"||!t.content_block||(t.content_block.type==="tool_use"||t.content_block.type==="server_tool_use")&&(e.activeToolBlocks[t.index]={id:t.content_block.id,name:t.content_block.name,inputJsonParts:[]})}function _le(t,e,n){if(!(t.type!=="content_block_delta"||!t.delta)){if(typeof t.index=="number"&&"partial_json"in t.delta&&typeof t.delta.partial_json=="string"){let r=e.activeToolBlocks[t.index];r&&r.inputJsonParts.push(t.delta.partial_json)}n&&typeof t.delta.text=="string"&&e.responseTexts.push(t.delta.text)}}function fle(t,e){if(t.type!=="content_block_stop"||typeof t.index!="number")return;let n=e.activeToolBlocks[t.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}e.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete e.activeToolBlocks[t.index]}function qj(t,e,n,r){!(t&&typeof t=="object")||lle(t,r)||(ple(t,e),dle(t,e),_le(t,e,n),fle(t,e))}function mle(t,e,n){e.isRecording()&&(t.responseId&&e.setAttributes({[or]:t.responseId}),t.responseModel&&e.setAttributes({[ft]:t.responseModel}),hp(e,t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens),e.setAttributes({[Xi]:!0}),t.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(t.finishReasons)}),n&&t.responseTexts.length>0&&e.setAttributes({[rt]:t.responseTexts.join("")}),n&&t.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(t.toolCalls)}),e.end())}async function*$j(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of t)qj(o,r,n,e),yield o}finally{r.responseId&&e.setAttributes({[or]:r.responseId}),r.responseModel&&e.setAttributes({[ft]:r.responseModel}),hp(e,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),e.setAttributes({[Xi]:!0}),r.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&e.setAttributes({[rt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(r.toolCalls)}),e.end()}}function Yj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return t.on("streamEvent",o=>{qj(o,r,n,e)}),t.on("message",()=>{mle(r,e,n)}),t.on("error",o=>{te(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end())}),t}function hle(t,e,n){let r={[Ps]:"anthropic",[Dt]:n,[W]:"auto.ai.anthropic"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let o=t[0];o.tools&&Array.isArray(o.tools)&&(r[Zr]=JSON.stringify(o.tools)),r[He]=o.model??"unknown","temperature"in o&&(r[Ms]=o.temperature),"top_p"in o&&(r[vs]=o.top_p),"stream"in o&&(r[Gc]=o.stream),"top_k"in o&&(r[Em]=o.top_k),"frequency_penalty"in o&&(r[xs]=o.frequency_penalty),"max_tokens"in o&&(r[Bc]=o.max_tokens)}else e==="models.retrieve"||e==="models.get"?r[He]=t[0]:r[He]="unknown";return r}function nI(t,e){let n=Vj(e);Hj(t,n),"prompt"in e&&t.setAttributes({[P1]:JSON.stringify(e.prompt)})}function Tle(t,e){if("content"in e&&Array.isArray(e.content)){t.setAttributes({[rt]:e.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of e.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&t.setAttributes({[Ot]:JSON.stringify(n)})}"completion"in e&&t.setAttributes({[rt]:e.completion}),"input_tokens"in e&&t.setAttributes({[rt]:JSON.stringify(e.input_tokens)})}function Ele(t,e){"id"in e&&"model"in e&&(t.setAttributes({[or]:e.id,[ft]:e.model}),"created"in e&&typeof e.created=="number"&&t.setAttributes({[Fy]:new Date(e.created*1e3).toISOString()}),"created_at"in e&&typeof e.created_at=="number"&&t.setAttributes({[Fy]:new Date(e.created_at*1e3).toISOString()}),"usage"in e&&e.usage&&hp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.cache_creation_input_tokens,e.usage.cache_read_input_tokens))}function Sle(t,e,n){if(!(!e||typeof e!="object")){if("type"in e&&e.type==="error"){Fj(t,e);return}n&&Tle(t,e),Ele(t,e)}}function Wj(t,e,n){throw te(t,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end()),t}function gle(t,e,n,r,o,s,i,a,c,l,p){let d=o[He]??"unknown",_={name:`${s} ${d}`,op:`gen_ai.${s}`,attributes:o};if(l&&!p){let f,m=It(_,h=>(f=t.apply(n,r),c.recordInputs&&a&&nI(h,a),(async()=>{try{let T=await f;return $j(T,h,c.recordOutputs??!1)}catch(T){return Wj(T,h,i)}})()));return Vc(f,m,"auto.ai.anthropic")}else return It(_,f=>{try{c.recordInputs&&a&&nI(f,a);let m=e.apply(n,r);return Yj(m,f,c.recordOutputs??!1)}catch(m){return Wj(m,f,i)}})}function Ale(t,e,n,r,o){return new Proxy(t,{apply(s,i,a){let c=n.operation,l=hle(a,e,c),p=l[He]??"unknown",d=typeof a[0]=="object"?a[0]:void 0,_=!!d?.stream,f=n.streaming===!0;if(_||f)return gle(t,s,r,a,l,c,e,d,o,_,f);let m,h=xr({name:`${c} ${p}`,op:`gen_ai.${c}`,attributes:l},T=>(m=s.apply(r,a),o.recordInputs&&d&&nI(T,d),m.then(S=>(Sle(T,S,o.recordOutputs),S),S=>{throw te(S,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:e}}}),S})));return Vc(m,h,"auto.ai.anthropic")}})}function zj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Fc(e,String(o)),a=jj[i];return typeof s=="function"&&a?Ale(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?zj(s,i,n):s}})}function Pm(t,e){return zj(t,"",eo(e))}var Gs="Google_GenAI",Kj={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{operation:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},Qj="google_genai",rI="chats.create",Xj="chat";function Rle(t,e){let n=t?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return e.setStatus({code:2,message:"internal_error"}),te(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function yle(t,e){typeof t.responseId=="string"&&(e.responseId=t.responseId),typeof t.modelVersion=="string"&&(e.responseModel=t.modelVersion);let n=t.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(e.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(e.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(e.totalTokens=n.totalTokenCount))}function Ile(t,e,n){Array.isArray(t.functionCalls)&&e.toolCalls.push(...t.functionCalls);for(let r of t.candidates??[]){r?.finishReason&&!e.finishReasons.includes(r.finishReason)&&e.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&e.responseTexts.push(o.text),o.functionCall&&e.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function Ole(t,e,n,r){!t||Rle(t,r)||(yle(t,e),Ile(t,e,n))}async function*Jj(t,e,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of t)Ole(o,r,n,e),yield o}finally{let o={[Xi]:!0};r.responseId&&(o[or]=r.responseId),r.responseModel&&(o[ft]=r.responseModel),r.promptTokens!==void 0&&(o[Pe]=r.promptTokens),r.completionTokens!==void 0&&(o[Ze]=r.completionTokens),r.totalTokens!==void 0&&(o[ln]=r.totalTokens),r.finishReasons.length&&(o[yn]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(o[rt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(o[Ot]=JSON.stringify(r.toolCalls)),e.setAttributes(o),e.end()}}function $c(t,e="user"){return typeof t=="string"?[{role:e,content:t}]:Array.isArray(t)?t.flatMap(n=>$c(n,e)):typeof t!="object"||!t?[]:"role"in t&&typeof t.role=="string"?[t]:"parts"in t?[{...t,role:e}]:[{role:e,content:t}]}function Zj(t,e){if("model"in t&&typeof t.model=="string")return t.model;if(e&&typeof e=="object"){let n=e;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 Nle(t){let e={};return"temperature"in t&&typeof t.temperature=="number"&&(e[Ms]=t.temperature),"topP"in t&&typeof t.topP=="number"&&(e[vs]=t.topP),"topK"in t&&typeof t.topK=="number"&&(e[Em]=t.topK),"maxOutputTokens"in t&&typeof t.maxOutputTokens=="number"&&(e[Bc]=t.maxOutputTokens),"frequencyPenalty"in t&&typeof t.frequencyPenalty=="number"&&(e[xs]=t.frequencyPenalty),"presencePenalty"in t&&typeof t.presencePenalty=="number"&&(e[jc]=t.presencePenalty),e}function ble(t,e,n){let r={[Ps]:Qj,[Dt]:t,[W]:"auto.ai.google_genai"};if(e){if(r[He]=Zj(e,n),"config"in e&&typeof e.config=="object"&&e.config){let o=e.config;if(Object.assign(r,Nle(o)),"tools"in o&&Array.isArray(o.tools)){let s=o.tools.flatMap(i=>i.functionDeclarations);r[Zr]=JSON.stringify(s)}}}else r[He]=Zj({},n);return r}function eH(t,e,n){if(n){let o=e.contents;o!=null&&t.setAttribute(Hc,typeof o=="string"?o:JSON.stringify(o));return}let r=[];if("config"in e&&e.config&&typeof e.config=="object"&&"systemInstruction"in e.config&&e.config.systemInstruction&&r.push(...$c(e.config.systemInstruction,"system")),"history"in e&&r.push(...$c(e.history,"user")),"contents"in e&&r.push(...$c(e.contents,"user")),"message"in e&&r.push(...$c(e.message,"user")),Array.isArray(r)&&r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0;t.setAttributes({[pn]:i,[Ut]:JSON.stringify(Us(s))})}}function Cle(t,e,n){if(!(!e||typeof e!="object")){if(e.modelVersion&&t.setAttribute(ft,e.modelVersion),e.usageMetadata&&typeof e.usageMetadata=="object"){let r=e.usageMetadata;typeof r.promptTokenCount=="number"&&t.setAttributes({[Pe]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&t.setAttributes({[Ze]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&t.setAttributes({[ln]:r.totalTokenCount})}if(n&&Array.isArray(e.candidates)&&e.candidates.length>0){let r=e.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&t.setAttributes({[rt]:r.join("")})}if(n&&e.functionCalls){let r=e.functionCalls;Array.isArray(r)&&r.length>0&&t.setAttributes({[Ot]:JSON.stringify(r)})}}}function tH(t,e,n,r,o){let s=e===rI,i=n.operation==="embeddings";return new Proxy(t,{apply(a,c,l){let p=n.operation,d=l[0],_=ble(p,d,r),f=_[He]??"unknown";return n.streaming?It({name:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},async m=>{try{o.recordInputs&&d&&eH(m,d,i);let h=await a.apply(r,l);return Jj(h,m,!!o.recordOutputs)}catch(h){throw m.setStatus({code:2,message:"internal_error"}),te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}}),m.end(),h}}):xr({name:s?`${p} ${f} create`:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},m=>(o.recordInputs&&d&&eH(m,d,i),Mr(()=>a.apply(r,l),h=>{te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}})},()=>{},h=>{!s&&!i&&Cle(m,h,o.recordOutputs)})))}})}function oI(t,e="",n){return new Proxy(t,{get:(r,o,s)=>{let i=Reflect.get(r,o,s),a=Fc(e,String(o)),c=Kj[a];if(typeof i=="function"&&c){if(a===rI){let l=tH(i,a,c,r,n);return function(...d){let _=l(...d);return _&&typeof _=="object"?oI(_,Xj,n):_}}return tH(i,a,c,r,n)}return typeof i=="function"?i.bind(r):i&&typeof i=="object"?oI(i,a,n):i}})}function Mm(t,e){return oI(t,"",eo(e))}var xm="LangChain",na="auto.ai.langchain",nH={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var sr=(t,e,n)=>{n!=null&&(t[e]=n)},Vn=(t,e,n)=>{let r=Number(n);Number.isNaN(r)||(t[e]=r)};function Go(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Yc(t){if(Array.isArray(t))try{let e=t.map(n=>n&&typeof n=="object"&&Ds(n)?Zi(n):n);return JSON.stringify(e)}catch{return String(t)}return Go(t)}function Sp(t){let e=t.toLowerCase();return nH[e]??e}function rH(t){return t.includes("System")?"system":t.includes("Human")?"user":t.includes("AI")||t.includes("Assistant")?"assistant":t.includes("Function")?"function":t.includes("Tool")?"tool":"user"}function sI(t){if(!(!t||Array.isArray(t)))return t.invocation_params}function gp(t){return t.map(e=>{let n=e._getType;if(typeof n=="function"){let o=n.call(e);return{role:Sp(o),content:Yc(e.content)}}if(e.lc===1&&e.kwargs){let o=e.id,s=Array.isArray(o)&&o.length>0?o[o.length-1]:"",i=typeof s=="string"?rH(s):"user";return{role:Sp(i),content:Yc(e.kwargs?.content)}}if(e.type){let o=String(e.type).toLowerCase();return{role:Sp(o),content:Yc(e.content)}}if(e.role)return{role:Sp(String(e.role)),content:Yc(e.content)};let r=e.constructor?.name;return r&&r!=="Object"?{role:Sp(rH(r)),content:Yc(e.content)}:{role:"user",content:Yc(e.content)}})}function Ple(t,e,n){let r={},o="kwargs"in t?t.kwargs:void 0,s=e?.temperature??n?.ls_temperature??o?.temperature;Vn(r,Ms,s);let i=e?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Vn(r,Bc,i);let a=e?.top_p??o?.top_p;Vn(r,vs,a);let c=e?.frequency_penalty;Vn(r,xs,c);let l=e?.presence_penalty;return Vn(r,jc,l),e&&"stream"in e&&sr(r,Gc,!!e.stream),r}function oH(t,e,n,r,o){return{[Ps]:Go(t??"langchain"),[Dt]:"chat",[He]:Go(e),[W]:na,...Ple(n,r,o)}}function sH(t,e,n,r,o){let s=o?.ls_provider,i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){sr(a,pn,e.length);let c=e.map(l=>({role:"user",content:l}));sr(a,Ut,Go(c))}return a}function iH(t,e,n,r,o){let s=o?.ls_provider??t.id?.[2],i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){let c=gp(e.flat()),{systemInstructions:l,filteredMessages:p}=Fn(c);l&&sr(a,Hn,l);let d=Array.isArray(p)?p.length:0;sr(a,pn,d);let _=Us(p);sr(a,Ut,Go(_))}return a}function Mle(t,e){let n=[],r=t.flat();for(let o of r){let s=o.message?.content;if(Array.isArray(s))for(let i of s){let a=i;a.type==="tool_use"&&n.push(a)}}n.length>0&&sr(e,Ot,Go(n))}function xle(t,e){if(!t)return;let n=t.tokenUsage,r=t.usage;if(n)Vn(e,Pe,n.promptTokens),Vn(e,Ze,n.completionTokens),Vn(e,ln,n.totalTokens);else if(r){Vn(e,Pe,r.input_tokens),Vn(e,Ze,r.output_tokens);let o=Number(r.input_tokens),s=Number(r.output_tokens),i=(Number.isNaN(o)?0:o)+(Number.isNaN(s)?0:s);i>0&&Vn(e,ln,i),r.cache_creation_input_tokens!==void 0&&Vn(e,U1,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Vn(e,w1,r.cache_read_input_tokens)}}function aH(t,e){if(!t)return;let n={};if(Array.isArray(t.generations)){let l=t.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&&sr(n,yn,Go(l)),Mle(t.generations,n),e){let p=t.generations.flat().map(d=>d.text??d.message?.content).filter(d=>typeof d=="string");p.length>0&&sr(n,rt,Go(p))}}xle(t.llmOutput,n);let r=t.llmOutput,s=t.generations?.[0]?.[0]?.message,i=r?.model_name??r?.model??s?.response_metadata?.model_name;i&&sr(n,ft,i);let a=r?.id??s?.id;a&&sr(n,or,a);let c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&sr(n,v1,Go(c)),n}function vm(t={}){let{recordInputs:e,recordOutputs:n}=eo(t),r=new Map,o=i=>{let a=r.get(i);a?.isRecording()&&(a.end(),r.delete(i))},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(i,a,c,l,p,d,_,f){let m=sI(d),h=sH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleChatModelStart(i,a,c,l,p,d,_,f){let m=sI(d),h=iH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleLLMEnd(i,a,c,l,p){let d=r.get(a);if(d?.isRecording()){let _=aH(i,n);_&&d.setAttributes(_),o(a)}},handleLLMError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${na}.llm_error_handler`}})},handleChainStart(i,a,c,l,p,d,_,f){let m=f||i.name||"unknown_chain",h={[W]:"auto.ai.langchain","langchain.chain.name":m};e&&(h["langchain.chain.inputs"]=JSON.stringify(a)),It({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...h,[ee]:"gen_ai.invoke_agent"}},T=>(r.set(c,T),T))},handleChainEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(i)}),o(a))},handleChainError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${na}.chain_error_handler`}})},handleToolStart(i,a,c,l){let p=i.name||"unknown_tool",d={[W]:na,[Ji]:p};e&&(d[gm]=a),It({name:`execute_tool ${p}`,op:"gen_ai.execute_tool",attributes:{...d,[ee]:"gen_ai.execute_tool"}},_=>(r.set(c,_),_))},handleToolEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[Am]:JSON.stringify(i)}),o(a))},handleToolError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${na}.tool_error_handler`}})},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}var Lm="LangGraph",iI="auto.ai.langgraph";function vle(t){if(!t||t.length===0)return null;let e=[];for(let n of t)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&e.push(...r)}return e.length>0?e:null}function Lle(t){let e=t,n=0,r=0,o=0;if(e.usage_metadata&&typeof e.usage_metadata=="object"){let s=e.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(o=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(e.response_metadata&&typeof e.response_metadata=="object"){let s=e.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){let i=s.tokenUsage;typeof i.promptTokens=="number"&&(n=i.promptTokens),typeof i.completionTokens=="number"&&(r=i.completionTokens),typeof i.totalTokens=="number"&&(o=i.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function Dle(t,e){let n=e;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&t.setAttribute(ft,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&t.setAttribute(yn,[r.finish_reason])}}function cH(t){if(!t.builder?.nodes?.tools?.runnable?.tools)return null;let e=t.builder?.nodes?.tools?.runnable?.tools;return!e||!Array.isArray(e)||e.length===0?null:e.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function uH(t,e,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let s=e?.length??0,i=o.length>s?o.slice(s):[];if(i.length===0)return;let a=vle(i);a&&t.setAttribute(Ot,JSON.stringify(a));let c=gp(i);t.setAttribute(rt,JSON.stringify(c));let l=0,p=0,d=0;for(let _ of i){let f=Lle(_);l+=f.inputTokens,p+=f.outputTokens,d+=f.totalTokens,Dle(t,_)}l>0&&t.setAttribute(Pe,l),p>0&&t.setAttribute(Ze,p),d>0&&t.setAttribute(ln,d)}function aI(t,e){return new Proxy(t,{apply(n,r,o){return xr({op:"gen_ai.create_agent",name:"create_agent",attributes:{[W]:iI,[ee]:"gen_ai.create_agent",[Dt]:"create_agent"}},s=>{try{let i=Reflect.apply(n,r,o),a=o.length>0?o[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(Uy,a.name),s.updateName(`create_agent ${a.name}`));let c=i.invoke;return c&&typeof c=="function"&&(i.invoke=Ule(c.bind(i),i,a,e)),i}catch(i){throw s.setStatus({code:2,message:"internal_error"}),te(i,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),i}})}})}function Ule(t,e,n,r){return new Proxy(t,{apply(o,s,i){return xr({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[W]:iI,[ee]:Sm,[Dt]:"invoke_agent"}},async a=>{try{let c=n?.name;c&&typeof c=="string"&&(a.setAttribute(D1,c),a.setAttribute(Uy,c),a.updateName(`invoke_agent ${c}`));let d=(i.length>1?i[1]:void 0)?.configurable?.thread_id;d&&typeof d=="string"&&a.setAttribute(_p,d);let _=cH(e);_&&a.setAttribute(Zr,JSON.stringify(_));let f=r.recordInputs,m=r.recordOutputs,h=i.length>0?i[0]?.messages??[]:[];if(h&&f){let S=gp(h),{systemInstructions:R,filteredMessages:I}=Fn(S);R&&a.setAttribute(Hn,R);let x=Us(I),F=Array.isArray(I)?I.length:0;a.setAttributes({[Ut]:JSON.stringify(x),[pn]:F})}let T=await Reflect.apply(o,s,i);return m&&uH(a,h??null,T),T}catch(c){throw a.setStatus({code:2,message:"internal_error"}),te(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function Dm(t,e){return t.compile=aI(t.compile,eo(e)),t}function Ap(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function Rp(t,e,n){let r=t[e];if(typeof r=="function"){try{t[e]=n}catch{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=n}catch{Object.defineProperty(t,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}function pH(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function dH(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let s=o.match(r);if(s)return{filename:`<data:${s[2]}>`,function:s[1]};let i=o.match(n);if(i){let a,c,l,p,d;if(i[1]){l=i[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){a=l.slice(0,h),c=l.slice(h+1);let T=a.indexOf(".Module");T>0&&(l=l.slice(T+1),a=a.slice(0,T))}p=void 0}c&&(p=a,d=c),c==="<anonymous>"&&(d=void 0,l=void 0),l===void 0&&(d=d||Mf,l=p?`${p}.${d}`:d);let _=MG(i[2]),f=i[5]==="native";!_&&i[5]&&!f&&(_=i[5]);let m=_?wle(_):void 0;return{filename:m??_,module:m&&t?.(m),function:l,lineno:lH(i[3]),colno:lH(i[4]),in_app:pH(_||"",f)}}if(o.match(e))return{filename:o}}}function cI(t){return[90,dH(t)]}function lH(t){return parseInt(t||"",10)||void 0}function wle(t){try{return decodeURI(t)}catch{return}}var In=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let n=this._cache.get(e);if(n!==void 0)return this._cache.delete(e),this._cache.set(e,n),n}set(e,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(e,n)}remove(e){let n=this._cache.get(e);return n&&this._cache.delete(e),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(n=>e.push(n)),e}};var uI=K(ne(),1),yp={};function w(t,e,n){return n?spe(t,e,n):ope(t,e)}function ope(t,e){return Object.assign(n=>{let r=yp[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return yp[t]=o,(0,uI.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function spe(t,e,n){return Object.assign(r=>{let o=n(r),s=yp[t];if(s)return s.setConfig(o),s;let i=new e(o);return yp[t]=i,(0,uI.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Ip(t){let e=!1,n=[];if(!ipe(t))e=!0;else{let o=t._wrap;t._wrap=(...s)=>(e=!0,n.forEach(i=>i()),n=[],o(...s))}return o=>{e?o():n.push(o)}}function ipe(t){return typeof t._wrap=="function"}b();import{subscribe as ape}from"node:diagnostics_channel";var re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Um="@sentry/instrumentation-http";function _H(t,e,n,r){let o=0,s=[];re&&g.log(r,"Patching request.on");let i=new WeakMap,a=n==="small"?1e3:n==="medium"?1e4:1048576;try{t.on=new Proxy(t.on,{apply:(c,l,p)=>{let[d,_,...f]=p;if(d==="data"){re&&g.log(r,`Handling request.on("data") with maximum body size of ${a}b`);let m=new Proxy(_,{apply:(h,T,S)=>{try{let R=S[0],I=Buffer.from(R);o<a?(s.push(I),o+=I.byteLength):re&&g.log(r,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{re&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,T,S)}});return i.set(_,m),Reflect.apply(c,l,[d,m,...f])}return Reflect.apply(c,l,p)}}),t.off=new Proxy(t.off,{apply:(c,l,p)=>{let[,d]=p,_=i.get(d);if(_){i.delete(d);let f=p.slice();return f[1]=_,Reflect.apply(c,l,f)}return Reflect.apply(c,l,p)}}),t.on("end",()=>{try{let c=Buffer.concat(s).toString("utf-8");if(c){let p=Buffer.byteLength(c,"utf-8")>a?`${Buffer.from(c).subarray(0,a-3).toString("utf-8")}...`:c;e.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(c){re&&g.error(r,"Error building captured request body",c)}})}catch(c){re&&g.error(r,"Error patching request to capture body",c)}}var fH=Un("sentry_http_server_instrumented"),pI="Http.Server",lI=new Map,mH=new WeakSet;function hH(t,e){nt(t,"_startSpanCallback",new WeakRef(e))}var cpe=(t={})=>{let e={sessions:t.sessions??!0,sessionFlushingDelayMS:t.sessionFlushingDelayMS??6e4,maxRequestBodySize:t.maxRequestBodySize??"medium",ignoreRequestBody:t.ignoreRequestBody};return{name:pI,setupOnce(){ape("http.server.request.start",r=>{upe(r.server,e)})},afterAllSetup(n){re&&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`.")}}},Op=cpe;function upe(t,{ignoreRequestBody:e,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:o}){let s=t.emit;if(mH.has(s))return;let i=new Proxy(s,{apply(a,c,l){if(l[0]!=="request")return a.apply(c,l);let p=H();if(P.active().getValue(fH)||!p)return a.apply(c,l);re&&g.log(pI,"Handling incoming request");let d=ue().clone(),_=l[1],f=l[2],m=dp(_),h=_.ip||_.socket?.remoteAddress,T=_.url||"/";n!=="none"&&!e?.(T,_)&&_H(_,d,n,pI),d.setSDKProcessingMetadata({normalizedRequest:m,ipAddress:h});let S=(_.method||"GET").toUpperCase(),R=ko(T),I=`${S} ${R}`;return d.setTransactionName(I),r&&p&&lpe(p,{requestIsolationScope:d,response:f,sessionFlushingDelayMS:o??6e4}),Wl(d,()=>{let x={traceId:zt(),sampleRand:yt(),propagationSpanId:Kt()};he().setPropagationContext({...x}),d.setPropagationContext({...x});let F=Ar.extract(P.active(),m.headers).setValue(fH,!0);return P.with(F,()=>{p.emit("httpServerRequest",_,f,m);let B=_._startSpanCallback?.deref();return B?B(()=>a.apply(c,l)):a.apply(c,l)})})}});mH.add(i),t.emit=i}function lpe(t,{requestIsolationScope:e,response:n,sessionFlushingDelayMS:r}){e.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=e.getScopeData().sdkProcessingMetadata.requestSession;if(t&&o){re&&g.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=lI.get(t),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{re&&g.log("Opened new request session aggregate.");let l={[i]:c};lI.set(t,l);let p=()=>{clearTimeout(_),d(),lI.delete(t);let f=Object.entries(l).map(([m,h])=>({started:m,exited:h.exited,errored:h.errored,crashed:h.crashed}));t.sendSession({aggregates:f})},d=t.on("flush",()=>{re&&g.log("Sending request session aggregate due to client flush"),p()}),_=setTimeout(()=>{re&&g.log("Sending request session aggregate due to flushing schedule"),p()},r).unref()}}})}b();var Bo=K(Te(),1);le();import{errorMonitor as ppe}from"node:events";var TH="Http.ServerSpans",dpe=(t={})=>{let e=t.ignoreStaticAssets??!0,n=t.ignoreIncomingRequests,r=t.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=t,{requestHook:s,responseHook:i,applyCustomAttributesOnSpan:a}=t.instrumentation??{};return{name:TH,setup(c){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||c.on("httpServerRequest",(l,p,d)=>{let _=l,f=p;hH(_,h=>{if(mpe(_,{ignoreStaticAssets:e,ignoreIncomingRequests:n}))return re&&g.log(TH,"Skipping span creation for incoming request",_.url),h();let T=d.url||_.url||"/",S=pp(T),R=_.headers,I=R["user-agent"],x=R["x-forwarded-for"],F=_.httpVersion,B=R.host,se=B?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",ve=c.tracer,on=T.startsWith("https")?"https":"http",Io=d.method||_.method?.toUpperCase()||"GET",ss=S?S.pathname:ko(T),yi=`${Io} ${ss}`,Et=ve.startSpan(yi,{kind:Ne.SERVER,attributes:{[ee]:"http.server",[W]:"auto.http.otel.http","sentry.http.prefetch":_pe(_)||void 0,"http.url":T,"http.method":d.method,"http.target":S?`${S.pathname}${S.search}`:ss,"http.host":B,"net.host.name":se,"http.client_ip":typeof x=="string"?x.split(",")[0]:void 0,"http.user_agent":I,"http.scheme":on,"http.flavor":F,"net.transport":F?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...hpe(_),...lm(d.headers||{},c.getOptions().sendDefaultPii??!1)}});s?.(Et,_),i?.(Et,f),a?.(Et,_,f),o?.(Et,_,f);let $a={type:Bo.RPCType.HTTP,span:Et};return P.with((0,Bo.setRPCMetadata)(X.setSpan(P.active(),Et),$a),()=>{P.bind(P.active(),_),P.bind(P.active(),f);let Ya=!1;function DC(r_){if(Ya)return;Ya=!0;let UC=Spe(_,f);Et.setAttributes(UC),Et.setStatus(r_),Et.end();let wC=UC["http.route"];wC&&ue().setTransactionName(`${_.method?.toUpperCase()||"GET"} ${wC}`)}return f.on("close",()=>{DC(Do(f.statusCode))}),f.on(ppe,()=>{let r_=Do(f.statusCode);DC(r_.code===2?r_:{code:2})}),h()})})})},processEvent(c){if(c.type==="transaction"){let l=c.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"&&gpe(l,r))return re&&g.log("Dropping transaction due to status code",l),null}return c},afterAllSetup(c){re&&(c.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),c.getIntegrationByName("Http.Server")||g.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}},Np=dpe;function _pe(t){return t.headers["next-router-prefetch"]==="1"}function fpe(t){let e=ko(t);return!!(e.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||e.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function mpe(t,{ignoreStaticAssets:e,ignoreIncomingRequests:n}){if((0,Bo.isTracingSuppressed)(P.active()))return!0;let r=t.url,o=t.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||e&&o==="GET"&&fpe(r)||n?.(r,t))}function hpe(t){let e=Tpe(t.headers);return e==null?{}:Epe(t.headers)?{"http.request_content_length":e}:{"http.request_content_length_uncompressed":e}}function Tpe(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}function Epe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}function Spe(t,e){let{socket:n}=t,{statusCode:r,statusMessage:o}=e,s={[bo]:r,[Pi]:r,"http.status_text":o?.toUpperCase()},i=(0,Bo.getRPCMetadata)(P.active());if(n){let{localAddress:a,localPort:c,remoteAddress:l,remotePort:p}=n;s[Zg]=a,s[eA]=c,s[Jg]=l,s["net.peer.port"]=p}if(s[Pi]=r,s["http.status_text"]=(o||"").toUpperCase(),i?.type===Bo.RPCType.HTTP&&i.route!==void 0){let a=i.route;s[Co]=a}return s}function gpe(t,e){return e.some(n=>{if(typeof n=="number")return n===t;let[r,o]=n;return t>=r&&t<=o})}b();var AH=K(Te(),1),Cp=K(ne(),1);le();import{subscribe as dI,unsubscribe as _I}from"node:diagnostics_channel";import{errorMonitor as gH}from"node:events";function bp(t,e){if(!t)return e;let n=Vi(t),r=Vi(e);if(!r)return t;let o={},s={};for(let[c,l]of Object.entries(r))c.startsWith(Xr)?o[c]=l:s[c]=l;let i=Object.keys(o).length>0,a={};if(n)for(let[c,l]of Object.entries(n))i&&c.startsWith(Xr)||(a[c]=l);Object.assign(a,o);for(let[c,l]of Object.entries(s))a[c]||(a[c]=l);return Bf(a)}var Wc="@sentry/instrumentation-http";function EH(t,e){let n=Ape(t),r=e?.statusCode,o=Ap(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function wm(t,e){let n=km(t),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Qi(n,r,e)?kc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s;if(!t.getHeader("sentry-trace")){if(i)try{t.setHeader("sentry-trace",i),re&&g.log(Wc,"Added sentry-trace header to outgoing request")}catch(p){re&&g.error(Wc,"Failed to add sentry-trace header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(c&&!t.getHeader("traceparent"))try{t.setHeader("traceparent",c),re&&g.log(Wc,"Added traceparent header to outgoing request")}catch(p){re&&g.error(Wc,"Failed to add traceparent header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(a){let p=t.getHeader("baggage"),d=bp(p,a);if(d)try{t.setHeader("baggage",d),re&&g.log(Wc,"Added baggage header to outgoing request")}catch(_){re&&g.error(Wc,"Failed to add baggage header to outgoing request:",Kr(_)?_.message:"Unknown error")}}}}function Ape(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=bs(n.toString()),o={url:Cs(r),"http.method":t.method||"GET"};return r.search&&(o["http.query"]=r.search),r.hash&&(o["http.fragment"]=r.hash),o}catch{return{}}}function SH(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function km(t){let e=t.getHeader("host")||t.host,n=t.protocol,r=t.path;return`${n}//${e}${r}`}var ra=class extends Cp.InstrumentationBase{constructor(e={}){super(Um,pe,e),this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=a=>{let c=a;this._onOutgoingRequestFinish(c.request,c.response)},r=a=>{let c=a;this._onOutgoingRequestFinish(c.request,void 0)},o=a=>{let c=a;this._onOutgoingRequestCreated(c.request)},s=a=>(e||(e=!0,dI("http.client.response.finish",n),dI("http.client.request.error",r),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&dI("http.client.request.created",o)),a),i=()=>{_I("http.client.response.finish",n),_I("http.client.request.error",r),_I("http.client.request.created",o)};return[new Cp.InstrumentationNodeModuleDefinition("http",["*"],s,i),new Cp.InstrumentationNodeModuleDefinition("https",["*"],s,i)]}_startSpanForOutgoingRequest(e){let n=e.once,[r,o]=Rpe(e),s=Xf({name:r,attributes:o,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(s,e);let i=new Proxy(n,{apply(l,p,d){let[_]=d;if(_!=="response")return l.apply(p,d);let f=P.active(),m=X.setSpan(f,s);return P.with(m,()=>l.apply(p,d))}});e.once=i;let a=!1,c=l=>{a||(a=!0,s.setStatus(l),s.end())};return e.prependListener("response",l=>{e.listenerCount("response")<=1&&l.resume(),P.bind(P.active(),l);let p=ype(l);s.setAttributes(p),this.getConfig().outgoingResponseHook?.(s,l),this.getConfig().outgoingRequestApplyCustomAttributes?.(s,e,l);let d=(_=!1)=>{this._diag.debug("outgoingRequest on end()");let f=_||typeof l.statusCode!="number"||l.aborted&&!l.complete?{code:Be.ERROR}:Do(l.statusCode);c(f)};l.on("end",()=>{d()}),l.on(gH,_=>{this._diag.debug("outgoingRequest on response error()",_),d(!0)})}),e.on("close",()=>{c({code:Be.UNSET})}),e.on(gH,l=>{this._diag.debug("outgoingRequest on request error()",l),c({code:Be.ERROR})}),s}_onOutgoingRequestFinish(e,n){re&&g.log(Um,"Handling finished outgoing request");let r=this.getConfig().breadcrumbs,o=typeof r>"u"?!0:r,s=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,s),o&&!s&&EH(e,n)}_onOutgoingRequestCreated(e){re&&g.log(Um,"Handling outgoing request created");let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),o=this.getConfig().propagateTraceInOutgoingRequests;if(r){let s=this._startSpanForOutgoingRequest(e);if(o&&s.isRecording()){let i=X.setSpan(P.active(),s);P.with(i,()=>{wm(e,this._propagationDecisionMap)})}else o&&wm(e,this._propagationDecisionMap)}else o&&wm(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if((0,AH.isTracingSuppressed)(P.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=SH(e),o=km(e);return n(o,r)}};function Rpe(t){let e=km(t),[n,r]=Oy(pp(e),"client","auto.http.otel.http",t),o=t.getHeader("user-agent");return[n,{[ee]:"http.client","otel.kind":"CLIENT",[RA]:o,[cs]:e,"http.url":e,"http.method":t.method,"http.target":t.path||"/","net.peer.name":t.host,"http.host":t.getHeader("host"),...r}]}function ype(t){let{statusCode:e,statusMessage:n,httpVersion:r,socket:o}=t,s=r.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp",i={[bo]:e,[hA]:r,"http.flavor":r,[TA]:s,"net.transport":s,"http.status_text":n?.toUpperCase(),"http.status_code":e,...Ipe(t)};if(o){let{remoteAddress:a,remotePort:c}=o;i[fA]=a,i[mA]=c,i["net.peer.ip"]=a,i["net.peer.port"]=c}return i}function Ipe(t){let e=Ope(t.headers);return e==null?{}:Npe(t.headers)?{[nA]:e}:{[rA]:e}}function Ope(t){let e=t["content-length"];if(typeof e=="number")return e;if(typeof e!="string")return;let n=parseInt(e,10);if(!isNaN(n))return n}function Npe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}var RH="Http",bpe=w(`${RH}.sentry`,t=>new ra(t)),yH=(t={})=>{let e={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},n={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:t.tracePropagation??!0,ignoreOutgoingRequests:t.ignoreOutgoingRequests},o=Op(e),s=Np(n),i=t.spans??!1,a=t.disableIncomingRequestSpans??!1,c=i&&!a;return{name:RH,setup(l){c&&s.setup(l)},setupOnce(){o.setupOnce(),bpe(r)},processEvent(l){return s.processEvent(l)}}};b();var NH=K(Te(),1),bH=K(ne(),1);import*as zc from"diagnostics_channel";var Lr=BR(process.versions.node),jo=Lr.major,Pp=Lr.minor;var fI="sentry-trace",Gm="baggage",Cpe="traceparent";function IH(t,e){let n=Bm(t.origin,t.path),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Qi(n,r,e)?kc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s,l=Array.isArray(t.headers)?t.headers:Ppe(t.headers);if(mI(l,fI),mI(l,Gm),o&&mI(l,Cpe),!(hI(l,fI)!==-1)){i&&l.push(fI,i),c&&hI(l,"traceparent")===-1&&l.push("traceparent",c);let d=hI(l,Gm);if(a&&d===-1)l.push(Gm,a);else if(a){let _=l[d+1],f=bp(_,a);f&&(l[d+1]=f)}}Array.isArray(t.headers)||(t.headers=Mpe(l))}function Ppe(t){let e=t.split(`\r
|
|
29
|
-
`),n=[];for(let r of e)try{let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&n.push(s,i)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function
|
|
28
|
+
Url: ${_m(t)}`),!0}return!1}function Wce(t,e){return e?.length?cm(t).some(n=>Ts(n,e)):!1}function zce(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Ts(n,e):!1}function Kce(t,e){if(!e?.length)return!1;let n=_m(t);return n?Ts(n,e):!1}function Qce(t,e){if(!e?.length)return!0;let n=_m(t);return n?Ts(n,e):!0}function Xce(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function _m(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Xce(n):null}catch{return C&&g.error(`Cannot extract url for event ${Es(t)}`),null}}function Jce(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function g1(t,e,n,r,o,s){if(!o.exception?.values||!s||!Qr(s.originalException,Error))return;let i=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;i&&(o.exception.values=Cy(t,e,r,s.originalException,n,o.exception.values,i,0))}function Cy(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(Qr(r[o],Error)){E1(i,a,r);let l=t(e,r[o]),p=c.length;S1(l,o,p,a),c=Cy(t,e,n,r[o],o,[l,...c],l,p)}return A1(r)&&r.errors.forEach((l,p)=>{if(Qr(l,Error)){E1(i,a,r);let d=t(e,l),_=c.length;S1(d,`errors[${p}]`,_,a),c=Cy(t,e,n,l,o,[d,...c],d,_)}}),c}function A1(t){return Array.isArray(t.errors)}function E1(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...A1(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function S1(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var Zce="cause",eue=5,tue="LinkedErrors",nue=(t={})=>{let e=t.limit||eue,n=t.key||Zce;return{name:tue,preprocessEvent(r,o,s){let i=s.getOptions();g1(gy,i.stackParser,n,e,r,o)}}},mm=nue;function R1(t){let e={},n=0;for(;n<t.length;){let r=t.indexOf("=",n);if(r===-1)break;let o=t.indexOf(";",n);if(o===-1)o=t.length;else if(o<r){n=t.lastIndexOf(";",r-1)+1;continue}let s=t.slice(n,r).trim();if(e[s]===void 0){let i=t.slice(r+1,o).trim();i.charCodeAt(0)===34&&(i=i.slice(1,-1));try{e[s]=i.indexOf("%")!==-1?decodeURIComponent(i):i}catch{e[s]=i}}n=o+1}return e}var Py=["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 y1(t){let e={};for(let s of Object.keys(t))e[s.toLowerCase()]=t[s];return Py.map(s=>{let i=e[s.toLowerCase()],a=Array.isArray(i)?i.join(";"):i;return s==="Forwarded"?rue(a):a?.split(",").map(c=>c.trim())}).reduce((s,i)=>i?s.concat(i):s,[]).find(s=>s!==null&&oue(s))||null}function rue(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function oue(t){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(t)}var sue={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},iue="RequestData",aue=(t={})=>{let e={...sue,...t.include};return{name:iue,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&cue(n,i,{ipAddress:a},c),n}}},hm=aue;function cue(t,e,n,r){if(t.request={...t.request,...uue(e,r)},r.ip){let o=e.headers&&y1(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function uue(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||Py.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?R1(r.cookie):void 0);n.cookies=o||{}}return e.query_string&&(n.query_string=t.query_string),e.data&&(n.data=t.data),n}function I1(t){let e="console";Ec(e,t),Sc(e,lue)}function lue(){"console"in J&&ql.forEach(function(t){t in J.console&&xR(J.console,t,function(e){return Tc[t]=e,function(...n){gc("console",{args:n,level:t}),Tc[t]?.apply(J.console,n)}})})}function O1(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var pue=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function due(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=pue.exec(e);return n?n.slice(1):[]}function My(t){let e=due(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var _ue=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,Tm=Symbol("sentryPostgresConnectionContext"),xy=Symbol.for("sentry.instrumented.postgresjs"),fue=Symbol.for("sentry.query.from.instrumented.sql");function Ly(t,e){return!t||typeof t!="function"?(C&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),t):vy(t,{requireParentSpan:!0,...e})}function vy(t,e,n){if(t[xy])return t;let r=new Proxy(t,{apply(o,s,i){let a=Reflect.apply(o,s,i);return a&&typeof a=="object"&&"handle"in a&&b1(a,r,e),a},get(o,s){let i=o[s];return typeof s!="string"||typeof i!="function"?i:s==="unsafe"||s==="file"?mue(i,o,r,e):s==="begin"||s==="reserve"?hue(i,o,r,e):i}});return n?r[Tm]=n:Aue(t,r),t[xy]=!0,r[xy]=!0,r}function mue(t,e,n,r){return function(...o){let s=Reflect.apply(t,e,o);return s&&typeof s=="object"&&"handle"in s&&b1(s,n,r),s}}function hue(t,e,n,r){return function(...o){let s=n[Tm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(t,e,o);return p&&typeof p.then=="function"?p.then(d=>vy(d,r,s)):p}let a=o.length===1?o[0]:o[1],c=function(p){let d=vy(p,r,s);return a(d)},l=o.length===1?[c]:[o[0],c];return Reflect.apply(t,e,l)}}function b1(t,e,n){if(t.handle?.__sentryWrapped)return;t[fue]=!0;let r=t.handle,o=async function(...s){if(!Tue(n))return r.apply(this,s);let i=Eue(t.strings),a=Sue(i);return It({name:a||"postgresjs.query",op:"db"},c=>{c.setAttribute(W,"auto.db.postgresjs"),c.setAttributes({"db.system.name":"postgres","db.query.text":a});let l=e?e[Tm]:void 0;if(gue(c,l),n.requestHook)try{n.requestHook(c,a,l)}catch(d){c.setAttribute("sentry.hook.error","requestHook failed"),C&&g.error("Error in requestHook for PostgresJs instrumentation:",d)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(d,_,f)=>{try{N1(c,a,f?.[0]?.command),c.end()}catch(m){C&&g.error("Error ending span in resolve callback:",m)}return Reflect.apply(d,_,f)}}),p.reject=new Proxy(p.reject,{apply:(d,_,f)=>{try{c.setStatus({code:2,message:f?.[0]?.message||"unknown_error"}),c.setAttribute("db.response.status_code",f?.[0]?.code||"unknown"),c.setAttribute("error.type",f?.[0]?.name||"unknown"),N1(c,a),c.end()}catch(m){C&&g.error("Error ending span in reject callback:",m)}return Reflect.apply(d,_,f)}});try{return r.apply(this,s)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})};o.__sentryWrapped=!0,t.handle=o}function Tue(t){return nr()!==void 0||!t.requireParentSpan}function Eue(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((e,n,r)=>r===0?n:`${e}$${r}${n}`,"")}function Sue(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"}function gue(t,e){if(e&&(e.ATTR_DB_NAMESPACE&&t.setAttribute("db.namespace",e.ATTR_DB_NAMESPACE),e.ATTR_SERVER_ADDRESS&&t.setAttribute("server.address",e.ATTR_SERVER_ADDRESS),e.ATTR_SERVER_PORT!==void 0)){let n=parseInt(e.ATTR_SERVER_PORT,10);isNaN(n)||t.setAttribute("server.port",n)}}function N1(t,e,n){if(n){t.setAttribute("db.operation.name",n);return}let r=e?.match(_ue);r?.[1]&&t.setAttribute("db.operation.name",r[1].toUpperCase())}function Aue(t,e){let n=t;if(!n.options||typeof n.options!="object")return;let r=n.options,o=r.host?.[0]||"localhost",s=r.port?.[0]||5432,i={ATTR_DB_NAMESPACE:typeof r.database=="string"&&r.database!==""?r.database:void 0,ATTR_SERVER_ADDRESS:o,ATTR_SERVER_PORT:String(s)};e[Tm]=i}var Rue="Console",Em=(t={})=>{let e=new Set(t.levels||ql);return{name:Rue,setup(n){I1(({args:r,level:o})=>{H()!==n||!e.has(o)||yue(o,r)})}}};function yue(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:O1(t),message:C1(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${C1(r)}`:"Assertion failed",n.data.arguments=r}else return;rr(n,{input:e,level:t})}function C1(t){return"util"in J&&typeof J.util.format=="function"?J.util.format(...t):UR(t," ")}var Iue="ConversationId",Oue=()=>({name:Iue,setup(t){t.on("spanStart",e=>{let n=he().getScopeData(),r=ue().getScopeData(),o=n.conversationId||r.conversationId;o&&e.setAttribute(XR,o)})}}),Dy=Oue;var P1="gen_ai.prompt",Ps="gen_ai.system",He="gen_ai.request.model",Bc="gen_ai.request.stream",Ms="gen_ai.request.temperature",jc="gen_ai.request.max_tokens",xs="gen_ai.request.frequency_penalty",Hc="gen_ai.request.presence_penalty",vs="gen_ai.request.top_p",Sm="gen_ai.request.top_k",M1="gen_ai.request.encoding_format",x1="gen_ai.request.dimensions",yn="gen_ai.response.finish_reasons",ft="gen_ai.response.model",or="gen_ai.response.id",v1="gen_ai.response.stop_reason",Pe="gen_ai.usage.input_tokens",Ze="gen_ai.usage.output_tokens",ln="gen_ai.usage.total_tokens",Dt="gen_ai.operation.name",pn="sentry.sdk_meta.gen_ai.input.messages.original_length",Ut="gen_ai.input.messages",L1="gen_ai.output.messages",Hn="gen_ai.system_instructions",rt="gen_ai.response.text",Zr="gen_ai.request.available_tools",Ji="gen_ai.response.streaming",Ot="gen_ai.response.tool_calls",Uy="gen_ai.agent.name",D1="gen_ai.pipeline.name",fp="gen_ai.conversation.id",U1="gen_ai.usage.cache_creation_input_tokens",w1="gen_ai.usage.cache_read_input_tokens",wy="gen_ai.usage.input_tokens.cache_write",Ls="gen_ai.usage.input_tokens.cached",gm="gen_ai.invoke_agent",k1="gen_ai.generate_text",G1="gen_ai.stream_text",B1="gen_ai.generate_object",j1="gen_ai.stream_object",Fc="gen_ai.embeddings.input",H1="gen_ai.embeddings",F1="gen_ai.embeddings",V1="gen_ai.rerank",q1="gen_ai.execute_tool",Zi="gen_ai.tool.name",ky="gen_ai.tool.call.id",Gy="gen_ai.tool.type",Am="gen_ai.tool.input",Rm="gen_ai.tool.output",$1="gen_ai.tool.description",By="openai.response.id",jy="openai.response.model",Hy="openai.response.timestamp",Y1="openai.usage.completion_tokens",W1="openai.usage.prompt_tokens",Fy="anthropic.response.timestamp";var mp=new Map,Vy=new Set(["ai.generateText","ai.streamText","ai.generateObject","ai.streamObject"]),qy=new Set(["ai.generateText.doGenerate","ai.streamText.doStream","ai.generateObject.doGenerate","ai.streamObject.doStream"]),z1=new Set(["ai.embed.doEmbed","ai.embedMany.doEmbed"]),K1=new Set(["ai.rerank.doRerank"]),Q1={"ai.embed.doEmbed":"embeddings","ai.embedMany.doEmbed":"embeddings","ai.rerank.doRerank":"rerank"};function Ds(t){return!t||typeof t!="object"?!1:bue(t)||J1(t)||Nue(t)||Z1(t)||ej(t)||Cue(t)||Pue(t)||Mue(t)||xue(t)||vue(t)||Lue(t)||Due(t)}function Nue(t){return"image_url"in t?typeof t.image_url=="string"?t.image_url.startsWith("data:"):X1(t):!1}function X1(t){return"image_url"in t&&!!t.image_url&&typeof t.image_url=="object"&&"url"in t.image_url&&typeof t.image_url.url=="string"&&t.image_url.url.startsWith("data:")}function bue(t){return"type"in t&&typeof t.type=="string"&&"source"in t&&Ds(t.source)}function J1(t){return"inlineData"in t&&!!t.inlineData&&typeof t.inlineData=="object"&&"data"in t.inlineData&&typeof t.inlineData.data=="string"}function Z1(t){return"type"in t&&t.type==="input_audio"&&"input_audio"in t&&!!t.input_audio&&typeof t.input_audio=="object"&&"data"in t.input_audio&&typeof t.input_audio.data=="string"}function ej(t){return"type"in t&&t.type==="file"&&"file"in t&&!!t.file&&typeof t.file=="object"&&"file_data"in t.file&&typeof t.file.file_data=="string"}function Cue(t){return"media_type"in t&&typeof t.media_type=="string"&&"data"in t}function Pue(t){return"type"in t&&t.type==="file"&&"mediaType"in t&&typeof t.mediaType=="string"&&"data"in t&&typeof t.data=="string"&&!t.data.startsWith("http://")&&!t.data.startsWith("https://")}function Mue(t){return"type"in t&&t.type==="image"&&"image"in t&&typeof t.image=="string"&&!t.image.startsWith("http://")&&!t.image.startsWith("https://")}function xue(t){return"type"in t&&(t.type==="blob"||t.type==="base64")}function vue(t){return"b64_json"in t}function Lue(t){return"type"in t&&"result"in t&&t.type==="image_generation"}function Due(t){return"uri"in t&&typeof t.uri=="string"&&t.uri.startsWith("data:")}var hp="[Blob substitute]",Uue=["image_url","data","content","b64_json","result","uri","image"];function ea(t){let e={...t};Ds(e.source)&&(e.source=ea(e.source)),J1(t)&&(e.inlineData={...t.inlineData,data:hp}),X1(t)&&(e.image_url={...t.image_url,url:hp}),Z1(t)&&(e.input_audio={...t.input_audio,data:hp}),ej(t)&&(e.file={...t.file,file_data:hp});for(let n of Uue)typeof e[n]=="string"&&(e[n]=hp);return e}var nj=2e4,ym=t=>new TextEncoder().encode(t).length,Yy=t=>ym(JSON.stringify(t));function Im(t,e){if(ym(t)<=e)return t;let n=0,r=t.length,o="";for(;n<=r;){let s=Math.floor((n+r)/2),i=t.slice(0,s);ym(i)<=e?(o=i,n=s+1):r=s-1}return o}function wue(t){return typeof t=="string"?t:"text"in t&&typeof t.text=="string"?t.text:""}function tj(t,e){return typeof t=="string"?e:{...t,text:e}}function kue(t){return t!==null&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function rj(t){return t!==null&&typeof t=="object"&&"content"in t&&Array.isArray(t.content)}function oj(t){return t!==null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)&&t.parts.length>0}function Gue(t,e){let n={...t,content:""},r=Yy(n),o=e-r;if(o<=0)return[];let s=Im(t.content,o);return[{...t,content:s}]}function Bue(t){return"parts"in t&&Array.isArray(t.parts)?{key:"parts",items:t.parts}:"content"in t&&Array.isArray(t.content)?{key:"content",items:t.content}:{key:null,items:[]}}function jue(t,e){let{key:n,items:r}=Bue(t);if(n===null||r.length===0)return[];let o=r.map(c=>tj(c,"")),s=Yy({...t,[n]:o}),i=e-s;if(i<=0)return[];let a=[];for(let c of r){let l=wue(c),p=ym(l);if(p<=i)a.push(c),i-=p;else if(a.length===0){let d=Im(l,i);d&&a.push(tj(c,d));break}else break}return a.length<=0?[]:[{...t,[n]:a}]}function Hue(t,e){if(!t)return[];if(typeof t=="string"){let n=Im(t,e);return n?[n]:[]}return typeof t!="object"?[]:kue(t)?Gue(t,e):rj(t)||oj(t)?jue(t,e):[]}function $y(t){return t.map(n=>{let r;return n&&typeof n=="object"&&(rj(n)?r={...n,content:$y(n.content)}:"content"in n&&Ds(n.content)&&(r={...n,content:ea(n.content)}),oj(n)&&(r={...r??n,parts:$y(n.parts)}),Ds(r)?r=ea(r):Ds(n)&&(r=ea(n))),r??n})}function Fue(t,e){if(!Array.isArray(t)||t.length===0)return t;let n=e-2,r=t[t.length-1],o=$y([r]),s=o[0];return Yy(s)<=n?o:Hue(s,n)}function Us(t){return Fue(t,nj)}function sj(t){return Im(t,nj)}function eo(t){let e=!!H()?.getOptions().sendDefaultPii;return{...t,recordInputs:t?.recordInputs??e,recordOutputs:t?.recordOutputs??e}}function Vc(t,e){return t?`${t}.${e}`:e}function Tp(t,e,n,r,o){if(e!==void 0&&t.setAttributes({[Pe]:e}),n!==void 0&&t.setAttributes({[Ze]:n}),e!==void 0||n!==void 0||r!==void 0||o!==void 0){let s=(e??0)+(n??0)+(r??0)+(o??0);t.setAttributes({[ln]:s})}}function ta(t){if(typeof t=="string")return sj(t);if(Array.isArray(t)){let e=Us(t);return JSON.stringify(e)}return JSON.stringify(t)}function Fn(t){if(!Array.isArray(t))return{systemInstructions:void 0,filteredMessages:t};let e=t.findIndex(i=>i&&typeof i=="object"&&"role"in i&&i.role==="system");if(e===-1)return{systemInstructions:void 0,filteredMessages:t};let n=t[e],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:t};let o=JSON.stringify([{type:"text",content:r}]),s=[...t.slice(0,e),...t.slice(e+1)];return{systemInstructions:o,filteredMessages:s}}async function Vue(t,e,n){let r=t.catch(i=>{throw te(i,{mechanism:{handled:!1,type:n}}),i}),o=await e,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:o}:o}function qc(t,e,n){return Lt(t)?new Proxy(t,{get(r,o){let i=o in Promise.prototype||o===Symbol.toStringTag?e:r,a=Reflect.get(i,o);return o==="withResponse"&&typeof a=="function"?function(){let l=a.call(r);return Vue(l,e,n)}:typeof a=="function"?a.bind(i):a}}):e}var Om="operation.name",ij="ai.operationId",Nm="ai.prompt",aj="ai.schema",cj="ai.response.object",Wy="ai.values",zy="ai.response.text",Ky="ai.response.toolCalls",uj="ai.response.finishReason",na="ai.prompt.messages",$c="ai.prompt.tools",Ep="ai.model.id",lj="ai.response.providerMetadata",pj="ai.usage.cachedInputTokens",dj="ai.telemetry.functionId",_j="ai.usage.completionTokens",fj="ai.usage.promptTokens",mj="ai.usage.tokens",Qy="ai.toolCall.name",Xy="ai.toolCall.id",hj="ai.toolCall.args",Tj="ai.toolCall.result";function Sj(t,e){let n=t.parent_span_id;if(!n)return;let r=t.data[Pe],o=t.data[Ze];if(typeof r=="number"||typeof o=="number"){let s=e.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(s.inputTokens+=r),typeof o=="number"&&(s.outputTokens+=o),e.set(n,s)}}function Jy(t,e){let n=e.get(t.span_id);!n||!t.data||(n.inputTokens>0&&(t.data[Pe]=n.inputTokens),n.outputTokens>0&&(t.data[Ze]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(t.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function que(t){let e=new Map;for(let n of t){let r=n.data[Zr];if(typeof r=="string")try{let o=JSON.parse(r);for(let s of o)s.name&&s.description&&!e.has(s.name)&&e.set(s.name,s.description)}catch{}}return e}function gj(t,e){let n=que(t);for(let r of t){if(r.op==="gen_ai.execute_tool"){let o=r.data[Zi];if(typeof o=="string"){let s=n.get(o);s&&(r.data[$1]=s)}}r.op==="gen_ai.invoke_agent"&&Jy(r,e)}}function Zy(t){return mp.get(t)}function eI(t){mp.delete(t)}function Aj(t){let e=t.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(e)}function Ej(t){return t.filter(e=>!!e&&typeof e=="object"&&"role"in e&&"content"in e)}function $ue(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"){let{messages:n}=e,{prompt:r,system:o}=e,s=[];if(typeof o=="string"&&s.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return s.push(...Ej(n)),s;if(Array.isArray(r))return s.push(...Ej(r)),s;if(typeof r=="string"&&s.push({role:"user",content:r}),s.length>0)return s}}catch{}return[]}function Rj(t,e){if(typeof e[Nm]=="string"&&!e[Ut]&&!e[na]){let n=e[Nm],r=$ue(n);if(r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0,a=ta(s);t.setAttributes({[Nm]:a,[Ut]:a,[pn]:i})}}else if(typeof e[na]=="string")try{let n=JSON.parse(e[na]);if(Array.isArray(n)){let{systemInstructions:r,filteredMessages:o}=Fn(n);r&&t.setAttribute(Hn,r);let s=Array.isArray(o)?o.length:0,i=ta(o);t.setAttributes({[na]:i,[Ut]:i,[pn]:s})}}catch{}}function yj(t){switch(t){case"ai.generateText":case"ai.streamText":case"ai.generateObject":case"ai.streamObject":return gm;case"ai.generateText.doGenerate":return k1;case"ai.streamText.doStream":return G1;case"ai.generateObject.doGenerate":return B1;case"ai.streamObject.doStream":return j1;case"ai.embed.doEmbed":return H1;case"ai.embedMany.doEmbed":return F1;case"ai.rerank.doRerank":return V1;case"ai.toolCall":return q1;default:return t.startsWith("ai.stream")?"ai.run":void 0}}function Yue(t){return Vy.has(t)?"invoke_agent":qy.has(t)?"generate_content":z1.has(t)?"embeddings":K1.has(t)?"rerank":t==="ai.toolCall"?"execute_tool":t}function Wue(t){let{data:e,description:n}=Y(t);if(n){if(e[Qy]&&e[Xy]&&n==="ai.toolCall"){Jue(t,e);return}!e[ij]&&!n.startsWith("ai.")||Zue(t,n,e)}}function zue(t){if(t.type==="transaction"&&t.spans){let e=new Map;for(let r of t.spans)Xue(r),Sj(r,e);gj(t.spans,e);let n=t.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Jy(n,e)}return t}function Kue(t){if(typeof t!="string")return"stop";switch(t){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return t;default:return t}}function Que(t){let e=t[zy],n=t[Ky],r=t[uj];if(e==null&&n==null)return;let o=[];if(typeof e=="string"&&e.length>0&&o.push({type:"text",content:e}),n!=null)try{let s=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(s)){for(let i of s){let a=i.input??i.args;o.push({type:"tool_call",id:i.toolCallId,name:i.toolName,arguments:typeof a=="string"?a:JSON.stringify(a??{})})}delete t[Ky]}}catch{}if(o.length>0){let s={role:"assistant",parts:o,finish_reason:Kue(r)};t[L1]=JSON.stringify([s]),delete t[zy]}}function Xue(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){if(t.status&&t.status!=="ok"&&(t.status="internal_error"),wt(e,_j,Ze),wt(e,fj,Pe),wt(e,pj,Ls),wt(e,"ai.usage.inputTokens",Pe),wt(e,"ai.usage.outputTokens",Ze),wt(e,mj,Pe),wt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),typeof e[Pe]=="number"&&typeof e[Ls]=="number"&&(e[Pe]=e[Pe]+e[Ls]),typeof e[Pe]=="number"){let r=typeof e[Ze]=="number"?e[Ze]:0;e[ln]=r+e[Pe]}if(e[$c]&&Array.isArray(e[$c])&&(e[$c]=Aj(e[$c])),e[Om]){let r=Yue(e[Om]);e[Dt]=r,delete e[Om]}if(wt(e,na,Ut),Que(e),wt(e,cj,"gen_ai.response.object"),wt(e,$c,"gen_ai.request.available_tools"),wt(e,hj,Am),wt(e,Tj,Rm),wt(e,aj,"gen_ai.request.schema"),wt(e,Ep,He),Array.isArray(e[Wy])){let r=e[Wy].map(o=>{try{return JSON.parse(o)}catch{return o}});e[Fc]=r.length===1?r[0]:JSON.stringify(r)}ele(e);for(let r of Object.keys(e))r.startsWith("ai.")&&wt(e,r,`vercel.${r}`)}}function wt(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function Jue(t,e){t.setAttribute(W,"auto.vercelai.otel"),t.setAttribute(ee,"gen_ai.execute_tool"),t.setAttribute(Dt,"execute_tool"),wt(e,Qy,Zi),wt(e,Xy,ky);let n=e[ky];typeof n=="string"&&mp.set(n,t.spanContext()),e[Gy]||t.setAttribute(Gy,"function");let r=e[Zi];r&&t.updateName(`execute_tool ${r}`)}function Zue(t,e,n){t.setAttribute(W,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[dj];o&&typeof o=="string"&&t.setAttribute("gen_ai.function_id",o),Rj(t,n),n[Ep]&&!n[ft]&&t.setAttribute(ft,n[Ep]),t.setAttribute("ai.streaming",e.includes("stream"));let s=yj(e);if(s&&t.setAttribute(ee,s),Vy.has(e)){o&&typeof o=="string"?t.updateName(`invoke_agent ${o}`):t.updateName("invoke_agent");return}let i=n[Ep];if(i){let a=qy.has(e)?"generate_content":Q1[e];a&&t.updateName(`${a} ${i}`)}}function bm(t){t.on("spanStart",Wue),t.addEventProcessor(Object.assign(zue,{id:"VercelAiEventProcessor"}))}function ele(t){let e=t[lj];if(e)try{let n=JSON.parse(e),r=n.openai??n.azure;if(r&&(vr(t,Ls,r.cachedPromptTokens),vr(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),vr(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),vr(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),t["gen_ai.conversation.id"]||vr(t,"gen_ai.conversation.id",r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;vr(t,Ls,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;vr(t,wy,s)}n.bedrock?.usage&&(vr(t,Ls,n.bedrock.usage.cacheReadInputTokens),vr(t,wy,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(vr(t,Ls,n.deepseek.promptCacheHitTokens),vr(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function vr(t,e,n){n!=null&&(t[e]=n)}var ws="OpenAI",Ij={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},tle=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],Oj=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...tle];function Nj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function bj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function Cj(t){if(t===null||typeof t!="object"||!("object"in t))return!1;let e=t;return e.object==="list"&&typeof e.model=="string"&&e.model.toLowerCase().includes("embedding")}function Pj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="conversation"}function Mj(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.startsWith("response.")}function xj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion.chunk"}function vj(t,e,n){if(Cm(t,e.id,e.model,e.created),e.usage&&Sp(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let r=e.choices.map(o=>o.finish_reason).filter(o=>o!==null);if(r.length>0&&t.setAttributes({[yn]:JSON.stringify(r)}),n){let o=e.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Lj(t,e,n){if(Cm(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[yn]:JSON.stringify([e.status])}),e.usage&&Sp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens),n){let r=e;if(Array.isArray(r.output)&&r.output.length>0){let o=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Dj(t,e){t.setAttributes({[jy]:e.model,[ft]:e.model}),e.usage&&Sp(t,e.usage.prompt_tokens,void 0,e.usage.total_tokens)}function Uj(t,e){let{id:n,created_at:r}=e;t.setAttributes({[By]:n,[or]:n,[fp]:n}),r&&t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function Sp(t,e,n,r){e!==void 0&&t.setAttributes({[W1]:e,[Pe]:e}),n!==void 0&&t.setAttributes({[Y1]:n,[Ze]:n}),r!==void 0&&t.setAttributes({[ln]:r})}function Cm(t,e,n,r){t.setAttributes({[By]:e,[or]:e}),t.setAttributes({[jy]:n,[ft]:n}),t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function nle(t){if("conversation"in t&&typeof t.conversation=="string")return t.conversation;if("previous_response_id"in t&&typeof t.previous_response_id=="string")return t.previous_response_id}function wj(t){let e={[He]:t.model??"unknown"};"temperature"in t&&(e[Ms]=t.temperature),"top_p"in t&&(e[vs]=t.top_p),"frequency_penalty"in t&&(e[xs]=t.frequency_penalty),"presence_penalty"in t&&(e[Hc]=t.presence_penalty),"stream"in t&&(e[Bc]=t.stream),"encoding_format"in t&&(e[M1]=t.encoding_format),"dimensions"in t&&(e[x1]=t.dimensions);let n=nle(t);return n&&(e[fp]=n),e}function rle(t,e){for(let n of t){let r=n.index;if(!(r===void 0||!n.function))if(!(r in e.chatCompletionToolCalls))e.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=e.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function ole(t,e,n){e.responseId=t.id??e.responseId,e.responseModel=t.model??e.responseModel,e.responseTimestamp=t.created??e.responseTimestamp,t.usage&&(e.promptTokens=t.usage.prompt_tokens,e.completionTokens=t.usage.completion_tokens,e.totalTokens=t.usage.total_tokens);for(let r of t.choices??[])n&&(r.delta?.content&&e.responseTexts.push(r.delta.content),r.delta?.tool_calls&&rle(r.delta.tool_calls,e)),r.finish_reason&&e.finishReasons.push(r.finish_reason)}function sle(t,e,n,r){if(!(t&&typeof t=="object")){e.eventTypes.push("unknown:non-object");return}if(t instanceof Error){r.setStatus({code:2,message:"internal_error"}),te(t,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in t))return;let o=t;if(!Oj.includes(o.type)){e.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&e.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){e.responseTexts.push(o.delta);return}if("response"in o){let{response:s}=o;e.responseId=s.id??e.responseId,e.responseModel=s.model??e.responseModel,e.responseTimestamp=s.created_at??e.responseTimestamp,s.usage&&(e.promptTokens=s.usage.input_tokens,e.completionTokens=s.usage.output_tokens,e.totalTokens=s.usage.total_tokens),s.status&&e.finishReasons.push(s.status),n&&s.output_text&&e.responseTexts.push(s.output_text)}}async function*kj(t,e,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of t)xj(o)?ole(o,r,n):Mj(o)&&sle(o,r,n,e),yield o}finally{Cm(e,r.responseId,r.responseModel,r.responseTimestamp),Sp(e,r.promptTokens,r.completionTokens,r.totalTokens),e.setAttributes({[Ji]:!0}),r.finishReasons.length&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&e.setAttributes({[rt]:r.responseTexts.join("")});let s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&e.setAttributes({[Ot]:JSON.stringify(s)}),e.end()}}function ile(t){let e=Array.isArray(t.tools)?t.tools:[],r=t.web_search_options&&typeof t.web_search_options=="object"?[{type:"web_search_options",...t.web_search_options}]:[],o=[...e,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(s){C&&g.error("Failed to serialize OpenAI tools:",s);return}}function ale(t,e){let n={[Ps]:"openai",[Dt]:e,[W]:"auto.ai.openai"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0],o=ile(r);o&&(n[Zr]=o),Object.assign(n,wj(r))}else n[He]="unknown";return n}function cle(t,e,n){if(!e||typeof e!="object")return;let r=e;if(Nj(r)){if(vj(t,r,n),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[rt]:JSON.stringify(o)})}}else bj(r)?(Lj(t,r,n),n&&r.output_text&&t.setAttributes({[rt]:r.output_text})):Cj(r)?Dj(t,r):Pj(r)&&Uj(t,r)}function Gj(t,e,n){if(n==="embeddings"&&"input"in e){let a=e.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;t.setAttribute(Fc,typeof a=="string"?a:JSON.stringify(a));return}let r="input"in e?e.input:"messages"in e?e.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=ta(s);t.setAttribute(Ut,i),Array.isArray(s)?t.setAttribute(pn,s.length):t.setAttribute(pn,1)}function ule(t,e,n,r,o){return function(...i){let a=n.operation,c=ale(i,a),l=c[He]||"unknown",p=i[0],d=p&&typeof p=="object"&&p.stream===!0,_={name:`${a} ${l}`,op:`gen_ai.${a}`,attributes:c};if(d){let h,T=It(_,S=>(h=t.apply(r,i),o.recordInputs&&p&&Gj(S,p,a),(async()=>{try{let R=await h;return kj(R,S,o.recordOutputs??!1)}catch(R){throw S.setStatus({code:2,message:"internal_error"}),te(R,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:e}}}),S.end(),R}})()));return qc(h,T,"auto.ai.openai")}let f,m=xr(_,h=>(f=t.apply(r,i),o.recordInputs&&p&&Gj(h,p,a),f.then(T=>(cle(h,T,o.recordOutputs),T),T=>{throw te(T,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:e}}}),T})));return qc(f,m,"auto.ai.openai")}}function Bj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Vc(e,String(o)),a=Ij[i];return typeof s=="function"&&a?ule(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?Bj(s,i,n):s}})}function Pm(t,e){return Bj(t,"",eo(e))}var ks="Anthropic_AI",jj={"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 Hj(t,e){if(Array.isArray(e)&&e.length===0)return;let{systemInstructions:n,filteredMessages:r}=Fn(e);n&&t.setAttributes({[Hn]:n});let o=Array.isArray(r)?r.length:1;t.setAttributes({[Ut]:ta(r),[pn]:o})}var lle={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 tI(t){return t&&lle[t]||"internal_error"}function Fj(t,e){e.error&&(t.setStatus({code:2,message:tI(e.error.type)}),te(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Vj(t){let{system:e,messages:n,input:r}=t,o=typeof e=="string"?[{role:"system",content:t.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,i=Array.isArray(n)?n:n!=null?[n]:[],a=s??i;return[...o,...a]}function ple(t,e){return"type"in t&&typeof t.type=="string"&&t.type==="error"?(e.setStatus({code:2,message:tI(t.error?.type)}),te(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function dle(t,e){if(t.type==="message_delta"&&t.usage&&"output_tokens"in t.usage&&typeof t.usage.output_tokens=="number"&&(e.completionTokens=t.usage.output_tokens),t.message){let n=t.message;n.id&&(e.responseId=n.id),n.model&&(e.responseModel=n.model),n.stop_reason&&e.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(e.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(e.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(e.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function _le(t,e){t.type!=="content_block_start"||typeof t.index!="number"||!t.content_block||(t.content_block.type==="tool_use"||t.content_block.type==="server_tool_use")&&(e.activeToolBlocks[t.index]={id:t.content_block.id,name:t.content_block.name,inputJsonParts:[]})}function fle(t,e,n){if(!(t.type!=="content_block_delta"||!t.delta)){if(typeof t.index=="number"&&"partial_json"in t.delta&&typeof t.delta.partial_json=="string"){let r=e.activeToolBlocks[t.index];r&&r.inputJsonParts.push(t.delta.partial_json)}n&&typeof t.delta.text=="string"&&e.responseTexts.push(t.delta.text)}}function mle(t,e){if(t.type!=="content_block_stop"||typeof t.index!="number")return;let n=e.activeToolBlocks[t.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}e.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete e.activeToolBlocks[t.index]}function qj(t,e,n,r){!(t&&typeof t=="object")||ple(t,r)||(dle(t,e),_le(t,e),fle(t,e,n),mle(t,e))}function hle(t,e,n){e.isRecording()&&(t.responseId&&e.setAttributes({[or]:t.responseId}),t.responseModel&&e.setAttributes({[ft]:t.responseModel}),Tp(e,t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens),e.setAttributes({[Ji]:!0}),t.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(t.finishReasons)}),n&&t.responseTexts.length>0&&e.setAttributes({[rt]:t.responseTexts.join("")}),n&&t.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(t.toolCalls)}),e.end())}async function*$j(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of t)qj(o,r,n,e),yield o}finally{r.responseId&&e.setAttributes({[or]:r.responseId}),r.responseModel&&e.setAttributes({[ft]:r.responseModel}),Tp(e,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),e.setAttributes({[Ji]:!0}),r.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&e.setAttributes({[rt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(r.toolCalls)}),e.end()}}function Yj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return t.on("streamEvent",o=>{qj(o,r,n,e)}),t.on("message",()=>{hle(r,e,n)}),t.on("error",o=>{te(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end())}),t}function Tle(t,e,n){let r={[Ps]:"anthropic",[Dt]:n,[W]:"auto.ai.anthropic"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let o=t[0];o.tools&&Array.isArray(o.tools)&&(r[Zr]=JSON.stringify(o.tools)),r[He]=o.model??"unknown","temperature"in o&&(r[Ms]=o.temperature),"top_p"in o&&(r[vs]=o.top_p),"stream"in o&&(r[Bc]=o.stream),"top_k"in o&&(r[Sm]=o.top_k),"frequency_penalty"in o&&(r[xs]=o.frequency_penalty),"max_tokens"in o&&(r[jc]=o.max_tokens)}else e==="models.retrieve"||e==="models.get"?r[He]=t[0]:r[He]="unknown";return r}function nI(t,e){let n=Vj(e);Hj(t,n),"prompt"in e&&t.setAttributes({[P1]:JSON.stringify(e.prompt)})}function Ele(t,e){if("content"in e&&Array.isArray(e.content)){t.setAttributes({[rt]:e.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of e.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&t.setAttributes({[Ot]:JSON.stringify(n)})}"completion"in e&&t.setAttributes({[rt]:e.completion}),"input_tokens"in e&&t.setAttributes({[rt]:JSON.stringify(e.input_tokens)})}function Sle(t,e){"id"in e&&"model"in e&&(t.setAttributes({[or]:e.id,[ft]:e.model}),"created"in e&&typeof e.created=="number"&&t.setAttributes({[Fy]:new Date(e.created*1e3).toISOString()}),"created_at"in e&&typeof e.created_at=="number"&&t.setAttributes({[Fy]:new Date(e.created_at*1e3).toISOString()}),"usage"in e&&e.usage&&Tp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.cache_creation_input_tokens,e.usage.cache_read_input_tokens))}function gle(t,e,n){if(!(!e||typeof e!="object")){if("type"in e&&e.type==="error"){Fj(t,e);return}n&&Ele(t,e),Sle(t,e)}}function Wj(t,e,n){throw te(t,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end()),t}function Ale(t,e,n,r,o,s,i,a,c,l,p){let d=o[He]??"unknown",_={name:`${s} ${d}`,op:`gen_ai.${s}`,attributes:o};if(l&&!p){let f,m=It(_,h=>(f=t.apply(n,r),c.recordInputs&&a&&nI(h,a),(async()=>{try{let T=await f;return $j(T,h,c.recordOutputs??!1)}catch(T){return Wj(T,h,i)}})()));return qc(f,m,"auto.ai.anthropic")}else return It(_,f=>{try{c.recordInputs&&a&&nI(f,a);let m=e.apply(n,r);return Yj(m,f,c.recordOutputs??!1)}catch(m){return Wj(m,f,i)}})}function Rle(t,e,n,r,o){return new Proxy(t,{apply(s,i,a){let c=n.operation,l=Tle(a,e,c),p=l[He]??"unknown",d=typeof a[0]=="object"?a[0]:void 0,_=!!d?.stream,f=n.streaming===!0;if(_||f)return Ale(t,s,r,a,l,c,e,d,o,_,f);let m,h=xr({name:`${c} ${p}`,op:`gen_ai.${c}`,attributes:l},T=>(m=s.apply(r,a),o.recordInputs&&d&&nI(T,d),m.then(S=>(gle(T,S,o.recordOutputs),S),S=>{throw te(S,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:e}}}),S})));return qc(m,h,"auto.ai.anthropic")}})}function zj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Vc(e,String(o)),a=jj[i];return typeof s=="function"&&a?Rle(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?zj(s,i,n):s}})}function Mm(t,e){return zj(t,"",eo(e))}var Gs="Google_GenAI",Kj={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{operation:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},Qj="google_genai",rI="chats.create",Xj="chat";function yle(t,e){let n=t?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return e.setStatus({code:2,message:"internal_error"}),te(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function Ile(t,e){typeof t.responseId=="string"&&(e.responseId=t.responseId),typeof t.modelVersion=="string"&&(e.responseModel=t.modelVersion);let n=t.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(e.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(e.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(e.totalTokens=n.totalTokenCount))}function Ole(t,e,n){Array.isArray(t.functionCalls)&&e.toolCalls.push(...t.functionCalls);for(let r of t.candidates??[]){r?.finishReason&&!e.finishReasons.includes(r.finishReason)&&e.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&e.responseTexts.push(o.text),o.functionCall&&e.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function Nle(t,e,n,r){!t||yle(t,r)||(Ile(t,e),Ole(t,e,n))}async function*Jj(t,e,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of t)Nle(o,r,n,e),yield o}finally{let o={[Ji]:!0};r.responseId&&(o[or]=r.responseId),r.responseModel&&(o[ft]=r.responseModel),r.promptTokens!==void 0&&(o[Pe]=r.promptTokens),r.completionTokens!==void 0&&(o[Ze]=r.completionTokens),r.totalTokens!==void 0&&(o[ln]=r.totalTokens),r.finishReasons.length&&(o[yn]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(o[rt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(o[Ot]=JSON.stringify(r.toolCalls)),e.setAttributes(o),e.end()}}function Yc(t,e="user"){return typeof t=="string"?[{role:e,content:t}]:Array.isArray(t)?t.flatMap(n=>Yc(n,e)):typeof t!="object"||!t?[]:"role"in t&&typeof t.role=="string"?[t]:"parts"in t?[{...t,role:e}]:[{role:e,content:t}]}function Zj(t,e){if("model"in t&&typeof t.model=="string")return t.model;if(e&&typeof e=="object"){let n=e;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 ble(t){let e={};return"temperature"in t&&typeof t.temperature=="number"&&(e[Ms]=t.temperature),"topP"in t&&typeof t.topP=="number"&&(e[vs]=t.topP),"topK"in t&&typeof t.topK=="number"&&(e[Sm]=t.topK),"maxOutputTokens"in t&&typeof t.maxOutputTokens=="number"&&(e[jc]=t.maxOutputTokens),"frequencyPenalty"in t&&typeof t.frequencyPenalty=="number"&&(e[xs]=t.frequencyPenalty),"presencePenalty"in t&&typeof t.presencePenalty=="number"&&(e[Hc]=t.presencePenalty),e}function Cle(t,e,n){let r={[Ps]:Qj,[Dt]:t,[W]:"auto.ai.google_genai"};if(e){if(r[He]=Zj(e,n),"config"in e&&typeof e.config=="object"&&e.config){let o=e.config;if(Object.assign(r,ble(o)),"tools"in o&&Array.isArray(o.tools)){let s=o.tools.flatMap(i=>i.functionDeclarations);r[Zr]=JSON.stringify(s)}}}else r[He]=Zj({},n);return r}function eH(t,e,n){if(n){let o=e.contents;o!=null&&t.setAttribute(Fc,typeof o=="string"?o:JSON.stringify(o));return}let r=[];if("config"in e&&e.config&&typeof e.config=="object"&&"systemInstruction"in e.config&&e.config.systemInstruction&&r.push(...Yc(e.config.systemInstruction,"system")),"history"in e&&r.push(...Yc(e.history,"user")),"contents"in e&&r.push(...Yc(e.contents,"user")),"message"in e&&r.push(...Yc(e.message,"user")),Array.isArray(r)&&r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0;t.setAttributes({[pn]:i,[Ut]:JSON.stringify(Us(s))})}}function Ple(t,e,n){if(!(!e||typeof e!="object")){if(e.modelVersion&&t.setAttribute(ft,e.modelVersion),e.usageMetadata&&typeof e.usageMetadata=="object"){let r=e.usageMetadata;typeof r.promptTokenCount=="number"&&t.setAttributes({[Pe]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&t.setAttributes({[Ze]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&t.setAttributes({[ln]:r.totalTokenCount})}if(n&&Array.isArray(e.candidates)&&e.candidates.length>0){let r=e.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&t.setAttributes({[rt]:r.join("")})}if(n&&e.functionCalls){let r=e.functionCalls;Array.isArray(r)&&r.length>0&&t.setAttributes({[Ot]:JSON.stringify(r)})}}}function tH(t,e,n,r,o){let s=e===rI,i=n.operation==="embeddings";return new Proxy(t,{apply(a,c,l){let p=n.operation,d=l[0],_=Cle(p,d,r),f=_[He]??"unknown";return n.streaming?It({name:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},async m=>{try{o.recordInputs&&d&&eH(m,d,i);let h=await a.apply(r,l);return Jj(h,m,!!o.recordOutputs)}catch(h){throw m.setStatus({code:2,message:"internal_error"}),te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}}),m.end(),h}}):xr({name:s?`${p} ${f} create`:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},m=>(o.recordInputs&&d&&eH(m,d,i),Mr(()=>a.apply(r,l),h=>{te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}})},()=>{},h=>{!s&&!i&&Ple(m,h,o.recordOutputs)})))}})}function oI(t,e="",n){return new Proxy(t,{get:(r,o,s)=>{let i=Reflect.get(r,o,s),a=Vc(e,String(o)),c=Kj[a];if(typeof i=="function"&&c){if(a===rI){let l=tH(i,a,c,r,n);return function(...d){let _=l(...d);return _&&typeof _=="object"?oI(_,Xj,n):_}}return tH(i,a,c,r,n)}return typeof i=="function"?i.bind(r):i&&typeof i=="object"?oI(i,a,n):i}})}function xm(t,e){return oI(t,"",eo(e))}var vm="LangChain",ra="auto.ai.langchain",nH={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var sr=(t,e,n)=>{n!=null&&(t[e]=n)},Vn=(t,e,n)=>{let r=Number(n);Number.isNaN(r)||(t[e]=r)};function Go(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Wc(t){if(Array.isArray(t))try{let e=t.map(n=>n&&typeof n=="object"&&Ds(n)?ea(n):n);return JSON.stringify(e)}catch{return String(t)}return Go(t)}function gp(t){let e=t.toLowerCase();return nH[e]??e}function rH(t){return t.includes("System")?"system":t.includes("Human")?"user":t.includes("AI")||t.includes("Assistant")?"assistant":t.includes("Function")?"function":t.includes("Tool")?"tool":"user"}function sI(t){if(!(!t||Array.isArray(t)))return t.invocation_params}function Ap(t){return t.map(e=>{let n=e._getType;if(typeof n=="function"){let o=n.call(e);return{role:gp(o),content:Wc(e.content)}}if(e.lc===1&&e.kwargs){let o=e.id,s=Array.isArray(o)&&o.length>0?o[o.length-1]:"",i=typeof s=="string"?rH(s):"user";return{role:gp(i),content:Wc(e.kwargs?.content)}}if(e.type){let o=String(e.type).toLowerCase();return{role:gp(o),content:Wc(e.content)}}if(e.role)return{role:gp(String(e.role)),content:Wc(e.content)};let r=e.constructor?.name;return r&&r!=="Object"?{role:gp(rH(r)),content:Wc(e.content)}:{role:"user",content:Wc(e.content)}})}function Mle(t,e,n){let r={},o="kwargs"in t?t.kwargs:void 0,s=e?.temperature??n?.ls_temperature??o?.temperature;Vn(r,Ms,s);let i=e?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Vn(r,jc,i);let a=e?.top_p??o?.top_p;Vn(r,vs,a);let c=e?.frequency_penalty;Vn(r,xs,c);let l=e?.presence_penalty;return Vn(r,Hc,l),e&&"stream"in e&&sr(r,Bc,!!e.stream),r}function oH(t,e,n,r,o){return{[Ps]:Go(t??"langchain"),[Dt]:"chat",[He]:Go(e),[W]:ra,...Mle(n,r,o)}}function sH(t,e,n,r,o){let s=o?.ls_provider,i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){sr(a,pn,e.length);let c=e.map(l=>({role:"user",content:l}));sr(a,Ut,Go(c))}return a}function iH(t,e,n,r,o){let s=o?.ls_provider??t.id?.[2],i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){let c=Ap(e.flat()),{systemInstructions:l,filteredMessages:p}=Fn(c);l&&sr(a,Hn,l);let d=Array.isArray(p)?p.length:0;sr(a,pn,d);let _=Us(p);sr(a,Ut,Go(_))}return a}function xle(t,e){let n=[],r=t.flat();for(let o of r){let s=o.message?.content;if(Array.isArray(s))for(let i of s){let a=i;a.type==="tool_use"&&n.push(a)}}n.length>0&&sr(e,Ot,Go(n))}function vle(t,e){if(!t)return;let n=t.tokenUsage,r=t.usage;if(n)Vn(e,Pe,n.promptTokens),Vn(e,Ze,n.completionTokens),Vn(e,ln,n.totalTokens);else if(r){Vn(e,Pe,r.input_tokens),Vn(e,Ze,r.output_tokens);let o=Number(r.input_tokens),s=Number(r.output_tokens),i=(Number.isNaN(o)?0:o)+(Number.isNaN(s)?0:s);i>0&&Vn(e,ln,i),r.cache_creation_input_tokens!==void 0&&Vn(e,U1,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Vn(e,w1,r.cache_read_input_tokens)}}function aH(t,e){if(!t)return;let n={};if(Array.isArray(t.generations)){let l=t.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&&sr(n,yn,Go(l)),xle(t.generations,n),e){let p=t.generations.flat().map(d=>d.text??d.message?.content).filter(d=>typeof d=="string");p.length>0&&sr(n,rt,Go(p))}}vle(t.llmOutput,n);let r=t.llmOutput,s=t.generations?.[0]?.[0]?.message,i=r?.model_name??r?.model??s?.response_metadata?.model_name;i&&sr(n,ft,i);let a=r?.id??s?.id;a&&sr(n,or,a);let c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&sr(n,v1,Go(c)),n}function Lm(t={}){let{recordInputs:e,recordOutputs:n}=eo(t),r=new Map,o=i=>{let a=r.get(i);a?.isRecording()&&(a.end(),r.delete(i))},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(i,a,c,l,p,d,_,f){let m=sI(d),h=sH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleChatModelStart(i,a,c,l,p,d,_,f){let m=sI(d),h=iH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleLLMEnd(i,a,c,l,p){let d=r.get(a);if(d?.isRecording()){let _=aH(i,n);_&&d.setAttributes(_),o(a)}},handleLLMError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.llm_error_handler`}})},handleChainStart(i,a,c,l,p,d,_,f){let m=f||i.name||"unknown_chain",h={[W]:"auto.ai.langchain","langchain.chain.name":m};e&&(h["langchain.chain.inputs"]=JSON.stringify(a)),It({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...h,[ee]:"gen_ai.invoke_agent"}},T=>(r.set(c,T),T))},handleChainEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(i)}),o(a))},handleChainError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.chain_error_handler`}})},handleToolStart(i,a,c,l){let p=i.name||"unknown_tool",d={[W]:ra,[Zi]:p};e&&(d[Am]=a),It({name:`execute_tool ${p}`,op:"gen_ai.execute_tool",attributes:{...d,[ee]:"gen_ai.execute_tool"}},_=>(r.set(c,_),_))},handleToolEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[Rm]:JSON.stringify(i)}),o(a))},handleToolError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${ra}.tool_error_handler`}})},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}var Dm="LangGraph",iI="auto.ai.langgraph";function Lle(t){if(!t||t.length===0)return null;let e=[];for(let n of t)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&e.push(...r)}return e.length>0?e:null}function Dle(t){let e=t,n=0,r=0,o=0;if(e.usage_metadata&&typeof e.usage_metadata=="object"){let s=e.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(o=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(e.response_metadata&&typeof e.response_metadata=="object"){let s=e.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){let i=s.tokenUsage;typeof i.promptTokens=="number"&&(n=i.promptTokens),typeof i.completionTokens=="number"&&(r=i.completionTokens),typeof i.totalTokens=="number"&&(o=i.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function Ule(t,e){let n=e;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&t.setAttribute(ft,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&t.setAttribute(yn,[r.finish_reason])}}function cH(t){if(!t.builder?.nodes?.tools?.runnable?.tools)return null;let e=t.builder?.nodes?.tools?.runnable?.tools;return!e||!Array.isArray(e)||e.length===0?null:e.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function uH(t,e,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let s=e?.length??0,i=o.length>s?o.slice(s):[];if(i.length===0)return;let a=Lle(i);a&&t.setAttribute(Ot,JSON.stringify(a));let c=Ap(i);t.setAttribute(rt,JSON.stringify(c));let l=0,p=0,d=0;for(let _ of i){let f=Dle(_);l+=f.inputTokens,p+=f.outputTokens,d+=f.totalTokens,Ule(t,_)}l>0&&t.setAttribute(Pe,l),p>0&&t.setAttribute(Ze,p),d>0&&t.setAttribute(ln,d)}function aI(t,e){return new Proxy(t,{apply(n,r,o){return xr({op:"gen_ai.create_agent",name:"create_agent",attributes:{[W]:iI,[ee]:"gen_ai.create_agent",[Dt]:"create_agent"}},s=>{try{let i=Reflect.apply(n,r,o),a=o.length>0?o[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(Uy,a.name),s.updateName(`create_agent ${a.name}`));let c=i.invoke;return c&&typeof c=="function"&&(i.invoke=wle(c.bind(i),i,a,e)),i}catch(i){throw s.setStatus({code:2,message:"internal_error"}),te(i,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),i}})}})}function wle(t,e,n,r){return new Proxy(t,{apply(o,s,i){return xr({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[W]:iI,[ee]:gm,[Dt]:"invoke_agent"}},async a=>{try{let c=n?.name;c&&typeof c=="string"&&(a.setAttribute(D1,c),a.setAttribute(Uy,c),a.updateName(`invoke_agent ${c}`));let d=(i.length>1?i[1]:void 0)?.configurable?.thread_id;d&&typeof d=="string"&&a.setAttribute(fp,d);let _=cH(e);_&&a.setAttribute(Zr,JSON.stringify(_));let f=r.recordInputs,m=r.recordOutputs,h=i.length>0?i[0]?.messages??[]:[];if(h&&f){let S=Ap(h),{systemInstructions:R,filteredMessages:I}=Fn(S);R&&a.setAttribute(Hn,R);let x=Us(I),F=Array.isArray(I)?I.length:0;a.setAttributes({[Ut]:JSON.stringify(x),[pn]:F})}let T=await Reflect.apply(o,s,i);return m&&uH(a,h??null,T),T}catch(c){throw a.setStatus({code:2,message:"internal_error"}),te(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function Um(t,e){return t.compile=aI(t.compile,eo(e)),t}function Rp(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function yp(t,e,n){let r=t[e];if(typeof r=="function"){try{t[e]=n}catch{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=n}catch{Object.defineProperty(t,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}function pH(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function dH(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let s=o.match(r);if(s)return{filename:`<data:${s[2]}>`,function:s[1]};let i=o.match(n);if(i){let a,c,l,p,d;if(i[1]){l=i[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){a=l.slice(0,h),c=l.slice(h+1);let T=a.indexOf(".Module");T>0&&(l=l.slice(T+1),a=a.slice(0,T))}p=void 0}c&&(p=a,d=c),c==="<anonymous>"&&(d=void 0,l=void 0),l===void 0&&(d=d||xf,l=p?`${p}.${d}`:d);let _=MG(i[2]),f=i[5]==="native";!_&&i[5]&&!f&&(_=i[5]);let m=_?kle(_):void 0;return{filename:m??_,module:m&&t?.(m),function:l,lineno:lH(i[3]),colno:lH(i[4]),in_app:pH(_||"",f)}}if(o.match(e))return{filename:o}}}function cI(t){return[90,dH(t)]}function lH(t){return parseInt(t||"",10)||void 0}function kle(t){try{return decodeURI(t)}catch{return}}var In=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let n=this._cache.get(e);if(n!==void 0)return this._cache.delete(e),this._cache.set(e,n),n}set(e,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(e,n)}remove(e){let n=this._cache.get(e);return n&&this._cache.delete(e),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(n=>e.push(n)),e}};var uI=K(ne(),1),Ip={};function w(t,e,n){return n?ipe(t,e,n):spe(t,e)}function spe(t,e){return Object.assign(n=>{let r=Ip[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return Ip[t]=o,(0,uI.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function ipe(t,e,n){return Object.assign(r=>{let o=n(r),s=Ip[t];if(s)return s.setConfig(o),s;let i=new e(o);return Ip[t]=i,(0,uI.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Op(t){let e=!1,n=[];if(!ape(t))e=!0;else{let o=t._wrap;t._wrap=(...s)=>(e=!0,n.forEach(i=>i()),n=[],o(...s))}return o=>{e?o():n.push(o)}}function ape(t){return typeof t._wrap=="function"}b();import{subscribe as cpe}from"node:diagnostics_channel";var re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var wm="@sentry/instrumentation-http";function _H(t,e,n,r){let o=0,s=[];re&&g.log(r,"Patching request.on");let i=new WeakMap,a=n==="small"?1e3:n==="medium"?1e4:1048576;try{t.on=new Proxy(t.on,{apply:(c,l,p)=>{let[d,_,...f]=p;if(d==="data"){re&&g.log(r,`Handling request.on("data") with maximum body size of ${a}b`);let m=new Proxy(_,{apply:(h,T,S)=>{try{let R=S[0],I=Buffer.from(R);o<a?(s.push(I),o+=I.byteLength):re&&g.log(r,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{re&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,T,S)}});return i.set(_,m),Reflect.apply(c,l,[d,m,...f])}return Reflect.apply(c,l,p)}}),t.off=new Proxy(t.off,{apply:(c,l,p)=>{let[,d]=p,_=i.get(d);if(_){i.delete(d);let f=p.slice();return f[1]=_,Reflect.apply(c,l,f)}return Reflect.apply(c,l,p)}}),t.on("end",()=>{try{let c=Buffer.concat(s).toString("utf-8");if(c){let p=Buffer.byteLength(c,"utf-8")>a?`${Buffer.from(c).subarray(0,a-3).toString("utf-8")}...`:c;e.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(c){re&&g.error(r,"Error building captured request body",c)}})}catch(c){re&&g.error(r,"Error patching request to capture body",c)}}var fH=Un("sentry_http_server_instrumented"),pI="Http.Server",lI=new Map,mH=new WeakSet;function hH(t,e){nt(t,"_startSpanCallback",new WeakRef(e))}var upe=(t={})=>{let e={sessions:t.sessions??!0,sessionFlushingDelayMS:t.sessionFlushingDelayMS??6e4,maxRequestBodySize:t.maxRequestBodySize??"medium",ignoreRequestBody:t.ignoreRequestBody};return{name:pI,setupOnce(){cpe("http.server.request.start",r=>{lpe(r.server,e)})},afterAllSetup(n){re&&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`.")}}},Np=upe;function lpe(t,{ignoreRequestBody:e,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:o}){let s=t.emit;if(mH.has(s))return;let i=new Proxy(s,{apply(a,c,l){if(l[0]!=="request")return a.apply(c,l);let p=H();if(P.active().getValue(fH)||!p)return a.apply(c,l);re&&g.log(pI,"Handling incoming request");let d=ue().clone(),_=l[1],f=l[2],m=_p(_),h=_.ip||_.socket?.remoteAddress,T=_.url||"/";n!=="none"&&!e?.(T,_)&&_H(_,d,n,pI),d.setSDKProcessingMetadata({normalizedRequest:m,ipAddress:h});let S=(_.method||"GET").toUpperCase(),R=ko(T),I=`${S} ${R}`;return d.setTransactionName(I),r&&p&&ppe(p,{requestIsolationScope:d,response:f,sessionFlushingDelayMS:o??6e4}),zl(d,()=>{let x={traceId:zt(),sampleRand:yt(),propagationSpanId:Kt()};he().setPropagationContext({...x}),d.setPropagationContext({...x});let F=Ar.extract(P.active(),m.headers).setValue(fH,!0);return P.with(F,()=>{p.emit("httpServerRequest",_,f,m);let B=_._startSpanCallback?.deref();return B?B(()=>a.apply(c,l)):a.apply(c,l)})})}});mH.add(i),t.emit=i}function ppe(t,{requestIsolationScope:e,response:n,sessionFlushingDelayMS:r}){e.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=e.getScopeData().sdkProcessingMetadata.requestSession;if(t&&o){re&&g.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=lI.get(t),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{re&&g.log("Opened new request session aggregate.");let l={[i]:c};lI.set(t,l);let p=()=>{clearTimeout(_),d(),lI.delete(t);let f=Object.entries(l).map(([m,h])=>({started:m,exited:h.exited,errored:h.errored,crashed:h.crashed}));t.sendSession({aggregates:f})},d=t.on("flush",()=>{re&&g.log("Sending request session aggregate due to client flush"),p()}),_=setTimeout(()=>{re&&g.log("Sending request session aggregate due to flushing schedule"),p()},r).unref()}}})}b();var Bo=K(Te(),1);le();import{errorMonitor as dpe}from"node:events";var TH="Http.ServerSpans",_pe=(t={})=>{let e=t.ignoreStaticAssets??!0,n=t.ignoreIncomingRequests,r=t.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=t,{requestHook:s,responseHook:i,applyCustomAttributesOnSpan:a}=t.instrumentation??{};return{name:TH,setup(c){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||c.on("httpServerRequest",(l,p,d)=>{let _=l,f=p;hH(_,h=>{if(hpe(_,{ignoreStaticAssets:e,ignoreIncomingRequests:n}))return re&&g.log(TH,"Skipping span creation for incoming request",_.url),h();let T=d.url||_.url||"/",S=dp(T),R=_.headers,I=R["user-agent"],x=R["x-forwarded-for"],F=_.httpVersion,B=R.host,se=B?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",ve=c.tracer,on=T.startsWith("https")?"https":"http",Io=d.method||_.method?.toUpperCase()||"GET",ss=S?S.pathname:ko(T),Ii=`${Io} ${ss}`,Et=ve.startSpan(Ii,{kind:Ne.SERVER,attributes:{[ee]:"http.server",[W]:"auto.http.otel.http","sentry.http.prefetch":fpe(_)||void 0,"http.url":T,"http.method":d.method,"http.target":S?`${S.pathname}${S.search}`:ss,"http.host":B,"net.host.name":se,"http.client_ip":typeof x=="string"?x.split(",")[0]:void 0,"http.user_agent":I,"http.scheme":on,"http.flavor":F,"net.transport":F?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...Tpe(_),...pm(d.headers||{},c.getOptions().sendDefaultPii??!1)}});s?.(Et,_),i?.(Et,f),a?.(Et,_,f),o?.(Et,_,f);let Ya={type:Bo.RPCType.HTTP,span:Et};return P.with((0,Bo.setRPCMetadata)(X.setSpan(P.active(),Et),Ya),()=>{P.bind(P.active(),_),P.bind(P.active(),f);let Wa=!1;function DC(o_){if(Wa)return;Wa=!0;let UC=gpe(_,f);Et.setAttributes(UC),Et.setStatus(o_),Et.end();let wC=UC["http.route"];wC&&ue().setTransactionName(`${_.method?.toUpperCase()||"GET"} ${wC}`)}return f.on("close",()=>{DC(Do(f.statusCode))}),f.on(dpe,()=>{let o_=Do(f.statusCode);DC(o_.code===2?o_:{code:2})}),h()})})})},processEvent(c){if(c.type==="transaction"){let l=c.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"&&Ape(l,r))return re&&g.log("Dropping transaction due to status code",l),null}return c},afterAllSetup(c){re&&(c.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),c.getIntegrationByName("Http.Server")||g.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}},bp=_pe;function fpe(t){return t.headers["next-router-prefetch"]==="1"}function mpe(t){let e=ko(t);return!!(e.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||e.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function hpe(t,{ignoreStaticAssets:e,ignoreIncomingRequests:n}){if((0,Bo.isTracingSuppressed)(P.active()))return!0;let r=t.url,o=t.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||e&&o==="GET"&&mpe(r)||n?.(r,t))}function Tpe(t){let e=Epe(t.headers);return e==null?{}:Spe(t.headers)?{"http.request_content_length":e}:{"http.request_content_length_uncompressed":e}}function Epe(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}function Spe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}function gpe(t,e){let{socket:n}=t,{statusCode:r,statusMessage:o}=e,s={[bo]:r,[Mi]:r,"http.status_text":o?.toUpperCase()},i=(0,Bo.getRPCMetadata)(P.active());if(n){let{localAddress:a,localPort:c,remoteAddress:l,remotePort:p}=n;s[Zg]=a,s[eA]=c,s[Jg]=l,s["net.peer.port"]=p}if(s[Mi]=r,s["http.status_text"]=(o||"").toUpperCase(),i?.type===Bo.RPCType.HTTP&&i.route!==void 0){let a=i.route;s[Co]=a}return s}function Ape(t,e){return e.some(n=>{if(typeof n=="number")return n===t;let[r,o]=n;return t>=r&&t<=o})}b();var AH=K(Te(),1),Pp=K(ne(),1);le();import{subscribe as dI,unsubscribe as _I}from"node:diagnostics_channel";import{errorMonitor as gH}from"node:events";function Cp(t,e){if(!t)return e;let n=qi(t),r=qi(e);if(!r)return t;let o={},s={};for(let[c,l]of Object.entries(r))c.startsWith(Xr)?o[c]=l:s[c]=l;let i=Object.keys(o).length>0,a={};if(n)for(let[c,l]of Object.entries(n))i&&c.startsWith(Xr)||(a[c]=l);Object.assign(a,o);for(let[c,l]of Object.entries(s))a[c]||(a[c]=l);return jf(a)}var zc="@sentry/instrumentation-http";function EH(t,e){let n=Rpe(t),r=e?.statusCode,o=Rp(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function km(t,e){let n=Gm(t),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Xi(n,r,e)?Gc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s;if(!t.getHeader("sentry-trace")){if(i)try{t.setHeader("sentry-trace",i),re&&g.log(zc,"Added sentry-trace header to outgoing request")}catch(p){re&&g.error(zc,"Failed to add sentry-trace header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(c&&!t.getHeader("traceparent"))try{t.setHeader("traceparent",c),re&&g.log(zc,"Added traceparent header to outgoing request")}catch(p){re&&g.error(zc,"Failed to add traceparent header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(a){let p=t.getHeader("baggage"),d=Cp(p,a);if(d)try{t.setHeader("baggage",d),re&&g.log(zc,"Added baggage header to outgoing request")}catch(_){re&&g.error(zc,"Failed to add baggage header to outgoing request:",Kr(_)?_.message:"Unknown error")}}}}function Rpe(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=bs(n.toString()),o={url:Cs(r),"http.method":t.method||"GET"};return r.search&&(o["http.query"]=r.search),r.hash&&(o["http.fragment"]=r.hash),o}catch{return{}}}function SH(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function Gm(t){let e=t.getHeader("host")||t.host,n=t.protocol,r=t.path;return`${n}//${e}${r}`}var oa=class extends Pp.InstrumentationBase{constructor(e={}){super(wm,pe,e),this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=a=>{let c=a;this._onOutgoingRequestFinish(c.request,c.response)},r=a=>{let c=a;this._onOutgoingRequestFinish(c.request,void 0)},o=a=>{let c=a;this._onOutgoingRequestCreated(c.request)},s=a=>(e||(e=!0,dI("http.client.response.finish",n),dI("http.client.request.error",r),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&dI("http.client.request.created",o)),a),i=()=>{_I("http.client.response.finish",n),_I("http.client.request.error",r),_I("http.client.request.created",o)};return[new Pp.InstrumentationNodeModuleDefinition("http",["*"],s,i),new Pp.InstrumentationNodeModuleDefinition("https",["*"],s,i)]}_startSpanForOutgoingRequest(e){let n=e.once,[r,o]=ype(e),s=Jf({name:r,attributes:o,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(s,e);let i=new Proxy(n,{apply(l,p,d){let[_]=d;if(_!=="response")return l.apply(p,d);let f=P.active(),m=X.setSpan(f,s);return P.with(m,()=>l.apply(p,d))}});e.once=i;let a=!1,c=l=>{a||(a=!0,s.setStatus(l),s.end())};return e.prependListener("response",l=>{e.listenerCount("response")<=1&&l.resume(),P.bind(P.active(),l);let p=Ipe(l);s.setAttributes(p),this.getConfig().outgoingResponseHook?.(s,l),this.getConfig().outgoingRequestApplyCustomAttributes?.(s,e,l);let d=(_=!1)=>{this._diag.debug("outgoingRequest on end()");let f=_||typeof l.statusCode!="number"||l.aborted&&!l.complete?{code:Be.ERROR}:Do(l.statusCode);c(f)};l.on("end",()=>{d()}),l.on(gH,_=>{this._diag.debug("outgoingRequest on response error()",_),d(!0)})}),e.on("close",()=>{c({code:Be.UNSET})}),e.on(gH,l=>{this._diag.debug("outgoingRequest on request error()",l),c({code:Be.ERROR})}),s}_onOutgoingRequestFinish(e,n){re&&g.log(wm,"Handling finished outgoing request");let r=this.getConfig().breadcrumbs,o=typeof r>"u"?!0:r,s=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,s),o&&!s&&EH(e,n)}_onOutgoingRequestCreated(e){re&&g.log(wm,"Handling outgoing request created");let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),o=this.getConfig().propagateTraceInOutgoingRequests;if(r){let s=this._startSpanForOutgoingRequest(e);if(o&&s.isRecording()){let i=X.setSpan(P.active(),s);P.with(i,()=>{km(e,this._propagationDecisionMap)})}else o&&km(e,this._propagationDecisionMap)}else o&&km(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if((0,AH.isTracingSuppressed)(P.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=SH(e),o=Gm(e);return n(o,r)}};function ype(t){let e=Gm(t),[n,r]=Oy(dp(e),"client","auto.http.otel.http",t),o=t.getHeader("user-agent");return[n,{[ee]:"http.client","otel.kind":"CLIENT",[RA]:o,[cs]:e,"http.url":e,"http.method":t.method,"http.target":t.path||"/","net.peer.name":t.host,"http.host":t.getHeader("host"),...r}]}function Ipe(t){let{statusCode:e,statusMessage:n,httpVersion:r,socket:o}=t,s=r.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp",i={[bo]:e,[hA]:r,"http.flavor":r,[TA]:s,"net.transport":s,"http.status_text":n?.toUpperCase(),"http.status_code":e,...Ope(t)};if(o){let{remoteAddress:a,remotePort:c}=o;i[fA]=a,i[mA]=c,i["net.peer.ip"]=a,i["net.peer.port"]=c}return i}function Ope(t){let e=Npe(t.headers);return e==null?{}:bpe(t.headers)?{[nA]:e}:{[rA]:e}}function Npe(t){let e=t["content-length"];if(typeof e=="number")return e;if(typeof e!="string")return;let n=parseInt(e,10);if(!isNaN(n))return n}function bpe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}var RH="Http",Cpe=w(`${RH}.sentry`,t=>new oa(t)),yH=(t={})=>{let e={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},n={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:t.tracePropagation??!0,ignoreOutgoingRequests:t.ignoreOutgoingRequests},o=Np(e),s=bp(n),i=t.spans??!1,a=t.disableIncomingRequestSpans??!1,c=i&&!a;return{name:RH,setup(l){c&&s.setup(l)},setupOnce(){o.setupOnce(),Cpe(r)},processEvent(l){return s.processEvent(l)}}};b();var NH=K(Te(),1),bH=K(ne(),1);import*as Kc from"diagnostics_channel";var Lr=BR(process.versions.node),jo=Lr.major,Mp=Lr.minor;var fI="sentry-trace",Bm="baggage",Ppe="traceparent";function IH(t,e){let n=jm(t.origin,t.path),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Xi(n,r,e)?Gc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s,l=Array.isArray(t.headers)?t.headers:Mpe(t.headers);if(mI(l,fI),mI(l,Bm),o&&mI(l,Ppe),!(hI(l,fI)!==-1)){i&&l.push(fI,i),c&&hI(l,"traceparent")===-1&&l.push("traceparent",c);let d=hI(l,Bm);if(a&&d===-1)l.push(Bm,a);else if(a){let _=l[d+1],f=Cp(_,a);f&&(l[d+1]=f)}}Array.isArray(t.headers)||(t.headers=xpe(l))}function Mpe(t){let e=t.split(`\r
|
|
29
|
+
`),n=[];for(let r of e)try{let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&n.push(s,i)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function xpe(t){let e=[];for(let n=0;n<t.length;n+=2){let r=t[n],o=t[n+1];!r||o==null||e.push(`${r}: ${o}`)}return e.length?e.join(`\r
|
|
30
30
|
`).concat(`\r
|
|
31
|
-
`):""}function mI(t,e){let n=-1;for(let r=0;r<t.length;r+=2){if(t[r]!==e)continue;if(n===-1){n=r;continue}let o=t[n+1];if(e===Gm&&o){let s=bp(t[r+1],o);s&&(t[n+1]=s)}t.splice(r,2),r-=2}}function hI(t,e){return t.findIndex((n,r)=>r%2===0&&n===e)}function OH(t,e){let n=xpe(t),r=e.statusCode,o=Ap(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function xpe(t){try{let e=Bm(t.origin,t.path),n=bs(e),r={url:Cs(n),"http.method":t.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function Bm(t,e="/"){try{return new URL(e,t).toString()}catch{let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}}var oa=class extends bH.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",pe,e),this._channelSubs=[],this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel("undici:request:create",this._onRequestCreated.bind(this)),this._subscribeToChannel("undici:request:headers",this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let n=this.getConfig();if(!(n.enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,o),!o&&n.tracePropagation!==!1&&IH(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:n}){let r=this.getConfig();if(!(r.enabled!==!1))return;let s=r.breadcrumbs,i=typeof s>"u"?!0:s,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&OH(e,n)}_subscribeToChannel(e,n){let r=jo>18||jo===18&&Pp>=19,o;if(r)zc.subscribe?.(e,n),o=()=>zc.unsubscribe?.(e,n);else{let s=zc.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,NH.isTracingSuppressed)(P.active()))return!0;let n=Bm(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};var vpe="NodeFetch",Lpe=w(`${vpe}.sentry`,oa,t=>t),Dpe=(t={})=>({name:"NodeFetch",setupOnce(){Lpe(t)}}),CH=Dpe;var lV=K(xH(),1);le();b();b();var dn=K(Te(),1),Bs=K(iO(),1),mO="sentry.parentIsRemote",au="sentry.graphql.operation";function hO(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function TO(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function R_e(t){return typeof t.kind=="number"}function y_e(t){return!!t.status}function DF(t){return!!t.name}function I_e(t){if(!TO(t))return{};let e=t.attributes[cs]||t.attributes[Za],n={url:e,"http.method":t.attributes[xi]||t.attributes[bl]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=bs(e);n.url=Cs(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function O_e(t){return R_e(t)?t.kind:Ne.INTERNAL}var Uh="sentry-trace",aO="baggage",EO="sentry.dsc",SO="sentry.sampled_not_recording",UF="sentry.url",N_e="sentry.sample_rand",b_e="sentry.sample_rate",gO=Un("sentry_scopes"),cO=Un("sentry_fork_isolation_scope"),uO=Un("sentry_fork_set_scope"),lO=Un("sentry_fork_set_isolation_scope"),wF="_scopeContext";function cu(t){return t.getValue(gO)}function kF(t,e){return t.setValue(gO,e)}function C_e(t,e){nt(t,wF,e)}function Gp(t){return t[wF]}function iu(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(SO)==="1":!1;if(e===Vt.SAMPLED)return!0;if(r)return!1;let o=n?n.get(EO):void 0,s=o?Uo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function GF(t,e,n){let r=e[xi]||e[bl];if(r)return M_e({attributes:e,name:t,kind:n},r);let o=e[Mi]||e[Kg],s=typeof e[ee]=="string"&&e[ee].startsWith("cache.");if(o&&!s)return P_e({attributes:e,name:t});let i=e[Ue]==="custom"?"custom":"route";if(e[iA])return{...kp(t,e,"route"),op:"rpc"};if(e[sA])return{...kp(t,e,i),op:"message"};let l=e[Xg];return l?{...kp(t,e,i),op:l.toString()}:{op:void 0,description:t,source:"custom"}}function BF(t){let e=TO(t)?t.attributes:{},n=DF(t)?t.name:"<unknown>",r=O_e(t);return GF(n,e,r)}function P_e({attributes:t,name:e}){let n=t[tr];if(typeof n=="string")return{op:"db",description:n,source:t[Ue]||"custom"};if(t[Ue]==="custom")return{op:"db",description:e,source:"custom"};let r=t[Qg];return{op:"db",description:r?r.toString():e,source:"task"}}function M_e({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case Ne.CLIENT:o.push("client");break;case Ne.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:l}=v_e(n,e);if(!s)return{...kp(t,n),op:o.join(".")};let p=n[au],d=`${r} ${s}`,_=p?`${d} (${x_e(p)})`:d,f=l||s==="/"?"route":"url",m={};i&&(m.url=i),a&&(m["http.query"]=a),c&&(m["http.fragment"]=c);let h=e===Ne.CLIENT||e===Ne.SERVER,S=!`${n[W]||"manual"}`.startsWith("auto"),R=n[Ue]==="custom",I=n[tr],x=!R&&I==null&&(h||!S),{description:F,source:B}=x?{description:_,source:f}:kp(t,n);return{op:o.join("."),description:F,source:B,data:m}}function x_e(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}function v_e(t,e){let n=t[tA],r=t[Za]||t[cs],o=t[Co],s=typeof r=="string"?bs(r):void 0,i=s?Cs(s):void 0,a=s?.search||void 0,c=s?.hash||void 0;return typeof o=="string"?{urlPath:o,url:i,query:a,fragment:c,hasRoute:!0}:e===Ne.SERVER&&typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function kp(t,e,n="custom"){let r=e[Ue]||n,o=e[tr];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function jF(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=Y(n).data[Ue],{description:i}=DF(n)?BF(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),Xe()){let a=iu(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function HF(){return X.getActiveSpan()}var js=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function FF({dsc:t,sampled:e}){let n=t?Fi(t):void 0,r=new dn.TraceState,o=n?r.set(EO,n):r;return e===!1?o.set(SO,"1"):o}var VF=new Set;function qF(){return Array.from(VF)}function Bh(t){VF.add(t)}var wh=class extends dn.W3CBaggagePropagator{constructor(){super(),Bh("SentryPropagator"),this._urlMatchesTargetsMap=new In(100)}inject(e,n,r){if((0,dn.isTracingSuppressed)(e)){js&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=X.getSpan(e),s=o&&w_e(o),{tracePropagationTargets:i,propagateTraceparent:a}=H()?.getOptions()||{};if(!Qi(s,i,this._urlMatchesTargetsMap)){js&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let c=D_e(n),l=U_e(n),p=Ar.getBaggage(e)||Ar.createBaggage({}),{dynamicSamplingContext:d,traceId:_,spanId:f,sampled:m}=$F(e);if(c){let h=Vi(c);h&&Object.entries(h).forEach(([T,S])=>{!l&&T.startsWith(Xr)||(p=p.setEntry(T,{value:S}))})}!l&&d&&(p=Object.entries(d).reduce((h,[T,S])=>S?h.setEntry(`${Xr}${T}`,{value:S}):h,p)),!l&&_&&_!==Ni&&(r.set(n,Uh,Rs(_,f,m)),a&&r.set(n,"traceparent",ys(_,f,m))),super.inject(Ar.setBaggage(e,p),n,r)}extract(e,n,r){let o=r.get(n,Uh),s=r.get(n,aO),i=o?Array.isArray(o)?o[0]:o:void 0;return WF(YF(e,{sentryTrace:i,baggage:s}))}fields(){return[Uh,aO,"traceparent"]}};function $F(t,e={}){let n=X.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:void 0,sampled:iu(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:a.spanId,sampled:iu(a)}}let r=e.scope||cu(t)?.scope||he(),o=e.client||H(),s=r.getPropagationContext();return{dynamicSamplingContext:o?Jr(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function YF(t,{sentryTrace:e,baggage:n}){let r=Kl(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r,c=H(),l=Uo(n);if(!s||c&&!JR(c,l?.org_id))return t;let p=k_e({traceId:o,spanId:s,sampled:i,dsc:a});return X.setSpanContext(t,p)}function L_e(t,e,n){let r=WF(YF(t,e));return P.with(r,n)}function WF(t){let e=cu(t),n={scope:e?e.scope:he().clone(),isolationScope:e?e.isolationScope:ue()};return kF(t,n)}function D_e(t){try{let e=t[aO];return Array.isArray(e)?e.join(","):e}catch{return}}function U_e(t){try{return t[Uh]}catch{return}}function w_e(t){let e=Y(t).data,n=e[Za]||e[cs];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(UF);if(r)return r}function k_e({spanId:t,traceId:e,sampled:n,dsc:r}){let o=FF({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Vt.SAMPLED:Vt.NONE,traceState:o}}function zF(t,e,n){let r=QF(),{name:o,parentSpan:s}=t;return tV(s)(()=>{let a=ZF(t.scope,t.forceTransaction),l=t.onlyIfParent&&!X.getSpan(a)?(0,dn.suppressTracing)(a):a,p=XF(t);if(!Xe()){let d=(0,dn.isTracingSuppressed)(l)?l:(0,dn.suppressTracing)(l);return P.with(d,()=>r.startActiveSpan(o,p,d,_=>(pO(_),P.with(a,()=>Mr(()=>e(_),()=>{Y(_).status===void 0&&_.setStatus({code:Be.ERROR})},n?()=>_.end():void 0)))))}return r.startActiveSpan(o,p,l,d=>(pO(d),Mr(()=>e(d),()=>{Y(d).status===void 0&&d.setStatus({code:Be.ERROR})},n?()=>d.end():void 0)))})}function G_e(t,e){return zF(t,e,!0)}function B_e(t,e){return zF(t,n=>e(n,()=>n.end()),!1)}function j_e(t){let e=QF(),{name:n,parentSpan:r}=t;return tV(r)(()=>{let s=ZF(t.scope,t.forceTransaction),a=t.onlyIfParent&&!X.getSpan(s)?(0,dn.suppressTracing)(s):s,c=XF(t);Xe()||(a=(0,dn.isTracingSuppressed)(a)?a:(0,dn.suppressTracing)(a));let l=e.startSpan(n,c,a);return pO(l),l})}function KF(t,e){let n=t?X.setSpan(P.active(),t):X.deleteSpan(P.active());return P.with(n,()=>e(he()))}function QF(){return H()?.tracer||X.getTracer("@sentry/opentelemetry",pe)}function XF(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?JF(e):e;return{attributes:o?{[ee]:o,...n}:n,kind:r,links:s,startTime:i}}function JF(t){return t<9999999999?t*1e3:t}function pO(t){let e=t.end.bind(t);t.end=n=>e(typeof n=="number"?JF(n):n)}function ZF(t,e){let n=H_e(t),r=X.getSpan(n);if(!r||!e)return n;let o=X.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=iu(r.spanContext()),c=je(r),l=Je(c),p=FF({dsc:l,sampled:a}),d={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Vt.SAMPLED:Vt.NONE,traceState:p};return X.setSpanContext(o,d)}function H_e(t){if(t){let e=Gp(t);if(e)return e}return P.active()}function F_e(t,e){return L_e(P.active(),t,e)}function V_e(t){let e=zt(),n=Kt(),r={traceId:e,spanId:n,isRemote:!0,traceFlags:Vt.NONE},o=X.setSpanContext(P.active(),r);return P.with(o,()=>(he().setPropagationContext({traceId:e,sampleRand:yt()}),t()))}function eV(t,e){let n=Gp(e),r=n&&X.getSpan(n),o=r?Is(r):Hi(e);return[r?Je(r):Jr(t,e),o]}function tV(t){return t!==void 0?e=>KF(t,e):e=>e()}function q_e(t){let e=(0,dn.suppressTracing)(P.active());return P.with(e,t)}function nV(t){t.on("preprocessEvent",e=>{let n=HF();if(!n||e.type==="transaction")return;e.contexts={trace:Is(n),...e.contexts};let r=je(n);return e.sdkProcessingMetadata={dynamicSamplingContext:Je(r),...e.sdkProcessingMetadata},e})}function $_e({span:t,scope:e,client:n,propagateTraceparent:r}={}){let o=(e&&Gp(e))??P.active();if(t){let{scope:p}=br(t);o=p&&Gp(p)||X.setSpan(P.active(),t)}let{traceId:s,spanId:i,sampled:a,dynamicSamplingContext:c}=$F(o,{scope:e,client:n}),l={"sentry-trace":Rs(s,i,a),baggage:Fi(c)};return r&&(l.traceparent=ys(s,i,a)),l}function rV(){function t(){let a=P.active(),c=cu(a);return c||{scope:yc(),isolationScope:er()}}function e(a){let c=P.active();return P.with(c,()=>a(s()))}function n(a,c){let l=Gp(a)||P.active();return P.with(l.setValue(uO,a),()=>c(a))}function r(a){let c=P.active();return P.with(c.setValue(cO,!0),()=>a(i()))}function o(a,c){let l=P.active();return P.with(l.setValue(lO,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}FR({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:G_e,startSpanManual:B_e,startInactiveSpan:j_e,getActiveSpan:HF,suppressTracing:q_e,getTraceData:$_e,continueTrace:F_e,startNewTrace:V_e,withActiveSpan:KF})}function oV(t){class e extends t{constructor(...r){super(...r),Bh("SentryContextManager")}with(r,o,s,...i){let a=cu(r),c=a?.scope||he(),l=a?.isolationScope||ue(),p=r.getValue(cO)===!0,d=r.getValue(uO),_=r.getValue(lO),f=d||c.clone(),m=_||(p?l.clone():l),S=kF(r,{scope:f,isolationScope:m}).deleteValue(cO).deleteValue(uO).deleteValue(lO);return C_e(f,S),super.with(S,o,s,...i)}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:gO}}}return e}function Y_e(t){let e=new Map;for(let n of t)W_e(e,n);return Array.from(e,function([n,r]){return r})}function sV(t){return t.attributes[mO]===!0?void 0:hO(t)}function W_e(t,e){let n=e.spanContext().spanId,r=sV(e);if(!r){dO(t,{id:n,span:e,children:[]});return}let o=z_e(t,r),s=dO(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function z_e(t,e){let n=t.get(e);return n||dO(t,{id:e,children:[]})}function dO(t,e){let n=t.get(e.id);return n?.span?n:n&&!n.span?(n.span=e.span,n.parentNode=e.parentNode,n):(t.set(e.id,e),e)}var iV={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"},K_e=t=>Object.values(iV).includes(t);function aV(t){let e=TO(t)?t.attributes:{},n=y_e(t)?t.status:void 0;if(n){if(n.code===Be.OK)return{code:1};if(n.code===Be.ERROR){if(typeof n.message>"u"){let o=xF(e);if(o)return o}return n.message&&K_e(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=xF(e);return r||(n?.code===Be.UNSET?{code:1}:{code:2,message:"unknown_error"})}function xF(t){let e=t[bo]||t[Pi],n=t[aA],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return Do(r);if(typeof n=="string")return{code:2,message:iV[n]||"unknown_error"}}var vF=1e3,LF=300,_O=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||LF,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Zn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=Ny(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Zn()/1e3);if(this._lastCleanupTimestampInS!==n){let i=0;this._finishedSpanBuckets.forEach((a,c)=>{a&&a.timestampInS<=n-this._finishedSpanBucketSize&&(i+=a.spans.size,this._finishedSpanBuckets[c]=void 0)}),i>0&&js&&g.log(`SpanExporter dropped ${i} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(e),this._spansToBucketEntry.set(e,o);let s=sV(e);(!s||this._sentSpans.has(s))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]);this._flushSentSpanCache();let n=this._maybeSend(e),r=n.size,o=e.length-r;js&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Zn()+LF*1e3;for(let i of n){this._sentSpans.set(i.spanContext().spanId,s);let a=this._spansToBucketEntry.get(i);a&&a.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let n=Y_e(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=X_e(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let p=a.contexts?.trace?.data;p&&(p["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let p of s.children)fO(p,c,r);a.spans=c.length>vF?c.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,vF):c;let l=Yi(i.events);l&&(a.measurements=l),em(a)}return r}_flushSentSpanCache(){let e=Zn();for(let[n,r]of this._sentSpans.entries())r<=e&&this._sentSpans.delete(n)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function Q_e(t){let e=t.attributes,n=e[W],r=e[ee],o=e[Ue];return{origin:n,op:r,source:o}}function X_e(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=cV(t),i=br(t),a=t.attributes[Nr],c={[Ue]:s,[Nr]:a,[ee]:e,[W]:o,...r,...uV(t.attributes)},{links:l}=t,{traceId:p,spanId:d}=t.spanContext(),_=hO(t),f=aV(t),m={parent_span_id:_,span_id:d,trace_id:p,data:c,origin:o,op:e,status:$i(f),links:qi(l)},h=c[bo],T=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:m,otel:{resource:t.resource.attributes},...T},spans:[],start_timestamp:Rn(t.startTime),timestamp:Rn(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:Je(t)},...s&&{transaction_info:{source:s}}}}function fO(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(I=>{fO(I,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=hO(r),{attributes:c,startTime:l,endTime:p,links:d}=r,{op:_,description:f,data:m,origin:h="manual"}=cV(r),T={[W]:h,[ee]:_,...uV(c),...m},S=aV(r),R={span_id:s,trace_id:i,data:T,description:f,parent_span_id:a,start_timestamp:Rn(l),timestamp:Rn(p)||void 0,status:$i(S),op:_,origin:h,measurements:Yi(r.events),links:qi(d)};e.push(R),t.children.forEach(I=>{fO(I,e,n)})}function cV(t){let{op:e,source:n,origin:r}=Q_e(t),{op:o,description:s,source:i,data:a}=BF(t),c=e||o,l=n||i,p={...a,...J_e(t)};return{op:c,description:s,source:l,origin:r,data:p}}function uV(t){let e={...t};return delete e[Nr],delete e[mO],delete e[tr],e}function J_e(t){let e=t.attributes,n={};t.kind!==Ne.INTERNAL&&(n["otel.kind"]=Ne[t.kind]);let r=e[Pi];r&&(n[bo]=r);let o=I_e(t);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function Z_e(t,e){let n=X.getSpan(e),r=cu(e);n&&!n.spanContext().isRemote&&bc(n,t),n?.spanContext().isRemote&&t.setAttribute(mO,!0),e===Wa&&(r={scope:yc(),isolationScope:er()}),r&&zl(t,r.scope,r.isolationScope),tp(t),H()?.emit("spanStart",t)}function efe(t){np(t),H()?.emit("spanEnd",t)}var kh=class{constructor(e){Bh("SentrySpanProcessor"),this._exporter=new _O(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){Z_e(e,n)}onEnd(e){efe(e),this._exporter.export(e)}},Gh=class{constructor(e){this._client=e,Bh("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=rfe(e),l=c?.spanContext();if(!Xe(a))return su({decision:void 0,context:e,spanAttributes:s});let p=s[bl]||s[xi];if(o===Ne.CLIENT&&p&&(!c||l?.isRemote))return su({decision:void 0,context:e,spanAttributes:s});let d=c?tfe(c,n,r):void 0;if(!(!c||l?.isRemote))return su({decision:d?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:f,data:m,op:h}=GF(r,s,o),T={...m,...s};h&&(T[ee]=h);let S={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:T,spanName:f,parentSampled:d,parentContext:l},S),!S.decision)return su({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=cu(e)??{},I=l?.traceState?l.traceState.get(EO):void 0,x=I?Uo(I):void 0,F=jn(x?.sample_rand)??yt(),[B,se,ve]=rp(a,{name:f,attributes:T,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:jn(x?.sample_rate)},F),on=`${p}`.toUpperCase();return on==="OPTIONS"||on==="HEAD"?(js&&g.log(`[Tracing] Not sampling span because HTTP method is '${on}' for ${r}`),su({decision:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:0})):(!B&&d===void 0&&(js&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...su({decision:B?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:ve?se:void 0}),attributes:{[Nr]:ve?se:void 0}})}toString(){return"SentrySampler"}};function tfe(t,e,n){let r=t.spanContext();if(No(r)&&r.traceId===e){if(r.isRemote){let s=iu(t.spanContext());return js&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=iu(r);return js&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function su({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=nfe(e,n);return o!==void 0&&(s=s.set(b_e,`${o}`)),r!==void 0&&(s=s.set(N_e,`${r}`)),t==null?{decision:Bs.SamplingDecision.NOT_RECORD,traceState:s}:t===Bs.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(SO,"1")}:{decision:t,traceState:s}}function nfe(t,e){let o=X.getSpan(t)?.spanContext()?.traceState||new dn.TraceState,s=e[Za]||e[cs];return s&&typeof s=="string"&&(o=o.set(UF,s)),o}function rfe(t){let e=X.getSpan(t);return e&&No(e.spanContext())?e:void 0}var AO=oV(lV.AsyncLocalStorageContextManager);b();function RO(){wn.disable(),wn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},dt.DEBUG)}import*as yO from"node:diagnostics_channel";var ofe="ChildProcess",pV=(t={})=>({name:ofe,setup(){yO.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&sfe(e.process,t)}),yO.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&ife(e.worker,t)})}});function sfe(t,e){let n=!1,r;t.on("spawn",()=>{if(t.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:t.spawnfile},e.includeChildProcessArgs&&(r.spawnargs=t.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&rr({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,rr({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function ife(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?te(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):rr({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as afe}from"node:child_process";import{readFile as cfe,readdir as ufe}from"node:fs";import*as bt from"node:os";import{join as lfe}from"node:path";import{promisify as _V}from"node:util";var pfe=_V(cfe),dfe=_V(ufe),_fe="Context",ffe=(t={})=>{let e,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...t};async function r(s){e===void 0&&(e=o());let i=mfe(await e);return s.contexts={...s.contexts,app:{...i.app,...s.contexts?.app},os:{...i.os,...s.contexts?.os},device:{...i.device,...s.contexts?.device},culture:{...i.culture,...s.contexts?.culture},cloud_resource:{...i.cloud_resource,...s.contexts?.cloud_resource}},s}async function o(){let s={};if(n.os&&(s.os=await hfe()),n.app&&(s.app=Efe()),n.device&&(s.device=Sfe(n.device)),n.culture){let i=Tfe();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=Ofe()),s}return{name:_fe,processEvent(s){return r(s)}}},fV=ffe;function mfe(t){if(t.app?.app_memory&&(t.app.app_memory=process.memoryUsage().rss),t.app?.free_memory&&typeof process.availableMemory=="function"){let e=process.availableMemory?.();e!=null&&(t.app.free_memory=e)}return t.device?.free_memory&&(t.device.free_memory=bt.freemem()),t}async function hfe(){let t=bt.platform();switch(t){case"darwin":return yfe();case"linux":return Ife();default:return{name:gfe[t]||t,version:bt.release()}}}function Tfe(){try{if(typeof process.versions.icu!="string")return;let t=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(t)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function Efe(){let t=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:t};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function Sfe(t){let e={},n;try{n=bt.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=bt.arch(),(t===!0||t.memory)&&(e.memory_size=bt.totalmem(),e.free_memory=bt.freemem()),t===!0||t.cpu){let r=bt.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var gfe={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},Afe=[{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"]}],Rfe={alpine:t=>t,arch:t=>ao(/distrib_release=(.*)/,t),centos:t=>ao(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>ao(/release (..)/,t),mint:t=>ao(/distrib_release=(.*)/,t),red:t=>ao(/release ([^ ]+)/,t),suse:t=>ao(/VERSION = (.*)\n/,t),ubuntu:t=>ao(/distrib_release=(.*)/,t)};function ao(t,e){let n=t.exec(e);return n?n[1]:void 0}async function yfe(){let t={kernel_version:bt.release(),name:"Mac OS X",version:`10.${Number(bt.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{afe("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=ao(/^ProductName:\s+(.*)$/m,e),t.version=ao(/^ProductVersion:\s+(.*)$/m,e),t.build=ao(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function dV(t){return t.split(" ")[0].toLowerCase()}async function Ife(){let t={kernel_version:bt.release(),name:"Linux"};try{let e=await dfe("/etc"),n=Afe.find(a=>e.includes(a.name));if(!n)return t;let r=lfe("/etc",n.name),o=(await pfe(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(dV(a))>=0)||s[0];let i=dV(t.name);t.version=Rfe[i]?.(o)}catch{}return t}function Ofe(){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 Nfe}from"node:fs";import{createInterface as bfe}from"node:readline";var IO=new In(10),TV=new In(20),Cfe=7,Pfe="ContextLines",Mfe=1e3,xfe=1e4;function vfe(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function Lfe(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function Dfe(t){return t.lineno!==void 0&&t.lineno>xfe||t.colno!==void 0&&t.colno>Mfe}function Ufe(t,e){let n=IO.get(t);if(n===void 0)return!1;for(let r=e[0];r<=e[1];r++)if(n[r]===void 0)return!1;return!0}function wfe(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=hV(r,e),s=[];for(;;){if(n===t.length-1){s.push(o);break}let i=t[n+1];if(typeof i!="number")break;i<=o[1]?o[1]=i+e:(s.push(o),o=hV(i,e)),n++}return s}function kfe(t,e,n){return new Promise((r,o)=>{let s=Nfe(t),i=bfe({input:s});function a(){s.destroy(),r()}let c=0,l=0,p=e[l];if(p===void 0){a();return}let d=p[0],_=p[1];function f(m){TV.set(t,1),re&&g.error(`Failed to read file: ${t}. Error: ${m}`),i.close(),i.removeAllListeners(),a()}s.on("error",f),i.on("error",f),i.on("close",a),i.on("line",m=>{if(c++,!(c<d)&&(n[c]=DR(m,0),c>=_)){if(l===e.length-1){i.close(),i.removeAllListeners();return}l++;let h=e[l];if(h===void 0){i.close(),i.removeAllListeners();return}d=h[0],_=h[1]}})})}async function Gfe(t,e){let n={};if(e>0&&t.exception?.values){for(let s of t.exception.values)if(s.stacktrace?.frames?.length)for(let i=s.stacktrace.frames.length-1;i>=0;i--){let a=s.stacktrace.frames[i],c=a?.filename;if(!a||typeof c!="string"||typeof a.lineno!="number"||Lfe(c)||Dfe(a))continue;n[c]||(n[c]=[]),n[c].push(a.lineno)}}let r=Object.keys(n);if(r.length==0)return t;let o=[];for(let s of r){if(TV.get(s))continue;let i=n[s];if(!i)continue;i.sort((l,p)=>l-p);let a=wfe(i,e);if(a.every(l=>Ufe(s,l)))continue;let c=vfe(IO,s,{});o.push(kfe(s,a,c))}if(await Promise.all(o).catch(()=>{re&&g.log("Failed to read one or more source files and resolve context lines")}),e>0&&t.exception?.values)for(let s of t.exception.values)s.stacktrace?.frames&&s.stacktrace.frames.length>0&&Bfe(s.stacktrace.frames,e,IO);return t}function Bfe(t,e,n){for(let r of t)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;jfe(r.lineno,r,e,o)}}function mV(t){delete t.pre_context,delete t.context_line,delete t.post_context}function jfe(t,e,n,r){if(e.lineno===void 0||r===void 0){re&&g.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=EV(t,n);s<t;s++){let i=r[s];if(i===void 0){mV(e),re&&g.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){mV(e),re&&g.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=SV(t,n);e.post_context=[];for(let s=t+1;s<=o;s++){let i=r[s];if(i===void 0)break;e.post_context.push(i)}}function EV(t,e){return Math.max(1,t-e)}function SV(t,e){return t+e}function hV(t,e){return[EV(t,e),SV(t,e)]}var Hfe=(t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:Cfe;return{name:Pfe,processEvent(n){return Gfe(n,e)}}},gV=Hfe;import{Worker as Ffe}from"node:worker_threads";var jh;async function Hh(){if(jh===void 0)try{jh=!!(await import("node:inspector")).url()}catch{jh=!1}return jh}var Bp="__SENTRY_ERROR_LOCAL_VARIABLES__";function RV(t,e,n){let r=0,o=5,s=0;return setInterval(()=>{s===0?r>t&&(o*=2,n(o),o>86400&&(o=86400),s=o):(s-=1,s===0&&e()),r=0},1e3).unref(),()=>{r+=1}}function AV(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function Fh(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||AV(t)&&AV(e)}var Vfe="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ3LjAgKGE1YTRlNzMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function yV(...t){g.log("[LocalVariables]",...t)}var IV=(t={})=>{function e(s,i){let a=(s.stacktrace?.frames||[]).filter(c=>c.function!=="new Promise");for(let c=0;c<a.length;c++){let l=a.length-c-1,p=i[c],d=a[l];if(!d||!p)break;p.vars===void 0||d.in_app===!1&&t.includeOutOfAppFrames!==!0||!Fh(d.function,p.function)||(d.vars=p.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&Bp in i.originalException&&Array.isArray(i.originalException[Bp])){for(let a of s.exception?.values||[])e(a,i.originalException[Bp]);i.originalException[Bp]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new Ffe(new URL(`data:application/javascript;base64,${Vfe}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{yV("Worker error",a)}),i.once("exit",a=>{yV("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await Hh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:g.isEnabled()};r().then(()=>{try{o(a)}catch(c){g.error("Failed to start worker",c)}},c=>{g.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}};function OV(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function qfe(t,e){if(e!==void 0)return OV(t(e,1))}function NV(t){let e=[],n=!1;function r(i){e=[],!n&&(n=!0,t(i))}e.push(r);function o(i){e.push(i)}function s(i){let a=e.pop()||r;try{a(i)}catch{r(i)}}return{add:o,next:s}}var OO=class t{constructor(e){this._session=e}static async create(e){if(e)return e;let n=await import("node:inspector");return new t(new n.Session)}configureAndConnect(e,n){this._session.connect(),this._session.on("Debugger.paused",r=>{e(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(e){this._session.post("Debugger.setPauseOnExceptions",{state:e?"all":"uncaught"})}getLocalVariables(e,n){this._getProperties(e,r=>{let{add:o,next:s}=NV(n);for(let i of r)if(i.value?.objectId&&i.value.className==="Array"){let a=i.value.objectId;o(c=>this._unrollArray(a,i.name,c,s))}else if(i.value?.objectId&&i.value.className==="Object"){let a=i.value.objectId;o(c=>this._unrollObject(a,i.name,c,s))}else i.value&&o(a=>this._unrollOther(i,a,s));s({})})}_getProperties(e,n){this._session.post("Runtime.getProperties",{objectId:e,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(e,n,r,o){this._getProperties(e,s=>{r[n]=s.filter(i=>i.name!=="length"&&!isNaN(parseInt(i.name,10))).sort((i,a)=>parseInt(i.name,10)-parseInt(a.name,10)).map(i=>i.value?.value),o(r)})}_unrollObject(e,n,r,o){this._getProperties(e,s=>{r[n]=s.map(i=>[i.name,i.value?.value]).reduce((i,[a,c])=>(i[a]=c,i),{}),o(r)})}_unrollOther(e,n,r){e.value&&("value"in e.value?e.value.value===void 0||e.value.value===null?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&e.value.type!=="function"?n[e.name]=`<${e.value.description}>`:e.value.type==="undefined"&&(n[e.name]="<undefined>")),r(n)}},$fe="LocalVariables",Yfe=(t={},e)=>{let n=new In(20),r,o=!1;function s(l){let p=OV(l.stacktrace?.frames);if(p===void 0)return;let d=n.remove(p);if(d===void 0)return;let _=(l.stacktrace?.frames||[]).filter(f=>f.function!=="new Promise");for(let f=0;f<_.length;f++){let m=_.length-f-1,h=d[f],T=_[m];if(!T||!h)break;h.vars===void 0||T.in_app===!1&&t.includeOutOfAppFrames!==!0||!Fh(T.function,h.function)||(T.vars=h.vars)}}function i(l){for(let p of l.exception?.values||[])s(p);return l}let a;async function c(){let p=H()?.getOptions();if(!p?.includeLocalVariables)return;if(jo<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Hh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let _=await OO.create(e),f=(h,{params:{reason:T,data:S,callFrames:R}},I)=>{if(T!=="exception"&&T!=="promiseRejection"){I();return}r?.();let x=qfe(h,S.description);if(x==null){I();return}let{add:F,next:B}=NV(se=>{n.set(x,se),I()});for(let se=0;se<Math.min(R.length,5);se++){let{scopeChain:ve,functionName:on,this:Io}=R[se],ss=ve.find(Et=>Et.type==="local"),yi=Io.className==="global"||!Io.className?on:`${Io.className}.${on}`;if(ss?.object.objectId===void 0)F(Et=>{Et[se]={function:yi},B(Et)});else{let Et=ss.object.objectId;F($a=>_.getLocalVariables(Et,Ya=>{$a[se]={function:yi,vars:Ya},B($a)}))}}B([])},m=t.captureAllExceptions!==!1;if(_.configureAndConnect((h,T)=>f(p.stackParser,h,T),m),m){let h=t.maxExceptionsPerSecond||50;r=RV(h,()=>{g.log("Local variables rate-limit lifted."),_.setPauseOnExceptions(!0)},T=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${T} seconds.`),_.setPauseOnExceptions(!1)})}o=!0}catch(_){g.log("The `LocalVariables` integration failed to start.",_)}}return{name:$fe,setupOnce(){a=c()},async processEvent(l){return await a,o?i(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}},bV=Yfe;var CV=(t={})=>Lr.major<19?bV(t):IV(t);import{existsSync as Wfe,readFileSync as vV}from"node:fs";import{dirname as zfe,join as LV}from"node:path";function jp(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var PV;function MV(){return jp()?!1:jo>=21||jo===20&&Pp>=6||jo===18&&Pp>=19?!0:(PV||(PV=!0,Qe(()=>{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)}var NO,Kfe="Modules",Qfe=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,Xfe=()=>({name:Kfe,processEvent(t){return t.modules={...t.modules,...xV()},t},getModules:xV}),DV=Xfe;function Jfe(){try{return U.cache?Object.keys(U.cache):[]}catch{return[]}}function Zfe(){return{...Qfe,...nme(),...jp()?eme():{}}}function eme(){let t=U.main?.paths||[],e=Jfe(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=zfe(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=LV(a,"package.json");if(r.add(a),!Wfe(c))return i();try{let l=JSON.parse(vV(c,"utf8"));n[l.name]=l.version}catch{}};i()}),n}function xV(){return NO||(NO=Zfe()),NO}function tme(){try{let t=LV(process.cwd(),"package.json");return JSON.parse(vV(t,"utf8"))}catch{return{}}}function nme(){let t=tme();return{...t.dependencies,...t.devDependencies}}import{isMainThread as ome}from"worker_threads";var rme=2e3;function Hp(t){Qe(()=>{console.error(t)});let e=H();if(e===void 0){re&&g.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=e.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:rme;e.close(r).then(o=>{o||re&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{re&&g.error(o)})}var sme="OnUncaughtException",UV=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:sme,setup(n){ome&&global.process.on("uncaughtException",ime(n,e))}}};function ime(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let l=Hp;e.onFatalError?l=e.onFatalError:a.onFatalError&&(l=a.onFatalError);let d=global.process.listeners("uncaughtException").filter(f=>f.name!=="domainUncaughtExceptionClear"&&f.tag!=="sentry_tracingErrorCallback"&&f._errorHandler!==!0).length===0,_=e.exitEvenIfOtherHandlersAreRegistered||d;r?_&&(s?(re&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Hp(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,l(i,c))},2e3))):(i=c,r=!0,H()===t&&te(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!s&&_&&(s=!0,l(c)))},{_errorHandler:!0})}var ame="OnUnhandledRejection",cme=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],ume=(t={})=>{let e={mode:t.mode??"warn",ignore:[...cme,...t.ignore??[]]};return{name:ame,setup(n){global.process.on("unhandledRejection",_me(n,e))}}},wV=ume;function lme(t){if(typeof t!="object"||t===null)return{name:"",message:String(t??"")};let e=t,n=typeof e.name=="string"?e.name:"",r=typeof e.message=="string"?e.message:String(t);return{name:n,message:r}}function pme(t,e){let n=t.name===void 0||xo(e.name,t.name,!0),r=t.message===void 0||xo(e.message,t.message);return n&&r}function dme(t,e){let n=lme(e);return t.some(r=>pme(r,n))}function _me(t,e){return function(r,o){if(H()!==t||dme(e.ignore??[],r))return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>Mc(i,c):c=>c())(()=>{te(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),fme(r,e.mode)}}function fme(t,e){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:";e==="warn"?Qe(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(Qe(()=>{console.warn(n)}),Hp(t))}var mme="ProcessSession",kV=()=>({name:mme,setupOnce(){sm(),process.on("beforeExit",()=>{ue().getSession()?.status!=="ok"&&ip()})}});import*as GV from"node:http";var bO="Spotlight",hme=(t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:bO,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}Tme(n,e)}}},BV=hme;function Tme(t,e){let n=Eme(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=ep(o);xc(()=>{let i=GV.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(r=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});i.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function Eme(t){try{return new URL(`${t}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}import*as jV from"node:util";var Sme="NodeSystemError";function gme(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:jV.getSystemErrorMap().has(t.errno)}var HV=(t={})=>({name:Sme,processEvent:(e,n,r)=>{if(!gme(n.originalException))return e;let o=n.originalException,s={...o};!r.getOptions().sendDefaultPii&&t.includePaths!==!0&&(delete s.path,delete s.dest),e.contexts={...e.contexts,node_system_error:s};for(let i of e.exception?.values||[])i.value&&(o.path&&i.value.includes(o.path)&&(i.value=i.value.replace(`'${o.path}'`,"").trim()),o.dest&&i.value.includes(o.dest)&&(i.value=i.value.replace(`'${o.dest}'`,"").trim()));return e}});import*as Rme from"node:http";import*as yme from"node:https";import{Readable as Ime}from"node:stream";import{createGzip as Ome}from"node:zlib";import*as Vo from"node:net";import*as PO from"node:tls";import*as CO from"node:http";var co=Symbol("AgentBaseInternalState"),Vh=class extends CO.Agent{constructor(e){super(e),this[co]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
32
|
-
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof CO.Agent)return s.addRequest(e,o);this[co].currentSocket=s,super.createSocket(e,n,r)},r)}createConnection(){let e=this[co].currentSocket;if(this[co].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[co].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[co]&&(this[co].defaultPort=e)}get protocol(){return this[co].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[co]&&(this[co].protocol=e)}};function
|
|
31
|
+
`):""}function mI(t,e){let n=-1;for(let r=0;r<t.length;r+=2){if(t[r]!==e)continue;if(n===-1){n=r;continue}let o=t[n+1];if(e===Bm&&o){let s=Cp(t[r+1],o);s&&(t[n+1]=s)}t.splice(r,2),r-=2}}function hI(t,e){return t.findIndex((n,r)=>r%2===0&&n===e)}function OH(t,e){let n=vpe(t),r=e.statusCode,o=Rp(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function vpe(t){try{let e=jm(t.origin,t.path),n=bs(e),r={url:Cs(n),"http.method":t.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function jm(t,e="/"){try{return new URL(e,t).toString()}catch{let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}}var sa=class extends bH.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",pe,e),this._channelSubs=[],this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel("undici:request:create",this._onRequestCreated.bind(this)),this._subscribeToChannel("undici:request:headers",this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let n=this.getConfig();if(!(n.enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,o),!o&&n.tracePropagation!==!1&&IH(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:n}){let r=this.getConfig();if(!(r.enabled!==!1))return;let s=r.breadcrumbs,i=typeof s>"u"?!0:s,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&OH(e,n)}_subscribeToChannel(e,n){let r=jo>18||jo===18&&Mp>=19,o;if(r)Kc.subscribe?.(e,n),o=()=>Kc.unsubscribe?.(e,n);else{let s=Kc.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,NH.isTracingSuppressed)(P.active()))return!0;let n=jm(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};var Lpe="NodeFetch",Dpe=w(`${Lpe}.sentry`,sa,t=>t),Upe=(t={})=>({name:"NodeFetch",setupOnce(){Dpe(t)}}),CH=Upe;var lV=K(xH(),1);le();b();b();var dn=K(Te(),1),Bs=K(iO(),1),mO="sentry.parentIsRemote",cu="sentry.graphql.operation";function hO(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function TO(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function y_e(t){return typeof t.kind=="number"}function I_e(t){return!!t.status}function DF(t){return!!t.name}function O_e(t){if(!TO(t))return{};let e=t.attributes[cs]||t.attributes[ec],n={url:e,"http.method":t.attributes[vi]||t.attributes[Cl]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=bs(e);n.url=Cs(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function N_e(t){return y_e(t)?t.kind:Ne.INTERNAL}var wh="sentry-trace",aO="baggage",EO="sentry.dsc",SO="sentry.sampled_not_recording",UF="sentry.url",b_e="sentry.sample_rand",C_e="sentry.sample_rate",gO=Un("sentry_scopes"),cO=Un("sentry_fork_isolation_scope"),uO=Un("sentry_fork_set_scope"),lO=Un("sentry_fork_set_isolation_scope"),wF="_scopeContext";function uu(t){return t.getValue(gO)}function kF(t,e){return t.setValue(gO,e)}function P_e(t,e){nt(t,wF,e)}function Bp(t){return t[wF]}function au(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(SO)==="1":!1;if(e===Vt.SAMPLED)return!0;if(r)return!1;let o=n?n.get(EO):void 0,s=o?Uo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function GF(t,e,n){let r=e[vi]||e[Cl];if(r)return x_e({attributes:e,name:t,kind:n},r);let o=e[xi]||e[Kg],s=typeof e[ee]=="string"&&e[ee].startsWith("cache.");if(o&&!s)return M_e({attributes:e,name:t});let i=e[Ue]==="custom"?"custom":"route";if(e[iA])return{...Gp(t,e,"route"),op:"rpc"};if(e[sA])return{...Gp(t,e,i),op:"message"};let l=e[Xg];return l?{...Gp(t,e,i),op:l.toString()}:{op:void 0,description:t,source:"custom"}}function BF(t){let e=TO(t)?t.attributes:{},n=DF(t)?t.name:"<unknown>",r=N_e(t);return GF(n,e,r)}function M_e({attributes:t,name:e}){let n=t[tr];if(typeof n=="string")return{op:"db",description:n,source:t[Ue]||"custom"};if(t[Ue]==="custom")return{op:"db",description:e,source:"custom"};let r=t[Qg];return{op:"db",description:r?r.toString():e,source:"task"}}function x_e({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case Ne.CLIENT:o.push("client");break;case Ne.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:l}=L_e(n,e);if(!s)return{...Gp(t,n),op:o.join(".")};let p=n[cu],d=`${r} ${s}`,_=p?`${d} (${v_e(p)})`:d,f=l||s==="/"?"route":"url",m={};i&&(m.url=i),a&&(m["http.query"]=a),c&&(m["http.fragment"]=c);let h=e===Ne.CLIENT||e===Ne.SERVER,S=!`${n[W]||"manual"}`.startsWith("auto"),R=n[Ue]==="custom",I=n[tr],x=!R&&I==null&&(h||!S),{description:F,source:B}=x?{description:_,source:f}:Gp(t,n);return{op:o.join("."),description:F,source:B,data:m}}function v_e(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}function L_e(t,e){let n=t[tA],r=t[ec]||t[cs],o=t[Co],s=typeof r=="string"?bs(r):void 0,i=s?Cs(s):void 0,a=s?.search||void 0,c=s?.hash||void 0;return typeof o=="string"?{urlPath:o,url:i,query:a,fragment:c,hasRoute:!0}:e===Ne.SERVER&&typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function Gp(t,e,n="custom"){let r=e[Ue]||n,o=e[tr];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function jF(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=Y(n).data[Ue],{description:i}=DF(n)?BF(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),Xe()){let a=au(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function HF(){return X.getActiveSpan()}var js=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function FF({dsc:t,sampled:e}){let n=t?Vi(t):void 0,r=new dn.TraceState,o=n?r.set(EO,n):r;return e===!1?o.set(SO,"1"):o}var VF=new Set;function qF(){return Array.from(VF)}function jh(t){VF.add(t)}var kh=class extends dn.W3CBaggagePropagator{constructor(){super(),jh("SentryPropagator"),this._urlMatchesTargetsMap=new In(100)}inject(e,n,r){if((0,dn.isTracingSuppressed)(e)){js&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=X.getSpan(e),s=o&&k_e(o),{tracePropagationTargets:i,propagateTraceparent:a}=H()?.getOptions()||{};if(!Xi(s,i,this._urlMatchesTargetsMap)){js&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let c=U_e(n),l=w_e(n),p=Ar.getBaggage(e)||Ar.createBaggage({}),{dynamicSamplingContext:d,traceId:_,spanId:f,sampled:m}=$F(e);if(c){let h=qi(c);h&&Object.entries(h).forEach(([T,S])=>{!l&&T.startsWith(Xr)||(p=p.setEntry(T,{value:S}))})}!l&&d&&(p=Object.entries(d).reduce((h,[T,S])=>S?h.setEntry(`${Xr}${T}`,{value:S}):h,p)),!l&&_&&_!==bi&&(r.set(n,wh,Rs(_,f,m)),a&&r.set(n,"traceparent",ys(_,f,m))),super.inject(Ar.setBaggage(e,p),n,r)}extract(e,n,r){let o=r.get(n,wh),s=r.get(n,aO),i=o?Array.isArray(o)?o[0]:o:void 0;return WF(YF(e,{sentryTrace:i,baggage:s}))}fields(){return[wh,aO,"traceparent"]}};function $F(t,e={}){let n=X.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:void 0,sampled:au(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:a.spanId,sampled:au(a)}}let r=e.scope||uu(t)?.scope||he(),o=e.client||H(),s=r.getPropagationContext();return{dynamicSamplingContext:o?Jr(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function YF(t,{sentryTrace:e,baggage:n}){let r=Ql(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r,c=H(),l=Uo(n);if(!s||c&&!JR(c,l?.org_id))return t;let p=G_e({traceId:o,spanId:s,sampled:i,dsc:a});return X.setSpanContext(t,p)}function D_e(t,e,n){let r=WF(YF(t,e));return P.with(r,n)}function WF(t){let e=uu(t),n={scope:e?e.scope:he().clone(),isolationScope:e?e.isolationScope:ue()};return kF(t,n)}function U_e(t){try{let e=t[aO];return Array.isArray(e)?e.join(","):e}catch{return}}function w_e(t){try{return t[wh]}catch{return}}function k_e(t){let e=Y(t).data,n=e[ec]||e[cs];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(UF);if(r)return r}function G_e({spanId:t,traceId:e,sampled:n,dsc:r}){let o=FF({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Vt.SAMPLED:Vt.NONE,traceState:o}}function zF(t,e,n){let r=QF(),{name:o,parentSpan:s}=t;return tV(s)(()=>{let a=ZF(t.scope,t.forceTransaction),l=t.onlyIfParent&&!X.getSpan(a)?(0,dn.suppressTracing)(a):a,p=XF(t);if(!Xe()){let d=(0,dn.isTracingSuppressed)(l)?l:(0,dn.suppressTracing)(l);return P.with(d,()=>r.startActiveSpan(o,p,d,_=>(pO(_),P.with(a,()=>Mr(()=>e(_),()=>{Y(_).status===void 0&&_.setStatus({code:Be.ERROR})},n?()=>_.end():void 0)))))}return r.startActiveSpan(o,p,l,d=>(pO(d),Mr(()=>e(d),()=>{Y(d).status===void 0&&d.setStatus({code:Be.ERROR})},n?()=>d.end():void 0)))})}function B_e(t,e){return zF(t,e,!0)}function j_e(t,e){return zF(t,n=>e(n,()=>n.end()),!1)}function H_e(t){let e=QF(),{name:n,parentSpan:r}=t;return tV(r)(()=>{let s=ZF(t.scope,t.forceTransaction),a=t.onlyIfParent&&!X.getSpan(s)?(0,dn.suppressTracing)(s):s,c=XF(t);Xe()||(a=(0,dn.isTracingSuppressed)(a)?a:(0,dn.suppressTracing)(a));let l=e.startSpan(n,c,a);return pO(l),l})}function KF(t,e){let n=t?X.setSpan(P.active(),t):X.deleteSpan(P.active());return P.with(n,()=>e(he()))}function QF(){return H()?.tracer||X.getTracer("@sentry/opentelemetry",pe)}function XF(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?JF(e):e;return{attributes:o?{[ee]:o,...n}:n,kind:r,links:s,startTime:i}}function JF(t){return t<9999999999?t*1e3:t}function pO(t){let e=t.end.bind(t);t.end=n=>e(typeof n=="number"?JF(n):n)}function ZF(t,e){let n=F_e(t),r=X.getSpan(n);if(!r||!e)return n;let o=X.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=au(r.spanContext()),c=je(r),l=Je(c),p=FF({dsc:l,sampled:a}),d={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Vt.SAMPLED:Vt.NONE,traceState:p};return X.setSpanContext(o,d)}function F_e(t){if(t){let e=Bp(t);if(e)return e}return P.active()}function V_e(t,e){return D_e(P.active(),t,e)}function q_e(t){let e=zt(),n=Kt(),r={traceId:e,spanId:n,isRemote:!0,traceFlags:Vt.NONE},o=X.setSpanContext(P.active(),r);return P.with(o,()=>(he().setPropagationContext({traceId:e,sampleRand:yt()}),t()))}function eV(t,e){let n=Bp(e),r=n&&X.getSpan(n),o=r?Is(r):Fi(e);return[r?Je(r):Jr(t,e),o]}function tV(t){return t!==void 0?e=>KF(t,e):e=>e()}function $_e(t){let e=(0,dn.suppressTracing)(P.active());return P.with(e,t)}function nV(t){t.on("preprocessEvent",e=>{let n=HF();if(!n||e.type==="transaction")return;e.contexts={trace:Is(n),...e.contexts};let r=je(n);return e.sdkProcessingMetadata={dynamicSamplingContext:Je(r),...e.sdkProcessingMetadata},e})}function Y_e({span:t,scope:e,client:n,propagateTraceparent:r}={}){let o=(e&&Bp(e))??P.active();if(t){let{scope:p}=br(t);o=p&&Bp(p)||X.setSpan(P.active(),t)}let{traceId:s,spanId:i,sampled:a,dynamicSamplingContext:c}=$F(o,{scope:e,client:n}),l={"sentry-trace":Rs(s,i,a),baggage:Vi(c)};return r&&(l.traceparent=ys(s,i,a)),l}function rV(){function t(){let a=P.active(),c=uu(a);return c||{scope:Ic(),isolationScope:er()}}function e(a){let c=P.active();return P.with(c,()=>a(s()))}function n(a,c){let l=Bp(a)||P.active();return P.with(l.setValue(uO,a),()=>c(a))}function r(a){let c=P.active();return P.with(c.setValue(cO,!0),()=>a(i()))}function o(a,c){let l=P.active();return P.with(l.setValue(lO,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}FR({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:B_e,startSpanManual:j_e,startInactiveSpan:H_e,getActiveSpan:HF,suppressTracing:$_e,getTraceData:Y_e,continueTrace:V_e,startNewTrace:q_e,withActiveSpan:KF})}function oV(t){class e extends t{constructor(...r){super(...r),jh("SentryContextManager")}with(r,o,s,...i){let a=uu(r),c=a?.scope||he(),l=a?.isolationScope||ue(),p=r.getValue(cO)===!0,d=r.getValue(uO),_=r.getValue(lO),f=d||c.clone(),m=_||(p?l.clone():l),S=kF(r,{scope:f,isolationScope:m}).deleteValue(cO).deleteValue(uO).deleteValue(lO);return P_e(f,S),super.with(S,o,s,...i)}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:gO}}}return e}function W_e(t){let e=new Map;for(let n of t)z_e(e,n);return Array.from(e,function([n,r]){return r})}function sV(t){return t.attributes[mO]===!0?void 0:hO(t)}function z_e(t,e){let n=e.spanContext().spanId,r=sV(e);if(!r){dO(t,{id:n,span:e,children:[]});return}let o=K_e(t,r),s=dO(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function K_e(t,e){let n=t.get(e);return n||dO(t,{id:e,children:[]})}function dO(t,e){let n=t.get(e.id);return n?.span?n:n&&!n.span?(n.span=e.span,n.parentNode=e.parentNode,n):(t.set(e.id,e),e)}var iV={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"},Q_e=t=>Object.values(iV).includes(t);function aV(t){let e=TO(t)?t.attributes:{},n=I_e(t)?t.status:void 0;if(n){if(n.code===Be.OK)return{code:1};if(n.code===Be.ERROR){if(typeof n.message>"u"){let o=xF(e);if(o)return o}return n.message&&Q_e(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=xF(e);return r||(n?.code===Be.UNSET?{code:1}:{code:2,message:"unknown_error"})}function xF(t){let e=t[bo]||t[Mi],n=t[aA],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return Do(r);if(typeof n=="string")return{code:2,message:iV[n]||"unknown_error"}}var vF=1e3,LF=300,_O=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||LF,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Zn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=Ny(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Zn()/1e3);if(this._lastCleanupTimestampInS!==n){let i=0;this._finishedSpanBuckets.forEach((a,c)=>{a&&a.timestampInS<=n-this._finishedSpanBucketSize&&(i+=a.spans.size,this._finishedSpanBuckets[c]=void 0)}),i>0&&js&&g.log(`SpanExporter dropped ${i} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(e),this._spansToBucketEntry.set(e,o);let s=sV(e);(!s||this._sentSpans.has(s))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]);this._flushSentSpanCache();let n=this._maybeSend(e),r=n.size,o=e.length-r;js&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Zn()+LF*1e3;for(let i of n){this._sentSpans.set(i.spanContext().spanId,s);let a=this._spansToBucketEntry.get(i);a&&a.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let n=W_e(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=J_e(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let p=a.contexts?.trace?.data;p&&(p["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let p of s.children)fO(p,c,r);a.spans=c.length>vF?c.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,vF):c;let l=Wi(i.events);l&&(a.measurements=l),tm(a)}return r}_flushSentSpanCache(){let e=Zn();for(let[n,r]of this._sentSpans.entries())r<=e&&this._sentSpans.delete(n)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function X_e(t){let e=t.attributes,n=e[W],r=e[ee],o=e[Ue];return{origin:n,op:r,source:o}}function J_e(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=cV(t),i=br(t),a=t.attributes[Nr],c={[Ue]:s,[Nr]:a,[ee]:e,[W]:o,...r,...uV(t.attributes)},{links:l}=t,{traceId:p,spanId:d}=t.spanContext(),_=hO(t),f=aV(t),m={parent_span_id:_,span_id:d,trace_id:p,data:c,origin:o,op:e,status:Yi(f),links:$i(l)},h=c[bo],T=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:m,otel:{resource:t.resource.attributes},...T},spans:[],start_timestamp:Rn(t.startTime),timestamp:Rn(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:Je(t)},...s&&{transaction_info:{source:s}}}}function fO(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(I=>{fO(I,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=hO(r),{attributes:c,startTime:l,endTime:p,links:d}=r,{op:_,description:f,data:m,origin:h="manual"}=cV(r),T={[W]:h,[ee]:_,...uV(c),...m},S=aV(r),R={span_id:s,trace_id:i,data:T,description:f,parent_span_id:a,start_timestamp:Rn(l),timestamp:Rn(p)||void 0,status:Yi(S),op:_,origin:h,measurements:Wi(r.events),links:$i(d)};e.push(R),t.children.forEach(I=>{fO(I,e,n)})}function cV(t){let{op:e,source:n,origin:r}=X_e(t),{op:o,description:s,source:i,data:a}=BF(t),c=e||o,l=n||i,p={...a,...Z_e(t)};return{op:c,description:s,source:l,origin:r,data:p}}function uV(t){let e={...t};return delete e[Nr],delete e[mO],delete e[tr],e}function Z_e(t){let e=t.attributes,n={};t.kind!==Ne.INTERNAL&&(n["otel.kind"]=Ne[t.kind]);let r=e[Mi];r&&(n[bo]=r);let o=O_e(t);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function efe(t,e){let n=X.getSpan(e),r=uu(e);n&&!n.spanContext().isRemote&&Cc(n,t),n?.spanContext().isRemote&&t.setAttribute(mO,!0),e===za&&(r={scope:Ic(),isolationScope:er()}),r&&Kl(t,r.scope,r.isolationScope),np(t),H()?.emit("spanStart",t)}function tfe(t){rp(t),H()?.emit("spanEnd",t)}var Gh=class{constructor(e){jh("SentrySpanProcessor"),this._exporter=new _O(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){efe(e,n)}onEnd(e){tfe(e),this._exporter.export(e)}},Bh=class{constructor(e){this._client=e,jh("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=ofe(e),l=c?.spanContext();if(!Xe(a))return iu({decision:void 0,context:e,spanAttributes:s});let p=s[Cl]||s[vi];if(o===Ne.CLIENT&&p&&(!c||l?.isRemote))return iu({decision:void 0,context:e,spanAttributes:s});let d=c?nfe(c,n,r):void 0;if(!(!c||l?.isRemote))return iu({decision:d?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:f,data:m,op:h}=GF(r,s,o),T={...m,...s};h&&(T[ee]=h);let S={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:T,spanName:f,parentSampled:d,parentContext:l},S),!S.decision)return iu({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=uu(e)??{},I=l?.traceState?l.traceState.get(EO):void 0,x=I?Uo(I):void 0,F=jn(x?.sample_rand)??yt(),[B,se,ve]=op(a,{name:f,attributes:T,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:jn(x?.sample_rate)},F),on=`${p}`.toUpperCase();return on==="OPTIONS"||on==="HEAD"?(js&&g.log(`[Tracing] Not sampling span because HTTP method is '${on}' for ${r}`),iu({decision:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:0})):(!B&&d===void 0&&(js&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...iu({decision:B?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:ve?se:void 0}),attributes:{[Nr]:ve?se:void 0}})}toString(){return"SentrySampler"}};function nfe(t,e,n){let r=t.spanContext();if(No(r)&&r.traceId===e){if(r.isRemote){let s=au(t.spanContext());return js&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=au(r);return js&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function iu({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=rfe(e,n);return o!==void 0&&(s=s.set(C_e,`${o}`)),r!==void 0&&(s=s.set(b_e,`${r}`)),t==null?{decision:Bs.SamplingDecision.NOT_RECORD,traceState:s}:t===Bs.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(SO,"1")}:{decision:t,traceState:s}}function rfe(t,e){let o=X.getSpan(t)?.spanContext()?.traceState||new dn.TraceState,s=e[ec]||e[cs];return s&&typeof s=="string"&&(o=o.set(UF,s)),o}function ofe(t){let e=X.getSpan(t);return e&&No(e.spanContext())?e:void 0}var AO=oV(lV.AsyncLocalStorageContextManager);b();function RO(){wn.disable(),wn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},dt.DEBUG)}import*as yO from"node:diagnostics_channel";var sfe="ChildProcess",pV=(t={})=>({name:sfe,setup(){yO.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&ife(e.process,t)}),yO.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&afe(e.worker,t)})}});function ife(t,e){let n=!1,r;t.on("spawn",()=>{if(t.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:t.spawnfile},e.includeChildProcessArgs&&(r.spawnargs=t.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&rr({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,rr({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function afe(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?te(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):rr({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as cfe}from"node:child_process";import{readFile as ufe,readdir as lfe}from"node:fs";import*as bt from"node:os";import{join as pfe}from"node:path";import{promisify as _V}from"node:util";var dfe=_V(ufe),_fe=_V(lfe),ffe="Context",mfe=(t={})=>{let e,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...t};async function r(s){e===void 0&&(e=o());let i=hfe(await e);return s.contexts={...s.contexts,app:{...i.app,...s.contexts?.app},os:{...i.os,...s.contexts?.os},device:{...i.device,...s.contexts?.device},culture:{...i.culture,...s.contexts?.culture},cloud_resource:{...i.cloud_resource,...s.contexts?.cloud_resource}},s}async function o(){let s={};if(n.os&&(s.os=await Tfe()),n.app&&(s.app=Sfe()),n.device&&(s.device=gfe(n.device)),n.culture){let i=Efe();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=Nfe()),s}return{name:ffe,processEvent(s){return r(s)}}},fV=mfe;function hfe(t){if(t.app?.app_memory&&(t.app.app_memory=process.memoryUsage().rss),t.app?.free_memory&&typeof process.availableMemory=="function"){let e=process.availableMemory?.();e!=null&&(t.app.free_memory=e)}return t.device?.free_memory&&(t.device.free_memory=bt.freemem()),t}async function Tfe(){let t=bt.platform();switch(t){case"darwin":return Ife();case"linux":return Ofe();default:return{name:Afe[t]||t,version:bt.release()}}}function Efe(){try{if(typeof process.versions.icu!="string")return;let t=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(t)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function Sfe(){let t=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:t};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function gfe(t){let e={},n;try{n=bt.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=bt.arch(),(t===!0||t.memory)&&(e.memory_size=bt.totalmem(),e.free_memory=bt.freemem()),t===!0||t.cpu){let r=bt.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var Afe={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},Rfe=[{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"]}],yfe={alpine:t=>t,arch:t=>ao(/distrib_release=(.*)/,t),centos:t=>ao(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>ao(/release (..)/,t),mint:t=>ao(/distrib_release=(.*)/,t),red:t=>ao(/release ([^ ]+)/,t),suse:t=>ao(/VERSION = (.*)\n/,t),ubuntu:t=>ao(/distrib_release=(.*)/,t)};function ao(t,e){let n=t.exec(e);return n?n[1]:void 0}async function Ife(){let t={kernel_version:bt.release(),name:"Mac OS X",version:`10.${Number(bt.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{cfe("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=ao(/^ProductName:\s+(.*)$/m,e),t.version=ao(/^ProductVersion:\s+(.*)$/m,e),t.build=ao(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function dV(t){return t.split(" ")[0].toLowerCase()}async function Ofe(){let t={kernel_version:bt.release(),name:"Linux"};try{let e=await _fe("/etc"),n=Rfe.find(a=>e.includes(a.name));if(!n)return t;let r=pfe("/etc",n.name),o=(await dfe(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(dV(a))>=0)||s[0];let i=dV(t.name);t.version=yfe[i]?.(o)}catch{}return t}function Nfe(){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 bfe}from"node:fs";import{createInterface as Cfe}from"node:readline";var IO=new In(10),TV=new In(20),Pfe=7,Mfe="ContextLines",xfe=1e3,vfe=1e4;function Lfe(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function Dfe(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function Ufe(t){return t.lineno!==void 0&&t.lineno>vfe||t.colno!==void 0&&t.colno>xfe}function wfe(t,e){let n=IO.get(t);if(n===void 0)return!1;for(let r=e[0];r<=e[1];r++)if(n[r]===void 0)return!1;return!0}function kfe(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=hV(r,e),s=[];for(;;){if(n===t.length-1){s.push(o);break}let i=t[n+1];if(typeof i!="number")break;i<=o[1]?o[1]=i+e:(s.push(o),o=hV(i,e)),n++}return s}function Gfe(t,e,n){return new Promise((r,o)=>{let s=bfe(t),i=Cfe({input:s});function a(){s.destroy(),r()}let c=0,l=0,p=e[l];if(p===void 0){a();return}let d=p[0],_=p[1];function f(m){TV.set(t,1),re&&g.error(`Failed to read file: ${t}. Error: ${m}`),i.close(),i.removeAllListeners(),a()}s.on("error",f),i.on("error",f),i.on("close",a),i.on("line",m=>{if(c++,!(c<d)&&(n[c]=DR(m,0),c>=_)){if(l===e.length-1){i.close(),i.removeAllListeners();return}l++;let h=e[l];if(h===void 0){i.close(),i.removeAllListeners();return}d=h[0],_=h[1]}})})}async function Bfe(t,e){let n={};if(e>0&&t.exception?.values){for(let s of t.exception.values)if(s.stacktrace?.frames?.length)for(let i=s.stacktrace.frames.length-1;i>=0;i--){let a=s.stacktrace.frames[i],c=a?.filename;if(!a||typeof c!="string"||typeof a.lineno!="number"||Dfe(c)||Ufe(a))continue;n[c]||(n[c]=[]),n[c].push(a.lineno)}}let r=Object.keys(n);if(r.length==0)return t;let o=[];for(let s of r){if(TV.get(s))continue;let i=n[s];if(!i)continue;i.sort((l,p)=>l-p);let a=kfe(i,e);if(a.every(l=>wfe(s,l)))continue;let c=Lfe(IO,s,{});o.push(Gfe(s,a,c))}if(await Promise.all(o).catch(()=>{re&&g.log("Failed to read one or more source files and resolve context lines")}),e>0&&t.exception?.values)for(let s of t.exception.values)s.stacktrace?.frames&&s.stacktrace.frames.length>0&&jfe(s.stacktrace.frames,e,IO);return t}function jfe(t,e,n){for(let r of t)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;Hfe(r.lineno,r,e,o)}}function mV(t){delete t.pre_context,delete t.context_line,delete t.post_context}function Hfe(t,e,n,r){if(e.lineno===void 0||r===void 0){re&&g.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=EV(t,n);s<t;s++){let i=r[s];if(i===void 0){mV(e),re&&g.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){mV(e),re&&g.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=SV(t,n);e.post_context=[];for(let s=t+1;s<=o;s++){let i=r[s];if(i===void 0)break;e.post_context.push(i)}}function EV(t,e){return Math.max(1,t-e)}function SV(t,e){return t+e}function hV(t,e){return[EV(t,e),SV(t,e)]}var Ffe=(t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:Pfe;return{name:Mfe,processEvent(n){return Bfe(n,e)}}},gV=Ffe;import{Worker as Vfe}from"node:worker_threads";var Hh;async function Fh(){if(Hh===void 0)try{Hh=!!(await import("node:inspector")).url()}catch{Hh=!1}return Hh}var jp="__SENTRY_ERROR_LOCAL_VARIABLES__";function RV(t,e,n){let r=0,o=5,s=0;return setInterval(()=>{s===0?r>t&&(o*=2,n(o),o>86400&&(o=86400),s=o):(s-=1,s===0&&e()),r=0},1e3).unref(),()=>{r+=1}}function AV(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function Vh(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||AV(t)&&AV(e)}var qfe="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ3LjAgKGE1YTRlNzMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function yV(...t){g.log("[LocalVariables]",...t)}var IV=(t={})=>{function e(s,i){let a=(s.stacktrace?.frames||[]).filter(c=>c.function!=="new Promise");for(let c=0;c<a.length;c++){let l=a.length-c-1,p=i[c],d=a[l];if(!d||!p)break;p.vars===void 0||d.in_app===!1&&t.includeOutOfAppFrames!==!0||!Vh(d.function,p.function)||(d.vars=p.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&jp in i.originalException&&Array.isArray(i.originalException[jp])){for(let a of s.exception?.values||[])e(a,i.originalException[jp]);i.originalException[jp]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new Vfe(new URL(`data:application/javascript;base64,${qfe}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{yV("Worker error",a)}),i.once("exit",a=>{yV("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await Fh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:g.isEnabled()};r().then(()=>{try{o(a)}catch(c){g.error("Failed to start worker",c)}},c=>{g.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}};function OV(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function $fe(t,e){if(e!==void 0)return OV(t(e,1))}function NV(t){let e=[],n=!1;function r(i){e=[],!n&&(n=!0,t(i))}e.push(r);function o(i){e.push(i)}function s(i){let a=e.pop()||r;try{a(i)}catch{r(i)}}return{add:o,next:s}}var OO=class t{constructor(e){this._session=e}static async create(e){if(e)return e;let n=await import("node:inspector");return new t(new n.Session)}configureAndConnect(e,n){this._session.connect(),this._session.on("Debugger.paused",r=>{e(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(e){this._session.post("Debugger.setPauseOnExceptions",{state:e?"all":"uncaught"})}getLocalVariables(e,n){this._getProperties(e,r=>{let{add:o,next:s}=NV(n);for(let i of r)if(i.value?.objectId&&i.value.className==="Array"){let a=i.value.objectId;o(c=>this._unrollArray(a,i.name,c,s))}else if(i.value?.objectId&&i.value.className==="Object"){let a=i.value.objectId;o(c=>this._unrollObject(a,i.name,c,s))}else i.value&&o(a=>this._unrollOther(i,a,s));s({})})}_getProperties(e,n){this._session.post("Runtime.getProperties",{objectId:e,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(e,n,r,o){this._getProperties(e,s=>{r[n]=s.filter(i=>i.name!=="length"&&!isNaN(parseInt(i.name,10))).sort((i,a)=>parseInt(i.name,10)-parseInt(a.name,10)).map(i=>i.value?.value),o(r)})}_unrollObject(e,n,r,o){this._getProperties(e,s=>{r[n]=s.map(i=>[i.name,i.value?.value]).reduce((i,[a,c])=>(i[a]=c,i),{}),o(r)})}_unrollOther(e,n,r){e.value&&("value"in e.value?e.value.value===void 0||e.value.value===null?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&e.value.type!=="function"?n[e.name]=`<${e.value.description}>`:e.value.type==="undefined"&&(n[e.name]="<undefined>")),r(n)}},Yfe="LocalVariables",Wfe=(t={},e)=>{let n=new In(20),r,o=!1;function s(l){let p=OV(l.stacktrace?.frames);if(p===void 0)return;let d=n.remove(p);if(d===void 0)return;let _=(l.stacktrace?.frames||[]).filter(f=>f.function!=="new Promise");for(let f=0;f<_.length;f++){let m=_.length-f-1,h=d[f],T=_[m];if(!T||!h)break;h.vars===void 0||T.in_app===!1&&t.includeOutOfAppFrames!==!0||!Vh(T.function,h.function)||(T.vars=h.vars)}}function i(l){for(let p of l.exception?.values||[])s(p);return l}let a;async function c(){let p=H()?.getOptions();if(!p?.includeLocalVariables)return;if(jo<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Fh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let _=await OO.create(e),f=(h,{params:{reason:T,data:S,callFrames:R}},I)=>{if(T!=="exception"&&T!=="promiseRejection"){I();return}r?.();let x=$fe(h,S.description);if(x==null){I();return}let{add:F,next:B}=NV(se=>{n.set(x,se),I()});for(let se=0;se<Math.min(R.length,5);se++){let{scopeChain:ve,functionName:on,this:Io}=R[se],ss=ve.find(Et=>Et.type==="local"),Ii=Io.className==="global"||!Io.className?on:`${Io.className}.${on}`;if(ss?.object.objectId===void 0)F(Et=>{Et[se]={function:Ii},B(Et)});else{let Et=ss.object.objectId;F(Ya=>_.getLocalVariables(Et,Wa=>{Ya[se]={function:Ii,vars:Wa},B(Ya)}))}}B([])},m=t.captureAllExceptions!==!1;if(_.configureAndConnect((h,T)=>f(p.stackParser,h,T),m),m){let h=t.maxExceptionsPerSecond||50;r=RV(h,()=>{g.log("Local variables rate-limit lifted."),_.setPauseOnExceptions(!0)},T=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${T} seconds.`),_.setPauseOnExceptions(!1)})}o=!0}catch(_){g.log("The `LocalVariables` integration failed to start.",_)}}return{name:Yfe,setupOnce(){a=c()},async processEvent(l){return await a,o?i(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}},bV=Wfe;var CV=(t={})=>Lr.major<19?bV(t):IV(t);import{existsSync as zfe,readFileSync as vV}from"node:fs";import{dirname as Kfe,join as LV}from"node:path";function Hp(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var PV;function MV(){return Hp()?!1:jo>=21||jo===20&&Mp>=6||jo===18&&Mp>=19?!0:(PV||(PV=!0,Qe(()=>{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)}var NO,Qfe="Modules",Xfe=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,Jfe=()=>({name:Qfe,processEvent(t){return t.modules={...t.modules,...xV()},t},getModules:xV}),DV=Jfe;function Zfe(){try{return U.cache?Object.keys(U.cache):[]}catch{return[]}}function eme(){return{...Xfe,...rme(),...Hp()?tme():{}}}function tme(){let t=U.main?.paths||[],e=Zfe(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=Kfe(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=LV(a,"package.json");if(r.add(a),!zfe(c))return i();try{let l=JSON.parse(vV(c,"utf8"));n[l.name]=l.version}catch{}};i()}),n}function xV(){return NO||(NO=eme()),NO}function nme(){try{let t=LV(process.cwd(),"package.json");return JSON.parse(vV(t,"utf8"))}catch{return{}}}function rme(){let t=nme();return{...t.dependencies,...t.devDependencies}}import{isMainThread as sme}from"worker_threads";var ome=2e3;function Fp(t){Qe(()=>{console.error(t)});let e=H();if(e===void 0){re&&g.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=e.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:ome;e.close(r).then(o=>{o||re&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{re&&g.error(o)})}var ime="OnUncaughtException",UV=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:ime,setup(n){sme&&global.process.on("uncaughtException",ame(n,e))}}};function ame(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let l=Fp;e.onFatalError?l=e.onFatalError:a.onFatalError&&(l=a.onFatalError);let d=global.process.listeners("uncaughtException").filter(f=>f.name!=="domainUncaughtExceptionClear"&&f.tag!=="sentry_tracingErrorCallback"&&f._errorHandler!==!0).length===0,_=e.exitEvenIfOtherHandlersAreRegistered||d;r?_&&(s?(re&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Fp(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,l(i,c))},2e3))):(i=c,r=!0,H()===t&&te(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!s&&_&&(s=!0,l(c)))},{_errorHandler:!0})}var cme="OnUnhandledRejection",ume=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],lme=(t={})=>{let e={mode:t.mode??"warn",ignore:[...ume,...t.ignore??[]]};return{name:cme,setup(n){global.process.on("unhandledRejection",fme(n,e))}}},wV=lme;function pme(t){if(typeof t!="object"||t===null)return{name:"",message:String(t??"")};let e=t,n=typeof e.name=="string"?e.name:"",r=typeof e.message=="string"?e.message:String(t);return{name:n,message:r}}function dme(t,e){let n=t.name===void 0||xo(e.name,t.name,!0),r=t.message===void 0||xo(e.message,t.message);return n&&r}function _me(t,e){let n=pme(e);return t.some(r=>dme(r,n))}function fme(t,e){return function(r,o){if(H()!==t||_me(e.ignore??[],r))return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>xc(i,c):c=>c())(()=>{te(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),mme(r,e.mode)}}function mme(t,e){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:";e==="warn"?Qe(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(Qe(()=>{console.warn(n)}),Fp(t))}var hme="ProcessSession",kV=()=>({name:hme,setupOnce(){im(),process.on("beforeExit",()=>{ue().getSession()?.status!=="ok"&&ap()})}});import*as GV from"node:http";var bO="Spotlight",Tme=(t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:bO,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}Eme(n,e)}}},BV=Tme;function Eme(t,e){let n=Sme(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=tp(o);vc(()=>{let i=GV.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(r=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});i.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function Sme(t){try{return new URL(`${t}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}import*as jV from"node:util";var gme="NodeSystemError";function Ame(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:jV.getSystemErrorMap().has(t.errno)}var HV=(t={})=>({name:gme,processEvent:(e,n,r)=>{if(!Ame(n.originalException))return e;let o=n.originalException,s={...o};!r.getOptions().sendDefaultPii&&t.includePaths!==!0&&(delete s.path,delete s.dest),e.contexts={...e.contexts,node_system_error:s};for(let i of e.exception?.values||[])i.value&&(o.path&&i.value.includes(o.path)&&(i.value=i.value.replace(`'${o.path}'`,"").trim()),o.dest&&i.value.includes(o.dest)&&(i.value=i.value.replace(`'${o.dest}'`,"").trim()));return e}});import*as yme from"node:http";import*as Ime from"node:https";import{Readable as Ome}from"node:stream";import{createGzip as Nme}from"node:zlib";import*as Vo from"node:net";import*as PO from"node:tls";import*as CO from"node:http";var co=Symbol("AgentBaseInternalState"),qh=class extends CO.Agent{constructor(e){super(e),this[co]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
32
|
+
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof CO.Agent)return s.addRequest(e,o);this[co].currentSocket=s,super.createSocket(e,n,r)},r)}createConnection(){let e=this[co].currentSocket;if(this[co].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[co].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[co]&&(this[co].defaultPort=e)}get protocol(){return this[co].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[co]&&(this[co].protocol=e)}};function $h(...t){g.log("[https-proxy-agent:parse-proxy-response]",...t)}function FV(t){return new Promise((e,n)=>{let r=0,o=[];function s(){let p=t.read();p?l(p):t.once("readable",s)}function i(){t.removeListener("end",a),t.removeListener("error",c),t.removeListener("readable",s)}function a(){i(),$h("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function c(p){i(),$h("onerror %o",p),n(p)}function l(p){o.push(p),r+=p.length;let d=Buffer.concat(o,r),_=d.indexOf(`\r
|
|
33
33
|
\r
|
|
34
|
-
`);if(_===-1){
|
|
35
|
-
`),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),T=+(h[1]||0),S=h.slice(2).join(" "),R={};for(let I of f){if(!I)continue;let x=I.indexOf(":");if(x===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${I}"`));let F=I.slice(0,x).toLowerCase(),B=I.slice(x+1).trimStart(),se=R[F];typeof se=="string"?R[F]=[se,B]:Array.isArray(se)?se.push(B):R[F]=B}
|
|
34
|
+
`);if(_===-1){$h("have not received end of HTTP headers yet..."),s();return}let f=d.subarray(0,_).toString("ascii").split(`\r
|
|
35
|
+
`),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),T=+(h[1]||0),S=h.slice(2).join(" "),R={};for(let I of f){if(!I)continue;let x=I.indexOf(":");if(x===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${I}"`));let F=I.slice(0,x).toLowerCase(),B=I.slice(x+1).trimStart(),se=R[F];typeof se=="string"?R[F]=[se,B]:Array.isArray(se)?se.push(B):R[F]=B}$h("got proxy server response: %o %o",m,R),i(),e({connect:{statusCode:T,statusText:S,headers:R},buffered:d})}t.on("error",c),t.on("end",a),s()})}function Vp(...t){g.log("[https-proxy-agent]",...t)}var qp=class extends qh{static __initStatic(){this.protocols=["http","https"]}constructor(e,n){super(n),this.options={},this.proxy=typeof e=="string"?new URL(e):e,this.proxyHeaders=n?.headers??{},Vp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?VV(n,"headers"):null,host:r,port:o}}async connect(e,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Vp("Creating `tls.Socket`: %o",this.connectOpts);let _=this.connectOpts.servername||this.connectOpts.host;o=PO.connect({...this.connectOpts,servername:_&&Vo.isIP(_)?void 0:_})}else Vp("Creating `net.Socket`: %o",this.connectOpts),o=Vo.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=Vo.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
|
|
36
36
|
`;if(r.username||r.password){let _=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(_).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let _ of Object.keys(s))a+=`${_}: ${s[_]}\r
|
|
37
37
|
`;let c=FV(o);o.write(`${a}\r
|
|
38
|
-
`);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Ame),n.secureEndpoint){Fp("Upgrading socket connection to TLS");let _=n.servername||n.host;return PO.connect({...VV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Fp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};Vp.__initStatic();function Ame(t){t.resume()}function VV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Nme=1024*32;function bme(t){return new Ime({read(){this.push(t),this.push(null)}})}function qV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),up(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Cme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?yme:Rme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Vp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=Pme(t,t.httpModule??o,i);return up(t,a)}function Cme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function Pme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{xc(()=>{let _=bme(l.body),f={...t.headers};l.body.length>Nme&&(f["content-encoding"]="gzip",_=_.pipe(Ome()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let S=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function $V(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=Uc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as Mme,sep as xme}from"node:path";function YV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function WV(t=process.argv[1]?My(process.argv[1]):process.cwd(),e=xme==="\\"){let n=e?YV(t):t;return r=>{if(!r)return;let o=e?YV(r):r,{dir:s,base:i,ext:a}=Mme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function zV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=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 e||n||r||t}var KV=xf(cI(WV()));b();var XV=K(ne(),1);import*as QV from"node:os";import{threadId as vme,isMainThread as Lme}from"worker_threads";var Dme=6e4,$h=class extends lp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||QV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,XV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Ki(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${Lme?"main":`worker-${vme}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Lc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??Dme).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){yy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?eV(this,e):[void 0,void 0]}};var JV=K(cR(),1);import*as ZV from"module";function MO(){if(MV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,JV.createAddHookMessageChannel)();ZV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Yh(){return[_m(),pm(),fm(),mm(),HV(),Dy(),Tm(),yH(),CH(),UV(),wV(),gV(),CV(),fV(),pV(),kV(),DV()]}function xO(t={}){return Ume(t,Yh)}function Ume(t={},e){let n=wme(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&MO(),rV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===bO)&&n.integrations.push(BV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Ki(n,"node-core");let o=new $h(n);return he().setClient(o),o.init(),g.log(`SDK initialized from ${jp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),Bme(),jF(o),nV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function vO(){if(!re)return;let t=qF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.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 wme(t,e){let n=kme(t.release),r=$V(t.spotlight),o=Gme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??qV,stackParser:yR(t.stackParser||KV),release:n,tracesSampleRate:o,spotlight:r,debug:Uc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:my({defaultIntegrations:a,integrations:i})}}function kme(t){if(t!==void 0)return t;let e=zV();if(e!==void 0)return e}function Gme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function Bme(){if(Uc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Kl(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function qp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var LO="Http",eq="@opentelemetry_sentry-patched/instrumentation-http",Wh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,jme=w(`${LO}.sentry`,t=>new ra(t)),Hme=w(LO,t=>{let e=new tq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:eq}),e.instrumentationName=eq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function Fme(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&Wh)}var nq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Op(r),i=Np(o),a=e&&!n;return{name:LO,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=Fme(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:Wh||!l,createSpansForOutgoingRequests:Wh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=qp(_);if(f.startsWith("data:")){let m=wc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(jme(p),l){let d=Vme(t);Hme(d)}},processEvent(c){return i.processEvent(c)}}};function Vme(t={}){return{disableOutgoingRequestInstrumentation:Wh,ignoreOutgoingRequestHook:n=>{let r=qp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=qp(r);if(o.startsWith("data:")){let s=wc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var cq=K(iq(),1);var uq="NodeFetch",Yme=w(uq,cq.UndiciInstrumentation,t=>Qme(t)),Wme=w(`${uq}.sentry`,oa,t=>t),zme=(t={})=>({name:"NodeFetch",setupOnce(){Kme(t,H()?.getOptions())&&Yme(t),Wme(t)}}),lq=zme;function aq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Kme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function Qme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=aq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=aq(n.origin,n.path);if(r.startsWith("data:")){let o=wc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Aq=K(gq(),1);var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Rq="Express";function dhe(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function _he(t,e){if(ue()===er())return mt&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var yq=w(Rq,()=>new Aq.ExpressInstrumentation({requestHook:t=>dhe(t),spanNameHook:(t,e)=>_he(t,e)})),fhe=()=>({name:Rq,setupOnce(){yq()}}),Iq=fhe;var Q$=K(q$(),1);import*as RN from"node:diagnostics_channel";b();var UT=K(Te(),1),_a=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var ad;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(ad||(ad={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(cd||(cd={}));b();var ud=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function AN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ud]||[];return s.push(o),Object.defineProperty(t,ud,{enumerable:!1,configurable:!0,value:s}),o}function LT(t,e){let n=t[ud]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ud])}function Y$(t,e,n){let r,o;try{o=t(),$$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!$$(o)&&(e(r,o),r))throw r;return o}}function $$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var pSe="0.1.0",dSe="@sentry/instrumentation-fastify-v3",W$="anonymous",_Se=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),DT=class extends _a.InstrumentationBase{constructor(e={}){super(dSe,pSe,e)}init(){return[new _a.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,UT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===UT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||W$,c=`${cd.MIDDLEWARE} - ${a}`,l=i[1],p=AN(l,s.tracer,c,{[$o.FASTIFY_TYPE]:ad.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){LT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>Y$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||LT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!_Se.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),fSe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,_a.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),LT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${cd.REQUEST_HANDLER} - ${c||this.pluginName||W$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:ad.REQUEST_HANDLER,[oA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=AN(o,e.tracer,l,p);z$(d);let{requestHook:_}=e.getConfig();return _&&(0,_a.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function fSe(){let t=H();t&&t.on("spanStart",e=>{z$(e)})}function z$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var wT="Fastify",X$=w(`${wT}.v3`,()=>new DT);function mSe(){let t=H();if(t)return t.getIntegrationByName(wT)}function K$(t,e,n,r){let o=mSe()?.getShouldHandleError()||eY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){mt&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var J$=w(`${wT}.v5`,()=>{let t=new Q$.FastifyOtelInstrumentation,e=t.plugin();return RN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?mt&&g.error("Failed to setup Fastify instrumentation",o):(TSe(),r&&ESe(r))})}),RN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;K$.call(K$,r,o,s,"diagnostics-channel")}),t}),hSe=({shouldHandleError:t})=>{let e;return{name:wT,setupOnce(){e=t||eY,X$(),J$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},Z$=(t={})=>hSe(t);function eY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function tY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function TSe(){let t=H();t&&t.on("spanStart",e=>{tY(e)})}function ESe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&tY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var RY=K(AY(),1);var yY="Graphql",IY=w(yY,RY.GraphQLInstrumentation,t=>{let e=NY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[au]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(au,p)):typeof p=="string"?c.setAttribute(au,[p,d]):c.setAttribute(au,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${BSe(p)})`)}}}}),GSe=(t={})=>({name:yY,setupOnce(){IY(NY(t))}}),OY=GSe;function NY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function BSe(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var GY=K(kY(),1);var BY="Kafka",jY=w(BY,()=>new GY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),HSe=()=>({name:BY,setupOnce(){jY()}}),HY=HSe;var zY=K(WY(),1);var KY="LruMemoizer",QY=w(KY,()=>new zY.LruMemoizerInstrumentation),VSe=()=>({name:KY,setupOnce(){QY()}}),XY=VSe;var iW=K(sW(),1);var aW="Mongo",cW=w(aW,()=>new iW.MongoDBInstrumentation({dbStatementSerializer:zSe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function zSe(t){let e=xN(t);return JSON.stringify(e)}function xN(t){if(Array.isArray(t))return t.map(e=>xN(e));if(KSe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xN(r)]).reduce((n,r)=>(XSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function KSe(t){return typeof t=="object"&&t!==null&&!QSe(t)}function QSe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function XSe(t){return Array.isArray(t)}var JSe=()=>({name:aW,setupOnce(){cW()}}),uW=JSe;var gW=K(SW(),1);var AW="Mongoose",RW=w(AW,()=>new gW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),age=()=>({name:AW,setupOnce(){RW()}}),yW=age;var xW=K(MW(),1);var vW="Mysql",LW=w(vW,()=>new xW.MySQLInstrumentation({})),Tge=()=>({name:vW,setupOnce(){LW()}}),DW=Tge;var FW=K(HW(),1);var VW="Mysql2",qW=w(VW,()=>new FW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),vge=()=>({name:VW,setupOnce(){qW()}}),$W=vge;var Tz=K(ZW(),1),Ez=K(dz(),1);var Xge=["get","set","setex"],JN=["get","mget"],Jge=["set","setex"];function yd(t,e){return t.includes(e.toLowerCase())}function ZN(t){return yd(JN,t)?"cache.get":yd(Jge,t)?"cache.put":void 0}function Zge(t,e){return e.some(n=>t.startsWith(n))}function fz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?_z(o.map(s=>n(s))):["<unknown>"],r=e[0];return yd(Xge,t)&&r!=null?n(r):_z(e.map(o=>n(o)))}catch{return}}function mz(t,e,n){if(!ZN(t))return!1;for(let r of e)if(Zge(r,n))return!0;return!1}function hz(t){let e=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(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function _z(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var SE="Redis",Id={},Sz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=fz(e,n),s=ZN(e);if(!o||!s||!Id.cachePrefixes||!mz(e,o,Id.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=hz(r);c&&t.setAttribute(KR,c),yd(JN,e)&&c!==void 0&&t.setAttribute(WR,c>0),t.setAttributes({[ee]:s,[zR]:o});let l=o.join(", ");t.updateName(Id.maxCacheKeyLength?hs(l,Id.maxCacheKeyLength):l)},eAe=w(`${SE}.IORedis`,()=>new Tz.IORedisInstrumentation({responseHook:Sz})),tAe=w(`${SE}.Redis`,()=>new Ez.RedisInstrumentation({responseHook:Sz})),gz=Object.assign(()=>{eAe(),tAe()},{id:SE}),nAe=(t={})=>({name:SE,setupOnce(){Id=t,gz()}}),Az=nAe;var Gz=K(kz(),1);var Bz="Postgres",jz=w(Bz,Gz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),TAe=t=>({name:Bz,setupOnce(){jz(t)}}),Hz=TAe;b();var ei=K(ne(),1);le();var ib="PostgresJs",Fz=[">=3.0.0 <4"],EAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,SAe=Symbol.for("sentry.query.from.instrumented.sql"),Vz=w(ib,t=>new sb({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),sb=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",Fz,n=>{try{return this._patchPostgres(n)}catch(r){return mt&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,Fz,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return mt&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return mt&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Ly(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(Rp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(ec,r);return}let o=n?.match(EAe);o?.[1]&&e.setAttribute(ec,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[SAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return It({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[Mi]:"postgres",[pA]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),mt&&g.error(`Error in requestHook for ${ib} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){mt&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(dA,m?.[0]?.code||"unknown"),a.setAttribute(_A,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){mt&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},gAe=t=>({name:ib,setupOnce(){Vz(t)}}),qz=gAe;b();b();var WE=K(bK(),1);b();var HRe={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},FRe=HRe.version.split(".")[0],Mb="PRISMA_INSTRUMENTATION",xb=`V${FRe}_PRISMA_INSTRUMENTATION`,Yu=globalThis;function VRe(){let t=Yu[xb];return t?.helper?t.helper:Yu[Mb]?.helper}function qRe(t){let e={helper:t};Yu[xb]=e,Yu[Mb]=e}function $Re(){delete Yu[xb],delete Yu[Mb]}var YRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",WRe="00-10-10-00";function zRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var KRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:WRe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)MK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!YRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(xK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return CK(s,e(s,r))}return n.startActiveSpan(o,t,s=>CK(s,e(s,r)))}};function MK(t,e,n,r,o){if(xK(e.name,o))return;let s={attributes:e.attributes,kind:zRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)MK(t,c,n,r,o);i.end(e.endTime)})}function CK(t,e){return QRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function QRe(t){return t!=null&&typeof t.then=="function"}function xK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var vK={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},PK=vK.version,XRe=vK.name,JRe="@prisma/client",LK=class extends WE.InstrumentationBase{tracerProvider;constructor(t={}){super(XRe,PK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new WE.InstrumentationNodeModuleDefinition(JRe,[PK])]}enable(){let t=this._config;qRe(new KRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){$Re()}isEnabled(){return VRe()!==void 0}};var DK="Prisma";function ZRe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function UK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var vb=class extends LK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=UK();ZRe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=eye(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function eye(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var tye=w(DK,t=>new vb(t)),wK=t=>({name:DK,setupOnce(){tye(t)},setup(e){UK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var YK=K($K(),1);var WK="Hapi",zK=w(WK,()=>new YK.HapiInstrumentation),fye=()=>({name:WK,setupOnce(){zK()}}),KK=fye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Gd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var XE=K(ne(),1);var mye="@sentry/instrumentation-hono",hye="0.0.1",QE=class extends XE.InstrumentationBase{constructor(e={}){super(mye,hye,e)}init(){return[new XE.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),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{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Lt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return Lt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Gd.MIDDLEWARE:Gd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var QK="Hono";function Tye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[xi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var XK=w(QK,()=>new QE({responseHook:t=>{Tye(t)}})),Eye=()=>({name:QK,setupOnce(){XK()}}),JK=Eye;var l2=K(u2(),1);le();var p2="Koa",d2=w(p2,l2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),bye=(t={})=>({name:p2,setupOnce(){d2(t)}}),_2=bye;var R2=K(A2(),1);var y2="Connect",I2=w(y2,()=>new R2.ConnectInstrumentation),kye=()=>({name:y2,setupOnce(){I2()}}),O2=kye;var U2=K(D2(),1);var Fye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),w2="Tedious",k2=w(w2,()=>new U2.TediousInstrumentation({})),Vye=()=>{let t;return{name:w2,setupOnce(){let e=k2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";Fye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},G2=Vye;var V2=K(F2(),1);var q2="GenericPool",$2=w(q2,()=>new V2.GenericPoolInstrumentation({})),$ye=()=>{let t;return{name:q2,setupOnce(){let e=$2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},Y2=$ye;var n4=K(t4(),1);var r4="Amqplib",nIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},o4=w(r4,()=>new n4.AmqplibInstrumentation(nIe)),rIe=()=>({name:r4,setupOnce(){o4()}}),s4=rIe;var Vd="VercelAI";var fS=K(ne(),1);var oIe=[">=3.0.0 <7"],i4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function sIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function iIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(aIe(e.content),cIe(e.content))}function aIe(t){for(let e of t){if(!sIe(e))continue;let n=Zy(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function cIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&eI(e.toolCallId)}function uIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var _S=class t extends fS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new fS.InstrumentationNodeModuleDefinition("ai",oIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(Vd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=uIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{iIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=i4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var a4=w(Vd,()=>new _S({}));function lIe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var pIe=(t={})=>{let e;return{name:Vd,options:t,setupOnce(){e=a4()},afterAllSetup(n){t.force??lIe(n)?Nm(n):e?.callWhenPatched(()=>Nm(n))}}},c4=pIe;var hS=K(ne(),1);var dIe=[">=4.0.0 <7"],mS=class extends hS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new hS.InstrumentationNodeModuleDefinition("openai",dIe,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(zi(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Cm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var u4=w(ws,t=>new mS(t)),_Ie=(t={})=>({name:ws,setupOnce(){u4(t)}}),l4=_Ie;var ES=K(ne(),1);var fIe=[">=0.19.2 <1.0.0"],TS=class extends ES.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new ES.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",fIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(zi(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Pm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var p4=w(ks,t=>new TS(t)),mIe=(t={})=>({name:ks,options:t,setupOnce(){p4(t)}}),d4=mIe;var sl=K(ne(),1);var _4=[">=0.10.0 <2"],SS=class extends sl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new sl.InstrumentationNodeModuleDefinition("@google/genai",_4,n=>this._patch(n),n=>n,[new sl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",_4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(zi(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Mm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return Rp(e,"GoogleGenAI",o),e}};var f4=w(Gs,t=>new SS(t)),hIe=(t={})=>({name:Gs,setupOnce(){f4(t)}}),m4=hIe;var _i=K(ne(),1);var gS=[">=0.1.0 <2.0.0"];function TIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function EIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=TIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var AS=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,gS,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,gS,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",gS,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",gS,this._patch.bind(this),r=>r)])),e}_patch(e){Ry([ws,ks,Gs]);let n=vm(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=EIe(l,n))}}};var h4=w(xm,t=>new AS(t)),SIe=(t={})=>({name:xm,setupOnce(){h4(t)}}),T4=SIe;var il=K(ne(),1);var E4=[">=0.0.0 <2.0.0"],RS=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@langchain/langgraph",E4,this._patch.bind(this),n=>n,[new il.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",E4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Dm(e.StateGraph.prototype,this.getConfig()),e}};var S4=w(Lm,t=>new RS(t)),gIe=(t={})=>({name:Lm,setupOnce(){S4(t)}}),g4=gIe;var C4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as R4 from"node:net";function y4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>A4(p,n,r,t,i)),l=["@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 p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>A4(d,n,r,t,i),d=>I4(d,r)));return c}function A4(t,e,n,r,o){return I4(t,n),e(t,"addDoc",AIe(r,o)),e(t,"getDocs",yIe(r,o)),e(t,"setDoc",IIe(r,o)),e(t,"deleteDoc",RIe(r,o)),t}function I4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function AIe(t,e){return function(r){return function(o,s){let i=IS(t,"addDoc",o);return e(i),yS(i,()=>r(o,s))}}}function RIe(t,e){return function(r){return function(o){let s=IS(t,"deleteDoc",o.parent||o);return e(s),yS(s,()=>r(o))}}}function yIe(t,e){return function(r){return function(o){let s=IS(t,"getDocs",o);return e(s),yS(s,()=>r(o))}}}function IIe(t,e){return function(r){return function(o,s,i){let a=IS(t,"setDoc",o.parent||o);return e(a),yS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function yS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function IS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ne.CLIENT});return NIe(r,n),r.setAttribute(ec,e),r}function OIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(R4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function NIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[uA]:e.path,[lA]:n.name,[Mi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=OIe(s);a&&(i[EA]=a),c&&(i[SA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function O4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("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:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>bIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>N4(m,r)))}),p}function Sn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Ne.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function bIe(t,e,n,r,o,s){switch(N4(t,n),s){case"function":e(t,"onRequest",Sn(r,o,"http.request")),e(t,"onCall",Sn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Sn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Sn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Sn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Sn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Sn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Sn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Sn(r,o,"storage.object.metadataUpdated"));break}return t}function N4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var b4={},CIe=[">=3.0.0 <5"],PIe=[">=6.0.0 <7"],OS=class extends C4.InstrumentationBase{constructor(e=b4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...b4,...e})}init(){let e=[];return e.push(y4(this.tracer,CIe,this._wrap,this._unwrap,this.getConfig())),e.push(O4(this.tracer,PIe,this._wrap,this._unwrap,this.getConfig())),e}};var P4="Firebase",MIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await nm(2e3))}}},M4=w(P4,()=>new OS(MIe)),xIe=()=>({name:P4,setupOnce(){M4()}}),x4=xIe;function v4(){return[Iq(),Z$(),OY(),JK(),uW(),yW(),DW(),$W(),Az(),Hz(),wK(),KK(),_2(),O2(),G2(),Y2(),HY(),s4(),XY(),T4(),g4(),c4(),l4(),d4(),m4(),qz(),x4()]}b();var NS=K(DI(),1),L4=K(iO(),1);le();var Xb=1e6;function D4(t,e={}){t.getOptions().debug&&RO();let[n,r]=vIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function vIe(t,e={}){let n=new L4.BasicTracerProvider({sampler:new Gh(t),resource:(0,NS.defaultResource)().merge((0,NS.resourceFromAttributes)({[gA]:"node",[cA]:"sentry",[AA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new kh({timeout:LIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new wh);let r=new AO;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function LIe(t){if(t!=null){if(t>Xb)return mt&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Xb}`),Xb;if(t<=0||Number.isNaN(t)){mt&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function U4(){return Yh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(nq(),lq())}function w4(t){return[...U4(),...Xe(t)?v4():[]]}function Jb(t={}){return DIe(t,w4)}function DIe(t={},e){Ki(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(D4(n,{spanProcessors:t.openTelemetrySpanProcessors}),vO()),n}var UIe="prod",G4="0.1.12",wIe=`@tanagram/lore/${G4}`;function xt(){return UIe}function bS(){return G4}function B4(){return wIe}Jb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:xt(),release:bS(),sendDefaultPii:!0});tm("service_name","lore-cli");import{realpathSync as hxe}from"node:fs";import{fileURLToPath as Txe,pathToFileURL as w9}from"node:url";var kIe=/\d/,GIe=["-","_","/","."];function BIe(t=""){if(!kIe.test(t))return t!==t.toLowerCase()}function j4(t,e){let n=e??GIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=BIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function jIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function HIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function FIe(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>jIe(e?.normalize?n.toLowerCase():n)).join(""):""}function qd(t,e){return HIe(FIe(t||"",e))}function CS(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function H4(t){return CS(t||"","_")}import{parseArgs as VIe}from"node:util";function LS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
|
|
39
|
-
`)}function Kn(t){return typeof t=="function"?t():t}var
|
|
40
|
-
`)}function eC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${H4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function V4(t,e){let n=e?xS("(Required)"):"",r=t.default===void 0?"":xS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{execFile as
|
|
41
|
-
`;let o=Object.entries(n).map(([s,i])=>`${s}=${
|
|
38
|
+
`);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Rme),n.secureEndpoint){Vp("Upgrading socket connection to TLS");let _=n.servername||n.host;return PO.connect({...VV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Vp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};qp.__initStatic();function Rme(t){t.resume()}function VV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var bme=1024*32;function Cme(t){return new Ome({read(){this.push(t),this.push(null)}})}function qV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),lp(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Pme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Ime:yme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new qp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=Mme(t,t.httpModule??o,i);return lp(t,a)}function Pme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function Mme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{vc(()=>{let _=Cme(l.body),f={...t.headers};l.body.length>bme&&(f["content-encoding"]="gzip",_=_.pipe(Nme()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let S=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function $V(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=wc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as xme,sep as vme}from"node:path";function YV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function WV(t=process.argv[1]?My(process.argv[1]):process.cwd(),e=vme==="\\"){let n=e?YV(t):t;return r=>{if(!r)return;let o=e?YV(r):r,{dir:s,base:i,ext:a}=xme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function zV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=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 e||n||r||t}var KV=vf(cI(WV()));b();var XV=K(ne(),1);import*as QV from"node:os";import{threadId as Lme,isMainThread as Dme}from"worker_threads";var Ume=6e4,Yh=class extends pp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||QV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,XV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Qi(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${Dme?"main":`worker-${Lme}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Dc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??Ume).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){yy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?eV(this,e):[void 0,void 0]}};var JV=K(cR(),1);import*as ZV from"module";function MO(){if(MV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,JV.createAddHookMessageChannel)();ZV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Wh(){return[fm(),dm(),mm(),hm(),HV(),Dy(),Em(),yH(),CH(),UV(),wV(),gV(),CV(),fV(),pV(),kV(),DV()]}function xO(t={}){return wme(t,Wh)}function wme(t={},e){let n=kme(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&MO(),rV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===bO)&&n.integrations.push(BV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Qi(n,"node-core");let o=new Yh(n);return he().setClient(o),o.init(),g.log(`SDK initialized from ${Hp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),jme(),jF(o),nV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function vO(){if(!re)return;let t=qF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.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 kme(t,e){let n=Gme(t.release),r=$V(t.spotlight),o=Bme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??qV,stackParser:yR(t.stackParser||KV),release:n,tracesSampleRate:o,spotlight:r,debug:wc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:my({defaultIntegrations:a,integrations:i})}}function Gme(t){if(t!==void 0)return t;let e=zV();if(e!==void 0)return e}function Bme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function jme(){if(wc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Ql(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function $p(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var LO="Http",eq="@opentelemetry_sentry-patched/instrumentation-http",zh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,Hme=w(`${LO}.sentry`,t=>new oa(t)),Fme=w(LO,t=>{let e=new tq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:eq}),e.instrumentationName=eq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function Vme(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&zh)}var nq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Np(r),i=bp(o),a=e&&!n;return{name:LO,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=Vme(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:zh||!l,createSpansForOutgoingRequests:zh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=$p(_);if(f.startsWith("data:")){let m=kc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(Hme(p),l){let d=qme(t);Fme(d)}},processEvent(c){return i.processEvent(c)}}};function qme(t={}){return{disableOutgoingRequestInstrumentation:zh,ignoreOutgoingRequestHook:n=>{let r=$p(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=$p(r);if(o.startsWith("data:")){let s=kc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var cq=K(iq(),1);var uq="NodeFetch",Wme=w(uq,cq.UndiciInstrumentation,t=>Xme(t)),zme=w(`${uq}.sentry`,sa,t=>t),Kme=(t={})=>({name:"NodeFetch",setupOnce(){Qme(t,H()?.getOptions())&&Wme(t),zme(t)}}),lq=Kme;function aq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Qme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function Xme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=aq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=aq(n.origin,n.path);if(r.startsWith("data:")){let o=kc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Aq=K(gq(),1);var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Rq="Express";function _he(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function fhe(t,e){if(ue()===er())return mt&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var yq=w(Rq,()=>new Aq.ExpressInstrumentation({requestHook:t=>_he(t),spanNameHook:(t,e)=>fhe(t,e)})),mhe=()=>({name:Rq,setupOnce(){yq()}}),Iq=mhe;var Q$=K(q$(),1);import*as RN from"node:diagnostics_channel";b();var wT=K(Te(),1),fa=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(cd||(cd={}));var ud;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(ud||(ud={}));b();var ld=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function AN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ld]||[];return s.push(o),Object.defineProperty(t,ld,{enumerable:!1,configurable:!0,value:s}),o}function DT(t,e){let n=t[ld]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ld])}function Y$(t,e,n){let r,o;try{o=t(),$$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!$$(o)&&(e(r,o),r))throw r;return o}}function $$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var dSe="0.1.0",_Se="@sentry/instrumentation-fastify-v3",W$="anonymous",fSe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),UT=class extends fa.InstrumentationBase{constructor(e={}){super(_Se,dSe,e)}init(){return[new fa.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,wT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===wT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||W$,c=`${ud.MIDDLEWARE} - ${a}`,l=i[1],p=AN(l,s.tracer,c,{[$o.FASTIFY_TYPE]:cd.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){DT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>Y$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||DT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!fSe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),mSe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,fa.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),DT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${ud.REQUEST_HANDLER} - ${c||this.pluginName||W$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:cd.REQUEST_HANDLER,[oA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=AN(o,e.tracer,l,p);z$(d);let{requestHook:_}=e.getConfig();return _&&(0,fa.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function mSe(){let t=H();t&&t.on("spanStart",e=>{z$(e)})}function z$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var kT="Fastify",X$=w(`${kT}.v3`,()=>new UT);function hSe(){let t=H();if(t)return t.getIntegrationByName(kT)}function K$(t,e,n,r){let o=hSe()?.getShouldHandleError()||eY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){mt&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var J$=w(`${kT}.v5`,()=>{let t=new Q$.FastifyOtelInstrumentation,e=t.plugin();return RN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?mt&&g.error("Failed to setup Fastify instrumentation",o):(ESe(),r&&SSe(r))})}),RN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;K$.call(K$,r,o,s,"diagnostics-channel")}),t}),TSe=({shouldHandleError:t})=>{let e;return{name:kT,setupOnce(){e=t||eY,X$(),J$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},Z$=(t={})=>TSe(t);function eY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function tY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function ESe(){let t=H();t&&t.on("spanStart",e=>{tY(e)})}function SSe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&tY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var RY=K(AY(),1);var yY="Graphql",IY=w(yY,RY.GraphQLInstrumentation,t=>{let e=NY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[cu]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(cu,p)):typeof p=="string"?c.setAttribute(cu,[p,d]):c.setAttribute(cu,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${jSe(p)})`)}}}}),BSe=(t={})=>({name:yY,setupOnce(){IY(NY(t))}}),OY=BSe;function NY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function jSe(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var GY=K(kY(),1);var BY="Kafka",jY=w(BY,()=>new GY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),FSe=()=>({name:BY,setupOnce(){jY()}}),HY=FSe;var zY=K(WY(),1);var KY="LruMemoizer",QY=w(KY,()=>new zY.LruMemoizerInstrumentation),qSe=()=>({name:KY,setupOnce(){QY()}}),XY=qSe;var iW=K(sW(),1);var aW="Mongo",cW=w(aW,()=>new iW.MongoDBInstrumentation({dbStatementSerializer:KSe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function KSe(t){let e=xN(t);return JSON.stringify(e)}function xN(t){if(Array.isArray(t))return t.map(e=>xN(e));if(QSe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xN(r)]).reduce((n,r)=>(JSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function QSe(t){return typeof t=="object"&&t!==null&&!XSe(t)}function XSe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function JSe(t){return Array.isArray(t)}var ZSe=()=>({name:aW,setupOnce(){cW()}}),uW=ZSe;var gW=K(SW(),1);var AW="Mongoose",RW=w(AW,()=>new gW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),cge=()=>({name:AW,setupOnce(){RW()}}),yW=cge;var xW=K(MW(),1);var vW="Mysql",LW=w(vW,()=>new xW.MySQLInstrumentation({})),Ege=()=>({name:vW,setupOnce(){LW()}}),DW=Ege;var FW=K(HW(),1);var VW="Mysql2",qW=w(VW,()=>new FW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),Lge=()=>({name:VW,setupOnce(){qW()}}),$W=Lge;var Tz=K(ZW(),1),Ez=K(dz(),1);var Jge=["get","set","setex"],JN=["get","mget"],Zge=["set","setex"];function Id(t,e){return t.includes(e.toLowerCase())}function ZN(t){return Id(JN,t)?"cache.get":Id(Zge,t)?"cache.put":void 0}function eAe(t,e){return e.some(n=>t.startsWith(n))}function fz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?_z(o.map(s=>n(s))):["<unknown>"],r=e[0];return Id(Jge,t)&&r!=null?n(r):_z(e.map(o=>n(o)))}catch{return}}function mz(t,e,n){if(!ZN(t))return!1;for(let r of e)if(eAe(r,n))return!0;return!1}function hz(t){let e=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(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function _z(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var gE="Redis",Od={},Sz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=fz(e,n),s=ZN(e);if(!o||!s||!Od.cachePrefixes||!mz(e,o,Od.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=hz(r);c&&t.setAttribute(KR,c),Id(JN,e)&&c!==void 0&&t.setAttribute(WR,c>0),t.setAttributes({[ee]:s,[zR]:o});let l=o.join(", ");t.updateName(Od.maxCacheKeyLength?hs(l,Od.maxCacheKeyLength):l)},tAe=w(`${gE}.IORedis`,()=>new Tz.IORedisInstrumentation({responseHook:Sz})),nAe=w(`${gE}.Redis`,()=>new Ez.RedisInstrumentation({responseHook:Sz})),gz=Object.assign(()=>{tAe(),nAe()},{id:gE}),rAe=(t={})=>({name:gE,setupOnce(){Od=t,gz()}}),Az=rAe;var Gz=K(kz(),1);var Bz="Postgres",jz=w(Bz,Gz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),EAe=t=>({name:Bz,setupOnce(){jz(t)}}),Hz=EAe;b();var ei=K(ne(),1);le();var ib="PostgresJs",Fz=[">=3.0.0 <4"],SAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,gAe=Symbol.for("sentry.query.from.instrumented.sql"),Vz=w(ib,t=>new sb({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),sb=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",Fz,n=>{try{return this._patchPostgres(n)}catch(r){return mt&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,Fz,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return mt&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return mt&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Ly(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(yp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(tc,r);return}let o=n?.match(SAe);o?.[1]&&e.setAttribute(tc,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[gAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return It({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[xi]:"postgres",[pA]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),mt&&g.error(`Error in requestHook for ${ib} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){mt&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(dA,m?.[0]?.code||"unknown"),a.setAttribute(_A,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){mt&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},AAe=t=>({name:ib,setupOnce(){Vz(t)}}),qz=AAe;b();b();var zE=K(bK(),1);b();var FRe={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},VRe=FRe.version.split(".")[0],Mb="PRISMA_INSTRUMENTATION",xb=`V${VRe}_PRISMA_INSTRUMENTATION`,Wu=globalThis;function qRe(){let t=Wu[xb];return t?.helper?t.helper:Wu[Mb]?.helper}function $Re(t){let e={helper:t};Wu[xb]=e,Wu[Mb]=e}function YRe(){delete Wu[xb],delete Wu[Mb]}var WRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",zRe="00-10-10-00";function KRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var QRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:zRe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)MK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!WRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(xK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return CK(s,e(s,r))}return n.startActiveSpan(o,t,s=>CK(s,e(s,r)))}};function MK(t,e,n,r,o){if(xK(e.name,o))return;let s={attributes:e.attributes,kind:KRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)MK(t,c,n,r,o);i.end(e.endTime)})}function CK(t,e){return XRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function XRe(t){return t!=null&&typeof t.then=="function"}function xK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var vK={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},PK=vK.version,JRe=vK.name,ZRe="@prisma/client",LK=class extends zE.InstrumentationBase{tracerProvider;constructor(t={}){super(JRe,PK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new zE.InstrumentationNodeModuleDefinition(ZRe,[PK])]}enable(){let t=this._config;$Re(new QRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){YRe()}isEnabled(){return qRe()!==void 0}};var DK="Prisma";function eye(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function UK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var vb=class extends LK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=UK();eye(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=tye(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function tye(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var nye=w(DK,t=>new vb(t)),wK=t=>({name:DK,setupOnce(){nye(t)},setup(e){UK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var YK=K($K(),1);var WK="Hapi",zK=w(WK,()=>new YK.HapiInstrumentation),mye=()=>({name:WK,setupOnce(){zK()}}),KK=mye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Bd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var JE=K(ne(),1);var hye="@sentry/instrumentation-hono",Tye="0.0.1",XE=class extends JE.InstrumentationBase{constructor(e={}){super(hye,Tye,e)}init(){return[new JE.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),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{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Lt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Bd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Bd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return Lt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Bd.MIDDLEWARE:Bd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var QK="Hono";function Eye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[vi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var XK=w(QK,()=>new XE({responseHook:t=>{Eye(t)}})),Sye=()=>({name:QK,setupOnce(){XK()}}),JK=Sye;var l2=K(u2(),1);le();var p2="Koa",d2=w(p2,l2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),Cye=(t={})=>({name:p2,setupOnce(){d2(t)}}),_2=Cye;var R2=K(A2(),1);var y2="Connect",I2=w(y2,()=>new R2.ConnectInstrumentation),Gye=()=>({name:y2,setupOnce(){I2()}}),O2=Gye;var U2=K(D2(),1);var Vye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),w2="Tedious",k2=w(w2,()=>new U2.TediousInstrumentation({})),qye=()=>{let t;return{name:w2,setupOnce(){let e=k2();t=Op(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";Vye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},G2=qye;var V2=K(F2(),1);var q2="GenericPool",$2=w(q2,()=>new V2.GenericPoolInstrumentation({})),Yye=()=>{let t;return{name:q2,setupOnce(){let e=$2();t=Op(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},Y2=Yye;var n4=K(t4(),1);var r4="Amqplib",rIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},o4=w(r4,()=>new n4.AmqplibInstrumentation(rIe)),oIe=()=>({name:r4,setupOnce(){o4()}}),s4=oIe;var qd="VercelAI";var mS=K(ne(),1);var sIe=[">=3.0.0 <7"],i4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function iIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function aIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(cIe(e.content),uIe(e.content))}function cIe(t){for(let e of t){if(!iIe(e))continue;let n=Zy(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function uIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&eI(e.toolCallId)}function lIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var fS=class t extends mS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new mS.InstrumentationNodeModuleDefinition("ai",sIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(qd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=lIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{aIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=i4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var a4=w(qd,()=>new fS({}));function pIe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var dIe=(t={})=>{let e;return{name:qd,options:t,setupOnce(){e=a4()},afterAllSetup(n){t.force??pIe(n)?bm(n):e?.callWhenPatched(()=>bm(n))}}},c4=dIe;var TS=K(ne(),1);var _Ie=[">=4.0.0 <7"],hS=class extends TS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new TS.InstrumentationNodeModuleDefinition("openai",_Ie,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(Ki(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Pm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var u4=w(ws,t=>new hS(t)),fIe=(t={})=>({name:ws,setupOnce(){u4(t)}}),l4=fIe;var SS=K(ne(),1);var mIe=[">=0.19.2 <1.0.0"],ES=class extends SS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new SS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",mIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ki(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Mm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var p4=w(ks,t=>new ES(t)),hIe=(t={})=>({name:ks,options:t,setupOnce(){p4(t)}}),d4=hIe;var il=K(ne(),1);var _4=[">=0.10.0 <2"],gS=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@google/genai",_4,n=>this._patch(n),n=>n,[new il.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",_4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(Ki(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return xm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return yp(e,"GoogleGenAI",o),e}};var f4=w(Gs,t=>new gS(t)),TIe=(t={})=>({name:Gs,setupOnce(){f4(t)}}),m4=TIe;var _i=K(ne(),1);var AS=[">=0.1.0 <2.0.0"];function EIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function SIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=EIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var RS=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,AS,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,AS,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",AS,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",AS,this._patch.bind(this),r=>r)])),e}_patch(e){Ry([ws,ks,Gs]);let n=Lm(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=SIe(l,n))}}};var h4=w(vm,t=>new RS(t)),gIe=(t={})=>({name:vm,setupOnce(){h4(t)}}),T4=gIe;var al=K(ne(),1);var E4=[">=0.0.0 <2.0.0"],yS=class extends al.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new al.InstrumentationNodeModuleDefinition("@langchain/langgraph",E4,this._patch.bind(this),n=>n,[new al.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",E4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Um(e.StateGraph.prototype,this.getConfig()),e}};var S4=w(Dm,t=>new yS(t)),AIe=(t={})=>({name:Dm,setupOnce(){S4(t)}}),g4=AIe;var C4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as R4 from"node:net";function y4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>A4(p,n,r,t,i)),l=["@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 p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>A4(d,n,r,t,i),d=>I4(d,r)));return c}function A4(t,e,n,r,o){return I4(t,n),e(t,"addDoc",RIe(r,o)),e(t,"getDocs",IIe(r,o)),e(t,"setDoc",OIe(r,o)),e(t,"deleteDoc",yIe(r,o)),t}function I4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function RIe(t,e){return function(r){return function(o,s){let i=OS(t,"addDoc",o);return e(i),IS(i,()=>r(o,s))}}}function yIe(t,e){return function(r){return function(o){let s=OS(t,"deleteDoc",o.parent||o);return e(s),IS(s,()=>r(o))}}}function IIe(t,e){return function(r){return function(o){let s=OS(t,"getDocs",o);return e(s),IS(s,()=>r(o))}}}function OIe(t,e){return function(r){return function(o,s,i){let a=OS(t,"setDoc",o.parent||o);return e(a),IS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function IS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function OS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ne.CLIENT});return bIe(r,n),r.setAttribute(tc,e),r}function NIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(R4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function bIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[uA]:e.path,[lA]:n.name,[xi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=NIe(s);a&&(i[EA]=a),c&&(i[SA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function O4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("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:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>CIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>N4(m,r)))}),p}function Sn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Ne.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function CIe(t,e,n,r,o,s){switch(N4(t,n),s){case"function":e(t,"onRequest",Sn(r,o,"http.request")),e(t,"onCall",Sn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Sn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Sn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Sn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Sn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Sn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Sn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Sn(r,o,"storage.object.metadataUpdated"));break}return t}function N4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var b4={},PIe=[">=3.0.0 <5"],MIe=[">=6.0.0 <7"],NS=class extends C4.InstrumentationBase{constructor(e=b4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...b4,...e})}init(){let e=[];return e.push(y4(this.tracer,PIe,this._wrap,this._unwrap,this.getConfig())),e.push(O4(this.tracer,MIe,this._wrap,this._unwrap,this.getConfig())),e}};var P4="Firebase",xIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await rm(2e3))}}},M4=w(P4,()=>new NS(xIe)),vIe=()=>({name:P4,setupOnce(){M4()}}),x4=vIe;function v4(){return[Iq(),Z$(),OY(),JK(),uW(),yW(),DW(),$W(),Az(),Hz(),wK(),KK(),_2(),O2(),G2(),Y2(),HY(),s4(),XY(),T4(),g4(),c4(),l4(),d4(),m4(),qz(),x4()]}b();var bS=K(DI(),1),L4=K(iO(),1);le();var Xb=1e6;function D4(t,e={}){t.getOptions().debug&&RO();let[n,r]=LIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function LIe(t,e={}){let n=new L4.BasicTracerProvider({sampler:new Bh(t),resource:(0,bS.defaultResource)().merge((0,bS.resourceFromAttributes)({[gA]:"node",[cA]:"sentry",[AA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new Gh({timeout:DIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new kh);let r=new AO;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function DIe(t){if(t!=null){if(t>Xb)return mt&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Xb}`),Xb;if(t<=0||Number.isNaN(t)){mt&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function U4(){return Wh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(nq(),lq())}function w4(t){return[...U4(),...Xe(t)?v4():[]]}function Jb(t={}){return UIe(t,w4)}function UIe(t={},e){Qi(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(D4(n,{spanProcessors:t.openTelemetrySpanProcessors}),vO()),n}var wIe="prod",G4="0.1.14",kIe=`@tanagram/lore/${G4}`;function xt(){return wIe}function fi(){return G4}function B4(){return kIe}Jb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:xt(),release:fi(),sendDefaultPii:!0});nm("service_name","lore-cli");import{realpathSync as Txe}from"node:fs";import{fileURLToPath as Exe,pathToFileURL as k9}from"node:url";var GIe=/\d/,BIe=["-","_","/","."];function jIe(t=""){if(!GIe.test(t))return t!==t.toLowerCase()}function j4(t,e){let n=e??BIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=jIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function HIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function FIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function VIe(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>HIe(e?.normalize?n.toLowerCase():n)).join(""):""}function $d(t,e){return FIe(VIe(t||"",e))}function CS(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function H4(t){return CS(t||"","_")}import{parseArgs as qIe}from"node:util";function LS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
|
|
39
|
+
`)}function Kn(t){return typeof t=="function"?t():t}var Oa=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function $Ie(t=[],e={}){let n=new Set(e.boolean||[]),r=new Set(e.string||[]),o=e.alias||{},s=e.default||{},i=new Map,a=new Map;for(let[T,S]of Object.entries(o)){let R=S;for(let I of R)i.set(T,I),a.has(I)||a.set(I,[]),a.get(I).push(T),i.set(I,T),a.has(T)||a.set(T,[]),a.get(T).push(I)}let c={};function l(T){if(n.has(T))return"boolean";let S=a.get(T)||[];for(let R of S)if(n.has(R))return"boolean";return"string"}function p(T){if(r.has(T))return!0;let S=a.get(T)||[];for(let R of S)if(r.has(R))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(s)]);for(let T of d)c[T]||(c[T]={type:l(T),default:s[T]});for(let[T,S]of i.entries())T.length===1&&c[S]&&!c[S].short&&(c[S].short=T);let _=[],f={};for(let T=0;T<t.length;T++){let S=t[T];if(S==="--"){_.push(...t.slice(T));break}if(S.startsWith("--no-")){let R=S.slice(5);f[R]=!0;continue}_.push(S)}let m;try{m=qIe({args:_,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:_}}let h={_:[]};h._=m.positionals;for(let[T,S]of Object.entries(m.values)){let R=S;l(T)==="boolean"&&typeof S=="string"?R=S!=="false":p(T)&&typeof S=="boolean"&&(R=""),h[T]=R}for(let[T]of Object.entries(f)){h[T]=!1;let S=i.get(T);S&&(h[S]=!1);let R=a.get(T);if(R)for(let I of R)h[I]=!1}for(let[T,S]of i.entries())h[T]!==void 0&&h[S]===void 0&&(h[S]=h[T]),h[S]!==void 0&&h[T]===void 0&&(h[T]=h[S]),h[T]!==h[S]&&s[S]===h[S]&&(h[S]=h[T]);return h}var YIe=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),DS=(t,e=39)=>n=>YIe?n:`\x1B[${t}m${n}\x1B[${e}m`,PS=DS(1,22),Gr=DS(36),xS=DS(90),MS=DS(4,24);function WIe(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=q4(e);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=$d(a.name),l=CS(a.name);if(c!==a.name||l!==a.name){let p=LS(n.alias[a.name]||[]);c!==a.name&&!p.includes(c)&&p.push(c),l!==a.name&&!p.includes(l)&&p.push(l),p.length>0&&(n.alias[a.name]=p)}}let o=$Ie(t,n),[...s]=o._,i=new Proxy(o,{get(a,c){return a[c]??a[$d(c)]??a[CS(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=s.shift();if(c!==void 0)i[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new Oa(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let c=i[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new Oa(`Invalid value for argument: ${Gr(`--${a.name}`)} (${Gr(c)}). Expected one of: ${l.map(p=>Gr(p)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new Oa(`Missing required argument: --${a.name}`,"EARG");return i}function q4(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:LS(r.alias)});return e}async function zIe(t){return Promise.all(t.map(e=>Kn(e)))}async function vS(t,e){let n=await Kn(t.args||{}),r=WIe(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await zIe(t.plugins??[]),i,a;try{for(let p of s)await p.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let l=await Kn(t.subCommands);if(l&&Object.keys(l).length>0){let p=KIe(e.rawArgs,n),d=e.rawArgs[p];if(d){let _=await F4(l,d);if(!_)throw new Oa(`Unknown command ${Gr(d)}`,"E_UNKNOWN_COMMAND");await vS(_,{rawArgs:e.rawArgs.slice(p+1)})}else{let _=await Kn(t.default);if(_){if(t.run)throw new Oa("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let f=await F4(l,_);if(!f)throw new Oa(`Default sub command ${Gr(_)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await vS(f,{rawArgs:e.rawArgs})}else if(!t.run)throw new Oa("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(l){a=l}let c=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(l){c.push(l)}for(let l of[...s].reverse())try{await l.cleanup?.(o)}catch(p){c.push(p)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:i}}async function F4(t,e){if(e in t)return Kn(t[e]);for(let n of Object.values(t)){let r=await Kn(n),o=await Kn(r?.meta);if(o?.alias&&LS(o.alias).includes(e))return r}}function KIe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&QIe(r,e)&&n++;continue}return n}return-1}function QIe(t,e){let n=t.replace(/^-{1,2}/,""),r=$d(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===$d(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var XIe=/^no[-A-Z]/;async function $4(t,e){let n=await Kn(t.meta||{}),r=q4(await Kn(t.args||{})),o=await Kn(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],c=[],l=[];for(let f of r)if(f.type==="positional"){let m=f.name.toUpperCase(),h=f.required!==!1&&f.default===void 0;a.push([Gr(m+eC(f)),V4(f,h)]),l.push(h?`<${m}>`:`[${m}]`)}else{let m=f.required===!0&&f.default===void 0,h=[...(f.alias||[]).map(T=>`-${T}`),`--${f.name}`].join(", ")+eC(f);if(i.push([Gr(h),V4(f,m)]),f.type==="boolean"&&(f.default===!0||f.negativeDescription)&&!XIe.test(f.name)){let T=[...(f.alias||[]).map(S=>`--no-${S}`),`--no-${f.name}`].join(", ");i.push([Gr(T),[f.negativeDescription,m?xS("(Required)"):""].filter(Boolean).join(" ")])}m&&l.push(`--${f.name}`+eC(f))}if(t.subCommands){let f=[],m=await Kn(t.subCommands);for(let[h,T]of Object.entries(m)){let S=await Kn((await Kn(T))?.meta);if(S?.hidden)continue;let R=LS(S?.alias),I=[h,...R].join(", ");c.push([Gr(I),S?.description||""]),f.push(h,...R)}l.push(f.join("|"))}let p=[],d=n.version||o.version;p.push(xS(`${n.description} (${s+(d?` v${d}`:"")})`),"");let _=i.length>0||a.length>0;return p.push(`${MS(PS("USAGE"))} ${Gr(`${s}${_?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(p.push(MS(PS("ARGUMENTS")),""),p.push(Zb(a," ")),p.push("")),i.length>0&&(p.push(MS(PS("OPTIONS")),""),p.push(Zb(i," ")),p.push("")),c.length>0&&(p.push(MS(PS("COMMANDS")),""),p.push(Zb(c," ")),p.push("",`Use ${Gr(`${s} <command> --help`)} for more information about a command.`)),p.filter(f=>typeof f=="string").join(`
|
|
40
|
+
`)}function eC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${H4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function V4(t,e){let n=e?xS("(Required)"):"",r=t.default===void 0?"":xS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{execFile as EOe}from"node:child_process";import tn from"node:fs/promises";import SOe from"node:os";import So from"node:path";import{promisify as gOe}from"node:util";import Y4 from"node:os";import Na from"node:path";function Zo(){let t=xt()==="dev"?".lore-dev":".lore";return Na.join(Y4.homedir(),t)}function US(){return Na.join(Zo(),"log.txt")}function tC(){return Na.join(Zo(),"sync_state.json")}function wS(){return Na.join(Zo(),"status.json")}function Yd(){return Na.join(Zo(),"install_source.json")}function Wd(){return Na.join(Zo(),"bin","lore")}function zd(){let t=xt();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function Kd(){return Na.join(Y4.homedir(),"Library","LaunchAgents",`${zd()}.plist`)}import cl from"node:fs/promises";import GS from"node:os";import en from"node:path";function mi(t,e){return t!==null&&typeof t=="object"&&"code"in t&&t.code===e}import z4 from"node:fs";var W4=null;function JIe(){let t=Zo();W4!==t&&(z4.mkdirSync(t,{recursive:!0}),W4=t)}function ZIe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function eOe(t,e,n){let r=`${new Date().toISOString()} ${t} ${e}`;if(!n)return`${r}
|
|
41
|
+
`;let o=Object.entries(n).map(([s,i])=>`${s}=${ZIe(i)}`).join(" ");return o?`${r} ${o}
|
|
42
42
|
`:`${r}
|
|
43
|
-
`}function nC(t,e,n){let r=
|
|
44
|
-
`)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith(";"))continue;if(r.startsWith("[")&&r.endsWith("]")){e=r==='[remote "origin"]';continue}if(!e)continue;let o=r.indexOf("=");if(!(o<0)&&r.slice(0,o).trim()==="url")return r.slice(o+1).trim()}return""}function
|
|
45
|
-
`);for(let i=0;i<o.length;i+=1){let a=o[i]?.trim();if(!a)continue;let c;try{c=JSON.parse(a)}catch(l){e3({historyPath:n,lineNumber:i+1,line:a,reason:"unparseable_json",error:l});continue}if(!
|
|
46
|
-
`)){let o=r.trim();if(!o)continue;let s;try{s=JSON.parse(o)}catch{break}if(s.type!=="assistant")continue;let i=s.message?.content;if(Array.isArray(i))for(let a of i){if(!sC(a)||a.type!=="tool_use"||a.name!=="ExitPlanMode"||!sC(a.input))continue;let c=a.input.planFilePath;if(typeof c!="string")continue;let l=c.trim();!l||n.has(l)||(e.push(l),n.add(l))}}return e}async function
|
|
47
|
-
`,{mode:384})}};async function s3(){try{return JSON.parse(await BS.readFile(wS(),"utf8"))}catch{return{}}}async function i3(){await BS.rm(wS(),{force:!0})}function
|
|
43
|
+
`}function nC(t,e,n){let r=eOe(t,e,n);JIe(),z4.appendFileSync(US(),r),xt()==="dev"&&process.stderr.write(r)}var pt={info(t,e){nC("info",t,e)},warn(t,e){nC("warn",t,e)},error(t,e){nC("error",t,e)}};import tOe from"node:crypto";import Qd from"node:fs/promises";import nOe from"node:os";import kS from"node:path";async function es(t){try{let e=await Qd.stat(t);return{exists:!0,size:e.size,modTimeUnixMs:e.mtime.getTime()}}catch(e){if(mi(e,"ENOENT"))return{exists:!1,size:0,modTimeUnixMs:0};throw e}}function rC(t,e){return t.exists!==e.exists?!0:t.exists?t.size!==e.size||t.modTimeUnixMs!==e.modTimeUnixMs:!1}async function oC(t){let e=await Qd.mkdtemp(kS.join(nOe.tmpdir(),"lore-upload-")),n=kS.join(e,kS.basename(t));await Qd.copyFile(t,n);let r=await Qd.readFile(n);return{tempPath:n,md5:tOe.createHash("md5").update(r).digest("hex")}}async function K4(t){await Qd.rm(kS.dirname(t),{recursive:!0,force:!0})}import Q4 from"node:fs/promises";import Xd from"node:path";async function X4(t){let e=t.trim();if(!e)return null;for(;;){let n=Xd.join(e,".git","config");try{return await Q4.stat(n),n}catch{let r=Xd.dirname(e);if(r===e)return null;e=r}}}async function J4(t){let e=await X4(t);return e?Xd.dirname(Xd.dirname(e)):null}async function Z4(t){let e=await X4(Xd.resolve(t.trim()));if(!e)return"";let n;try{n=await Q4.readFile(e,"utf8")}catch{return""}let r=rOe(n),o=oOe(r);return o?`${o.owner}/${o.name}`:""}function rOe(t){let e=!1;for(let n of t.split(`
|
|
44
|
+
`)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith(";"))continue;if(r.startsWith("[")&&r.endsWith("]")){e=r==='[remote "origin"]';continue}if(!e)continue;let o=r.indexOf("=");if(!(o<0)&&r.slice(0,o).trim()==="url")return r.slice(o+1).trim()}return""}function oOe(t){let e=t.trim();if(!e)return null;let n="",r=/^(?:ssh:\/\/)?git@[^/:]+[:/](.+)$/.exec(e);if(r)n=r[1]??"";else try{n=new URL(e).pathname.replace(/^\/+/,"")}catch{n=e}n=n.replace(/\.git$/,"").replace(/^\/+|\/+$/g,"");let o=n.split("/").filter(Boolean);if(o.length<2)return null;let[s,i]=o.slice(-2);return!s||!i?null:{owner:s,name:i}}var sOe=60*60*1e3,iC=Symbol("missingSessionID"),n3={name:"claudeCode",historyFilePath:Jd,readUnuploadedEntries:r3,collectLocalFiles:aOe,buildPendingTranscriptWatches:cOe};function Jd(){return en.join(GS.homedir(),".claude","history.jsonl")}async function r3(t){let e=Jd(),n;try{n=await cl.readFile(e,"utf8")}catch(r){if(mi(r,"ENOENT"))return[];throw r}return iOe(n,t)}function iOe(t,e,n=Jd()){let r=[],o=t.split(`
|
|
45
|
+
`);for(let i=0;i<o.length;i+=1){let a=o[i]?.trim();if(!a)continue;let c;try{c=JSON.parse(a)}catch(l){e3({historyPath:n,lineNumber:i+1,line:a,reason:"unparseable_json",error:l});continue}if(!mOe(c)){e3({historyPath:n,lineNumber:i+1,line:a,reason:"invalid_history_entry"});continue}r.push(c)}let s=r.findIndex(i=>i.timestamp>=e);return s>=0?r.slice(s):[]}function e3({historyPath:t,lineNumber:e,line:n,reason:r,error:o}){pt.warn("claude_history_entry_skipped",{history_path:t,line_number:e,history_line:n,reason:r,...o?{error:o instanceof Error?o.message:String(o)}:{}})}async function aOe(t){let e=[],n=new Array(t.length),r=new Set,o=new Set,s=[];try{for(let i=0;i<t.length;i+=1){let a=t[i],c=await o3(a);if(c===iC){let m=`__missing_session__:${a.project}:${a.timestamp}:${i}`;n[i]=m,r.add(m),o.add(m);continue}if(n[i]=c.key,o.has(c.key))continue;let l=await es(c.fullPath),p;try{p=await oC(c.fullPath)}catch(m){if(mi(m,"ENOENT")){r.add(c.key),o.add(c.key);continue}throw new Error(`read session transcript ${c.fullPath}: ${String(m)}`)}s.push(p.tempPath);let d=await Z4(a.project);e.push({key:c.key,filename:c.relativeFilename,sourcePath:c.fullPath,repoOriginPath:d,tempPath:p.tempPath,md5:p.md5,fileType:"transcript",harness:"claudeCode",harnessInternalId:a.sessionId?.trim()??"",watchedState:l}),o.add(c.key);let _=await cl.readFile(p.tempPath,"utf8"),f=_Oe(_);for(let m of f){let h;try{h=await fOe(m)}catch{continue}let T=`${c.key}::plan:${h}`;if(o.has(T))continue;let S=await es(h),R;try{R=await oC(h)}catch(I){if(mi(I,"ENOENT"))continue;throw new Error(`read plan file ${h}: ${String(I)}`)}s.push(R.tempPath),e.push({key:T,filename:h,sourcePath:h,repoOriginPath:d,tempPath:R.tempPath,md5:R.md5,fileType:"plan",harness:"claudeCode",harnessInternalId:h,watchedState:S}),o.add(T)}}}catch(i){throw await Promise.all(s.map(a=>cl.rm(en.dirname(a),{recursive:!0,force:!0}))),i}return{entries:t,localFiles:e,entryFileKeys:n,skippedFileKeys:r}}async function cOe(t,e){let n=await r3(t),r=Date.now(),o=[],s=new Set;for(let i of n){let a=await o3(i);if(a===iC||s.has(a.fullPath))continue;let c=await es(a.fullPath);c.exists&&(o.push({sessionId:i.sessionId?.trim()??"",project:i.project,transcriptPath:a.fullPath,expiresAt:new Date(r+sOe),baseline:e.get(a.fullPath)??c}),s.add(a.fullPath))}return o.sort((i,a)=>i.transcriptPath.localeCompare(a.transcriptPath))}async function o3(t){let e=t.sessionId?.trim();if(!e)return iC;let n=pOe(),r=await uOe(t.project),o=null;for(let s of r){let i=lOe(s),a=en.posix.join(i,`${e}.jsonl`),c=en.join(n,...a.split("/")),l={fullPath:c,relativeFilename:a,key:a};o??=l;try{return await cl.stat(c),l}catch(p){if(!mi(p,"ENOENT"))throw new Error(`stat session transcript ${c}: ${String(p)}`)}}if(!o)throw new Error("history entry is missing project path");return o}async function uOe(t){let e=en.normalize(t.trim());if(!e||e===".")throw new Error("history entry is missing project path");let n=[e],r=await J4(e);if(!r||r===e)return n;for(let o=en.dirname(e);o!==e&&(n.push(o),o!==r);)e=o,o=en.dirname(o);return n}function lOe(t){let e=en.normalize(t.trim());if(!e||e===".")throw new Error("history entry is missing project path");return e.split(en.sep).join("-")}function pOe(){return en.join(GS.homedir(),".claude","projects")}function dOe(){return en.join(GS.homedir(),".claude","plans")}function _Oe(t){let e=[],n=new Set;for(let r of t.split(`
|
|
46
|
+
`)){let o=r.trim();if(!o)continue;let s;try{s=JSON.parse(o)}catch{break}if(s.type!=="assistant")continue;let i=s.message?.content;if(Array.isArray(i))for(let a of i){if(!sC(a)||a.type!=="tool_use"||a.name!=="ExitPlanMode"||!sC(a.input))continue;let c=a.input.planFilePath;if(typeof c!="string")continue;let l=c.trim();!l||n.has(l)||(e.push(l),n.add(l))}}return e}async function fOe(t){let e=t.trim();if(!e)throw new Error("plan file path is empty");let n=dOe(),r=n;try{r=await cl.realpath(n)}catch{}if(e.startsWith("~/")&&(e=en.join(GS.homedir(),e.slice(2))),!en.isAbsolute(e))throw new Error(`plan file path must stay under ${n}`);if(e=en.normalize(e),!t3(e,n))throw new Error(`plan file path must stay under ${n}`);try{let o=await cl.realpath(e);if(!t3(o,r))throw new Error(`plan file path must resolve under ${n}`)}catch(o){if(!mi(o,"ENOENT"))throw o}return e}function t3(t,e){let n=en.relative(e,t);return n===""||n!==".."&&!n.startsWith(`..${en.sep}`)}function mOe(t){return sC(t)&&typeof t.timestamp=="number"&&typeof t.project=="string"}function sC(t){return t!==null&&typeof t=="object"}import BS from"node:fs/promises";import hOe from"node:path";var jS=class{status={};async markRunning(){let e=new Date().toISOString();this.status={pid:process.pid,state:"running",started_at:e,last_heartbeat_at:e},await this.persist()}async heartbeat(){this.status.pid=process.pid,this.status.last_heartbeat_at=new Date().toISOString(),await this.persist()}async markAuthenticated(){this.status.auth="logged_in",await this.heartbeat()}async markSyncSuccess(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.auth="logged_in",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_success_at=n,this.status.last_error=void 0,this.status.last_thread_ids=[...e],await this.persist()}async setPendingWatchers(e){this.status.pid=process.pid,this.status.state="running",this.status.pending_watchers=e.map(n=>({session_id:n.sessionId||void 0,project:n.project||void 0,transcript_path:n.transcriptPath||void 0,expires_at:n.expiresAt.toISOString()})),await this.heartbeat()}async markLoggedOut(){let e=new Date().toISOString();this.status.pid=process.pid,this.status.state="logged_out",this.status.auth="logged_out",this.status.last_heartbeat_at=e,this.status.last_completed_at=e,this.status.last_error=void 0,this.status.last_thread_ids=void 0,this.status.pending_watchers=void 0,await this.persist()}async markSuccess(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.state="idle",this.status.auth="logged_in",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_success_at=n,this.status.last_error=void 0,this.status.last_thread_ids=[...e],this.status.pending_watchers=void 0,await this.persist()}async markError(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.state="error",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_error=e instanceof Error?e.message:String(e),this.status.pending_watchers=void 0,await this.persist()}async persist(){let e=wS();await BS.mkdir(hOe.dirname(e),{recursive:!0,mode:448}),await BS.writeFile(e,`${JSON.stringify(TOe(this.status),null,2)}
|
|
47
|
+
`,{mode:384})}};async function s3(){try{return JSON.parse(await BS.readFile(wS(),"utf8"))}catch{return{}}}async function i3(){await BS.rm(wS(),{force:!0})}function TOe(t){return JSON.parse(JSON.stringify(t))}var AOe=gOe(EOe),ROe=2*60*1e3;async function cC(){lC();let t=await OOe(),e=await NOe(t);await MOe(t);let n=await IOe();return await u3(),await xOe(n),await vOe(),{plistPath:n,binaryPath:e}}async function a3(){lC(),await u3(),await tn.rm(Kd(),{force:!0}),await tn.rm(Wd(),{force:!0}),await tn.rm(Yd(),{force:!0}),await i3()}async function c3(){lC();let t=Kd(),e=Wd(),n=So.join(So.dirname(Yd()),"status.json"),r=Yd(),o=await s3(),s=await l3(),i=await kOe(t),a=UOe(o,new Date),{health:c,healthy:l}=DOe(i,s,o,a);return{label:zd(),enabled:i,loaded:s.loaded,running:s.running,healthy:l,health:c,heartbeat_fresh:a,plist_path:t,binary_path:e,status_path:n,install_source_path:r,...Object.keys(o).length>0?{status:o}:{}}}async function yOe(){let t=Wd(),e=Jd();return`<?xml version="1.0" encoding="UTF-8"?>
|
|
48
48
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
49
49
|
<plist version="1.0">
|
|
50
50
|
<dict>
|
|
51
51
|
<key>Label</key>
|
|
52
|
-
<string>${HS(
|
|
52
|
+
<string>${HS(zd())}</string>
|
|
53
53
|
<key>ProgramArguments</key>
|
|
54
54
|
<array>
|
|
55
55
|
<string>${HS(t)}</string>
|
|
@@ -68,42 +68,42 @@ Url: ${dm(t)}`),!0}return!1}function Yce(t,e){return e?.length?am(t).some(n=>Ts(
|
|
|
68
68
|
<key>EnvironmentVariables</key>
|
|
69
69
|
<dict>
|
|
70
70
|
<key>PATH</key>
|
|
71
|
-
<string>${HS(
|
|
71
|
+
<string>${HS(wOe())}</string>
|
|
72
72
|
</dict>
|
|
73
73
|
</dict>
|
|
74
74
|
</plist>
|
|
75
|
-
`}async function
|
|
75
|
+
`}async function IOe(){let t=Kd();return await tn.mkdir(So.dirname(t),{recursive:!0,mode:493}),await tn.writeFile(t,await yOe(),{mode:420}),t}async function OOe(){let t=process.argv[1];if(!t)throw new Error("resolve current executable: missing process argv[1]");return tn.realpath(t)}async function NOe(t){let e=Wd();await tn.mkdir(So.dirname(e),{recursive:!0,mode:448});let n=bOe(t);if(n.type==="write")return await tn.writeFile(e,n.contents,{mode:493}),await tn.chmod(e,493),e;if(await tn.realpath(e).catch(()=>"")!==t){let o=`${e}.tmp`;await tn.copyFile(t,o),await tn.chmod(o,493),await tn.rename(o,e)}return e}function bOe(t){return COe(t)?{type:"write",contents:POe(t)}:{type:"copy"}}function COe(t){return t.endsWith(".ts")||t.endsWith(".tsx")}function POe(t){let e=So.dirname(So.dirname(t)),n=So.join(e,"node_modules",".bin","tsx");return`#!/bin/sh
|
|
76
76
|
set -eu
|
|
77
77
|
cd ${aC(e)}
|
|
78
78
|
exec ${aC(n)} ${aC(t)} "$@"
|
|
79
|
-
`}function aC(t){return`'${t.replaceAll("'","'\\''")}'`}async function
|
|
80
|
-
`,{mode:384})}async function u3(){try{await FS("bootout",uC(),
|
|
81
|
-
`)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function FS(...t){try{let e=await gOe("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(kOe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function LOe(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function DOe(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+AOe>=e.getTime()}function uC(){return`gui/${process.getuid?.()??EOe.userInfo().uid}`}function p3(){return`${uC()}/${Wd()}`}function UOe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(So.delimiter)??[],...t].filter(Boolean))).join(So.delimiter)}async function wOe(t){try{return await tn.stat(t),!0}catch{return!1}}function HS(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function lC(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function d3(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function kOe(t){return t instanceof Error}var _3={meta:{name:"enable",description:"Install and start background uploads"},async run(){let{plistPath:t,binaryPath:e}=await cC();console.log("Lore background uploads enabled."),console.log(`LaunchAgent: ${t}`),console.log(`Stable binary: ${e}`)}},f3={meta:{name:"disable",description:"Stop and remove background uploads"},async run(){await a3(),console.log("Lore background uploads disabled.")}},m3={meta:{name:"restart",description:"Restart background uploads"},async run(){await cC(),console.log("Lore background uploads restarted.")}},h3={meta:{name:"status",description:"Show background upload status"},args:{json:{type:"boolean",description:"Output status as JSON"}},async run({args:t}){let e=await c3();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(`Lore: ${e.health}`),console.log(`Enabled: ${e.enabled}`),console.log(`Loaded: ${e.loaded}`),console.log(`Running: ${e.running}`),console.log(`Healthy: ${e.healthy}`),e.status?.last_heartbeat_at&&console.log(`Last heartbeat: ${e.status.last_heartbeat_at}`),e.status?.last_success_at&&console.log(`Last success: ${e.status.last_success_at}`),e.status?.last_error&&console.log(`Last error: ${e.status.last_error}`),console.log(`LaunchAgent: ${e.plist_path}`),console.log(`Stable binary: ${e.binary_path}`),console.log(`Status file: ${e.status_path}`)}};var u={};sg(u,{BRAND:()=>uNe,DIRTY:()=>Na,EMPTY_PATH:()=>HOe,INVALID:()=>Q,NEVER:()=>WNe,OK:()=>nn,ParseStatus:()=>Ft,Schema:()=>ce,ZodAny:()=>Ti,ZodArray:()=>os,ZodBigInt:()=>Ca,ZodBoolean:()=>Pa,ZodBranded:()=>Zd,ZodCatch:()=>ja,ZodDate:()=>Ma,ZodDefault:()=>Ba,ZodDiscriminatedUnion:()=>$S,ZodEffects:()=>Sr,ZodEnum:()=>ka,ZodError:()=>vn,ZodFirstPartyTypeKind:()=>Z,ZodFunction:()=>WS,ZodIntersection:()=>Da,ZodIssueCode:()=>N,ZodLazy:()=>Ua,ZodLiteral:()=>wa,ZodMap:()=>_l,ZodNaN:()=>ml,ZodNativeEnum:()=>Ga,ZodNever:()=>Br,ZodNull:()=>va,ZodNullable:()=>Ro,ZodNumber:()=>ba,ZodObject:()=>Ln,ZodOptional:()=>Tr,ZodParsedType:()=>D,ZodPipeline:()=>e_,ZodPromise:()=>Ei,ZodReadonly:()=>Ha,ZodRecord:()=>YS,ZodSchema:()=>ce,ZodSet:()=>fl,ZodString:()=>hi,ZodSymbol:()=>pl,ZodTransformer:()=>Sr,ZodTuple:()=>Ao,ZodType:()=>ce,ZodUndefined:()=>xa,ZodUnion:()=>La,ZodUnknown:()=>rs,ZodVoid:()=>dl,addIssueToContext:()=>M,any:()=>ENe,array:()=>RNe,bigint:()=>_Ne,boolean:()=>b3,coerce:()=>YNe,custom:()=>I3,date:()=>fNe,datetimeRegex:()=>R3,defaultErrorMap:()=>ts,discriminatedUnion:()=>NNe,effect:()=>GNe,enum:()=>UNe,function:()=>vNe,getErrorMap:()=>cl,getParsedType:()=>go,instanceof:()=>pNe,intersection:()=>bNe,isAborted:()=>VS,isAsync:()=>ul,isDirty:()=>qS,isValid:()=>mi,late:()=>lNe,lazy:()=>LNe,literal:()=>DNe,makeIssue:()=>Jd,map:()=>MNe,nan:()=>dNe,nativeEnum:()=>wNe,never:()=>gNe,null:()=>TNe,nullable:()=>jNe,number:()=>N3,object:()=>yNe,objectUtil:()=>pC,oboolean:()=>$Ne,onumber:()=>qNe,optional:()=>BNe,ostring:()=>VNe,pipeline:()=>FNe,preprocess:()=>HNe,promise:()=>kNe,quotelessJson:()=>GOe,record:()=>PNe,set:()=>xNe,setErrorMap:()=>jOe,strictObject:()=>INe,string:()=>O3,symbol:()=>mNe,transformer:()=>GNe,tuple:()=>CNe,undefined:()=>hNe,union:()=>ONe,unknown:()=>SNe,util:()=>de,void:()=>ANe});var de;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(de||(de={}));var pC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(pC||(pC={}));var D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),go=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var N=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),GOe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),vn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};vn.create=t=>new vn(t);var BOe=(t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}},ts=BOe;var T3=ts;function jOe(t){T3=t}function cl(){return T3}var Jd=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},HOe=[];function M(t,e){let n=cl(),r=Jd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ts?void 0:ts].filter(o=>!!o)});t.common.issues.push(r)}var Ft=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),Na=t=>({status:"dirty",value:t}),nn=t=>({status:"valid",value:t}),VS=t=>t.status==="aborted",qS=t=>t.status==="dirty",mi=t=>t.status==="valid",ul=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Er=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},E3=(t,e)=>{if(mi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new vn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}var ce=class{get description(){return this._def.description}_getType(e){return go(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ft,ctx:{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ul(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parseSync({data:e,path:r.path,parent:r});return E3(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return mi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>mi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(ul(o)?o:Promise.resolve(o));return E3(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:N.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Sr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Tr.create(this,this._def)}nullable(){return Ro.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return os.create(this)}promise(){return Ei.create(this,this._def)}or(e){return La.create([this,e],this._def)}and(e){return Da.create(this,e,this._def)}transform(e){return new Sr({...ie(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Ba({...ie(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new Zd({typeName:Z.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ja({...ie(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return e_.create(this,e)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},FOe=/^c[^\s-]{8,}$/i,VOe=/^[0-9a-z]+$/,qOe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$Oe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,YOe=/^[a-z0-9_-]{21}$/i,WOe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zOe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,KOe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,QOe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dC,XOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,JOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ZOe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,eNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tNe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nNe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,g3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rNe=new RegExp(`^${g3}$`);function A3(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function oNe(t){return new RegExp(`^${A3(t)}$`)}function R3(t){let e=`${g3}T${A3(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function sNe(t,e){return!!((e==="v4"||!e)&&XOe.test(t)||(e==="v6"||!e)&&ZOe.test(t))}function iNe(t,e){if(!WOe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function aNe(t,e){return!!((e==="v4"||!e)&&JOe.test(t)||(e==="v6"||!e)&&eNe.test(t))}var hi=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.string,received:s.parsedType}),Q}let r=new Ft,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")KOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"email",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")dC||(dC=new RegExp(QOe,"u")),dC.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"emoji",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")$Oe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"uuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")YOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"nanoid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")FOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")VOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid2",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")qOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ulid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),M(o,{validation:"url",code:N.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"regex",code:N.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?R3(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?rNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?oNe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?zOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"duration",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?sNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ip",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?iNe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"jwt",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?aNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cidr",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?tNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?nNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64url",code:N.invalid_string,message:s.message}),r.dirty()):de.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:N.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};hi.create=t=>new hi({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...ie(t)});function cNe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var ba=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.number,received:s.parsedType}),Q}let r,o=new Ft;for(let s of this._def.checks)s.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?cNe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_finite,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};ba.create=t=>new ba({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Ca=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Ft;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ca.create=t=>new Ca({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Pa=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.boolean,received:r.parsedType}),Q}return nn(e.data)}};Pa.create=t=>new Pa({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var Ma=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_date}),Q}let r=new Ft,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):de.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Ma.create=t=>new Ma({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...ie(t)});var pl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.symbol,received:r.parsedType}),Q}return nn(e.data)}};pl.create=t=>new pl({typeName:Z.ZodSymbol,...ie(t)});var xa=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.undefined,received:r.parsedType}),Q}return nn(e.data)}};xa.create=t=>new xa({typeName:Z.ZodUndefined,...ie(t)});var va=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.null,received:r.parsedType}),Q}return nn(e.data)}};va.create=t=>new va({typeName:Z.ZodNull,...ie(t)});var Ti=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return nn(e.data)}};Ti.create=t=>new Ti({typeName:Z.ZodAny,...ie(t)});var rs=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nn(e.data)}};rs.create=t=>new rs({typeName:Z.ZodUnknown,...ie(t)});var Br=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.never,received:n.parsedType}),Q}};Br.create=t=>new Br({typeName:Z.ZodNever,...ie(t)});var dl=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.void,received:r.parsedType}),Q}return nn(e.data)}};dl.create=t=>new dl({typeName:Z.ZodVoid,...ie(t)});var os=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return M(n,{code:N.invalid_type,expected:D.array,received:n.parsedType}),Q;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(M(n,{code:i?N.too_big:N.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(M(n,{code:N.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(M(n,{code:N.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Er(n,i,n.path,a)))).then(i=>Ft.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Er(n,i,n.path,a)));return Ft.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};os.create=(t,e)=>new os({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ie(e)});function ll(t){if(t instanceof Ln){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Tr.create(ll(r))}return new Ln({...t._def,shape:()=>e})}else return t instanceof os?new os({...t._def,type:ll(t.element)}):t instanceof Tr?Tr.create(ll(t.unwrap())):t instanceof Ro?Ro.create(ll(t.unwrap())):t instanceof Ao?Ao.create(t.items.map(e=>ll(e))):t}var Ln=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return M(l,{code:N.invalid_type,expected:D.object,received:l.parsedType}),Q}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Br&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let p=s[l],d=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new Er(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Br){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&(M(o,{code:N.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let d=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new Er(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let d=await p.key,_=await p.value;l.push({key:d,value:_,alwaysSet:p.alwaysSet})}return l}).then(l=>Ft.mergeObjectSync(r,l)):Ft.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return ll(this)}partial(e){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Tr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return y3(de.objectKeys(this.shape))}};Ln.create=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.strictCreate=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strict",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.lazycreate=(t,e)=>new Ln({shape:t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});var La=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new vn(a.ctx.common.issues));return M(n,{code:N.invalid_union,unionErrors:i}),Q}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=c._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new vn(c));return M(n,{code:N.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};La.create=(t,e)=>new La({options:t,typeName:Z.ZodUnion,...ie(e)});var ns=t=>t instanceof Ua?ns(t.schema):t instanceof Sr?ns(t.innerType()):t instanceof wa?[t.value]:t instanceof ka?t.options:t instanceof Ga?de.objectValues(t.enum):t instanceof Ba?ns(t._def.innerType):t instanceof xa?[void 0]:t instanceof va?[null]:t instanceof Tr?[void 0,...ns(t.unwrap())]:t instanceof Ro?[null,...ns(t.unwrap())]:t instanceof Zd||t instanceof Ha?ns(t.unwrap()):t instanceof ja?ns(t._def.innerType):[],$S=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return M(n,{code:N.invalid_type,expected:D.object,received:n.parsedType}),Q;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(M(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=ns(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function _C(t,e){let n=go(t),r=go(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=de.objectKeys(e),s=de.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=_C(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=_C(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Da=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(VS(s)||VS(i))return Q;let a=_C(s.value,i.value);return a.valid?((qS(s)||qS(i))&&n.dirty(),{status:n.value,value:a.data}):(M(r,{code:N.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Da.create=(t,e,n)=>new Da({left:t,right:e,typeName:Z.ZodIntersection,...ie(n)});var Ao=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return M(r,{code:N.invalid_type,expected:D.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return M(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(M(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Er(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ft.mergeArray(n,i)):Ft.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ao.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ao({items:t,typeName:Z.ZodTuple,rest:null,...ie(e)})};var YS=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return M(r,{code:N.invalid_type,expected:D.object,received:r.parsedType}),Q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Er(r,a,r.path,a)),value:i._parse(new Er(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ft.mergeObjectAsync(n,o):Ft.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:Z.ZodRecord,...ie(r)}):new t({keyType:hi.create(),valueType:e,typeName:Z.ZodRecord,...ie(n)})}},_l=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return M(r,{code:N.invalid_type,expected:D.map,received:r.parsedType}),Q;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],l)=>({key:o._parse(new Er(r,a,r.path,[l,"key"])),value:s._parse(new Er(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}}}};_l.create=(t,e,n)=>new _l({valueType:e,keyType:t,typeName:Z.ZodMap,...ie(n)});var fl=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return M(r,{code:N.invalid_type,expected:D.set,received:r.parsedType}),Q;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(M(r,{code:N.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(M(r,{code:N.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let l=new Set;for(let p of c){if(p.status==="aborted")return Q;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>s._parse(new Er(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};fl.create=(t,e)=>new fl({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...ie(e)});var WS=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return M(n,{code:N.invalid_type,expected:D.function,received:n.parsedType}),Q;function r(a,c){return Jd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cl(),ts].filter(l=>!!l),issueData:{code:N.invalid_arguments,argumentsError:c}})}function o(a,c){return Jd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cl(),ts].filter(l=>!!l),issueData:{code:N.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ei){let a=this;return nn(async function(...c){let l=new vn([]),p=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(o(d,f)),l})})}else{let a=this;return nn(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new vn([r(c,l.error)]);let p=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(p,s);if(!d.success)throw new vn([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ao.create(e).rest(rs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Ao.create([]).rest(rs.create()),returns:n||rs.create(),typeName:Z.ZodFunction,...ie(r)})}},Ua=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Ua.create=(t,e)=>new Ua({getter:t,typeName:Z.ZodLazy,...ie(e)});var wa=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return M(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};wa.create=(t,e)=>new wa({value:t,typeName:Z.ZodLiteral,...ie(e)});function y3(t,e){return new ka({values:t,typeName:Z.ZodEnum,...ie(e)})}var ka=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{expected:de.joinValues(r),received:n.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{received:n.data,code:N.invalid_enum_value,options:r}),Q}return nn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ka.create=y3;var Ga=class extends ce{_parse(e){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=de.objectValues(n);return M(r,{expected:de.joinValues(o),received:r.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=de.objectValues(n);return M(r,{received:r.data,code:N.invalid_enum_value,options:o}),Q}return nn(e.data)}get enum(){return this._def.values}};Ga.create=(t,e)=>new Ga({values:t,typeName:Z.ZodNativeEnum,...ie(e)});var Ei=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return M(n,{code:N.invalid_type,expected:D.promise,received:n.parsedType}),Q;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return nn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Ei.create=(t,e)=>new Ei({type:t,typeName:Z.ZodPromise,...ie(e)});var Sr=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{M(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?Na(c.value):n.value==="dirty"?Na(c.value):c});{if(n.value==="aborted")return Q;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?Na(a.value):n.value==="dirty"?Na(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mi(i))return Q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>mi(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Q);de.assertNever(o)}};Sr.create=(t,e,n)=>new Sr({schema:t,typeName:Z.ZodEffects,effect:e,...ie(n)});Sr.createWithPreprocess=(t,e,n)=>new Sr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...ie(n)});var Tr=class extends ce{_parse(e){return this._getType(e)===D.undefined?nn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tr.create=(t,e)=>new Tr({innerType:t,typeName:Z.ZodOptional,...ie(e)});var Ro=class extends ce{_parse(e){return this._getType(e)===D.null?nn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ro.create=(t,e)=>new Ro({innerType:t,typeName:Z.ZodNullable,...ie(e)});var Ba=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var ja=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ul(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ja.create=(t,e)=>new ja({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var ml=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};ml.create=t=>new ml({typeName:Z.ZodNaN,...ie(t)});var uNe=Symbol("zod_brand"),Zd=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},e_=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?(n.dirty(),Na(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Z.ZodPipeline})}},Ha=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>(mi(o)&&(o.value=Object.freeze(o.value)),o);return ul(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Ha.create=(t,e)=>new Ha({innerType:t,typeName:Z.ZodReadonly,...ie(e)});function S3(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function I3(t,e={},n){return t?Ti.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=S3(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=S3(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Ti.create()}var lNe={object:Ln.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var pNe=(t,e={message:`Input not instance of ${t.name}`})=>I3(n=>n instanceof t,e),O3=hi.create,N3=ba.create,dNe=ml.create,_Ne=Ca.create,b3=Pa.create,fNe=Ma.create,mNe=pl.create,hNe=xa.create,TNe=va.create,ENe=Ti.create,SNe=rs.create,gNe=Br.create,ANe=dl.create,RNe=os.create,yNe=Ln.create,INe=Ln.strictCreate,ONe=La.create,NNe=$S.create,bNe=Da.create,CNe=Ao.create,PNe=YS.create,MNe=_l.create,xNe=fl.create,vNe=WS.create,LNe=Ua.create,DNe=wa.create,UNe=ka.create,wNe=Ga.create,kNe=Ei.create,GNe=Sr.create,BNe=Tr.create,jNe=Ro.create,HNe=Sr.createWithPreprocess,FNe=e_.create,VNe=()=>O3().optional(),qNe=()=>N3().optional(),$Ne=()=>b3().optional(),YNe={string:t=>hi.create({...t,coerce:!0}),number:t=>ba.create({...t,coerce:!0}),boolean:t=>Pa.create({...t,coerce:!0}),bigint:t=>Ca.create({...t,coerce:!0}),date:t=>Ma.create({...t,coerce:!0})};var WNe=Q;var zNe=t=>typeof t?.safeParse=="function";var fC=t=>typeof t?.passthrough=="function";var KNe=(t,e)=>fC(t)?fC(e)?t.merge(e):t:fC(e)?e:Object.assign({},t,e);var p5e=u.object({name:u.literal("ZodError"),issues:u.array(u.object({path:u.array(u.union([u.string(),u.number()])),message:u.string().optional(),code:u.nativeEnum(u.ZodIssueCode)}).catchall(u.any()))}),QNe=Symbol("ContractNoBody"),P3=t=>"method"in t&&"path"in t;var M3=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return P3(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:KNe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,M3(r,e)]})),mC=Symbol("ContractPlainType"),gr=()=>({router:(t,e)=>M3(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>mC,body:()=>mC,type:()=>mC,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>QNe}),XNe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},JNe=(t,e=!1)=>{let n=e?ZNe(t):ebe(t);return n?.length>0?"?"+n:""},ZNe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",ebe=t=>t?Object.keys(t).flatMap(e=>hC(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",hC=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>hC(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>hC(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var TC=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var tbe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),c=a.headers.get("content-type");if(c?.includes("application/")&&c?.includes("json")){let l={status:a.status,body:await a.json(),headers:a.headers},p=t.responses[l.status];return(s??t.validateResponseOnClient)&&zNe(p)?{...l,body:p.parse(l.body)}:l}return c?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},nbe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},C3=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),rbe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:c}=t,l=n.api||tbe,p=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([f,m])=>typeof m=="function"?[f,m(t)]:[f,m])),d={...p&&C3(p),...C3(a)};Object.keys(d).forEach(f=>{d[f]===void 0&&delete d[f]});let _={route:r,path:e,method:r.method,headers:d,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...c},...c?.signal&&{signal:c.signal},...c?.cache&&{cache:c.cache},...c&&"next"in c&&!!c?.next&&{next:c.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?_={..._,contentType:"multipart/form-data",body:o instanceof FormData?o:nbe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?_={..._,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",..._.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(_={..._,contentType:"application/json",headers:{"content-type":"application/json",..._.headers},body:JSON.stringify(o)})),l({..._,...i})},obe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:c,fetchOptions:l,cache:p,next:d,..._}=n||{},f={...e,...c};return{path:sbe(r,f.baseUrl,o,t,!!f.jsonQuery),clientArgs:f,route:t,body:s,query:r,extraInputArgs:_,fetchOptions:{...p&&{cache:p},...d&&{next:d},...l},headers:{...a,...i}}},sbe=(t,e,n,r,o)=>{let s=XNe({path:r.path,params:n}),i=JNe(t,o);return`${e}${s}${i}`},ibe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=obe(t,e,r),s=await rbe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new TC(s,n)}},EC=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>P3(r)?[n,ibe(r,e)]:[n,EC(r,e)]));var SC=["free","creator","team"],x3=typeof process<"u"&&process.env?.NODE_ENV!=="production",abe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:x3?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:x3?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var v3=abe.stripe.plans,_5e=Object.freeze(Object.fromEntries(v3.map(t=>[t.tier,t])));var cbe=gr(),rn=u.object({message:u.string()}),gC=u.record(u.unknown()),Fa=u.string().regex(/^doc_[0-9A-Za-z]{22}$/),zS=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),ube=["active","archived"],KS=u.enum(ube),L3=u.object({id:u.string().min(1),display_name:u.string().min(1)}),D3=u.object({id:zS,name:u.string().min(1)}),AC=u.object({id:Fa,title:u.string().min(1),status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),lbe=u.object({type:u.literal("list"),list_type:u.literal("doc"),objects:u.array(AC)}),pbe=u.object({project_id:zS.optional(),status:KS.optional()}),dbe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional()}),_be=u.object({id:Fa,created_at:u.string().datetime()}),fbe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional(),status:KS.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),mbe=u.object({id:Fa,updated_at:u.string().datetime()}),hbe=u.object({id:Fa,title:u.string().min(1),prosemirror_json:gC,status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),U3=cbe.router({listDocs:{method:"GET",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),query:pbe,responses:{200:lbe,401:rn,403:rn},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),body:dbe,responses:{201:_be,401:rn,403:rn,404:rn,422:rn},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:hbe,401:rn,403:rn,404:rn},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),body:fbe,responses:{200:mbe,401:rn,403:rn,404:rn,422:rn},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:rn,403:rn,404:rn},summary:"Hard-delete a doc and any mention references it owns"}});var Tbe=gr(),et=u.object({message:u.string()}),RC=u.record(u.unknown()),yo=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),Ebe=["active","archived"],QS=u.enum(Ebe),yC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),w3=u.object({thread_id:u.string().min(1),title:u.string().min(1),added_at:u.string().datetime(),added_by:yC}),Sbe=u.object({id:yo,name:u.string().min(1),status:QS,author:yC,thread_count:u.number().int().nonnegative(),doc_count:u.number().int().nonnegative(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),gbe=u.object({type:u.literal("list"),list_type:u.literal("project"),objects:u.array(Sbe)}),Abe=u.object({status:QS.optional()}),Rbe=u.object({name:u.string().trim().min(1).max(200),prosemirror_json:RC.optional()}),ybe=u.object({id:yo,created_at:u.string().datetime()}),Ibe=u.object({name:u.string().trim().min(1).max(200).optional(),prosemirror_json:RC.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),Obe=u.object({id:yo,updated_at:u.string().datetime()}),Nbe=u.object({archived:u.boolean()}),bbe=u.object({id:yo,status:QS,archived_at:u.string().datetime().nullable()}),Cbe=u.object({id:yo,name:u.string().min(1),prosemirror_json:RC,status:QS,author:yC,created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable(),threads:u.array(w3),docs:u.array(AC)}),Pbe=u.object({thread_id:u.string().min(1).max(64)}),Mbe=w3,k3=Tbe.router({listProjects:{method:"GET",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),query:Abe,responses:{200:gbe,401:et},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),body:Rbe,responses:{201:ybe,401:et,422:et},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Cbe,401:et,403:et,404:et},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Ibe,responses:{200:Obe,401:et,403:et,404:et,422:et},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Nbe,responses:{200:bbe,401:et,403:et,404:et},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Pbe,responses:{201:Mbe,401:et,403:et,404:et,409:et,422:et},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:u.object({projectId:yo,threadId:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:et,403:et,404:et},summary:"Remove a thread membership from a project"}});var xbe=gr(),XS=u.object({message:u.string()}),vbe=["thread","plan","doc","user"],JS=u.enum(vbe),Lbe=["doc","project"],Dbe=u.enum(Lbe),Ube=u.object({kind:JS,id:u.string().min(1),title:u.string().min(1),href:u.string().min(1)}),wbe=u.object({type:u.literal("list"),list_type:u.literal("mention"),objects:u.array(Ube)}),kbe=u.object({q:u.string().trim().min(1).max(50),kinds:u.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(u.array(JS).optional())}),Gbe=u.object({source_kind:Dbe,source_id:u.string().min(1),source_title:u.string().min(1),source_href:u.string().min(1),target_kind:JS,target_id:u.string().min(1),created_at:u.string().datetime()}),Bbe=u.object({type:u.literal("list"),list_type:u.literal("backlink"),objects:u.array(Gbe)}),jbe=u.object({target_kind:JS,target_id:u.string().min(1).max(64)}),G3=xbe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:u.object({authorization:u.string().min(1).optional()}),query:kbe,responses:{200:wbe,401:XS,422:XS},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:u.object({authorization:u.string().min(1).optional()}),query:jbe,responses:{200:Bbe,401:XS,403:XS},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var Hbe=gr(),Fbe=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(u.unknown())}),Si=u.object({message:u.string()}),B3=u.object({thread_id:u.string().min(1),is_favorited:u.boolean(),favorited_at:u.string().datetime().nullable()}),Vbe=u.object({before:u.string().min(1).max(64).optional()}),j3=Hbe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:B3,401:Si,403:Si,404:Si},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:B3,401:Si,403:Si,404:Si},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:Vbe,responses:{200:Fbe,401:Si,403:Si},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var qbe=gr(),IC=u.object({message:u.string()}),$be=u.object({id:u.string().min(1),title:u.string(),href:u.string().min(1),author_display_name:u.string().nullable(),author_handle:u.string().nullable()}),Ybe=u.object({name:u.string().min(1),usage_count:u.number().int().nonnegative(),href:u.string().min(1)}),Wbe=u.object({id:u.string().min(1),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),href:u.string().min(1)}),zbe=u.object({type:u.literal("global_search"),threads:u.array($be),skills:u.array(Ybe),people:u.array(Wbe)}),Kbe=u.object({q:u.string().trim().min(1).max(80)}),H3=qbe.router({globalSearch:{method:"GET",path:"/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Kbe,responses:{200:zbe,401:IC,403:IC,422:IC},summary:"Global navbar search across threads, skills, and people. Org-scoped, max 5 results per kind."}});var Qbe=gr(),Xbe=u.object({id:u.string().uuid(),role:u.enum(["user","assistant"]),content:u.string().min(1),timestamp:u.string().datetime()}),Jbe=u.object({id:u.string().uuid(),title:u.string().min(1),author:u.string().min(1),authorAvatar:u.string().min(1).max(4),model:u.string().min(1),turnCount:u.number().int().nonnegative(),createdAt:u.string().datetime(),preview:u.string()}),Q5e=Jbe.extend({messages:u.array(Xbe)}),A=u.object({message:u.string()}),Zbe=/^[a-zA-Z0-9_-]{2,32}$/,K3=u.string().regex(Zbe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),OC=u.object({id:u.string(),first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().nullable(),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),share_new_threads_to_workspace:u.boolean(),experimental_features_enabled:u.boolean(),onboarded_at:u.string().nullable()}),eCe=u.object({stytchMemberId:u.string().min(1).optional(),emailAddress:u.string().email(),name:u.string().nullable(),user:OC,is_admin:u.boolean()}),tCe=u.object({share_new_threads_to_workspace:u.boolean().optional(),experimental_features_enabled:u.boolean().optional(),onboarded_at:u.union([u.literal("now"),u.null()]).optional(),display_name:u.string().min(1).max(120).optional(),handle:K3.optional(),bio:u.string().max(280).nullable().optional(),avatar_storage_url:u.string().min(1).nullable().optional(),banner_storage_url:u.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),nCe=u.object({id:u.string(),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),visible_thread_count:u.number().int().nonnegative(),last_active_at:u.string().datetime().nullable()}),Q3=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),organization_name:u.string().min(1).nullable(),created_at:u.string().min(1),visible_thread_count:u.number().int().nonnegative(),follower_count:u.number().int().nonnegative(),following_count:u.number().int().nonnegative(),published_project_count:u.number().int().nonnegative(),is_following:u.boolean(),is_self:u.boolean()}),rCe=u.object({type:u.literal("list"),list_type:u.literal("organization_member"),objects:u.array(nCe)}),oCe=u.object({email_address:u.string().email()}),sCe=u.object({email_address:u.string().email(),member_id:u.string().min(1)}),iCe=u.object({location:u.string().trim().min(1),contact:u.string().trim().email()}),aCe=u.object({location:u.string().min(1),contact:u.string().email(),created_at:u.string().datetime()}),cCe=u.object({first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().min(1).optional()}),uCe=u.object({name:u.string().min(1),email_domains:u.array(u.string().min(1)).nonempty(),stytch_org_id:u.string().min(1)}),lCe=u.object({user:cCe,organization:uCe}),pCe=u.object({path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),dCe=u.object({repo_origin_path:u.string().min(1),building_blocks:u.array(pCe)}),X3=u.string().regex(/^th_[0-9A-Za-z]{22}$/),eg=u.string().regex(/^tb_[0-9A-Za-z]{22}$/),_Ce=u.object({id:X3,author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),body:u.string(),created_at:u.string().datetime(),repo_origin_path:u.string().min(1),latest_revision_id:eg,revision_count:u.number().int().positive()}),fCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),mCe=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:fCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),hCe=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable(),comments:u.array(mCe)}),TCe=u.object({thread_block_id:eg,from_position:u.number().int().positive(),to_position:u.number().int().positive(),selected_text:u.string().min(1),content:u.string().trim().min(1)}),ECe=u.object({id:u.string().min(1)}),SCe=u.object({content:u.string().trim().min(1)}),gCe=u.object({id:u.string().min(1)}),ACe=u.object({content:u.string().trim().min(1)}),RCe=u.object({id:u.string().min(1)}),yCe=u.object({content:u.string().trim().min(1)}),ICe=u.object({id:u.string().min(1)}),OCe=u.object({resolved:u.boolean()}),NCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),bCe=u.object({resolved:u.boolean()}),CCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),J3=u.record(u.unknown()),PCe=u.object({id:eg,body:u.string(),created_at:u.string().datetime(),prosemirror_json:J3,comment_threads:u.array(hCe)}),MCe=u.object({id:X3,created_at:u.string().datetime(),repo_origin_path:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),latest_revision_id:eg,revision_count:u.number().int().positive(),revisions:u.array(PCe)}),xCe=u.object({type:u.literal("list"),list_type:u.literal("plan"),has_more:u.boolean(),objects:u.array(_Ce)}),vCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_id:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional()}),Z3=u.object({id:u.string().min(1),organization_id:u.string().min(1),created_at:u.string().min(1),repo_origin_path:u.string().min(1),path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),LCe=u.array(Z3),DCe=u.object({type:u.literal("list"),list_type:u.literal("building_block"),has_more:u.boolean(),objects:u.array(Z3)}),UCe=u.object({repo_origin_path:u.string().min(1),before:u.string().min(1).optional(),after:u.string().min(1).optional()}),wCe=u.enum(["thread","building_block"]),kCe=u.object({repo_origin_path:u.string().min(1),sources:u.array(wCe).nonempty()}),GCe=u.object({type:u.literal("list"),list_type:u.literal("repository"),has_more:u.boolean(),objects:u.array(kCe)}),gi=u.enum(["claudeCode","codex","amp","cursor","unspecified"]),BCe=["transcript","plan"],jCe=u.enum(BCe),HCe=u.object({md5:u.string().min(1),harness:gi,filename:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional(),harness_internal_id:u.string().min(1).optional(),file_type:jCe.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),bC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),FCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),e9=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:FCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),t9=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable()}),VCe=t9.extend({comments:u.array(e9)}),t_=u.object({id:u.string().min(1),type:u.string().min(1),index_in_thread:u.number().int().nonnegative(),isCritiqued:u.boolean(),comment_threads:u.array(VCe).optional()}).passthrough(),n9=u.object({type:u.literal("list"),list_type:u.literal("thread_block"),has_more:u.boolean(),objects:u.array(t_)}),F3=t_.extend({type:u.literal("plan"),prosemirror_json:J3,thread_file_id:u.string().min(1)}),qCe=u.union([u.literal(-1),u.literal(1)]),r9=u.union([u.literal(-1),u.literal(0),u.literal(1)]),V3=u.object({score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9}),$Ce=u.object({value:qCe}),YCe=u.object({id:u.string().min(1),display_name:u.string().min(1),avatar_url:u.string().nullable()}),Va=u.object({id:u.string().min(1),thread_id:u.string().min(1),author_id:u.string().min(1).nullable(),author:YCe.nullable(),parent_comment_id:u.string().min(1).nullable(),content:u.string(),created_at:u.string().datetime(),updated_at:u.string().datetime(),deleted_at:u.string().datetime().nullable()}),WCe=u.object({type:u.literal("list"),list_type:u.literal("thread_comment"),objects:u.array(Va)}),zCe=u.object({content:u.string().trim().min(1).max(4e3),parent_comment_id:u.string().min(1).optional()}),KCe=Va,QCe=u.object({content:u.string().trim().min(1).max(4e3)}),XCe=Va,JCe=Va,X5e=u.discriminatedUnion("kind",[u.object({kind:u.literal("created"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va}),u.object({kind:u.literal("updated"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va}),u.object({kind:u.literal("deleted"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va})]),ZCe=u.enum(["pending","generating","ready","failed"]),ePe=u.enum(["pending","generating","ready","failed"]),tPe=u.enum(["pending","placeholder","ai","user"]),o9=u.enum(["pending","generating","ready","failed"]),s9=u.enum(["pending","generating","ready","failed","disabled"]),i9=u.enum(["pending","generating","ready","failed"]),nPe=u.object({title:u.string().min(1),body:u.string().min(1),files:u.array(u.string()).optional()}),rPe=u.object({status:s9,url:u.string().nullable(),url_expires_at:u.string().nullable(),generated_at:u.string().nullable(),model:u.string().nullable()}),oPe=u.object({status:i9,steps:u.array(nPe),generated_at:u.string().nullable()}),sPe=u.object({remix_of_thread_id:u.string().nullable(),remix_count:u.number().int().nonnegative()}),iPe=u.object({cover:rPe,how_to:oPe,lineage:sPe}),aPe=u.enum(["asked","requested","decided","corrected","shared"]),cPe=u.object({id:u.string().min(1),kind:aPe,summary:u.string().min(1),block_id:u.string().min(1)}),uPe=u.object({type:u.literal("list"),list_type:u.literal("thread_decision"),status:o9,generated_at:u.string().nullable(),objects:u.array(cPe)}),hl=u.object({id:u.string().min(1),thread_file_id:u.string().min(1),organization_id:u.string().min(1),author:bC,repo:u.string().min(1),title:u.string().min(1),started_at:u.string().min(1),blocks:n9,user_message_count:u.number().int().nonnegative(),files_touched:u.array(u.string()),skills_invoked:u.array(u.string()),harness:gi,transcript_parsing_state:u.enum(["pending","parsed","too_large_to_parse"]),visibility:u.enum(["private","workspace","public"]),has_plan:u.boolean().optional(),summary:u.string().nullable(),summary_status:ZCe,summary_generated_at:u.string().nullable(),title_status:ePe,title_generated_at:u.string().nullable(),title_source:tPe,decisions_status:o9,decisions_generated_at:u.string().nullable(),score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9,comment_count:u.number().int().nonnegative(),is_favorited:u.boolean(),card:iPe}),lPe=u.object({storage_url:u.string().min(1)}),pPe=u.object({storage_url:u.string(),harness:gi,thread:hl.nullable()}),dPe=u.object({status:u.literal("complete"),thread_files:u.array(pPe)}),_Pe=u.object({id:u.string(),presigned_url:u.string().nullable(),presigned_url_expires_at:u.string().nullable(),storage_url:u.string(),harness:gi,expected_md5:u.string(),error:u.string().nullable(),thread:hl.nullable()}),fPe=u.object({id:u.string(),substrate:u.enum(["s3","filesystem"]),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:u.array(_Pe)}),mPe=u.object({visibility:u.enum(["private","workspace","public"]).optional(),title:u.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),hPe=u.discriminatedUnion("visibility",[u.object({visibility:u.literal("private")}),u.object({visibility:u.literal("workspace")}),u.object({visibility:u.literal("public"),title:u.string().min(1),author_display_name:u.string().min(1),first_user_message:u.string().nullable(),summary:u.string().nullable(),started_at:u.string().min(1),harness:gi})]),TPe=hl,q3=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(TPe)}),EPe=u.enum(["recent","popular"]),SPe=hl,gPe=u.object({type:u.literal("list"),list_type:u.literal("discover_thread"),has_more:u.boolean(),objects:u.array(SPe)}),APe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),sort:EPe.optional(),harness:gi.optional(),search:u.string().max(200).optional()}),RPe=u.object({thread_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),organization_count:u.number().int().nonnegative(),harness_breakdown:u.record(gi,u.number().int().nonnegative())}),yPe=u.object({id:u.string(),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:u.string(),thread_count:u.number().int().nonnegative()}),IPe=u.object({type:u.literal("list"),list_type:u.literal("upload_session"),objects:u.array(yPe)}),OPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),NPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_ids:u.string().min(1).optional(),created_at:u.string().min(1).optional(),filepath_prefixes:u.string().min(1).optional()}),bPe=u.object({path:u.string().min(1),start_offset:u.number().int().nonnegative(),end_offset:u.number().int().positive()}),CPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),usage_count_last_24h:u.number().int().nonnegative(),usage_count_last_7d:u.number().int().nonnegative()}),PPe=u.object({type:u.literal("list"),list_type:u.literal("skill"),objects:u.array(CPe)}),MPe=u.object({id:u.string(),title:u.string(),visibility:u.enum(["private","workspace","public"]),started_at:u.string(),author:bC,skills_invoked:u.array(u.string())}),xPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),threads:u.array(MPe)}),vPe=u.object({path:u.string().min(1),text:u.string().max(64e3)}),LPe=u.enum(["text_edit","redact","delete_block"]),DPe=u.object({id:u.string(),thread_block_id:u.string(),editor:u.object({id:u.string(),display_name:u.string()}),kind:LPe,path:u.string().nullable(),previous_text:u.string().nullable(),new_text:u.string().nullable(),created_at:u.string()}),UPe=u.object({type:u.literal("list"),list_type:u.literal("thread_block_edit"),objects:u.array(DPe)}),wPe=u.object({organization_count:u.number().int().nonnegative(),user_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),thread_count_last_24h:u.number().int().nonnegative(),user_count_last_24h:u.number().int().nonnegative()}),kPe=u.object({id:u.string(),name:u.string(),email_domains:u.array(u.string()),stytch_org_id:u.string(),member_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),default_thread_visibility:u.enum(["private","workspace","public"]),created_at:u.string()}),GPe=u.object({type:u.literal("list"),list_type:u.literal("admin_organization"),objects:u.array(kPe)}),a9=u.object({id:u.string(),name:u.string()}),BPe=u.object({id:u.string(),display_name:u.string(),stytch_id:u.string().nullable(),thread_count:u.number().int().nonnegative(),onboarded_at:u.string().nullable(),created_at:u.string(),organizations:u.array(a9)}),jPe=u.object({type:u.literal("list"),list_type:u.literal("admin_user"),objects:u.array(BPe)}),HPe=u.object({id:u.string(),title:u.string(),started_at:u.string(),created_at:u.string(),deleted_at:u.string().nullable(),visibility:u.enum(["private","workspace","public"]),harness:gi,author:bC,organization:a9}),FPe=u.object({type:u.literal("list"),list_type:u.literal("admin_thread"),has_more:u.boolean(),objects:u.array(HPe)}),VPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),$3=u.object({token:u.string().min(1),thread_id:u.string().min(1)}),qPe=u.object({visitor:u.string().min(1).max(64).optional()}),$Pe=u.object({user_id:u.string(),display_name:u.string(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative()}),YPe=u.object({window_days:u.number().int().positive(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative(),active_sharers:u.number().int().nonnegative(),k_factor:u.number().nullable(),shares_sent_sparkline:u.array(u.number().int().nonnegative()),top_sharers:u.array($Pe)}),WPe=u.object({windows:u.array(YPe)}),zPe=u.object({quoted_text:u.string().min(1),comment:u.string().nullable(),type:u.enum(["comment","highlight:trapdoor"])}),KPe=t9,QPe=e9.extend({comment_thread_id:u.string().min(1)}),XPe=u.object({markdown:u.string().min(1)}),JPe=u.object({storage_url:u.string().min(1),thread_file_id:u.string().min(1),parsed_plan_block:F3,critiqued_plan_block:F3,annotations:u.array(zPe),comment_threads:u.array(KPe),comments:u.array(QPe)}),Tl=u.enum(SC),c9=u.object({skills:u.boolean(),workspace_scope:u.boolean(),review:u.boolean(),shared_thread_ttl_days:u.number().int().positive().nullable()}),NC=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),effective_plan:Tl,admin_override:Tl.nullable(),stripe_subscription_status:u.string().nullable(),cancel_at_period_end:u.boolean(),current_period_end:u.string().nullable(),seat_quantity:u.number().int().positive(),member_count:u.number().int().nonnegative().nullable(),features:c9}),ZPe=u.object({effective_plan:Tl,features:c9,user:NC,organization:NC.nullable()}),eMe=u.object({plan:u.enum(["creator","team"]),seat_quantity:u.number().int().positive().optional()}),tMe=u.object({checkout_url:u.string().min(1)}),nMe=u.object({portal_url:u.string().min(1)}),rMe=u.object({seat_quantity:u.number().int().positive()}),Y3=u.object({plan:Tl.nullable()}),ZS=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),label:u.string().min(1),effective_plan:Tl,admin_override:Tl.nullable(),stripe_subscription_status:u.string().nullable(),seat_quantity:u.number().int().positive()}),oMe=u.object({users:u.array(ZS),organizations:u.array(ZS)}),sMe=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable()}),iMe=u.object({thread_id:u.string().min(1),title:u.string().min(1),author:sMe,last_active_at:u.string().datetime(),last_block_excerpt:u.string().nullable(),last_block_kind:u.string().min(1).nullable(),is_streaming:u.boolean()}),aMe=u.object({type:u.literal("list"),list_type:u.literal("live_thread"),objects:u.array(iMe)}),cMe=u.object({thread_id:u.string().min(1)}),uMe=u.object({thread_id:u.string().min(1),last_seen_at:u.string().datetime(),started_at:u.string().datetime()}),lMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!0),follower_count:u.number().int().nonnegative()}),pMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!1),follower_count:u.number().int().nonnegative()}),u9=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable(),bio:u.string().max(280).nullable(),is_following:u.boolean(),is_self:u.boolean()}),W3=u.object({type:u.literal("list"),list_type:u.literal("user_follow"),objects:u.array(u9)}),dMe=u.object({date:u.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:u.number().int().nonnegative()}),_Me=u.object({window_start:u.string().datetime(),window_end:u.string().datetime(),total_contributions:u.number().int().nonnegative(),days_active:u.number().int().nonnegative(),daily_average:u.number().nonnegative(),current_streak_days:u.number().int().nonnegative(),days:u.array(dMe)}),fMe=u.object({type:u.literal("thread_created"),occurred_at:u.string().datetime(),id:u.string().min(1),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),mMe=u.object({type:u.literal("comment_posted"),occurred_at:u.string().datetime(),id:u.string().min(1),comment_excerpt:u.string(),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),hMe=u.object({type:u.literal("project_published"),occurred_at:u.string().datetime(),id:u.string().min(1),project:u.object({id:u.string().min(1),name:u.string().min(1)})}),TMe=u.object({type:u.literal("user_followed"),occurred_at:u.string().datetime(),id:u.string().min(1),followee:u9}),EMe=u.discriminatedUnion("type",[fMe,mMe,hMe,TMe]),SMe=u.object({type:u.literal("list"),list_type:u.literal("user_activity"),objects:u.array(EMe)}),gMe=u.object({id:u.string().min(1),name:u.string().min(1),excerpt:u.string(),published_at:u.string().datetime(),updated_at:u.string().datetime()}),AMe=u.object({type:u.literal("list"),list_type:u.literal("profile_published_project"),objects:u.array(gMe)}),z3=u.object({id:u.string().min(1),published_at:u.string().datetime().nullable()}),RMe=u.enum(["avatar","banner"]),yMe=u.enum(["image/png","image/jpeg","image/webp","image/gif"]),IMe=u.object({kind:RMe,content_type:yMe,base64_data:u.string().min(1)}),OMe=u.object({substrate:u.enum(["s3","filesystem"]),storage_url:u.string().min(1)}),NMe=Q3,l9=Qbe.router({health:{method:"GET",path:"/health",responses:{200:u.object({status:u.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:u.object({authorization:u.string().min(1).optional(),"x-lore-referral-token":u.string().min(1).max(16).optional()}),responses:{200:eCe,401:A},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:u.object({authorization:u.string().min(1).optional()}),body:cMe,responses:{200:uMe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:aMe,401:A,403:A},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:NPe,responses:{200:q3,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:hl,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:q3,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:OPe,responses:{200:n9,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:SCe,responses:{201:gCe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:yCe,responses:{201:ICe,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:bCe,responses:{200:CCe,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:PPe,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:u.object({name:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:xPe,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:bPe,responses:{200:t_,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:vPe,responses:{200:t_,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:t_,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:UPe,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:uPe,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:mPe,responses:{200:hl,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:u.object({cover_status:s9,how_to_status:i9}),401:A,403:A,404:A,429:A.extend({retry_after_seconds:u.number().int().nonnegative()})},summary:"Enqueue cover image + how-to recipe generation for the thread. Author-only. Idempotent \u2014 recently-fired statuses are not double-enqueued. Rate-limited: at most one cover generation per minute per thread (cooldown begins when the previous cover finishes). Used to populate cards on legacy threads (created before Lore Cards) and to retry after a 'failed' status or opt back in from 'disabled'."},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:$Ce,responses:{200:V3,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:V3,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:WCe,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:zCe,responses:{201:KCe,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:QCe,responses:{200:XCe,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:JCe,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:u.object({id:u.string().min(1)}),responses:{200:hPe,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:u.object({authorization:u.string().min(1).optional()}),body:lCe,responses:{201:OC,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Q3,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:u.object({authorization:u.string().min(1).optional()}),body:tCe,responses:{200:OC,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:u.object({handle:K3}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:NMe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:u.object({limit:u.coerce.number().int().positive().max(100).optional()}),responses:{200:SMe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:_Me,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:lMe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:pMe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:AMe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:u.object({authorization:u.string().min(1).optional()}),body:IMe,responses:{200:OMe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:rCe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:u.object({authorization:u.string().min(1).optional()}),body:oCe,responses:{201:sCe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:GCe,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),body:dCe,responses:{201:LCe,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:MCe,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:TCe,responses:{201:ECe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:ACe,responses:{201:RCe,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:OCe,responses:{200:NCe,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:u.object({authorization:u.string().min(1).optional()}),query:vCe,responses:{200:xCe,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),query:UCe,responses:{200:DCe,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:IPe,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(HCe).nonempty()}),responses:{201:fPe,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(lPe).nonempty()}),responses:{200:dPe,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:wPe,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:GPe,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:jPe,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:VPe,responses:{200:FPe,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:APe,responses:{200:gPe},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:RPe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:iCe,responses:{201:aCe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:$3,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:u.object({token:u.string().min(1).max(16)}),query:qPe,responses:{200:$3,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:WPe,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:u.object({authorization:u.string().min(1).optional()}),body:XPe,responses:{200:JPe,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:ZPe,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:u.object({authorization:u.string().min(1).optional()}),body:eMe,responses:{200:tMe,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({subject_type:u.enum(["user","organization"]).default("user")}).optional(),responses:{200:nMe,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:u.object({authorization:u.string().min(1).optional()}),body:rMe,responses:{200:NC,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:oMe,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:k3,docs:U3,mentions:G3,favorites:j3,search:H3},{pathPrefix:"/api"});import n_ from"node:fs";import p9 from"node:path";function tg(){return p9.join(Zo(),"token")}function CC(){let t;try{t=n_.readFileSync(tg(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||CMe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function ng(){return CC().token}function d9(){return n_.existsSync(tg())}function _9(t){let e=tg();n_.mkdirSync(p9.dirname(e),{recursive:!0,mode:448}),n_.writeFileSync(e,t,{mode:384})}function f9(){try{n_.rmSync(tg())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function bMe(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function CMe(t,e){let n;try{n=bMe(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var PMe={dev:"http://localhost:4000",prod:"https://lore.tanagram.ai"};function Ai(t={}){let e=t.token??ng();return EC(l9,{baseUrl:PMe[xt()],baseHeaders:{"User-Agent":B4(),...e?{authorization:`Bearer ${e}`}:{}}})}var m9={meta:{name:"health",description:"Check API health"},async run({data:t}){pt.info("command_start",{command:"health"});let n=await(t?.client??Ai()).health();if(n.status===200){console.log(n.body.status);return}throw pt.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var h9={meta:{name:"hello",description:"Print a friendly greeting"},run(){pt.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as xMe}from"node:child_process";import S9 from"node:crypto";import vMe from"node:http";var MMe={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function T9(){return MMe[xt()]}var LMe=5*60*1e3;function DMe(){return S9.randomBytes(32).toString("base64url")}function UMe(t){return S9.createHash("sha256").update(t).digest("base64url")}function wMe(t){let e;try{e=JSON.parse(Buffer.from(t.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof e.session_jwt!="string"||!e.session_jwt)throw new Error("missing session token");if(typeof e.code_challenge!="string"||!e.code_challenge)throw new Error("missing code challenge");return{sessionJwt:e.session_jwt,codeChallenge:e.code_challenge}}function kMe(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function E9(t,e,n){let r=e==="success";t.writeHead(200,{"Content-Type":"text/html"}),t.end(`<!DOCTYPE html>
|
|
79
|
+
`}function aC(t){return`'${t.replaceAll("'","'\\''")}'`}async function MOe(t){let e=Yd();await tn.mkdir(So.dirname(e),{recursive:!0,mode:448}),await tn.writeFile(e,`${JSON.stringify({binary_path:t,updated_at:new Date().toISOString()},null,2)}
|
|
80
|
+
`,{mode:384})}async function u3(){try{await FS("bootout",uC(),Kd())}catch(t){if(d3(t)||!(await l3().catch(()=>({loaded:!0}))).loaded)return;throw t}}async function xOe(t){await FS("bootstrap",uC(),t)}async function vOe(){await FS("kickstart","-k",p3())}async function l3(){try{let t=await FS("print",p3());return LOe(t)}catch(t){if(d3(t))return{loaded:!1,running:!1,pid:0,raw:""};throw t}}function LOe(t){let e={loaded:t.trim().length>0,running:!1,pid:0,raw:t},n;for(let r of t.split(`
|
|
81
|
+
`)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function FS(...t){try{let e=await AOe("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(GOe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function DOe(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function UOe(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+ROe>=e.getTime()}function uC(){return`gui/${process.getuid?.()??SOe.userInfo().uid}`}function p3(){return`${uC()}/${zd()}`}function wOe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(So.delimiter)??[],...t].filter(Boolean))).join(So.delimiter)}async function kOe(t){try{return await tn.stat(t),!0}catch{return!1}}function HS(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function lC(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function d3(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function GOe(t){return t instanceof Error}var _3={meta:{name:"enable",description:"Install and start background uploads"},async run(){let{plistPath:t,binaryPath:e}=await cC();console.log("Lore background uploads enabled."),console.log(`LaunchAgent: ${t}`),console.log(`Stable binary: ${e}`)}},f3={meta:{name:"disable",description:"Stop and remove background uploads"},async run(){await a3(),console.log("Lore background uploads disabled.")}},m3={meta:{name:"restart",description:"Restart background uploads"},async run(){await cC(),console.log("Lore background uploads restarted.")}},h3={meta:{name:"status",description:"Show background upload status"},args:{json:{type:"boolean",description:"Output status as JSON"}},async run({args:t}){let e=await c3();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(`Lore: ${e.health}`),console.log(`Enabled: ${e.enabled}`),console.log(`Loaded: ${e.loaded}`),console.log(`Running: ${e.running}`),console.log(`Healthy: ${e.healthy}`),e.status?.last_heartbeat_at&&console.log(`Last heartbeat: ${e.status.last_heartbeat_at}`),e.status?.last_success_at&&console.log(`Last success: ${e.status.last_success_at}`),e.status?.last_error&&console.log(`Last error: ${e.status.last_error}`),console.log(`LaunchAgent: ${e.plist_path}`),console.log(`Stable binary: ${e.binary_path}`),console.log(`Status file: ${e.status_path}`)}};var u={};sg(u,{BRAND:()=>lNe,DIRTY:()=>ba,EMPTY_PATH:()=>FOe,INVALID:()=>Q,NEVER:()=>zNe,OK:()=>nn,ParseStatus:()=>Ft,Schema:()=>ce,ZodAny:()=>Ei,ZodArray:()=>os,ZodBigInt:()=>Pa,ZodBoolean:()=>Ma,ZodBranded:()=>e_,ZodCatch:()=>Ha,ZodDate:()=>xa,ZodDefault:()=>ja,ZodDiscriminatedUnion:()=>$S,ZodEffects:()=>Sr,ZodEnum:()=>Ga,ZodError:()=>vn,ZodFirstPartyTypeKind:()=>Z,ZodFunction:()=>WS,ZodIntersection:()=>Ua,ZodIssueCode:()=>N,ZodLazy:()=>wa,ZodLiteral:()=>ka,ZodMap:()=>fl,ZodNaN:()=>hl,ZodNativeEnum:()=>Ba,ZodNever:()=>Br,ZodNull:()=>La,ZodNullable:()=>Ro,ZodNumber:()=>Ca,ZodObject:()=>Ln,ZodOptional:()=>Tr,ZodParsedType:()=>D,ZodPipeline:()=>t_,ZodPromise:()=>Si,ZodReadonly:()=>Fa,ZodRecord:()=>YS,ZodSchema:()=>ce,ZodSet:()=>ml,ZodString:()=>Ti,ZodSymbol:()=>dl,ZodTransformer:()=>Sr,ZodTuple:()=>Ao,ZodType:()=>ce,ZodUndefined:()=>va,ZodUnion:()=>Da,ZodUnknown:()=>rs,ZodVoid:()=>_l,addIssueToContext:()=>M,any:()=>SNe,array:()=>yNe,bigint:()=>fNe,boolean:()=>b3,coerce:()=>WNe,custom:()=>I3,date:()=>mNe,datetimeRegex:()=>R3,defaultErrorMap:()=>ts,discriminatedUnion:()=>bNe,effect:()=>BNe,enum:()=>wNe,function:()=>LNe,getErrorMap:()=>ul,getParsedType:()=>go,instanceof:()=>dNe,intersection:()=>CNe,isAborted:()=>VS,isAsync:()=>ll,isDirty:()=>qS,isValid:()=>hi,late:()=>pNe,lazy:()=>DNe,literal:()=>UNe,makeIssue:()=>Zd,map:()=>xNe,nan:()=>_Ne,nativeEnum:()=>kNe,never:()=>ANe,null:()=>ENe,nullable:()=>HNe,number:()=>N3,object:()=>INe,objectUtil:()=>pC,oboolean:()=>YNe,onumber:()=>$Ne,optional:()=>jNe,ostring:()=>qNe,pipeline:()=>VNe,preprocess:()=>FNe,promise:()=>GNe,quotelessJson:()=>BOe,record:()=>MNe,set:()=>vNe,setErrorMap:()=>HOe,strictObject:()=>ONe,string:()=>O3,symbol:()=>hNe,transformer:()=>BNe,tuple:()=>PNe,undefined:()=>TNe,union:()=>NNe,unknown:()=>gNe,util:()=>de,void:()=>RNe});var de;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(de||(de={}));var pC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(pC||(pC={}));var D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),go=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var N=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),BOe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),vn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};vn.create=t=>new vn(t);var jOe=(t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}},ts=jOe;var T3=ts;function HOe(t){T3=t}function ul(){return T3}var Zd=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},FOe=[];function M(t,e){let n=ul(),r=Zd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ts?void 0:ts].filter(o=>!!o)});t.common.issues.push(r)}var Ft=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),ba=t=>({status:"dirty",value:t}),nn=t=>({status:"valid",value:t}),VS=t=>t.status==="aborted",qS=t=>t.status==="dirty",hi=t=>t.status==="valid",ll=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Er=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},E3=(t,e)=>{if(hi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new vn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}var ce=class{get description(){return this._def.description}_getType(e){return go(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ft,ctx:{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ll(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parseSync({data:e,path:r.path,parent:r});return E3(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return hi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>hi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(ll(o)?o:Promise.resolve(o));return E3(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:N.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Sr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Tr.create(this,this._def)}nullable(){return Ro.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return os.create(this)}promise(){return Si.create(this,this._def)}or(e){return Da.create([this,e],this._def)}and(e){return Ua.create(this,e,this._def)}transform(e){return new Sr({...ie(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ja({...ie(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new e_({typeName:Z.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Ha({...ie(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return t_.create(this,e)}readonly(){return Fa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},VOe=/^c[^\s-]{8,}$/i,qOe=/^[0-9a-z]+$/,$Oe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,YOe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,WOe=/^[a-z0-9_-]{21}$/i,zOe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,KOe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,QOe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XOe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dC,JOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ZOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,eNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tNe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nNe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rNe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,g3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",oNe=new RegExp(`^${g3}$`);function A3(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function sNe(t){return new RegExp(`^${A3(t)}$`)}function R3(t){let e=`${g3}T${A3(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function iNe(t,e){return!!((e==="v4"||!e)&&JOe.test(t)||(e==="v6"||!e)&&eNe.test(t))}function aNe(t,e){if(!zOe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function cNe(t,e){return!!((e==="v4"||!e)&&ZOe.test(t)||(e==="v6"||!e)&&tNe.test(t))}var Ti=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.string,received:s.parsedType}),Q}let r=new Ft,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")QOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"email",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")dC||(dC=new RegExp(XOe,"u")),dC.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"emoji",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")YOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"uuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")WOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"nanoid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")VOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")qOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid2",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")$Oe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ulid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),M(o,{validation:"url",code:N.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"regex",code:N.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?R3(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?oNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?sNe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?KOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"duration",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?iNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ip",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?aNe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"jwt",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?cNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cidr",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?nNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?rNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64url",code:N.invalid_string,message:s.message}),r.dirty()):de.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:N.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ti.create=t=>new Ti({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...ie(t)});function uNe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Ca=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.number,received:s.parsedType}),Q}let r,o=new Ft;for(let s of this._def.checks)s.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?uNe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_finite,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Ca.create=t=>new Ca({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Pa=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Ft;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Pa.create=t=>new Pa({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Ma=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.boolean,received:r.parsedType}),Q}return nn(e.data)}};Ma.create=t=>new Ma({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var xa=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_date}),Q}let r=new Ft,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):de.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};xa.create=t=>new xa({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...ie(t)});var dl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.symbol,received:r.parsedType}),Q}return nn(e.data)}};dl.create=t=>new dl({typeName:Z.ZodSymbol,...ie(t)});var va=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.undefined,received:r.parsedType}),Q}return nn(e.data)}};va.create=t=>new va({typeName:Z.ZodUndefined,...ie(t)});var La=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.null,received:r.parsedType}),Q}return nn(e.data)}};La.create=t=>new La({typeName:Z.ZodNull,...ie(t)});var Ei=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return nn(e.data)}};Ei.create=t=>new Ei({typeName:Z.ZodAny,...ie(t)});var rs=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nn(e.data)}};rs.create=t=>new rs({typeName:Z.ZodUnknown,...ie(t)});var Br=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.never,received:n.parsedType}),Q}};Br.create=t=>new Br({typeName:Z.ZodNever,...ie(t)});var _l=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.void,received:r.parsedType}),Q}return nn(e.data)}};_l.create=t=>new _l({typeName:Z.ZodVoid,...ie(t)});var os=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return M(n,{code:N.invalid_type,expected:D.array,received:n.parsedType}),Q;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(M(n,{code:i?N.too_big:N.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(M(n,{code:N.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(M(n,{code:N.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Er(n,i,n.path,a)))).then(i=>Ft.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Er(n,i,n.path,a)));return Ft.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};os.create=(t,e)=>new os({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ie(e)});function pl(t){if(t instanceof Ln){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Tr.create(pl(r))}return new Ln({...t._def,shape:()=>e})}else return t instanceof os?new os({...t._def,type:pl(t.element)}):t instanceof Tr?Tr.create(pl(t.unwrap())):t instanceof Ro?Ro.create(pl(t.unwrap())):t instanceof Ao?Ao.create(t.items.map(e=>pl(e))):t}var Ln=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return M(l,{code:N.invalid_type,expected:D.object,received:l.parsedType}),Q}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Br&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let p=s[l],d=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new Er(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Br){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&(M(o,{code:N.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let d=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new Er(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let d=await p.key,_=await p.value;l.push({key:d,value:_,alwaysSet:p.alwaysSet})}return l}).then(l=>Ft.mergeObjectSync(r,l)):Ft.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return pl(this)}partial(e){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Tr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return y3(de.objectKeys(this.shape))}};Ln.create=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.strictCreate=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strict",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.lazycreate=(t,e)=>new Ln({shape:t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});var Da=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new vn(a.ctx.common.issues));return M(n,{code:N.invalid_union,unionErrors:i}),Q}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=c._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new vn(c));return M(n,{code:N.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};Da.create=(t,e)=>new Da({options:t,typeName:Z.ZodUnion,...ie(e)});var ns=t=>t instanceof wa?ns(t.schema):t instanceof Sr?ns(t.innerType()):t instanceof ka?[t.value]:t instanceof Ga?t.options:t instanceof Ba?de.objectValues(t.enum):t instanceof ja?ns(t._def.innerType):t instanceof va?[void 0]:t instanceof La?[null]:t instanceof Tr?[void 0,...ns(t.unwrap())]:t instanceof Ro?[null,...ns(t.unwrap())]:t instanceof e_||t instanceof Fa?ns(t.unwrap()):t instanceof Ha?ns(t._def.innerType):[],$S=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return M(n,{code:N.invalid_type,expected:D.object,received:n.parsedType}),Q;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(M(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=ns(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function _C(t,e){let n=go(t),r=go(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=de.objectKeys(e),s=de.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=_C(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=_C(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ua=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(VS(s)||VS(i))return Q;let a=_C(s.value,i.value);return a.valid?((qS(s)||qS(i))&&n.dirty(),{status:n.value,value:a.data}):(M(r,{code:N.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ua.create=(t,e,n)=>new Ua({left:t,right:e,typeName:Z.ZodIntersection,...ie(n)});var Ao=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return M(r,{code:N.invalid_type,expected:D.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return M(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(M(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Er(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ft.mergeArray(n,i)):Ft.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ao.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ao({items:t,typeName:Z.ZodTuple,rest:null,...ie(e)})};var YS=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return M(r,{code:N.invalid_type,expected:D.object,received:r.parsedType}),Q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Er(r,a,r.path,a)),value:i._parse(new Er(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ft.mergeObjectAsync(n,o):Ft.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:Z.ZodRecord,...ie(r)}):new t({keyType:Ti.create(),valueType:e,typeName:Z.ZodRecord,...ie(n)})}},fl=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return M(r,{code:N.invalid_type,expected:D.map,received:r.parsedType}),Q;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],l)=>({key:o._parse(new Er(r,a,r.path,[l,"key"])),value:s._parse(new Er(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}}}};fl.create=(t,e,n)=>new fl({valueType:e,keyType:t,typeName:Z.ZodMap,...ie(n)});var ml=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return M(r,{code:N.invalid_type,expected:D.set,received:r.parsedType}),Q;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(M(r,{code:N.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(M(r,{code:N.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let l=new Set;for(let p of c){if(p.status==="aborted")return Q;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>s._parse(new Er(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};ml.create=(t,e)=>new ml({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...ie(e)});var WS=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return M(n,{code:N.invalid_type,expected:D.function,received:n.parsedType}),Q;function r(a,c){return Zd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ul(),ts].filter(l=>!!l),issueData:{code:N.invalid_arguments,argumentsError:c}})}function o(a,c){return Zd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ul(),ts].filter(l=>!!l),issueData:{code:N.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Si){let a=this;return nn(async function(...c){let l=new vn([]),p=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(o(d,f)),l})})}else{let a=this;return nn(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new vn([r(c,l.error)]);let p=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(p,s);if(!d.success)throw new vn([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ao.create(e).rest(rs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Ao.create([]).rest(rs.create()),returns:n||rs.create(),typeName:Z.ZodFunction,...ie(r)})}},wa=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};wa.create=(t,e)=>new wa({getter:t,typeName:Z.ZodLazy,...ie(e)});var ka=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return M(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};ka.create=(t,e)=>new ka({value:t,typeName:Z.ZodLiteral,...ie(e)});function y3(t,e){return new Ga({values:t,typeName:Z.ZodEnum,...ie(e)})}var Ga=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{expected:de.joinValues(r),received:n.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{received:n.data,code:N.invalid_enum_value,options:r}),Q}return nn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ga.create=y3;var Ba=class extends ce{_parse(e){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=de.objectValues(n);return M(r,{expected:de.joinValues(o),received:r.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=de.objectValues(n);return M(r,{received:r.data,code:N.invalid_enum_value,options:o}),Q}return nn(e.data)}get enum(){return this._def.values}};Ba.create=(t,e)=>new Ba({values:t,typeName:Z.ZodNativeEnum,...ie(e)});var Si=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return M(n,{code:N.invalid_type,expected:D.promise,received:n.parsedType}),Q;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return nn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Si.create=(t,e)=>new Si({type:t,typeName:Z.ZodPromise,...ie(e)});var Sr=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{M(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?ba(c.value):n.value==="dirty"?ba(c.value):c});{if(n.value==="aborted")return Q;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?ba(a.value):n.value==="dirty"?ba(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!hi(i))return Q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>hi(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Q);de.assertNever(o)}};Sr.create=(t,e,n)=>new Sr({schema:t,typeName:Z.ZodEffects,effect:e,...ie(n)});Sr.createWithPreprocess=(t,e,n)=>new Sr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...ie(n)});var Tr=class extends ce{_parse(e){return this._getType(e)===D.undefined?nn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tr.create=(t,e)=>new Tr({innerType:t,typeName:Z.ZodOptional,...ie(e)});var Ro=class extends ce{_parse(e){return this._getType(e)===D.null?nn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ro.create=(t,e)=>new Ro({innerType:t,typeName:Z.ZodNullable,...ie(e)});var ja=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ja.create=(t,e)=>new ja({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var Ha=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ll(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ha.create=(t,e)=>new Ha({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var hl=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};hl.create=t=>new hl({typeName:Z.ZodNaN,...ie(t)});var lNe=Symbol("zod_brand"),e_=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},t_=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?(n.dirty(),ba(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Z.ZodPipeline})}},Fa=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>(hi(o)&&(o.value=Object.freeze(o.value)),o);return ll(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Fa.create=(t,e)=>new Fa({innerType:t,typeName:Z.ZodReadonly,...ie(e)});function S3(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function I3(t,e={},n){return t?Ei.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=S3(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=S3(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Ei.create()}var pNe={object:Ln.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var dNe=(t,e={message:`Input not instance of ${t.name}`})=>I3(n=>n instanceof t,e),O3=Ti.create,N3=Ca.create,_Ne=hl.create,fNe=Pa.create,b3=Ma.create,mNe=xa.create,hNe=dl.create,TNe=va.create,ENe=La.create,SNe=Ei.create,gNe=rs.create,ANe=Br.create,RNe=_l.create,yNe=os.create,INe=Ln.create,ONe=Ln.strictCreate,NNe=Da.create,bNe=$S.create,CNe=Ua.create,PNe=Ao.create,MNe=YS.create,xNe=fl.create,vNe=ml.create,LNe=WS.create,DNe=wa.create,UNe=ka.create,wNe=Ga.create,kNe=Ba.create,GNe=Si.create,BNe=Sr.create,jNe=Tr.create,HNe=Ro.create,FNe=Sr.createWithPreprocess,VNe=t_.create,qNe=()=>O3().optional(),$Ne=()=>N3().optional(),YNe=()=>b3().optional(),WNe={string:t=>Ti.create({...t,coerce:!0}),number:t=>Ca.create({...t,coerce:!0}),boolean:t=>Ma.create({...t,coerce:!0}),bigint:t=>Pa.create({...t,coerce:!0}),date:t=>xa.create({...t,coerce:!0})};var zNe=Q;var KNe=t=>typeof t?.safeParse=="function";var fC=t=>typeof t?.passthrough=="function";var QNe=(t,e)=>fC(t)?fC(e)?t.merge(e):t:fC(e)?e:Object.assign({},t,e);var d5e=u.object({name:u.literal("ZodError"),issues:u.array(u.object({path:u.array(u.union([u.string(),u.number()])),message:u.string().optional(),code:u.nativeEnum(u.ZodIssueCode)}).catchall(u.any()))}),XNe=Symbol("ContractNoBody"),P3=t=>"method"in t&&"path"in t;var M3=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return P3(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:QNe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,M3(r,e)]})),mC=Symbol("ContractPlainType"),gr=()=>({router:(t,e)=>M3(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>mC,body:()=>mC,type:()=>mC,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>XNe}),JNe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},ZNe=(t,e=!1)=>{let n=e?ebe(t):tbe(t);return n?.length>0?"?"+n:""},ebe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",tbe=t=>t?Object.keys(t).flatMap(e=>hC(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",hC=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>hC(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>hC(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var TC=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var nbe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),c=a.headers.get("content-type");if(c?.includes("application/")&&c?.includes("json")){let l={status:a.status,body:await a.json(),headers:a.headers},p=t.responses[l.status];return(s??t.validateResponseOnClient)&&KNe(p)?{...l,body:p.parse(l.body)}:l}return c?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},rbe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},C3=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),obe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:c}=t,l=n.api||nbe,p=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([f,m])=>typeof m=="function"?[f,m(t)]:[f,m])),d={...p&&C3(p),...C3(a)};Object.keys(d).forEach(f=>{d[f]===void 0&&delete d[f]});let _={route:r,path:e,method:r.method,headers:d,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...c},...c?.signal&&{signal:c.signal},...c?.cache&&{cache:c.cache},...c&&"next"in c&&!!c?.next&&{next:c.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?_={..._,contentType:"multipart/form-data",body:o instanceof FormData?o:rbe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?_={..._,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",..._.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(_={..._,contentType:"application/json",headers:{"content-type":"application/json",..._.headers},body:JSON.stringify(o)})),l({..._,...i})},sbe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:c,fetchOptions:l,cache:p,next:d,..._}=n||{},f={...e,...c};return{path:ibe(r,f.baseUrl,o,t,!!f.jsonQuery),clientArgs:f,route:t,body:s,query:r,extraInputArgs:_,fetchOptions:{...p&&{cache:p},...d&&{next:d},...l},headers:{...a,...i}}},ibe=(t,e,n,r,o)=>{let s=JNe({path:r.path,params:n}),i=ZNe(t,o);return`${e}${s}${i}`},abe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=sbe(t,e,r),s=await obe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new TC(s,n)}},EC=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>P3(r)?[n,abe(r,e)]:[n,EC(r,e)]));var SC=["free","creator","team"],x3=typeof process<"u"&&process.env?.NODE_ENV!=="production",cbe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:x3?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:x3?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var v3=cbe.stripe.plans,f5e=Object.freeze(Object.fromEntries(v3.map(t=>[t.tier,t])));var ube=gr(),rn=u.object({message:u.string()}),gC=u.record(u.unknown()),Va=u.string().regex(/^doc_[0-9A-Za-z]{22}$/),zS=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),lbe=["active","archived"],KS=u.enum(lbe),L3=u.object({id:u.string().min(1),display_name:u.string().min(1)}),D3=u.object({id:zS,name:u.string().min(1)}),AC=u.object({id:Va,title:u.string().min(1),status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),pbe=u.object({type:u.literal("list"),list_type:u.literal("doc"),objects:u.array(AC)}),dbe=u.object({project_id:zS.optional(),status:KS.optional()}),_be=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional()}),fbe=u.object({id:Va,created_at:u.string().datetime()}),mbe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional(),status:KS.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),hbe=u.object({id:Va,updated_at:u.string().datetime()}),Tbe=u.object({id:Va,title:u.string().min(1),prosemirror_json:gC,status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),U3=ube.router({listDocs:{method:"GET",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),query:dbe,responses:{200:pbe,401:rn,403:rn},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),body:_be,responses:{201:fbe,401:rn,403:rn,404:rn,422:rn},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:u.object({docId:Va}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Tbe,401:rn,403:rn,404:rn},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:u.object({docId:Va}),headers:u.object({authorization:u.string().min(1).optional()}),body:mbe,responses:{200:hbe,401:rn,403:rn,404:rn,422:rn},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:u.object({docId:Va}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:rn,403:rn,404:rn},summary:"Hard-delete a doc and any mention references it owns"}});var Ebe=gr(),et=u.object({message:u.string()}),RC=u.record(u.unknown()),yo=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),Sbe=["active","archived"],QS=u.enum(Sbe),yC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),w3=u.object({thread_id:u.string().min(1),title:u.string().min(1),added_at:u.string().datetime(),added_by:yC}),gbe=u.object({id:yo,name:u.string().min(1),status:QS,author:yC,thread_count:u.number().int().nonnegative(),doc_count:u.number().int().nonnegative(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),Abe=u.object({type:u.literal("list"),list_type:u.literal("project"),objects:u.array(gbe)}),Rbe=u.object({status:QS.optional()}),ybe=u.object({name:u.string().trim().min(1).max(200),prosemirror_json:RC.optional()}),Ibe=u.object({id:yo,created_at:u.string().datetime()}),Obe=u.object({name:u.string().trim().min(1).max(200).optional(),prosemirror_json:RC.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),Nbe=u.object({id:yo,updated_at:u.string().datetime()}),bbe=u.object({archived:u.boolean()}),Cbe=u.object({id:yo,status:QS,archived_at:u.string().datetime().nullable()}),Pbe=u.object({id:yo,name:u.string().min(1),prosemirror_json:RC,status:QS,author:yC,created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable(),threads:u.array(w3),docs:u.array(AC)}),Mbe=u.object({thread_id:u.string().min(1).max(64)}),xbe=w3,k3=Ebe.router({listProjects:{method:"GET",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),query:Rbe,responses:{200:Abe,401:et},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),body:ybe,responses:{201:Ibe,401:et,422:et},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Pbe,401:et,403:et,404:et},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Obe,responses:{200:Nbe,401:et,403:et,404:et,422:et},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:bbe,responses:{200:Cbe,401:et,403:et,404:et},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Mbe,responses:{201:xbe,401:et,403:et,404:et,409:et,422:et},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:u.object({projectId:yo,threadId:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:et,403:et,404:et},summary:"Remove a thread membership from a project"}});var vbe=gr(),XS=u.object({message:u.string()}),Lbe=["thread","plan","doc","user"],JS=u.enum(Lbe),Dbe=["doc","project"],Ube=u.enum(Dbe),wbe=u.object({kind:JS,id:u.string().min(1),title:u.string().min(1),href:u.string().min(1)}),kbe=u.object({type:u.literal("list"),list_type:u.literal("mention"),objects:u.array(wbe)}),Gbe=u.object({q:u.string().trim().min(1).max(50),kinds:u.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(u.array(JS).optional())}),Bbe=u.object({source_kind:Ube,source_id:u.string().min(1),source_title:u.string().min(1),source_href:u.string().min(1),target_kind:JS,target_id:u.string().min(1),created_at:u.string().datetime()}),jbe=u.object({type:u.literal("list"),list_type:u.literal("backlink"),objects:u.array(Bbe)}),Hbe=u.object({target_kind:JS,target_id:u.string().min(1).max(64)}),G3=vbe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Gbe,responses:{200:kbe,401:XS,422:XS},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:u.object({authorization:u.string().min(1).optional()}),query:Hbe,responses:{200:jbe,401:XS,403:XS},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var Fbe=gr(),Vbe=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(u.unknown())}),gi=u.object({message:u.string()}),B3=u.object({thread_id:u.string().min(1),is_favorited:u.boolean(),favorited_at:u.string().datetime().nullable()}),qbe=u.object({before:u.string().min(1).max(64).optional()}),j3=Fbe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:B3,401:gi,403:gi,404:gi},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:B3,401:gi,403:gi,404:gi},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:qbe,responses:{200:Vbe,401:gi,403:gi},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var $be=gr(),IC=u.object({message:u.string()}),Ybe=u.object({id:u.string().min(1),title:u.string(),href:u.string().min(1),author_display_name:u.string().nullable(),author_handle:u.string().nullable()}),Wbe=u.object({name:u.string().min(1),usage_count:u.number().int().nonnegative(),href:u.string().min(1)}),zbe=u.object({id:u.string().min(1),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),href:u.string().min(1)}),Kbe=u.object({type:u.literal("global_search"),threads:u.array(Ybe),skills:u.array(Wbe),people:u.array(zbe)}),Qbe=u.object({q:u.string().trim().min(1).max(80)}),H3=$be.router({globalSearch:{method:"GET",path:"/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Qbe,responses:{200:Kbe,401:IC,403:IC,422:IC},summary:"Global navbar search across threads, skills, and people. Org-scoped, max 5 results per kind."}});var Xbe=gr(),Jbe=u.object({id:u.string().uuid(),role:u.enum(["user","assistant"]),content:u.string().min(1),timestamp:u.string().datetime()}),Zbe=u.object({id:u.string().uuid(),title:u.string().min(1),author:u.string().min(1),authorAvatar:u.string().min(1).max(4),model:u.string().min(1),turnCount:u.number().int().nonnegative(),createdAt:u.string().datetime(),preview:u.string()}),X5e=Zbe.extend({messages:u.array(Jbe)}),A=u.object({message:u.string()}),eCe=/^[a-zA-Z0-9_-]{2,32}$/,K3=u.string().regex(eCe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),OC=u.object({id:u.string(),first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().nullable(),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),share_new_threads_to_workspace:u.boolean(),experimental_features_enabled:u.boolean(),onboarded_at:u.string().nullable()}),tCe=u.object({stytchMemberId:u.string().min(1).optional(),emailAddress:u.string().email(),name:u.string().nullable(),user:OC,is_admin:u.boolean()}),nCe=u.object({share_new_threads_to_workspace:u.boolean().optional(),experimental_features_enabled:u.boolean().optional(),onboarded_at:u.union([u.literal("now"),u.null()]).optional(),display_name:u.string().min(1).max(120).optional(),handle:K3.optional(),bio:u.string().max(280).nullable().optional(),avatar_storage_url:u.string().min(1).nullable().optional(),banner_storage_url:u.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),rCe=u.object({id:u.string(),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),visible_thread_count:u.number().int().nonnegative(),last_active_at:u.string().datetime().nullable()}),Q3=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),organization_name:u.string().min(1).nullable(),created_at:u.string().min(1),visible_thread_count:u.number().int().nonnegative(),follower_count:u.number().int().nonnegative(),following_count:u.number().int().nonnegative(),published_project_count:u.number().int().nonnegative(),is_following:u.boolean(),is_self:u.boolean()}),oCe=u.object({type:u.literal("list"),list_type:u.literal("organization_member"),objects:u.array(rCe)}),sCe=u.object({email_address:u.string().email()}),iCe=u.object({email_address:u.string().email(),member_id:u.string().min(1)}),aCe=u.object({location:u.string().trim().min(1),contact:u.string().trim().email()}),cCe=u.object({location:u.string().min(1),contact:u.string().email(),created_at:u.string().datetime()}),uCe=u.object({first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().min(1).optional()}),lCe=u.object({name:u.string().min(1),email_domains:u.array(u.string().min(1)).nonempty(),stytch_org_id:u.string().min(1)}),pCe=u.object({user:uCe,organization:lCe}),dCe=u.object({path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),_Ce=u.object({repo_origin_path:u.string().min(1),building_blocks:u.array(dCe)}),X3=u.string().regex(/^th_[0-9A-Za-z]{22}$/),eg=u.string().regex(/^tb_[0-9A-Za-z]{22}$/),fCe=u.object({id:X3,author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),body:u.string(),created_at:u.string().datetime(),repo_origin_path:u.string().min(1),latest_revision_id:eg,revision_count:u.number().int().positive()}),mCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),hCe=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:mCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),TCe=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable(),comments:u.array(hCe)}),ECe=u.object({thread_block_id:eg,from_position:u.number().int().positive(),to_position:u.number().int().positive(),selected_text:u.string().min(1),content:u.string().trim().min(1)}),SCe=u.object({id:u.string().min(1)}),gCe=u.object({content:u.string().trim().min(1)}),ACe=u.object({id:u.string().min(1)}),RCe=u.object({content:u.string().trim().min(1)}),yCe=u.object({id:u.string().min(1)}),ICe=u.object({content:u.string().trim().min(1)}),OCe=u.object({id:u.string().min(1)}),NCe=u.object({resolved:u.boolean()}),bCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),CCe=u.object({resolved:u.boolean()}),PCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),J3=u.record(u.unknown()),MCe=u.object({id:eg,body:u.string(),created_at:u.string().datetime(),prosemirror_json:J3,comment_threads:u.array(TCe)}),xCe=u.object({id:X3,created_at:u.string().datetime(),repo_origin_path:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),latest_revision_id:eg,revision_count:u.number().int().positive(),revisions:u.array(MCe)}),vCe=u.object({type:u.literal("list"),list_type:u.literal("plan"),has_more:u.boolean(),objects:u.array(fCe)}),LCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_id:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional()}),Z3=u.object({id:u.string().min(1),organization_id:u.string().min(1),created_at:u.string().min(1),repo_origin_path:u.string().min(1),path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),DCe=u.array(Z3),UCe=u.object({type:u.literal("list"),list_type:u.literal("building_block"),has_more:u.boolean(),objects:u.array(Z3)}),wCe=u.object({repo_origin_path:u.string().min(1),before:u.string().min(1).optional(),after:u.string().min(1).optional()}),kCe=u.enum(["thread","building_block"]),GCe=u.object({repo_origin_path:u.string().min(1),sources:u.array(kCe).nonempty()}),BCe=u.object({type:u.literal("list"),list_type:u.literal("repository"),has_more:u.boolean(),objects:u.array(GCe)}),Ai=u.enum(["claudeCode","codex","amp","cursor","unspecified"]),jCe=["transcript","plan"],HCe=u.enum(jCe),FCe=u.object({md5:u.string().min(1),harness:Ai,filename:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional(),harness_internal_id:u.string().min(1).optional(),file_type:HCe.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),bC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),VCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),e9=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:VCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),t9=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable()}),qCe=t9.extend({comments:u.array(e9)}),n_=u.object({id:u.string().min(1),type:u.string().min(1),index_in_thread:u.number().int().nonnegative(),isCritiqued:u.boolean(),comment_threads:u.array(qCe).optional()}).passthrough(),n9=u.object({type:u.literal("list"),list_type:u.literal("thread_block"),has_more:u.boolean(),objects:u.array(n_)}),F3=n_.extend({type:u.literal("plan"),prosemirror_json:J3,thread_file_id:u.string().min(1)}),$Ce=u.union([u.literal(-1),u.literal(1)]),r9=u.union([u.literal(-1),u.literal(0),u.literal(1)]),V3=u.object({score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9}),YCe=u.object({value:$Ce}),WCe=u.object({id:u.string().min(1),display_name:u.string().min(1),avatar_url:u.string().nullable()}),qa=u.object({id:u.string().min(1),thread_id:u.string().min(1),author_id:u.string().min(1).nullable(),author:WCe.nullable(),parent_comment_id:u.string().min(1).nullable(),content:u.string(),created_at:u.string().datetime(),updated_at:u.string().datetime(),deleted_at:u.string().datetime().nullable()}),zCe=u.object({type:u.literal("list"),list_type:u.literal("thread_comment"),objects:u.array(qa)}),KCe=u.object({content:u.string().trim().min(1).max(4e3),parent_comment_id:u.string().min(1).optional()}),QCe=qa,XCe=u.object({content:u.string().trim().min(1).max(4e3)}),JCe=qa,ZCe=qa,J5e=u.discriminatedUnion("kind",[u.object({kind:u.literal("created"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:qa}),u.object({kind:u.literal("updated"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:qa}),u.object({kind:u.literal("deleted"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:qa})]),ePe=u.enum(["pending","generating","ready","failed"]),tPe=u.enum(["pending","generating","ready","failed"]),nPe=u.enum(["pending","placeholder","ai","user"]),o9=u.enum(["pending","generating","ready","failed"]),s9=u.enum(["pending","generating","ready","failed","disabled"]),i9=u.enum(["pending","generating","ready","failed"]),rPe=u.object({title:u.string().min(1),body:u.string().min(1),files:u.array(u.string()).optional()}),oPe=u.object({status:s9,url:u.string().nullable(),url_expires_at:u.string().nullable(),generated_at:u.string().nullable(),model:u.string().nullable()}),sPe=u.object({status:i9,steps:u.array(rPe),generated_at:u.string().nullable()}),iPe=u.object({remix_of_thread_id:u.string().nullable(),remix_count:u.number().int().nonnegative()}),aPe=u.object({cover:oPe,how_to:sPe,lineage:iPe}),cPe=u.enum(["asked","requested","decided","corrected","shared"]),uPe=u.object({id:u.string().min(1),kind:cPe,summary:u.string().min(1),block_id:u.string().min(1)}),lPe=u.object({type:u.literal("list"),list_type:u.literal("thread_decision"),status:o9,generated_at:u.string().nullable(),objects:u.array(uPe)}),Tl=u.object({id:u.string().min(1),thread_file_id:u.string().min(1),organization_id:u.string().min(1),author:bC,repo:u.string().min(1),title:u.string().min(1),started_at:u.string().min(1),blocks:n9,user_message_count:u.number().int().nonnegative(),files_touched:u.array(u.string()),skills_invoked:u.array(u.string()),harness:Ai,transcript_parsing_state:u.enum(["pending","parsed","too_large_to_parse"]),visibility:u.enum(["private","workspace","public"]),has_plan:u.boolean().optional(),summary:u.string().nullable(),summary_status:ePe,summary_generated_at:u.string().nullable(),title_status:tPe,title_generated_at:u.string().nullable(),title_source:nPe,decisions_status:o9,decisions_generated_at:u.string().nullable(),score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9,comment_count:u.number().int().nonnegative(),is_favorited:u.boolean(),card:aPe}),pPe=u.object({storage_url:u.string().min(1)}),dPe=u.object({storage_url:u.string(),harness:Ai,thread:Tl.nullable()}),_Pe=u.object({status:u.literal("complete"),thread_files:u.array(dPe)}),fPe=u.object({id:u.string(),presigned_url:u.string().nullable(),presigned_url_expires_at:u.string().nullable(),storage_url:u.string(),harness:Ai,expected_md5:u.string(),error:u.string().nullable(),thread:Tl.nullable()}),mPe=u.object({id:u.string(),substrate:u.enum(["s3","filesystem"]),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:u.array(fPe)}),hPe=u.object({visibility:u.enum(["private","workspace","public"]).optional(),title:u.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),TPe=u.discriminatedUnion("visibility",[u.object({visibility:u.literal("private")}),u.object({visibility:u.literal("workspace")}),u.object({visibility:u.literal("public"),title:u.string().min(1),author_display_name:u.string().min(1),first_user_message:u.string().nullable(),summary:u.string().nullable(),started_at:u.string().min(1),harness:Ai})]),EPe=Tl,q3=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(EPe)}),SPe=u.enum(["recent","popular"]),gPe=Tl,APe=u.object({type:u.literal("list"),list_type:u.literal("discover_thread"),has_more:u.boolean(),objects:u.array(gPe)}),RPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),sort:SPe.optional(),harness:Ai.optional(),search:u.string().max(200).optional()}),yPe=u.object({thread_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),organization_count:u.number().int().nonnegative(),harness_breakdown:u.record(Ai,u.number().int().nonnegative())}),IPe=u.object({id:u.string(),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:u.string(),thread_count:u.number().int().nonnegative()}),OPe=u.object({type:u.literal("list"),list_type:u.literal("upload_session"),objects:u.array(IPe)}),NPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),bPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_ids:u.string().min(1).optional(),created_at:u.string().min(1).optional(),filepath_prefixes:u.string().min(1).optional()}),CPe=u.object({path:u.string().min(1),start_offset:u.number().int().nonnegative(),end_offset:u.number().int().positive()}),PPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),usage_count_last_24h:u.number().int().nonnegative(),usage_count_last_7d:u.number().int().nonnegative()}),MPe=u.object({type:u.literal("list"),list_type:u.literal("skill"),objects:u.array(PPe)}),xPe=u.object({id:u.string(),title:u.string(),visibility:u.enum(["private","workspace","public"]),started_at:u.string(),author:bC,skills_invoked:u.array(u.string())}),vPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),threads:u.array(xPe)}),LPe=u.object({path:u.string().min(1),text:u.string().max(64e3)}),DPe=u.enum(["text_edit","redact","delete_block"]),UPe=u.object({id:u.string(),thread_block_id:u.string(),editor:u.object({id:u.string(),display_name:u.string()}),kind:DPe,path:u.string().nullable(),previous_text:u.string().nullable(),new_text:u.string().nullable(),created_at:u.string()}),wPe=u.object({type:u.literal("list"),list_type:u.literal("thread_block_edit"),objects:u.array(UPe)}),kPe=u.object({organization_count:u.number().int().nonnegative(),user_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),thread_count_last_24h:u.number().int().nonnegative(),user_count_last_24h:u.number().int().nonnegative()}),GPe=u.object({id:u.string(),name:u.string(),email_domains:u.array(u.string()),stytch_org_id:u.string(),member_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),default_thread_visibility:u.enum(["private","workspace","public"]),created_at:u.string()}),BPe=u.object({type:u.literal("list"),list_type:u.literal("admin_organization"),objects:u.array(GPe)}),a9=u.object({id:u.string(),name:u.string()}),jPe=u.object({id:u.string(),display_name:u.string(),stytch_id:u.string().nullable(),thread_count:u.number().int().nonnegative(),onboarded_at:u.string().nullable(),created_at:u.string(),organizations:u.array(a9)}),HPe=u.object({type:u.literal("list"),list_type:u.literal("admin_user"),objects:u.array(jPe)}),FPe=u.object({id:u.string(),title:u.string(),started_at:u.string(),created_at:u.string(),deleted_at:u.string().nullable(),visibility:u.enum(["private","workspace","public"]),harness:Ai,author:bC,organization:a9}),VPe=u.object({type:u.literal("list"),list_type:u.literal("admin_thread"),has_more:u.boolean(),objects:u.array(FPe)}),qPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),$3=u.object({token:u.string().min(1),thread_id:u.string().min(1)}),$Pe=u.object({visitor:u.string().min(1).max(64).optional()}),YPe=u.object({user_id:u.string(),display_name:u.string(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative()}),WPe=u.object({window_days:u.number().int().positive(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative(),active_sharers:u.number().int().nonnegative(),k_factor:u.number().nullable(),shares_sent_sparkline:u.array(u.number().int().nonnegative()),top_sharers:u.array(YPe)}),zPe=u.object({windows:u.array(WPe)}),KPe=u.object({quoted_text:u.string().min(1),comment:u.string().nullable(),type:u.enum(["comment","highlight:trapdoor"])}),QPe=t9,XPe=e9.extend({comment_thread_id:u.string().min(1)}),JPe=u.object({markdown:u.string().min(1)}),ZPe=u.object({storage_url:u.string().min(1),thread_file_id:u.string().min(1),parsed_plan_block:F3,critiqued_plan_block:F3,annotations:u.array(KPe),comment_threads:u.array(QPe),comments:u.array(XPe)}),El=u.enum(SC),c9=u.object({skills:u.boolean(),workspace_scope:u.boolean(),review:u.boolean(),shared_thread_ttl_days:u.number().int().positive().nullable()}),NC=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),effective_plan:El,admin_override:El.nullable(),stripe_subscription_status:u.string().nullable(),cancel_at_period_end:u.boolean(),current_period_end:u.string().nullable(),seat_quantity:u.number().int().positive(),member_count:u.number().int().nonnegative().nullable(),features:c9}),eMe=u.object({effective_plan:El,features:c9,user:NC,organization:NC.nullable()}),tMe=u.object({plan:u.enum(["creator","team"]),seat_quantity:u.number().int().positive().optional()}),nMe=u.object({checkout_url:u.string().min(1)}),rMe=u.object({portal_url:u.string().min(1)}),oMe=u.object({seat_quantity:u.number().int().positive()}),Y3=u.object({plan:El.nullable()}),ZS=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),label:u.string().min(1),effective_plan:El,admin_override:El.nullable(),stripe_subscription_status:u.string().nullable(),seat_quantity:u.number().int().positive()}),sMe=u.object({users:u.array(ZS),organizations:u.array(ZS)}),iMe=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable()}),aMe=u.object({thread_id:u.string().min(1),title:u.string().min(1),author:iMe,last_active_at:u.string().datetime(),last_block_excerpt:u.string().nullable(),last_block_kind:u.string().min(1).nullable(),is_streaming:u.boolean()}),cMe=u.object({type:u.literal("list"),list_type:u.literal("live_thread"),objects:u.array(aMe)}),uMe=u.object({thread_id:u.string().min(1)}),lMe=u.object({thread_id:u.string().min(1),last_seen_at:u.string().datetime(),started_at:u.string().datetime()}),pMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!0),follower_count:u.number().int().nonnegative()}),dMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!1),follower_count:u.number().int().nonnegative()}),u9=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable(),bio:u.string().max(280).nullable(),is_following:u.boolean(),is_self:u.boolean()}),W3=u.object({type:u.literal("list"),list_type:u.literal("user_follow"),objects:u.array(u9)}),_Me=u.object({date:u.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:u.number().int().nonnegative()}),fMe=u.object({window_start:u.string().datetime(),window_end:u.string().datetime(),total_contributions:u.number().int().nonnegative(),days_active:u.number().int().nonnegative(),daily_average:u.number().nonnegative(),current_streak_days:u.number().int().nonnegative(),days:u.array(_Me)}),mMe=u.object({type:u.literal("thread_created"),occurred_at:u.string().datetime(),id:u.string().min(1),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),hMe=u.object({type:u.literal("comment_posted"),occurred_at:u.string().datetime(),id:u.string().min(1),comment_excerpt:u.string(),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),TMe=u.object({type:u.literal("project_published"),occurred_at:u.string().datetime(),id:u.string().min(1),project:u.object({id:u.string().min(1),name:u.string().min(1)})}),EMe=u.object({type:u.literal("user_followed"),occurred_at:u.string().datetime(),id:u.string().min(1),followee:u9}),SMe=u.discriminatedUnion("type",[mMe,hMe,TMe,EMe]),gMe=u.object({type:u.literal("list"),list_type:u.literal("user_activity"),objects:u.array(SMe)}),AMe=u.object({id:u.string().min(1),name:u.string().min(1),excerpt:u.string(),published_at:u.string().datetime(),updated_at:u.string().datetime()}),RMe=u.object({type:u.literal("list"),list_type:u.literal("profile_published_project"),objects:u.array(AMe)}),z3=u.object({id:u.string().min(1),published_at:u.string().datetime().nullable()}),yMe=u.enum(["avatar","banner"]),IMe=u.enum(["image/png","image/jpeg","image/webp","image/gif"]),OMe=u.object({kind:yMe,content_type:IMe,base64_data:u.string().min(1)}),NMe=u.object({substrate:u.enum(["s3","filesystem"]),storage_url:u.string().min(1)}),bMe=Q3,l9=Xbe.router({health:{method:"GET",path:"/health",responses:{200:u.object({status:u.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:u.object({authorization:u.string().min(1).optional(),"x-lore-referral-token":u.string().min(1).max(16).optional()}),responses:{200:tCe,401:A},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:u.object({authorization:u.string().min(1).optional()}),body:uMe,responses:{200:lMe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:cMe,401:A,403:A},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:bPe,responses:{200:q3,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Tl,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:q3,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:NPe,responses:{200:n9,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:gCe,responses:{201:ACe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:ICe,responses:{201:OCe,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:CCe,responses:{200:PCe,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:MPe,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:u.object({name:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:vPe,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:CPe,responses:{200:n_,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:LPe,responses:{200:n_,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:n_,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:wPe,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:lPe,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:hPe,responses:{200:Tl,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:u.object({cover_status:s9,how_to_status:i9}),401:A,403:A,404:A,429:A.extend({retry_after_seconds:u.number().int().nonnegative()})},summary:"Enqueue cover image + how-to recipe generation for the thread. Author-only. Idempotent \u2014 recently-fired statuses are not double-enqueued. Rate-limited: at most one cover generation per minute per thread (cooldown begins when the previous cover finishes). Used to populate cards on legacy threads (created before Lore Cards) and to retry after a 'failed' status or opt back in from 'disabled'."},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:YCe,responses:{200:V3,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:V3,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:zCe,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:KCe,responses:{201:QCe,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:XCe,responses:{200:JCe,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:ZCe,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:u.object({id:u.string().min(1)}),responses:{200:TPe,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:u.object({authorization:u.string().min(1).optional()}),body:pCe,responses:{201:OC,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Q3,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:u.object({authorization:u.string().min(1).optional()}),body:nCe,responses:{200:OC,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:u.object({handle:K3}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:bMe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:u.object({limit:u.coerce.number().int().positive().max(100).optional()}),responses:{200:gMe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:fMe,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:pMe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:dMe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:RMe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:u.object({authorization:u.string().min(1).optional()}),body:OMe,responses:{200:NMe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:oCe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:u.object({authorization:u.string().min(1).optional()}),body:sCe,responses:{201:iCe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:BCe,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),body:_Ce,responses:{201:DCe,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:xCe,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:ECe,responses:{201:SCe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:RCe,responses:{201:yCe,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:NCe,responses:{200:bCe,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:u.object({authorization:u.string().min(1).optional()}),query:LCe,responses:{200:vCe,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),query:wCe,responses:{200:UCe,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:OPe,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(FCe).nonempty()}),responses:{201:mPe,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(pPe).nonempty()}),responses:{200:_Pe,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:kPe,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:BPe,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:HPe,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:qPe,responses:{200:VPe,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:RPe,responses:{200:APe},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:yPe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:aCe,responses:{201:cCe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:$3,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:u.object({token:u.string().min(1).max(16)}),query:$Pe,responses:{200:$3,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:zPe,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:u.object({authorization:u.string().min(1).optional()}),body:JPe,responses:{200:ZPe,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:eMe,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:u.object({authorization:u.string().min(1).optional()}),body:tMe,responses:{200:nMe,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({subject_type:u.enum(["user","organization"]).default("user")}).optional(),responses:{200:rMe,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:u.object({authorization:u.string().min(1).optional()}),body:oMe,responses:{200:NC,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:sMe,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:k3,docs:U3,mentions:G3,favorites:j3,search:H3},{pathPrefix:"/api"});import r_ from"node:fs";import p9 from"node:path";function tg(){return p9.join(Zo(),"token")}function CC(){let t;try{t=r_.readFileSync(tg(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||PMe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function ng(){return CC().token}function d9(){return r_.existsSync(tg())}function _9(t){let e=tg();r_.mkdirSync(p9.dirname(e),{recursive:!0,mode:448}),r_.writeFileSync(e,t,{mode:384})}function f9(){try{r_.rmSync(tg())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function CMe(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function PMe(t,e){let n;try{n=CMe(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var MMe={dev:"http://localhost:4000",prod:"https://lore-api.tanagram.ai"};function Ri(t={}){let e=t.token??ng();return EC(l9,{baseUrl:MMe[xt()],baseHeaders:{"User-Agent":B4(),...e?{authorization:`Bearer ${e}`}:{}}})}var m9={meta:{name:"health",description:"Check API health"},async run({data:t}){pt.info("command_start",{command:"health"});let n=await(t?.client??Ri()).health();if(n.status===200){console.log(n.body.status);return}throw pt.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var h9={meta:{name:"hello",description:"Print a friendly greeting"},run(){pt.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as vMe}from"node:child_process";import S9 from"node:crypto";import LMe from"node:http";var xMe={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function T9(){return xMe[xt()]}var DMe=5*60*1e3;function UMe(){return S9.randomBytes(32).toString("base64url")}function wMe(t){return S9.createHash("sha256").update(t).digest("base64url")}function kMe(t){let e;try{e=JSON.parse(Buffer.from(t.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof e.session_jwt!="string"||!e.session_jwt)throw new Error("missing session token");if(typeof e.code_challenge!="string"||!e.code_challenge)throw new Error("missing code challenge");return{sessionJwt:e.session_jwt,codeChallenge:e.code_challenge}}function GMe(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function E9(t,e,n){let r=e==="success";t.writeHead(200,{"Content-Type":"text/html"}),t.end(`<!DOCTYPE html>
|
|
82
82
|
<html><head><meta charset="utf-8"><title>Lore CLI</title></head>
|
|
83
83
|
<body style="font-family:system-ui;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0;background:#fafafa">
|
|
84
84
|
<div style="text-align:center;max-width:400px;padding:40px;border:1px solid #e0e0e0;border-radius:10px;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,0.1)">
|
|
85
85
|
<div style="font-size:48px;margin-bottom:20px">${r?"\u2713":"\u2717"}</div>
|
|
86
86
|
<h1 style="margin:0 0 10px">${r?"Authorization Complete":"Authorization Cancelled"}</h1>
|
|
87
|
-
<p style="color:#666">${r?"You can close this window now.":
|
|
87
|
+
<p style="color:#666">${r?"You can close this window now.":GMe(n??"Authorization was cancelled.")}</p>
|
|
88
88
|
<p style="color:#999;font-size:14px">You can close this tab and return to your terminal.</p>
|
|
89
|
-
</div></body></html>`)}async function
|
|
89
|
+
</div></body></html>`)}async function BMe(){let t,e=new Promise(s=>{t=s}),n=LMe.createServer((s,i)=>{let a=new URL(s.url??"/","http://127.0.0.1");if(a.pathname!=="/callback"){i.writeHead(404),i.end();return}let c=a.searchParams.get("error");if(c){let p=a.searchParams.get("error_description")||c;E9(i,"error",p),t?.({type:"error",description:p});return}let l=a.searchParams.get("code");if(l){E9(i,"success"),t?.({type:"code",code:l});return}i.writeHead(400),i.end()});return await new Promise((s,i)=>{n.once("error",i),n.listen(0,"127.0.0.1",()=>{n.off("error",i),s()})}),{redirectURI:`http://127.0.0.1:${n.address().port}/callback`,waitForCallback(s){return new Promise((i,a)=>{let c=setTimeout(()=>{a(new Error("authorization timed out"))},s);e.then(l=>{clearTimeout(c),i(l)})})},close(){return new Promise((s,i)=>{n.close(a=>{if(a){i(a);return}s()})})}}}async function jMe(t){let{command:e,args:n}=HMe(process.platform,t);await new Promise((r,o)=>{let s=vMe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function HMe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function FMe(t){if(CC().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function VMe({client:t=Ri(),openBrowser:e=jMe,setAccessToken:n=_9,webBaseURL:r=T9(),timeoutMs:o=DMe}={}){if(await FMe(t)){console.log(`
|
|
90
90
|
Already logged in. Use 'lore logout' if you want to sign out.
|
|
91
|
-
`);return}let s=
|
|
91
|
+
`);return}let s=UMe(),i=wMe(s),a=await BMe();try{let c=new URL("/cli-authorize",r);c.searchParams.set("redirect_uri",a.redirectURI),c.searchParams.set("code_challenge",i),c.searchParams.set("code_challenge_method","S256");try{await e(c.toString()),console.log(`
|
|
92
92
|
Opening browser to log in...`),console.log(`
|
|
93
93
|
If your browser didn't open, visit:`)}catch(d){pt.warn("open_browser_failed",{error:d instanceof Error?d.message:String(d)}),console.log(`
|
|
94
94
|
Visit this URL to log in:`)}console.log(` ${c.toString()}
|
|
95
95
|
`),console.log(" Waiting for authorization. Click Authorize in your browser...");let l=await a.waitForCallback(o);if(l.type==="error")throw console.log(`
|
|
96
96
|
Authorization denied: ${l.description}
|
|
97
|
-
`),new Error(l.description);let p=
|
|
97
|
+
`),new Error(l.description);let p=kMe(l.code);if(p.codeChallenge!==i)throw console.log(`
|
|
98
98
|
Authorization code verification failed.
|
|
99
99
|
`),new Error("PKCE challenge mismatch");n(p.sessionJwt),console.log(`
|
|
100
100
|
Logged in successfully.
|
|
101
101
|
`)}catch(c){throw c instanceof Error&&c.message==="authorization timed out"&&console.log(`
|
|
102
102
|
Authorization timed out. Please try again.
|
|
103
|
-
`),c}finally{await a.close()}}var g9={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:t}){pt.info("command_start",{command:"login"}),await
|
|
103
|
+
`),c}finally{await a.close()}}var g9={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:t}){pt.info("command_start",{command:"login"}),await VMe({client:t?.client,openBrowser:t?.openBrowser,setAccessToken:t?.setAccessToken,webBaseURL:t?.webBaseURL,timeoutMs:t?.timeoutMs})}};var A9={meta:{name:"logout",description:"Log out of your Lore workspace"},run(){pt.info("command_start",{command:"logout"});let t=d9();if(f9(),!t){console.log(`
|
|
104
104
|
Not currently logged in.
|
|
105
105
|
`);return}console.log(`
|
|
106
106
|
Logged out successfully.
|
|
107
|
-
`)}};var R9={meta:{name:"logs",description:"Print the path to the log file"},run(){pt.info("command_start",{command:"logs"}),console.log(US())}};import{promises as Ri}from"node:fs";import VMe from"node:os";import qa from"node:path";import{fileURLToPath as y9}from"node:url";function PC(){return qa.join(VMe.homedir(),".claude","skills")}function I9(t){return t.map(e=>e.name).sort().join(", ")}function O9(t){return t[0]?qa.dirname(t[0].destination):PC()}async function qMe(t){try{return(await Ri.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function N9(){let t=[y9(new URL("../skills",import.meta.url)),y9(new URL("../../skills",import.meta.url))];for(let e of t)if(await qMe(e))return e;throw new Error("bundled skills directory not found")}function $Me(t,e){let n=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,r,o,s]=n,i=o.replace(/^name: .*$/m,`name: ${e}`);if(i===o)throw new Error("skill file frontmatter is missing a name");return`${r}${i}${s}${t.slice(n[0].length)}`}async function YMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await Ri.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];await Ri.mkdir(t,{recursive:!0});for(let a of o){let c=`${a.name}${s}`,l=qa.join(r,a.name),p=qa.join(t,c);if(await Ri.cp(l,p,{recursive:!0,force:!0}),s){let d=qa.join(p,"SKILL.md"),_=await Ri.readFile(d,"utf8");await Ri.writeFile(d,$Me(_,c))}i.push({name:c,source:l,destination:p})}return i}async function WMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await Ri.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];for(let a of o){let c=`${a.name}${s}`,l=qa.join(r,a.name),p=qa.join(t,c);await Ri.rm(p,{recursive:!0,force:!0}),i.push({name:c,source:l,destination:p})}return i}var b9={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await YMe({destination:t.destination});console.log(`installed skills ${I9(e)} to ${O9(e)}`)}},C9={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await WMe({destination:t.destination});console.log(`uninstalled skills ${I9(e)} from ${O9(e)}`)}};import rg from"node:fs/promises";import zMe from"node:path";import{setTimeout as xC}from"node:timers/promises";var KMe=1e3,QMe=2*60*1e3,XMe=1e3,JMe=250,og=class extends Error{constructor(){super("lore is logged out")}};async function M9(t={}){let e=await lxe(),n=t.recorder??new jS,r=t.adapter??n3,o=t.client??Ai();await n.markRunning();let s=[],i=e,a=new Map,c=!1;try{let l=await x9({lastUploadedTimestamp:e.latestUploadedTimestamp,adapter:r,client:o,recorder:n});if(s=l.threadIDs,i=l.syncState,a=l.watchBaselineOverrides,c=l.loggedOut,c||await n.markSyncSuccess(s),!c&&s.length>0){let p=await ZMe({syncState:i,baselineOverrides:a,adapter:r,client:o,recorder:n});s=[...s,...p.threadIDs],i=p.syncState,c=p.loggedOut}return c?await n.markLoggedOut():await n.markSuccess(s),s}catch(l){throw await n.markError(l),l}}async function x9(t){let e=[],n={latestUploadedTimestamp:t.lastUploadedTimestamp},r=new Map,o=!1;try{let s=await exe(t);e=s.threadIDs,n=s.syncState,r=s.watchBaselineOverrides}catch(s){if(s instanceof og)o=!0,e=[],r=new Map;else throw await P9(n),s}return await P9(n),{threadIDs:e,syncState:n,watchBaselineOverrides:r,loggedOut:o}}async function ZMe(t){let e=t.adapter.historyFilePath(),n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(t.syncState.latestUploadedTimestamp,t.baselineOverrides);if(await t.recorder.setPendingWatchers(r),r.length===0)return await t.recorder.setPendingWatchers([]),{threadIDs:[],syncState:t.syncState,loggedOut:!1};let o=[],s=t.syncState;try{for(;;){await xC(XMe),await t.recorder.heartbeat();let i=new Date,a=await es(e),c=rC(n,a);if(n=a,c||(c=await cxe(r)),!c){let p=uxe(r,i);if(r=p.watchers,p.changed&&await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};continue}await xC(JMe);let l=await x9({lastUploadedTimestamp:s.latestUploadedTimestamp,adapter:t.adapter,client:t.client,recorder:t.recorder});if(s=l.syncState,l.loggedOut)return{threadIDs:o,syncState:s,loggedOut:!0};if(o.push(...l.threadIDs),await t.recorder.markSyncSuccess(l.threadIDs),l.threadIDs.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};if(n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(s.latestUploadedTimestamp,l.watchBaselineOverrides),await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1}}}finally{await t.recorder.setPendingWatchers([])}}async function exe(t){let e={latestUploadedTimestamp:t.lastUploadedTimestamp},n=await t.adapter.readUnuploadedEntries(t.lastUploadedTimestamp);if(n.length===0)return{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};if(!ng())throw new og;await t.recorder.markAuthenticated();let o=await t.adapter.collectLocalFiles(n);try{if(o.localFiles.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,o.skippedFileKeys),{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};let s=await txe(t.client,o.localFiles);if(s.thread_files.length!==o.localFiles.length)throw new Error(`upload session returned ${s.thread_files.length} files for ${o.localFiles.length} local files`);let i=sxe(o.localFiles,s.thread_files),a=[],c=[],l=new Set;for(let m=0;m<s.thread_files.length;m+=1){let h=s.thread_files[m],T=i[m];if(!(!h||!T)){if(!h.presigned_url?.trim()){let S=h.error?.trim()||`upload session response missing presigned_url for ${T.filename}`;pt.info("run_upload_skip",{filename:T.filename,reason:S}),l.add(T.key);continue}a.push(h),c.push(T)}}for(let m=0;m<a.length;m+=1){let h=a[m],T=c[m];!h||!T||await nxe(h.presigned_url??"",T.tempPath)}let p=[],d=new Map,_=new Set([...o.skippedFileKeys,...l]);if(a.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d};let f=await rxe(t.client,s.id,a);if(f.thread_files.length!==c.length)throw new Error(`completed upload session returned ${f.thread_files.length} files for ${c.length} local files`);for(let m=0;m<f.thread_files.length;m+=1){await t.recorder.heartbeat();let h=f.thread_files[m],T=c[m];if(!h||!T)continue;let S=h.thread?.id?.trim()??"";if(!S){if(T.fileType==="plan"){_.add(T.key);continue}throw new Error(`complete upload session response missing thread for ${T.filename}`)}p.push(S),await oxe(t.client,S,t.recorder),_.add(T.key),T.sourcePath&&d.set(T.sourcePath,T.watchedState)}return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d}}finally{await Promise.all(o.localFiles.map(s=>K4(s.tempPath)))}}async function txe(t,e){let n=e.map(o=>({md5:o.md5,harness:o.harness,filename:o.filename,repo_origin_path:o.repoOriginPath||void 0,file_type:o.fileType,harness_internal_id:o.harnessInternalId})),r=await t.createUploadSession({body:{thread_files:n}});if(r.status!==201)throw new Error(vC("create upload session",r.status,r.body));return r.body}async function nxe(t,e){let n=await rg.readFile(e),r=await fetch(t,{method:"PUT",body:n,headers:{"content-length":String(n.length)}});if(!r.ok)throw new Error(`upload transcript: unexpected status ${r.status}: ${await r.text()}`)}async function rxe(t,e,n){let r=n.map(s=>({storage_url:ixe(s)})),o=await t.completeUploadSession({params:{id:e},body:{thread_files:r}});if(o.status!==200)throw new Error(vC("complete upload session",o.status,o.body));return o.body}async function oxe(t,e,n,r={}){let o=r.timeoutMs??QMe,s=r.pollIntervalMs??KMe,i=Date.now();for(;;){await n.heartbeat();let a=await t.getThread({params:{id:e}});if(a.status!==200)throw new Error(vC(`get thread ${e}`,a.status,a.body));let c=a.body.transcript_parsing_state;if(c==="parsed"||c==="too_large_to_parse")return;if(c!=="pending"&&c!=="parsing")throw new Error(`unexpected transcript parsing state for thread ${e}: ${JSON.stringify(c)}`);let l=Date.now()-i;if(l>=o)throw new Error(`timed out waiting for thread ${e} parsing after ${o}ms`);await xC(Math.min(s,o-l))}}function sxe(t,e){let n=new Map;for(let r of t){let o=r.md5.trim().toLowerCase();n.set(o,[...n.get(o)??[],r])}return e.map((r,o)=>{let s=r.expected_md5?.trim();if(!s)throw new Error(`upload session response missing expected_md5 for thread_files[${o}]`);let i=s.toLowerCase(),a=n.get(i);if(!a||a.length===0)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);let[c,...l]=a;if(!c)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);return l.length===0?n.delete(i):n.set(i,l),c})}function MC(t,e,n,r){let o=t;for(let s=0;s<e.length;s+=1){let i=n[s];if(!i||!r.has(i))break;o=e[s]?.timestamp??o}return o}function ixe(t){if(!t.storage_url.trim())throw new Error("upload session response missing storage_url");return`s3://${axe(t.presigned_url??"")}/${t.storage_url.replace(/^\/+/,"")}`}function axe(t){let e;try{e=new URL(t)}catch(s){throw new Error(`parse presigned URL ${JSON.stringify(t)}: ${String(s)}`)}let n=e.hostname,r=n.indexOf(".s3");if(r>0)return n.slice(0,r);let o=e.pathname.replace(/^\/+|\/+$/g,"").split("/");if(o.length>=2&&o[0])return o[0];throw new Error(`could not determine S3 bucket from presigned URL ${JSON.stringify(t)}`)}async function cxe(t){for(let e of t){let n=await es(e.transcriptPath);if(rC(e.baseline,n))return!0}return!1}function uxe(t,e){let n=t.filter(r=>e<r.expiresAt);return{watchers:n,changed:n.length!==t.length}}async function lxe(){try{return{latestUploadedTimestamp:JSON.parse(await rg.readFile(tC(),"utf8")).latestUploadedTimestamp??0}}catch{return{latestUploadedTimestamp:0}}}async function P9(t){let e=tC();await rg.mkdir(zMe.dirname(e),{recursive:!0,mode:448}),await rg.writeFile(e,`${JSON.stringify(t,null,2)}
|
|
108
|
-
`,{mode:384})}function vC(t,e,n){return
|
|
109
|
-
`),!
|
|
107
|
+
`)}};var R9={meta:{name:"logs",description:"Print the path to the log file"},run(){pt.info("command_start",{command:"logs"}),console.log(US())}};import{promises as yi}from"node:fs";import qMe from"node:os";import $a from"node:path";import{fileURLToPath as y9}from"node:url";function PC(){return $a.join(qMe.homedir(),".claude","skills")}function I9(t){return t.map(e=>e.name).sort().join(", ")}function O9(t){return t[0]?$a.dirname(t[0].destination):PC()}async function $Me(t){try{return(await yi.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function N9(){let t=[y9(new URL("../skills",import.meta.url)),y9(new URL("../../skills",import.meta.url))];for(let e of t)if(await $Me(e))return e;throw new Error("bundled skills directory not found")}function YMe(t,e){let n=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,r,o,s]=n,i=o.replace(/^name: .*$/m,`name: ${e}`);if(i===o)throw new Error("skill file frontmatter is missing a name");return`${r}${i}${s}${t.slice(n[0].length)}`}async function WMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await yi.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];await yi.mkdir(t,{recursive:!0});for(let a of o){let c=`${a.name}${s}`,l=$a.join(r,a.name),p=$a.join(t,c);if(await yi.cp(l,p,{recursive:!0,force:!0}),s){let d=$a.join(p,"SKILL.md"),_=await yi.readFile(d,"utf8");await yi.writeFile(d,YMe(_,c))}i.push({name:c,source:l,destination:p})}return i}async function zMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await yi.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];for(let a of o){let c=`${a.name}${s}`,l=$a.join(r,a.name),p=$a.join(t,c);await yi.rm(p,{recursive:!0,force:!0}),i.push({name:c,source:l,destination:p})}return i}var b9={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await WMe({destination:t.destination});console.log(`installed skills ${I9(e)} to ${O9(e)}`)}},C9={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await zMe({destination:t.destination});console.log(`uninstalled skills ${I9(e)} from ${O9(e)}`)}};import rg from"node:fs/promises";import KMe from"node:path";import{setTimeout as xC}from"node:timers/promises";var QMe=1e3,XMe=2*60*1e3,JMe=1e3,ZMe=250,og=class extends Error{constructor(){super("lore is logged out")}};async function M9(t={}){let e=await pxe(),n=t.recorder??new jS,r=t.adapter??n3,o=t.client??Ri();await n.markRunning();let s=[],i=e,a=new Map,c=!1;try{let l=await x9({lastUploadedTimestamp:e.latestUploadedTimestamp,adapter:r,client:o,recorder:n});if(s=l.threadIDs,i=l.syncState,a=l.watchBaselineOverrides,c=l.loggedOut,c||await n.markSyncSuccess(s),!c&&s.length>0){let p=await exe({syncState:i,baselineOverrides:a,adapter:r,client:o,recorder:n});s=[...s,...p.threadIDs],i=p.syncState,c=p.loggedOut}return c?await n.markLoggedOut():await n.markSuccess(s),s}catch(l){throw await n.markError(l),l}}async function x9(t){let e=[],n={latestUploadedTimestamp:t.lastUploadedTimestamp},r=new Map,o=!1;try{let s=await txe(t);e=s.threadIDs,n=s.syncState,r=s.watchBaselineOverrides}catch(s){if(s instanceof og)o=!0,e=[],r=new Map;else throw await P9(n),s}return await P9(n),{threadIDs:e,syncState:n,watchBaselineOverrides:r,loggedOut:o}}async function exe(t){let e=t.adapter.historyFilePath(),n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(t.syncState.latestUploadedTimestamp,t.baselineOverrides);if(await t.recorder.setPendingWatchers(r),r.length===0)return await t.recorder.setPendingWatchers([]),{threadIDs:[],syncState:t.syncState,loggedOut:!1};let o=[],s=t.syncState;try{for(;;){await xC(JMe),await t.recorder.heartbeat();let i=new Date,a=await es(e),c=rC(n,a);if(n=a,c||(c=await uxe(r)),!c){let p=lxe(r,i);if(r=p.watchers,p.changed&&await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};continue}await xC(ZMe);let l=await x9({lastUploadedTimestamp:s.latestUploadedTimestamp,adapter:t.adapter,client:t.client,recorder:t.recorder});if(s=l.syncState,l.loggedOut)return{threadIDs:o,syncState:s,loggedOut:!0};if(o.push(...l.threadIDs),await t.recorder.markSyncSuccess(l.threadIDs),l.threadIDs.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};if(n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(s.latestUploadedTimestamp,l.watchBaselineOverrides),await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1}}}finally{await t.recorder.setPendingWatchers([])}}async function txe(t){let e={latestUploadedTimestamp:t.lastUploadedTimestamp},n=await t.adapter.readUnuploadedEntries(t.lastUploadedTimestamp);if(n.length===0)return{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};if(!ng())throw new og;await t.recorder.markAuthenticated();let o=await t.adapter.collectLocalFiles(n);try{if(o.localFiles.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,o.skippedFileKeys),{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};let s=await nxe(t.client,o.localFiles);if(s.thread_files.length!==o.localFiles.length)throw new Error(`upload session returned ${s.thread_files.length} files for ${o.localFiles.length} local files`);let i=ixe(o.localFiles,s.thread_files),a=[],c=[],l=new Set;for(let m=0;m<s.thread_files.length;m+=1){let h=s.thread_files[m],T=i[m];if(!(!h||!T)){if(!h.presigned_url?.trim()){let S=h.error?.trim()||`upload session response missing presigned_url for ${T.filename}`;pt.info("run_upload_skip",{filename:T.filename,reason:S}),l.add(T.key);continue}a.push(h),c.push(T)}}for(let m=0;m<a.length;m+=1){let h=a[m],T=c[m];!h||!T||await rxe(h.presigned_url??"",T.tempPath)}let p=[],d=new Map,_=new Set([...o.skippedFileKeys,...l]);if(a.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d};let f=await oxe(t.client,s.id,a);if(f.thread_files.length!==c.length)throw new Error(`completed upload session returned ${f.thread_files.length} files for ${c.length} local files`);for(let m=0;m<f.thread_files.length;m+=1){await t.recorder.heartbeat();let h=f.thread_files[m],T=c[m];if(!h||!T)continue;let S=h.thread?.id?.trim()??"";if(!S){if(T.fileType==="plan"){_.add(T.key);continue}throw new Error(`complete upload session response missing thread for ${T.filename}`)}p.push(S),await sxe(t.client,S,t.recorder),_.add(T.key),T.sourcePath&&d.set(T.sourcePath,T.watchedState)}return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d}}finally{await Promise.all(o.localFiles.map(s=>K4(s.tempPath)))}}async function nxe(t,e){let n=e.map(o=>({md5:o.md5,harness:o.harness,filename:o.filename,repo_origin_path:o.repoOriginPath||void 0,file_type:o.fileType,harness_internal_id:o.harnessInternalId})),r=await t.createUploadSession({body:{thread_files:n}});if(r.status!==201)throw new Error(vC("create upload session",r.status,r.body));return r.body}async function rxe(t,e){let n=await rg.readFile(e),r=await fetch(t,{method:"PUT",body:n,headers:{"content-length":String(n.length)}});if(!r.ok)throw new Error(`upload transcript: unexpected status ${r.status}: ${await r.text()}`)}async function oxe(t,e,n){let r=n.map(s=>({storage_url:axe(s)})),o=await t.completeUploadSession({params:{id:e},body:{thread_files:r}});if(o.status!==200)throw new Error(vC("complete upload session",o.status,o.body));return o.body}async function sxe(t,e,n,r={}){let o=r.timeoutMs??XMe,s=r.pollIntervalMs??QMe,i=Date.now();for(;;){await n.heartbeat();let a=await t.getThread({params:{id:e}});if(a.status!==200)throw new Error(vC(`get thread ${e}`,a.status,a.body));let c=a.body.transcript_parsing_state;if(c==="parsed"||c==="too_large_to_parse")return;if(c!=="pending"&&c!=="parsing")throw new Error(`unexpected transcript parsing state for thread ${e}: ${JSON.stringify(c)}`);let l=Date.now()-i;if(l>=o)throw new Error(`timed out waiting for thread ${e} parsing after ${o}ms`);await xC(Math.min(s,o-l))}}function ixe(t,e){let n=new Map;for(let r of t){let o=r.md5.trim().toLowerCase();n.set(o,[...n.get(o)??[],r])}return e.map((r,o)=>{let s=r.expected_md5?.trim();if(!s)throw new Error(`upload session response missing expected_md5 for thread_files[${o}]`);let i=s.toLowerCase(),a=n.get(i);if(!a||a.length===0)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);let[c,...l]=a;if(!c)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);return l.length===0?n.delete(i):n.set(i,l),c})}function MC(t,e,n,r){let o=t;for(let s=0;s<e.length;s+=1){let i=n[s];if(!i||!r.has(i))break;o=e[s]?.timestamp??o}return o}function axe(t){if(!t.storage_url.trim())throw new Error("upload session response missing storage_url");return`s3://${cxe(t.presigned_url??"")}/${t.storage_url.replace(/^\/+/,"")}`}function cxe(t){let e;try{e=new URL(t)}catch(s){throw new Error(`parse presigned URL ${JSON.stringify(t)}: ${String(s)}`)}let n=e.hostname,r=n.indexOf(".s3");if(r>0)return n.slice(0,r);let o=e.pathname.replace(/^\/+|\/+$/g,"").split("/");if(o.length>=2&&o[0])return o[0];throw new Error(`could not determine S3 bucket from presigned URL ${JSON.stringify(t)}`)}async function uxe(t){for(let e of t){let n=await es(e.transcriptPath);if(rC(e.baseline,n))return!0}return!1}function lxe(t,e){let n=t.filter(r=>e<r.expiresAt);return{watchers:n,changed:n.length!==t.length}}async function pxe(){try{return{latestUploadedTimestamp:JSON.parse(await rg.readFile(tC(),"utf8")).latestUploadedTimestamp??0}}catch{return{latestUploadedTimestamp:0}}}async function P9(t){let e=tC();await rg.mkdir(KMe.dirname(e),{recursive:!0,mode:448}),await rg.writeFile(e,`${JSON.stringify(t,null,2)}
|
|
108
|
+
`,{mode:384})}function vC(t,e,n){return dxe(n)&&typeof n.message=="string"?`${t} failed: HTTP ${e}: ${n.message}`:`${t} failed: HTTP ${e}`}function dxe(t){return t!==null&&typeof t=="object"}var v9={meta:{name:"_run_upload",hidden:!0},async run({data:t}){let e=await M9({client:t?.client,adapter:t?.adapter,recorder:t?.recorder});console.log(JSON.stringify(e))}};var L9={meta:{name:"version",description:"Print the Lore CLI version"},run(){console.log(fi())}};var D9={meta:{name:"whoami",description:"Print the authenticated Lore user",hidden:!0},async run({data:t}){pt.info("command_start",{command:"whoami"});let n=await(t?.client??Ri()).whoAmI({headers:{}});if(n.status===200){console.log(n.body.emailAddress);return}throw console.error("Not authenticated. Run 'lore login' first."),new Error(`whoami failed: HTTP ${n.status}`)}};var _xe="phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ",fxe="https://phe.tanagram.ai/capture/",mxe=2e3;function U9(t){return process.env[t]??""}function hxe(t,e){let n=[t,e].filter(Boolean);return n.length>0?n.join("@"):"unknown-cli-user"}async function w9({commandName:t,durationMs:e}){let n=U9("USER"),r=U9("HOST"),o=new AbortController,s=setTimeout(()=>o.abort(),mxe);try{await fetch(fxe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:_xe,event:"lore.cli.command_run",properties:{distinct_id:hxe(n,r),command_name:t,cli_version:fi(),duration_ms:Math.round(e),environment:xt(),user:n,host:r}}),signal:o.signal})}catch(i){pt.warn("posthog_capture_failed",{command:t,error:i instanceof Error?i.message:String(i)})}finally{clearTimeout(s)}}var j9={hello:h9,health:m9,enable:_3,disable:f3,restart:m3,status:h3,login:g9,logout:A9,whoami:D9,logs:R9,version:L9,_run_upload:v9,"postinstall:install-skills":b9,"postinstall:uninstall-skills":C9};function Sxe(t){let e=t.find(n=>!n.startsWith("-"));return e||"hello"}var gxe={name:"cli-metrics",setup(t){t.data={...t.data,commandStartedAtMs:performance.now()}},async cleanup(t){let e=t.data?.commandStartedAtMs;if(typeof e!="number")return;let n=performance.now()-e;await(t.data?.captureCliCommandMetric??w9)({commandName:Sxe(t.rawArgs),durationMs:n})}},LC={meta:{name:"lore",description:"Lore CLI"},plugins:[gxe],subCommands:j9,default:"hello"};function G9(t){return t instanceof Error&&t.name==="CLIError"}function Axe(t){let e=t.find(r=>!r.startsWith("-")),n=e?j9[e]:void 0;return n?[n,LC]:[LC,void 0]}async function Rxe(t){try{if(t.includes("--help")||t.includes("-h")){console.log(await $4(...Axe(t)));return}if(t.includes("--version")||t.includes("-v")){console.log(fi());return}await vS(LC,{rawArgs:t})}catch(e){if(G9(e)||xt()==="prod"&&e instanceof Error?console.error(e.message):console.error(e,`
|
|
109
|
+
`),!G9(e)){te(e),om(2e3).catch(()=>{}).finally(()=>{process.exit(1)});return}process.exit(1)}}function B9(t){try{return Txe(t)}catch{return t}}function yxe(t,e){if(!e)return!1;let n=Exe(t);return k9(B9(n)).href===k9(B9(e)).href}yxe(import.meta.url,process.argv[1])&&await Rxe(process.argv.slice(2));export{yxe as isCliEntrypoint,LC as mainCommand};
|