@naarang/ccc 3.3.0-beta.13 → 3.3.0-beta.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 CHANGED
@@ -888,7 +888,7 @@ Event: ${QB(_)}`),!0}return!1}function b04(_,$){if(!$?.length)return!1;return Tl
888
888
  `;let K=Q71(Q);Q.write(`${Z}\r
889
889
  `);let{connect:z,buffered:H}=await K;if(_.emit("proxyConnect",z),this.emit("proxyConnect",z,_),z.statusCode===200){if(_.once("socket",A$4),$.secureEndpoint){gk("Upgrading socket connection to TLS");let V=$.servername||$.host;return tY0.connect({...Y71($,"host","path","port"),socket:Q,servername:PV.isIP(V)?void 0:V})}return Q}Q.destroy();let W=new PV.Socket({writable:!1});return W.readable=!0,_.once("socket",(V)=>{gk("Replaying proxy buffer for failed request"),V.push(H),V.push(null)}),W}}Np.__initStatic();function A$4(_){_.resume()}function Y71(_,...$){let X={},Q;for(Q in _)if(!$.includes(Q))X[Q]=_[Q];return X}var R$4=32768;function C$4(_){return new T$4({read(){this.push(_),this.push(null)}})}function eY0(_){let $;try{$=new URL(_.url)}catch(z){return q7(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),vN(_,()=>Promise.resolve({}))}let X=$.protocol==="https:",Q=P$4($,_.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),Y=X?q$4:M$4,J=_.keepAlive===void 0?!1:_.keepAlive,Z=Q?new Np(Q):new Y.Agent({keepAlive:J,maxSockets:30,timeout:2000}),K=I$4(_,_.httpModule??Y,Z);return vN(_,K)}function P$4(_,$){let{no_proxy:X}=process.env;if(X?.split(",").some((Y)=>_.host.endsWith(Y)||_.hostname.endsWith(Y)))return;else return $}function I$4(_,$,X){let{hostname:Q,pathname:Y,port:J,protocol:Z,search:K}=new URL(_.url);return function(H){return new Promise((W,V)=>{HB(()=>{let G=C$4(H.body),B={..._.headers};if(H.body.length>R$4)B["content-encoding"]="gzip",G=G.pipe(E$4());let U=Q.startsWith("["),O=$.request({method:"POST",agent:X,headers:B,hostname:U?Q.slice(1,-1):Q,path:`${Y}${K}`,port:J,protocol:Z,ca:_.caCerts},(F)=>{F.on("data",()=>{}),F.on("end",()=>{}),F.setEncoding("utf8");let N=F.headers["retry-after"]??null,w=F.headers["x-sentry-rate-limits"]??null;W({statusCode:F.statusCode,headers:{"retry-after":N,"x-sentry-rate-limits":Array.isArray(w)?w[0]||null:w}})});O.on("error",V),G.pipe(O)})})}}var j$4=new Set(["false","f","n","no","off","0"]),S$4=new Set(["true","t","y","yes","on","1"]);function Dp(_,$){let X=String(_).toLowerCase();if(j$4.has(X))return!1;if(S$4.has(X))return!0;return $?.strict?null:Boolean(_)}import{posix as k$4,sep as b$4}from"path";function J71(_){return _.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function _J0(_=process.argv[1]?CQ0(process.argv[1]):process.cwd(),$=b$4==="\\"){let X=$?J71(_):_;return(Q)=>{if(!Q)return;let Y=$?J71(Q):Q,{dir:J,base:Z,ext:K}=k$4.parse(Y);if(K===".js"||K===".mjs"||K===".cjs")Z=Z.slice(0,K.length*-1);let z=decodeURIComponent(Z);if(!J)J=".";let H=J.lastIndexOf("/node_modules");if(H>-1)return`${J.slice(H+14).replace(/\//g,".")}:${z}`;if(J.startsWith(X)){let W=J.slice(X.length+1).replace(/\//g,".");return W?`${W}:${z}`:z}return z}}function $J0(_){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(v_.SENTRY_RELEASE?.id)return v_.SENTRY_RELEASE.id;let $=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,X=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_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,Q=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 $||X||Q||_}var XJ0=Ql(sQ0(_J0()));var K71=h6(G4(),1),z71=h6(Y8(),1);import*as Z71 from"os";import{threadId as v$4,isMainThread as x$4}from"worker_threads";var f$4=60000;class Lp extends Cl{constructor(_){let $=_.includeServerName===!1?void 0:_.serverName||global.process.env.SENTRY_NAME||Z71.hostname(),X={..._,platform:"node",runtime:{name:"node",version:global.process.version},serverName:$};if(_.openTelemetryInstrumentations)z71.registerInstrumentations({instrumentations:_.openTelemetryInstrumentations});MV(X,"node"),g1.log(`Initializing Sentry: process: ${process.pid}, thread: ${x$4?"main":`worker-${v$4}`}.`);super(X);if(this.getOptions().enableLogs){if(this._logOnExitFlushListener=()=>{Yk(this)},$)this.on("beforeCaptureLog",(Q)=>{Q.attributes={...Q.attributes,"server.address":$}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let _="@sentry/node",$=J9,X=K71.trace.getTracer(_,$);return this._tracer=X,X}async flush(_){if(await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(_)}async close(_){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);let $=await super.close(_);if(this.traceProvider)await this.traceProvider.shutdown();return $}startClientReportTracking(){let _=this.getOptions();if(_.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{R8&&g1.log("Flushing client reports based on interval."),this._flushOutcomes()},_.clientReportFlushInterval??f$4).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_setupIntegrations(){LQ0(),super._setupIntegrations()}_getTraceInfoFromScope(_){if(!_)return[void 0,void 0];return t$1(this,_)}}var W71=h6(ZX0(),1);import*as H71 from"module";function QJ0(){if(!v51())return;if(!v_._sentryEsmLoaderHookRegistered){v_._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:_}=W71.createAddHookMessageChannel();H71.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:_,include:[]},transferList:[_]})}catch(_){g1.warn("Failed to register 'import-in-the-middle' hook",_)}}}function Ap(){return[Fq(),Oq(),wq(),Nq(),lY0(),Dq(),_71(),$71(),cq(),lq(),uq(),mY0(),mq(),iY0(),X71(),dq()]}function YJ0(_={}){return y$4(_,Ap)}function y$4(_={},$){let X=g$4(_,$);if(X.debug===!0)if(R8)g1.enable();else q7(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(X.registerEsmLoaderHooks!==!1)QJ0();if($51(),e9().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:J})=>J===dY0))X.integrations.push(cY0({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));MV(X,"node-core");let Y=new Lp(X);if(e9().setClient(Y),Y.init(),v_._sentryInjectLoaderHookRegister?.(),g1.log(`SDK initialized from ${bk()?"CommonJS":"ESM"}`),Y.startClientReportTracking(),u$4(),h$1(Y),_51(Y),process.env.VERCEL)process.on("SIGTERM",async()=>{await Y.flush(200)});return Y}function Mp(){if(!R8)return;let _=c$1(),$=["SentryContextManager","SentryPropagator"];if(S5())$.push("SentrySpanProcessor");for(let X of $)if(!_.includes(X))g1.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!_.includes("SentrySampler"))g1.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 g$4(_,$){let X=h$4(_.release),Q;if(_.spotlight===!1)Q=!1;else if(typeof _.spotlight==="string")Q=_.spotlight;else{let z=Dp(process.env.SENTRY_SPOTLIGHT,{strict:!0}),H=z===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;Q=_.spotlight===!0?H??!0:z??H}let Y=m$4(_.tracesSampleRate),J={..._,dsn:_.dsn??process.env.SENTRY_DSN,environment:_.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:_.sendClientReports??!0,transport:_.transport??eY0,stackParser:kX0(_.stackParser||XJ0),release:X,tracesSampleRate:Y,spotlight:Q,debug:Dp(_.debug??process.env.SENTRY_DEBUG)},Z=_.integrations,K=_.defaultIntegrations??$(J);return{...J,integrations:zQ0({defaultIntegrations:K,integrations:Z})}}function h$4(_){if(_!==void 0)return _;let $=$J0();if($!==void 0)return $;return}function m$4(_){if(_!==void 0)return _;let $=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!$)return;let X=parseFloat($);return isFinite(X)?X:void 0}function u$4(){if(Dp(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let _=process.env.SENTRY_TRACE,$=process.env.SENTRY_BAGGAGE,X=PN(_,$);e9().setPropagationContext(X)}}function Z$(_,$){_.setAttribute(S_,$)}var JJ0="Http",V71="@opentelemetry_sentry-patched/instrumentation-http",d$4=i4(`${JJ0}.sentry`,(_)=>{return new yq(_)}),c$4=i4(JJ0,(_)=>{let $=new U71.HttpInstrumentation({..._,disableIncomingRequestInstrumentation:!0});try{$._diag=G71.diag.createComponentLogger({namespace:V71}),$.instrumentationName=V71}catch{}return $});function l$4(_,$={}){if(typeof _.spans==="boolean")return _.spans;if($.skipOpenTelemetrySetup)return!1;if(!S5($)&&PB.major>=22)return!1;return!0}var hk=a6((_={})=>{let $=_.spans??!0,X=_.disableIncomingRequestSpans,Q={sessions:_.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:_.sessionFlushingDelayMS,ignoreRequestBody:_.ignoreIncomingRequestBody,maxRequestBodySize:_.maxIncomingRequestBodySize},Y={ignoreIncomingRequests:_.ignoreIncomingRequests,ignoreStaticAssets:_.ignoreStaticAssets,ignoreStatusCodes:_.dropSpansForIncomingRequestStatusCodes,instrumentation:_.instrumentation,onSpanCreated:_.incomingRequestSpanHook},J=Cq(Q),Z=Pq(Y),K=$&&!X;return{name:JJ0,setup(z){let H=z.getOptions();if(K&&S5(H))Z.setup(z)},setupOnce(){let z=E4()?.getOptions()||{},H=l$4(_,z);J.setupOnce();let W={breadcrumbs:_.breadcrumbs,propagateTraceInOutgoingRequests:!H,ignoreOutgoingRequests:_.ignoreOutgoingRequests};if(d$4(W),H){let V=p$4(_);c$4(V)}},processEvent(z){return Z.processEvent(z)}}});function p$4(_={}){return{ignoreOutgoingRequestHook:(X)=>{let Q=Mk(X);if(!Q)return!1;let Y=_.ignoreOutgoingRequests;if(Y?.(Q,X))return!0;return!1},requireParentforOutgoingSpans:!1,requestHook:(X,Q)=>{Z$(X,"auto.http.otel.http"),_.instrumentation?.requestHook?.(X,Q)},responseHook:(X,Q)=>{_.instrumentation?.responseHook?.(X,Q)},applyCustomAttributesOnSpan:(X,Q,Y)=>{_.instrumentation?.applyCustomAttributesOnSpan?.(X,Q,Y)}}}var q71=h6(M71(),1);var T71="NodeFetch",o$4=i4(T71,q71.UndiciInstrumentation,(_)=>{return $54(_)}),s$4=i4(`${T71}.sentry`,hq,(_)=>{return _}),t$4=(_={})=>{return{name:"NodeFetch",setupOnce(){if(_54(_,E4()?.getOptions()))o$4(_);s$4(_)}}},uk=a6(t$4);function e$4(_,$="/"){let X=`${_}`;if(X.endsWith("/")&&$.startsWith("/"))return`${X}${$.slice(1)}`;if(!X.endsWith("/")&&!$.startsWith("/"))return`${X}/${$.slice(1)}`;return`${X}${$}`}function _54(_,$={}){return typeof _.spans==="boolean"?_.spans:!$.skipOpenTelemetrySetup&&S5($)}function $54(_={}){return{requireParentforSpans:!1,ignoreRequestHook:(X)=>{let Q=e$4(X.origin,X.path),Y=_.ignoreOutgoingRequests;return!!(Y&&Q&&Y(Q))},startSpanHook:()=>{return{[S_]:"auto.http.otel.node_fetch"}},requestHook:_.requestHook,responseHook:_.responseHook}}var i71=h6(p71(),1);var o5=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var a71="Express";function R54(_){Z$(_,"auto.http.otel.express");let $=F_(_).data,X=$["express.type"];if(X)_.setAttribute(e_,`${X}.express`);let Q=$["express.name"];if(typeof Q==="string")_.updateName(Q)}function C54(_,$){if(H9()===RJ())return o5&&g1.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),$;if(_.layerType==="request_handler"){let X=_.request,Q=X.method?X.method.toUpperCase():"GET";H9().setTransactionName(`${Q} ${_.route}`)}return $}var n71=i4(a71,()=>new i71.ExpressInstrumentation({requestHook:(_)=>R54(_),spanNameHook:(_,$)=>C54(_,$)})),P54=()=>{return{name:a71,setupOnce(){n71()}}},r71=a6(P54);import*as LJ0 from"diagnostics_channel";var E7=h6(G4(),1),jp=h6(G5(),1),R31=h6(Y8(),1),o7=h6(J$(),1);import A31 from"diagnostics_channel";var F31=h6(z31(),1);var lk=(_)=>{if(typeof _!=="string")throw TypeError("invalid pattern");if(_.length>65536)throw TypeError("pattern is too long")};var f54={"[: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]},pk=(_)=>_.replace(/[[\]\\-]/g,"\\$&"),y54=(_)=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),W31=(_)=>_.join(""),H31=(_,$)=>{let X=$;if(_.charAt(X)!=="[")throw Error("not in a brace expression");let Q=[],Y=[],J=X+1,Z=!1,K=!1,z=!1,H=!1,W=X,V="";_:while(J<_.length){let O=_.charAt(J);if((O==="!"||O==="^")&&J===X+1){H=!0,J++;continue}if(O==="]"&&Z&&!z){W=J+1;break}if(Z=!0,O==="\\"){if(!z){z=!0,J++;continue}}if(O==="["&&!z){for(let[F,[N,w,D]]of Object.entries(f54))if(_.startsWith(F,J)){if(V)return["$.",!1,_.length-X,!0];if(J+=F.length,D)Y.push(N);else Q.push(N);K=K||w;continue _}}if(z=!1,V){if(O>V)Q.push(pk(V)+"-"+pk(O));else if(O===V)Q.push(pk(O));V="",J++;continue}if(_.startsWith("-]",J+1)){Q.push(pk(O+"-")),J+=2;continue}if(_.startsWith("-",J+1)){V=O,J+=2;continue}Q.push(pk(O)),J++}if(W<J)return["",!1,0,!1];if(!Q.length&&!Y.length)return["$.",!1,_.length-X,!0];if(Y.length===0&&Q.length===1&&/^\\?.$/.test(Q[0])&&!H){let O=Q[0].length===2?Q[0].slice(-1):Q[0];return[y54(O),!1,W-X,!1]}let G="["+(H?"^":"")+W31(Q)+"]",B="["+(H?"":"^")+W31(Y)+"]";return[Q.length&&Y.length?"("+G+"|"+B+")":Q.length?G:B,K,W-X,!0]};var IB=(_,{windowsPathsNoEscape:$=!1}={})=>{return $?_.replace(/\[([^\/\\])\]/g,"$1"):_.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var g54=new Set(["!","?","+","*","@"]),V31=(_)=>g54.has(_),h54="(?!(?:^|/)\\.\\.?(?:$|/))",Pp="(?!\\.)",m54=new Set(["[","."]),u54=new Set(["..","."]),d54=new Set("().*{}+?[]^$\\!"),c54=(_)=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),OJ0="[^/]",G31=OJ0+"*?",U31=OJ0+"+?";class DX{type;#_;#$;#Q=!1;#X=[];#J;#w;#V;#G=!1;#K;#H;#Z=!1;constructor(_,$,X={}){if(this.type=_,_)this.#$=!0;if(this.#J=$,this.#_=this.#J?this.#J.#_:this,this.#K=this.#_===this?X:this.#_.#K,this.#V=this.#_===this?[]:this.#_.#V,_==="!"&&!this.#_.#G)this.#V.push(this);this.#w=this.#J?this.#J.#X.length:0}get hasMagic(){if(this.#$!==void 0)return this.#$;for(let _ of this.#X){if(typeof _==="string")continue;if(_.type||_.hasMagic)return this.#$=!0}return this.#$}toString(){if(this.#H!==void 0)return this.#H;if(!this.type)return this.#H=this.#X.map((_)=>String(_)).join("");else return this.#H=this.type+"("+this.#X.map((_)=>String(_)).join("|")+")"}#W(){if(this!==this.#_)throw Error("should only call on root");if(this.#G)return this;this.toString(),this.#G=!0;let _;while(_=this.#V.pop()){if(_.type!=="!")continue;let $=_,X=$.#J;while(X){for(let Q=$.#w+1;!X.type&&Q<X.#X.length;Q++)for(let Y of _.#X){if(typeof Y==="string")throw Error("string part in extglob AST??");Y.copyIn(X.#X[Q])}$=X,X=$.#J}}return this}push(..._){for(let $ of _){if($==="")continue;if(typeof $!=="string"&&!($ instanceof DX&&$.#J===this))throw Error("invalid part: "+$);this.#X.push($)}}toJSON(){let _=this.type===null?this.#X.slice().map(($)=>typeof $==="string"?$:$.toJSON()):[this.type,...this.#X.map(($)=>$.toJSON())];if(this.isStart()&&!this.type)_.unshift([]);if(this.isEnd()&&(this===this.#_||this.#_.#G&&this.#J?.type==="!"))_.push({});return _}isStart(){if(this.#_===this)return!0;if(!this.#J?.isStart())return!1;if(this.#w===0)return!0;let _=this.#J;for(let $=0;$<this.#w;$++){let X=_.#X[$];if(!(X instanceof DX&&X.type==="!"))return!1}return!0}isEnd(){if(this.#_===this)return!0;if(this.#J?.type==="!")return!0;if(!this.#J?.isEnd())return!1;if(!this.type)return this.#J?.isEnd();let _=this.#J?this.#J.#X.length:0;return this.#w===_-1}copyIn(_){if(typeof _==="string")this.push(_);else this.push(_.clone(this))}clone(_){let $=new DX(this.type,_);for(let X of this.#X)$.copyIn(X);return $}static#Y(_,$,X,Q){let Y=!1,J=!1,Z=-1,K=!1;if($.type===null){let G=X,B="";while(G<_.length){let U=_.charAt(G++);if(Y||U==="\\"){Y=!Y,B+=U;continue}if(J){if(G===Z+1){if(U==="^"||U==="!")K=!0}else if(U==="]"&&!(G===Z+2&&K))J=!1;B+=U;continue}else if(U==="["){J=!0,Z=G,K=!1,B+=U;continue}if(!Q.noext&&V31(U)&&_.charAt(G)==="("){$.push(B),B="";let O=new DX(U,$);G=DX.#Y(_,O,G,Q),$.push(O);continue}B+=U}return $.push(B),G}let z=X+1,H=new DX(null,$),W=[],V="";while(z<_.length){let G=_.charAt(z++);if(Y||G==="\\"){Y=!Y,V+=G;continue}if(J){if(z===Z+1){if(G==="^"||G==="!")K=!0}else if(G==="]"&&!(z===Z+2&&K))J=!1;V+=G;continue}else if(G==="["){J=!0,Z=z,K=!1,V+=G;continue}if(V31(G)&&_.charAt(z)==="("){H.push(V),V="";let B=new DX(G,H);H.push(B),z=DX.#Y(_,B,z,Q);continue}if(G==="|"){H.push(V),V="",W.push(H),H=new DX(null,$);continue}if(G===")"){if(V===""&&$.#X.length===0)$.#Z=!0;return H.push(V),V="",$.push(...W,H),z}V+=G}return $.type=null,$.#$=void 0,$.#X=[_.substring(X-1)],z}static fromGlob(_,$={}){let X=new DX(null,void 0,$);return DX.#Y(_,X,0,$),X}toMMPattern(){if(this!==this.#_)return this.#_.toMMPattern();let _=this.toString(),[$,X,Q,Y]=this.toRegExpSource();if(!(Q||this.#$||this.#K.nocase&&!this.#K.nocaseMagicOnly&&_.toUpperCase()!==_.toLowerCase()))return X;let Z=(this.#K.nocase?"i":"")+(Y?"u":"");return Object.assign(new RegExp(`^${$}$`,Z),{_src:$,_glob:_})}get options(){return this.#K}toRegExpSource(_){let $=_??!!this.#K.dot;if(this.#_===this)this.#W();if(!this.type){let K=this.isStart()&&this.isEnd(),z=this.#X.map((G)=>{let[B,U,O,F]=typeof G==="string"?DX.#O(G,this.#$,K):G.toRegExpSource(_);return this.#$=this.#$||O,this.#Q=this.#Q||F,B}).join(""),H="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&u54.has(this.#X[0]))){let B=m54,U=$&&B.has(z.charAt(0))||z.startsWith("\\.")&&B.has(z.charAt(2))||z.startsWith("\\.\\.")&&B.has(z.charAt(4)),O=!$&&!_&&B.has(z.charAt(0));H=U?h54:O?Pp:""}}}let W="";if(this.isEnd()&&this.#_.#G&&this.#J?.type==="!")W="(?:$|\\/)";return[H+z+W,IB(z),this.#$=!!this.#$,this.#Q]}let X=this.type==="*"||this.type==="+",Q=this.type==="!"?"(?:(?!(?:":"(?:",Y=this.#B($);if(this.isStart()&&this.isEnd()&&!Y&&this.type!=="!"){let K=this.toString();return this.#X=[K],this.type=null,this.#$=void 0,[K,IB(this.toString()),!1,!1]}let J=!X||_||$||!Pp?"":this.#B(!0);if(J===Y)J="";if(J)Y=`(?:${Y})(?:${J})*?`;let Z="";if(this.type==="!"&&this.#Z)Z=(this.isStart()&&!$?Pp:"")+U31;else{let K=this.type==="!"?"))"+(this.isStart()&&!$&&!_?Pp:"")+G31+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;Z=Q+Y+K}return[Z,IB(Y),this.#$=!!this.#$,this.#Q]}#B(_){return this.#X.map(($)=>{if(typeof $==="string")throw Error("string type in extglob ast??");let[X,Q,Y,J]=$.toRegExpSource(_);return this.#Q=this.#Q||J,X}).filter(($)=>!(this.isStart()&&this.isEnd())||!!$).join("|")}static#O(_,$,X=!1){let Q=!1,Y="",J=!1;for(let Z=0;Z<_.length;Z++){let K=_.charAt(Z);if(Q){Q=!1,Y+=(d54.has(K)?"\\":"")+K;continue}if(K==="\\"){if(Z===_.length-1)Y+="\\\\";else Q=!0;continue}if(K==="["){let[z,H,W,V]=H31(_,Z);if(W){Y+=z,J=J||H,Z+=W-1,$=$||V;continue}}if(K==="*"){if(X&&_==="*")Y+=U31;else Y+=G31;$=!0;continue}if(K==="?"){Y+=OJ0,$=!0;continue}Y+=c54(K)}return[Y,IB(_),!!$,J]}}var FJ0=(_,{windowsPathsNoEscape:$=!1}={})=>{return $?_.replace(/[?*()[\]]/g,"[$&]"):_.replace(/[?*()[\]\\]/g,"\\$&")};var LX=(_,$,X={})=>{if(lk($),!X.nocomment&&$.charAt(0)==="#")return!1;return new ik($,X).match(_)},l54=/^\*+([^+@!?\*\[\(]*)$/,p54=(_)=>($)=>!$.startsWith(".")&&$.endsWith(_),i54=(_)=>($)=>$.endsWith(_),a54=(_)=>{return _=_.toLowerCase(),($)=>!$.startsWith(".")&&$.toLowerCase().endsWith(_)},n54=(_)=>{return _=_.toLowerCase(),($)=>$.toLowerCase().endsWith(_)},r54=/^\*+\.\*+$/,o54=(_)=>!_.startsWith(".")&&_.includes("."),s54=(_)=>_!=="."&&_!==".."&&_.includes("."),t54=/^\.\*+$/,e54=(_)=>_!=="."&&_!==".."&&_.startsWith("."),_74=/^\*+$/,$74=(_)=>_.length!==0&&!_.startsWith("."),X74=(_)=>_.length!==0&&_!=="."&&_!=="..",Q74=/^\?+([^+@!?\*\[\(]*)?$/,Y74=([_,$=""])=>{let X=w31([_]);if(!$)return X;return $=$.toLowerCase(),(Q)=>X(Q)&&Q.toLowerCase().endsWith($)},J74=([_,$=""])=>{let X=N31([_]);if(!$)return X;return $=$.toLowerCase(),(Q)=>X(Q)&&Q.toLowerCase().endsWith($)},Z74=([_,$=""])=>{let X=N31([_]);return!$?X:(Q)=>X(Q)&&Q.endsWith($)},K74=([_,$=""])=>{let X=w31([_]);return!$?X:(Q)=>X(Q)&&Q.endsWith($)},w31=([_])=>{let $=_.length;return(X)=>X.length===$&&!X.startsWith(".")},N31=([_])=>{let $=_.length;return(X)=>X.length===$&&X!=="."&&X!==".."},D31=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",B31={win32:{sep:"\\"},posix:{sep:"/"}},z74=D31==="win32"?B31.win32.sep:B31.posix.sep;LX.sep=z74;var aZ=Symbol("globstar **");LX.GLOBSTAR=aZ;var W74="[^/]",H74=W74+"*?",V74="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",G74="(?:(?!(?:\\/|^)\\.).)*?",U74=(_,$={})=>(X)=>LX(X,_,$);LX.filter=U74;var iZ=(_,$={})=>Object.assign({},_,$),B74=(_)=>{if(!_||typeof _!=="object"||!Object.keys(_).length)return LX;let $=LX;return Object.assign((Q,Y,J={})=>$(Q,Y,iZ(_,J)),{Minimatch:class extends $.Minimatch{constructor(Y,J={}){super(Y,iZ(_,J))}static defaults(Y){return $.defaults(iZ(_,Y)).Minimatch}},AST:class extends $.AST{constructor(Y,J,Z={}){super(Y,J,iZ(_,Z))}static fromGlob(Y,J={}){return $.AST.fromGlob(Y,iZ(_,J))}},unescape:(Q,Y={})=>$.unescape(Q,iZ(_,Y)),escape:(Q,Y={})=>$.escape(Q,iZ(_,Y)),filter:(Q,Y={})=>$.filter(Q,iZ(_,Y)),defaults:(Q)=>$.defaults(iZ(_,Q)),makeRe:(Q,Y={})=>$.makeRe(Q,iZ(_,Y)),braceExpand:(Q,Y={})=>$.braceExpand(Q,iZ(_,Y)),match:(Q,Y,J={})=>$.match(Q,Y,iZ(_,J)),sep:$.sep,GLOBSTAR:aZ})};LX.defaults=B74;var L31=(_,$={})=>{if(lk(_),$.nobrace||!/\{(?:(?!\{).)*\}/.test(_))return[_];return F31.default(_)};LX.braceExpand=L31;var O74=(_,$={})=>new ik(_,$).makeRe();LX.makeRe=O74;var F74=(_,$,X={})=>{let Q=new ik($,X);if(_=_.filter((Y)=>Q.match(Y)),Q.options.nonull&&!_.length)_.push($);return _};LX.match=F74;var O31=/[?*]|[+@!]\(.*?\)|\[|\]/,w74=(_)=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class ik{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(_,$={}){if(lk(_),$=$||{},this.options=$,this.pattern=_,this.platform=$.platform||D31,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!$.windowsPathsNoEscape||$.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!$.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!$.nonegate,this.comment=!1,this.empty=!1,this.partial=!!$.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=$.windowsNoMagicRoot!==void 0?$.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 _ of this.set)for(let $ of _)if(typeof $!=="string")return!0;return!1}debug(..._){}make(){let _=this.pattern,$=this.options;if(!$.nocomment&&_.charAt(0)==="#"){this.comment=!0;return}if(!_){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],$.debug)this.debug=(...Y)=>console.error(...Y);this.debug(this.pattern,this.globSet);let X=this.globSet.map((Y)=>this.slashSplit(Y));this.globParts=this.preprocess(X),this.debug(this.pattern,this.globParts);let Q=this.globParts.map((Y,J,Z)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=Y[0]===""&&Y[1]===""&&(Y[2]==="?"||!O31.test(Y[2]))&&!O31.test(Y[3]),z=/^[a-z]:/i.test(Y[0]);if(K)return[...Y.slice(0,4),...Y.slice(4).map((H)=>this.parse(H))];else if(z)return[Y[0],...Y.slice(1).map((H)=>this.parse(H))]}return Y.map((K)=>this.parse(K))});if(this.debug(this.pattern,Q),this.set=Q.filter((Y)=>Y.indexOf(!1)===-1),this.isWindows)for(let Y=0;Y<this.set.length;Y++){let J=this.set[Y];if(J[0]===""&&J[1]===""&&this.globParts[Y][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(_){if(this.options.noglobstar){for(let X=0;X<_.length;X++)for(let Q=0;Q<_[X].length;Q++)if(_[X][Q]==="**")_[X][Q]="*"}let{optimizationLevel:$=1}=this.options;if($>=2)_=this.firstPhasePreProcess(_),_=this.secondPhasePreProcess(_);else if($>=1)_=this.levelOneOptimize(_);else _=this.adjascentGlobstarOptimize(_);return _}adjascentGlobstarOptimize(_){return _.map(($)=>{let X=-1;while((X=$.indexOf("**",X+1))!==-1){let Q=X;while($[Q+1]==="**")Q++;if(Q!==X)$.splice(X,Q-X)}return $})}levelOneOptimize(_){return _.map(($)=>{return $=$.reduce((X,Q)=>{let Y=X[X.length-1];if(Q==="**"&&Y==="**")return X;if(Q===".."){if(Y&&Y!==".."&&Y!=="."&&Y!=="**")return X.pop(),X}return X.push(Q),X},[]),$.length===0?[""]:$})}levelTwoFileOptimize(_){if(!Array.isArray(_))_=this.slashSplit(_);let $=!1;do{if($=!1,!this.preserveMultipleSlashes){for(let Q=1;Q<_.length-1;Q++){let Y=_[Q];if(Q===1&&Y===""&&_[0]==="")continue;if(Y==="."||Y==="")$=!0,_.splice(Q,1),Q--}if(_[0]==="."&&_.length===2&&(_[1]==="."||_[1]===""))$=!0,_.pop()}let X=0;while((X=_.indexOf("..",X+1))!==-1){let Q=_[X-1];if(Q&&Q!=="."&&Q!==".."&&Q!=="**")$=!0,_.splice(X-1,2),X-=2}}while($);return _.length===0?[""]:_}firstPhasePreProcess(_){let $=!1;do{$=!1;for(let X of _){let Q=-1;while((Q=X.indexOf("**",Q+1))!==-1){let J=Q;while(X[J+1]==="**")J++;if(J>Q)X.splice(Q+1,J-Q);let Z=X[Q+1],K=X[Q+2],z=X[Q+3];if(Z!=="..")continue;if(!K||K==="."||K===".."||!z||z==="."||z==="..")continue;$=!0,X.splice(Q,1);let H=X.slice(0);H[Q]="**",_.push(H),Q--}if(!this.preserveMultipleSlashes){for(let J=1;J<X.length-1;J++){let Z=X[J];if(J===1&&Z===""&&X[0]==="")continue;if(Z==="."||Z==="")$=!0,X.splice(J,1),J--}if(X[0]==="."&&X.length===2&&(X[1]==="."||X[1]===""))$=!0,X.pop()}let Y=0;while((Y=X.indexOf("..",Y+1))!==-1){let J=X[Y-1];if(J&&J!=="."&&J!==".."&&J!=="**"){$=!0;let K=Y===1&&X[Y+1]==="**"?["."]:[];if(X.splice(Y-1,2,...K),X.length===0)X.push("");Y-=2}}}}while($);return _}secondPhasePreProcess(_){for(let $=0;$<_.length-1;$++)for(let X=$+1;X<_.length;X++){let Q=this.partsMatch(_[$],_[X],!this.preserveMultipleSlashes);if(Q){_[$]=[],_[X]=Q;break}}return _.filter(($)=>$.length)}partsMatch(_,$,X=!1){let Q=0,Y=0,J=[],Z="";while(Q<_.length&&Y<$.length)if(_[Q]===$[Y])J.push(Z==="b"?$[Y]:_[Q]),Q++,Y++;else if(X&&_[Q]==="**"&&$[Y]===_[Q+1])J.push(_[Q]),Q++;else if(X&&$[Y]==="**"&&_[Q]===$[Y+1])J.push($[Y]),Y++;else if(_[Q]==="*"&&$[Y]&&(this.options.dot||!$[Y].startsWith("."))&&$[Y]!=="**"){if(Z==="b")return!1;Z="a",J.push(_[Q]),Q++,Y++}else if($[Y]==="*"&&_[Q]&&(this.options.dot||!_[Q].startsWith("."))&&_[Q]!=="**"){if(Z==="a")return!1;Z="b",J.push($[Y]),Q++,Y++}else return!1;return _.length===$.length&&J}parseNegate(){if(this.nonegate)return;let _=this.pattern,$=!1,X=0;for(let Q=0;Q<_.length&&_.charAt(Q)==="!";Q++)$=!$,X++;if(X)this.pattern=_.slice(X);this.negate=$}matchOne(_,$,X=!1){let Q=this.options;if(this.isWindows){let U=typeof _[0]==="string"&&/^[a-z]:$/i.test(_[0]),O=!U&&_[0]===""&&_[1]===""&&_[2]==="?"&&/^[a-z]:$/i.test(_[3]),F=typeof $[0]==="string"&&/^[a-z]:$/i.test($[0]),N=!F&&$[0]===""&&$[1]===""&&$[2]==="?"&&typeof $[3]==="string"&&/^[a-z]:$/i.test($[3]),w=O?3:U?0:void 0,D=N?3:F?0:void 0;if(typeof w==="number"&&typeof D==="number"){let[A,T]=[_[w],$[D]];if(A.toLowerCase()===T.toLowerCase()){if($[D]=A,D>w)$=$.slice(D);else if(w>D)_=_.slice(w)}}}let{optimizationLevel:Y=1}=this.options;if(Y>=2)_=this.levelTwoFileOptimize(_);this.debug("matchOne",this,{file:_,pattern:$}),this.debug("matchOne",_.length,$.length);for(var J=0,Z=0,K=_.length,z=$.length;J<K&&Z<z;J++,Z++){this.debug("matchOne loop");var H=$[Z],W=_[J];if(this.debug($,H,W),H===!1)return!1;if(H===aZ){this.debug("GLOBSTAR",[$,H,W]);var V=J,G=Z+1;if(G===z){this.debug("** at the end");for(;J<K;J++)if(_[J]==="."||_[J]===".."||!Q.dot&&_[J].charAt(0)===".")return!1;return!0}while(V<K){var B=_[V];if(this.debug(`
890
890
  globstar while`,_,V,$,G,B),this.matchOne(_.slice(V),$.slice(G),X))return this.debug("globstar found match!",V,K,B),!0;else{if(B==="."||B===".."||!Q.dot&&B.charAt(0)==="."){this.debug("dot detected!",_,V,$,G);break}this.debug("globstar swallow a segment, and continue"),V++}}if(X){if(this.debug(`
891
- >>> no match, partial?`,_,V,$,G),V===K)return!0}return!1}let U;if(typeof H==="string")U=W===H,this.debug("string match",H,W,U);else U=H.test(W),this.debug("pattern match",H,W,U);if(!U)return!1}if(J===K&&Z===z)return!0;else if(J===K)return X;else if(Z===z)return J===K-1&&_[J]==="";else throw Error("wtf?")}braceExpand(){return L31(this.pattern,this.options)}parse(_){lk(_);let $=this.options;if(_==="**")return aZ;if(_==="")return"";let X,Q=null;if(X=_.match(_74))Q=$.dot?X74:$74;else if(X=_.match(l54))Q=($.nocase?$.dot?n54:a54:$.dot?i54:p54)(X[1]);else if(X=_.match(Q74))Q=($.nocase?$.dot?J74:Y74:$.dot?Z74:K74)(X);else if(X=_.match(r54))Q=$.dot?s54:o54;else if(X=_.match(t54))Q=e54;let Y=DX.fromGlob(_,this.options).toMMPattern();if(Q&&typeof Y==="object")Reflect.defineProperty(Y,"test",{value:Q});return Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let _=this.set;if(!_.length)return this.regexp=!1,this.regexp;let $=this.options,X=$.noglobstar?H74:$.dot?V74:G74,Q=new Set($.nocase?["i"]:[]),Y=_.map((K)=>{let z=K.map((H)=>{if(H instanceof RegExp)for(let W of H.flags.split(""))Q.add(W);return typeof H==="string"?w74(H):H===aZ?aZ:H._src});return z.forEach((H,W)=>{let V=z[W+1],G=z[W-1];if(H!==aZ||G===aZ)return;if(G===void 0)if(V!==void 0&&V!==aZ)z[W+1]="(?:\\/|"+X+"\\/)?"+V;else z[W]=X;else if(V===void 0)z[W-1]=G+"(?:\\/|"+X+")?";else if(V!==aZ)z[W-1]=G+"(?:\\/|\\/"+X+"\\/)"+V,z[W+1]=aZ}),z.filter((H)=>H!==aZ).join("/")}).join("|"),[J,Z]=_.length>1?["(?:",")"]:["",""];if(Y="^"+J+Y+Z+"$",this.negate)Y="^(?!"+Y+").+$";try{this.regexp=new RegExp(Y,[...Q].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(_){if(this.preserveMultipleSlashes)return _.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(_))return["",..._.split(/\/+/)];else return _.split(/\/+/)}match(_,$=this.partial){if(this.debug("match",_,this.pattern),this.comment)return!1;if(this.empty)return _==="";if(_==="/"&&$)return!0;let X=this.options;if(this.isWindows)_=_.split("\\").join("/");let Q=this.slashSplit(_);this.debug(this.pattern,"split",Q);let Y=this.set;this.debug(this.pattern,"set",Y);let J=Q[Q.length-1];if(!J)for(let Z=Q.length-2;!J&&Z>=0;Z--)J=Q[Z];for(let Z=0;Z<Y.length;Z++){let K=Y[Z],z=Q;if(X.matchBase&&K.length===1)z=[J];if(this.matchOne(z,K,$)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(_){return LX.defaults(_).Minimatch}}LX.AST=DX;LX.Minimatch=ik;LX.escape=FJ0;LX.unescape=IB;var M31="@fastify/otel",D74="0.8.0",L74=">=4.0.0 <6",q31=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],a$={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},jB={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},IV="anonymous",dQ=Symbol("fastify otel instance"),SB=Symbol("fastify otel request spans"),ak=Symbol("fastify otel request context"),T31=Symbol("fastify otel addhook original"),E31=Symbol("fastify otel setnotfound original"),Ip=Symbol("fastify otel ignore path");class wJ0 extends R31.InstrumentationBase{constructor(_){super(M31,D74,_);if(this.servername=_?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[Ip]=null,this._logger=E7.diag.createComponentLogger({namespace:M31}),_?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let $=_?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof $!=="string"||$.length===0)&&typeof $!=="function")throw TypeError("ignorePaths must be a string or a function");let X=LX;this[Ip]=(Q)=>{if(typeof $==="function")return $(Q);else return X(Q.url,$)}}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let _=this.plugin();this._handleInitialization=($)=>{$.fastify.register(_)},A31.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){if(this._handleInitialization)A31.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0;return super.disable()}init(){return[]}plugin(){let _=this;return $[Symbol.for("skip-override")]=!0,$[Symbol.for("fastify.display-name")]="@fastify/otel",$[Symbol.for("plugin-meta")]={fastify:L74,name:"@fastify/otel"},$;function $(X,Q,Y){X.decorate(dQ,_),X.decorate(T31,X.addHook),X.decorate(E31,X.setNotFoundHandler),X.decorateRequest("opentelemetry",function(){let V=this[ak];return{span:this[SB],tracer:_.tracer,context:V,inject:(B,U)=>{return E7.propagation.inject(V,B,U)},extract:(B,U)=>{return E7.propagation.extract(V,B,U)}}}),X.decorateRequest(SB,null),X.decorateRequest(ak,null),X.addHook("onRoute",function(W){if(_[Ip]?.(W)===!0){_._logger.debug(`Ignoring route instrumentation ${W.method} ${W.url} because it matches the ignore path`);return}for(let V of q31)if(W[V]!=null){let G=W[V];if(typeof G==="function")W[V]=H(G,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[a$.FASTIFY_TYPE]:jB.ROUTE,[o7.ATTR_HTTP_ROUTE]:W.url,[a$.HOOK_CALLBACK_NAME]:G.name?.length>0?G.name:IV});else if(Array.isArray(G)){let B=[];for(let U of G)B.push(H(U,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[a$.FASTIFY_TYPE]:jB.ROUTE,[o7.ATTR_HTTP_ROUTE]:W.url,[a$.HOOK_CALLBACK_NAME]:U.name?.length>0?U.name:IV}));W[V]=B}}if(W.onSend!=null)W.onSend=Array.isArray(W.onSend)?[...W.onSend,J]:[W.onSend,J];else W.onSend=J;if(W.onError!=null)W.onError=Array.isArray(W.onError)?[...W.onError,Z]:[W.onError,Z];else W.onError=Z;W.handler=H(W.handler,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - route-handler`,[a$.FASTIFY_TYPE]:jB.HANDLER,[o7.ATTR_HTTP_ROUTE]:W.url,[a$.HOOK_CALLBACK_NAME]:W.handler.name.length>0?W.handler.name:IV})}),X.addHook("onRequest",function(W,V,G){if(this[dQ].isEnabled()===!1)return G();else if(this[dQ][Ip]?.({url:W.url,method:W.method})===!0)return this[dQ]._logger.debug(`Ignoring request ${W.method} ${W.url} because it matches the ignore path`),G();let B=E7.context.active();if(E7.trace.getSpan(B)==null)B=E7.propagation.extract(B,W.headers);let U=jp.getRPCMetadata(B);if(W.routeOptions.url!=null&&U?.type===jp.RPCType.HTTP)U.route=W.routeOptions.url;let O=this[dQ].tracer.startSpan("request",{attributes:{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.ROOT]:"@fastify/otel",[o7.ATTR_HTTP_ROUTE]:W.url,[o7.ATTR_HTTP_REQUEST_METHOD]:W.method}},B);W[ak]=E7.trace.setSpan(B,O),W[SB]=O,E7.context.with(W[ak],()=>{G()})}),X.addHook("onResponse",function(W,V,G){let B=W[SB];if(B!=null)B.setStatus({code:E7.SpanStatusCode.OK,message:"OK"}),B.setAttributes({[o7.ATTR_HTTP_RESPONSE_STATUS_CODE]:404}),B.end();W[SB]=null,G()}),X.addHook=K,X.setNotFoundHandler=z,Y();function J(W,V,G,B){let U=W[SB];if(U!=null){if(V.statusCode<500)U.setStatus({code:E7.SpanStatusCode.OK,message:"OK"});U.setAttributes({[o7.ATTR_HTTP_RESPONSE_STATUS_CODE]:V.statusCode}),U.end()}W[SB]=null,B(null,G)}function Z(W,V,G,B){let U=W[SB];if(U!=null)U.setStatus({code:E7.SpanStatusCode.ERROR,message:G.message}),U.recordException(G);B()}function K(W,V){let G=this[T31];if(q31.includes(W))return G.call(this,W,H(V,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - ${W}`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:IV}));else return G.call(this,W,V)}function z(W,V){let G=this[E31];if(typeof W==="function")V=H(W,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:W.name?.length>0?W.name:IV}),G.call(this,V);else{if(W.preValidation!=null)W.preValidation=H(W.preValidation,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:W.preValidation.name?.length>0?W.preValidation.name:IV});if(W.preHandler!=null)W.preHandler=H(W.preHandler,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:W.preHandler.name?.length>0?W.preHandler.name:IV});V=H(V,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:IV}),G.call(this,W,V)}}function H(W,V={}){return function(...B){let U=this[dQ],[O]=B;if(U.isEnabled()===!1)return W.call(this,...B);let F=O[ak]??E7.context.active(),N=U.tracer.startSpan(`handler - ${W.name?.length>0?W.name:this.pluginName??IV}`,{attributes:V},F);return E7.context.with(E7.trace.setSpan(F,N),function(){try{let w=W.call(this,...B);if(typeof w?.then==="function")return w.then((D)=>{return N.end(),D},(D)=>{return N.setStatus({code:E7.SpanStatusCode.ERROR,message:D.message}),N.recordException(D),N.end(),Promise.reject(D)});return N.end(),w}catch(w){throw N.setStatus({code:E7.SpanStatusCode.ERROR,message:w.message}),N.recordException(w),N.end(),w}},this)}}}}}var aK=h6(G4(),1),kp=h6(G5(),1),nN=h6(Y8(),1),S31=h6(J$(),1);var jV;(function(_){_.FASTIFY_NAME="fastify.name";let X="fastify.type";_.FASTIFY_TYPE=X;let Q="hook.name";_.HOOK_NAME=Q;let Y="plugin.name";_.PLUGIN_NAME=Y})(jV||(jV={}));var nk;(function(_){_.MIDDLEWARE="middleware";let X="request_handler";_.REQUEST_HANDLER=X})(nk||(nk={}));var rk;(function(_){_.MIDDLEWARE="middleware";let X="request handler";_.REQUEST_HANDLER=X})(rk||(rk={}));var P31=h6(G4(),1);var ok=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function NJ0(_,$,X,Q={}){let Y=$.startSpan(X,{attributes:Q}),J=_[ok]||[];return J.push(Y),Object.defineProperty(_,ok,{enumerable:!1,configurable:!0,value:J}),Y}function Sp(_,$){let X=_[ok]||[];if(!X.length)return;X.forEach((Q)=>{if($)Q.setStatus({code:P31.SpanStatusCode.ERROR,message:$.message}),Q.recordException($);Q.end()}),delete _[ok]}function I31(_,$,X){let Q,Y=void 0;try{if(Y=_(),C31(Y))Y.then((J)=>$(void 0,J),(J)=>$(J))}catch(J){Q=J}finally{if(!C31(Y)){if($(Q,Y),Q)throw Q}return Y}}function C31(_){return typeof _==="object"&&_&&typeof Object.getOwnPropertyDescriptor(_,"then")?.value==="function"||!1}var A74="0.1.0",M74="@sentry/instrumentation-fastify-v3",j31="anonymous",q74=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]);class DJ0 extends nN.InstrumentationBase{constructor(_={}){super(M74,A74,_)}init(){return[new nN.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],(_)=>{return this._patchConstructor(_)})]}_hookOnRequest(){let _=this;return function(X,Q,Y){if(!_.isEnabled())return Y();_._wrap(Q,"send",_._patchSend());let J=X,Z=kp.getRPCMetadata(aK.context.active()),K=J.routeOptions?J.routeOptions.url:X.routerPath;if(K&&Z?.type===kp.RPCType.HTTP)Z.route=K;let z=X.method||"GET";H9().setTransactionName(`${z} ${K}`),Y()}}_wrapHandler(_,$,X,Q){let Y=this;return this._diag.debug("Patching fastify route.handler function"),function(...J){if(!Y.isEnabled())return X.apply(this,J);let Z=X.name||_||j31,K=`${rk.MIDDLEWARE} - ${Z}`,z=J[1],H=NJ0(z,Y.tracer,K,{[jV.FASTIFY_TYPE]:nk.MIDDLEWARE,[jV.PLUGIN_NAME]:_,[jV.HOOK_NAME]:$}),W=Q&&J[J.length-1];if(W)J[J.length-1]=function(...V){Sp(z),W.apply(this,V)};return aK.context.with(aK.trace.setSpan(aK.context.active(),H),()=>{return I31(()=>{return X.apply(this,J)},(V)=>{if(V instanceof Error)H.setStatus({code:aK.SpanStatusCode.ERROR,message:V.message}),H.recordException(V);if(!Q)Sp(z)})})}}_wrapAddHook(){let _=this;return this._diag.debug("Patching fastify server.addHook function"),function($){return function(...Q){let Y=Q[0],J=Q[1],Z=this.pluginName;if(!q74.has(Y))return $.apply(this,Q);let K=typeof Q[Q.length-1]==="function"&&J.constructor.name!=="AsyncFunction";return $.apply(this,[Y,_._wrapHandler(Z,Y,J,K)])}}}_patchConstructor(_){let $=this;function X(...Q){let Y=_.fastify.apply(this,Q);return Y.addHook("onRequest",$._hookOnRequest()),Y.addHook("preHandler",$._hookPreHandler()),T74(),$._wrap(Y,"addHook",$._wrapAddHook()),Y}if(_.errorCodes!==void 0)X.errorCodes=_.errorCodes;return X.fastify=X,X.default=X,X}_patchSend(){let _=this;return this._diag.debug("Patching fastify reply.send function"),function(X){return function(...Y){let J=Y[0];if(!_.isEnabled())return X.apply(this,Y);return nN.safeExecuteInTheMiddle(()=>{return X.apply(this,Y)},(Z)=>{if(!Z&&J instanceof Error)Z=J;Sp(this,Z)})}}}_hookPreHandler(){let _=this;return this._diag.debug("Patching fastify preHandler function"),function(X,Q,Y){if(!_.isEnabled())return Y();let J=X,Z=J.routeOptions?.handler||J.context?.handler,K=Z?.name.startsWith("bound ")?Z.name.substring(6):Z?.name,z=`${rk.REQUEST_HANDLER} - ${K||this.pluginName||j31}`,H={[jV.PLUGIN_NAME]:this.pluginName,[jV.FASTIFY_TYPE]:nk.REQUEST_HANDLER,[S31.SEMATTRS_HTTP_ROUTE]:J.routeOptions?J.routeOptions.url:X.routerPath};if(K)H[jV.FASTIFY_NAME]=K;let W=NJ0(Q,_.tracer,z,H);k31(W);let{requestHook:V}=_.getConfig();if(V)nN.safeExecuteInTheMiddle(()=>V(W,{request:X}),(G)=>{if(G)_._diag.error("request hook failed",G)},!0);return aK.context.with(aK.trace.setSpan(aK.context.active(),W),()=>{Y()})}}}function T74(){let _=E4();if(_)_.on("spanStart",($)=>{k31($)})}function k31(_){let $=F_(_).data,X=$["fastify.type"];if($[e_]||!X)return;_.setAttributes({[S_]:"auto.http.otel.fastify",[e_]:`${X}.fastify`});let Q=$["fastify.name"]||$["plugin.name"]||$["hook.name"];if(typeof Q==="string"){let Y=Q.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");_.updateName(Y)}}var bp="Fastify",v31=i4(`${bp}.v3`,()=>new DJ0);function E74(){let _=E4();if(!_)return;else return _.getIntegrationByName(bp)}function b31(_,$,X,Q){let Y=E74()?.getShouldHandleError()||y31;if(Q==="diagnostics-channel")this.diagnosticsChannelExists=!0;if(this.diagnosticsChannelExists&&Q==="onError-hook"){o5&&g1.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}if(Y(_,$,X))J8(_,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var x31=i4(`${bp}.v5`,()=>{let _=new wJ0,$=_.plugin();return LJ0.subscribe("fastify.initialization",(X)=>{let Q=X.fastify;Q?.register($).after((Y)=>{if(Y)o5&&g1.error("Failed to setup Fastify instrumentation",Y);else if(C74(),Q)P74(Q)})}),LJ0.subscribe("tracing:fastify.request.handler:error",(X)=>{let{error:Q,request:Y,reply:J}=X;b31.call(b31,Q,Y,J,"diagnostics-channel")}),_}),R74=({shouldHandleError:_})=>{let $;return{name:bp,setupOnce(){$=_||y31,v31(),x31()},getShouldHandleError(){return $},setShouldHandleError(X){$=X}}},f31=a6((_={})=>R74(_));function y31(_,$,X){let Q=X.statusCode;return Q>=500||Q<=299}function g31(_){let $=F_(_),X=$.description,Q=$.data,Y=Q["fastify.type"],J=Y==="hook",Z=Y===X?.startsWith("handler -"),K=X==="request"||Y==="request-handler";if(Q[e_]||!Z&&!K&&!J)return;let z=J?"hook":Z?"middleware":K?"request-handler":"<unknown>";_.setAttributes({[S_]:"auto.http.otel.fastify",[e_]:`${z}.fastify`});let H=Q["fastify.name"]||Q["plugin.name"]||Q["hook.name"];if(typeof H==="string"){let W=H.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");_.updateName(W)}}function C74(){let _=E4();if(_)_.on("spanStart",($)=>{g31($)})}function P74(_){_.addHook("onRequest",async($,X)=>{if($.opentelemetry){let{span:J}=$.opentelemetry();if(J)g31(J)}let Q=$.routeOptions?.url,Y=$.method||"GET";H9().setTransactionName(`${Y} ${Q}`)})}var AX1=h6(G4(),1),MX1=h6(LX1(),1);var qX1="Graphql",TX1=i4(qX1,MX1.GraphQLInstrumentation,(_)=>{let $=RX1(_);return{...$,responseHook(X,Q){if(Z$(X,"auto.graphql.otel.graphql"),Q.errors?.length&&!F_(X).status)X.setStatus({code:AX1.SpanStatusCode.ERROR});let J=F_(X).data,Z=J["graphql.operation.type"],K=J["graphql.operation.name"];if($.useOperationNameForRootSpan&&Z){let z=n5(X),W=F_(z).data[xq]||[],V=K?`${Z} ${K}`:`${Z}`;if(Array.isArray(W))W.push(V),z.setAttribute(xq,W);else if(typeof W==="string")z.setAttribute(xq,[W,V]);else z.setAttribute(xq,V);if(!F_(z).data["original-description"])z.setAttribute("original-description",F_(z).description);z.updateName(`${F_(z).data["original-description"]} (${Y34(W)})`)}}}}),Q34=(_={})=>{return{name:qX1,setupOnce(){TX1(RX1(_))}}},EX1=a6(Q34);function RX1(_){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,..._}}function Y34(_){if(Array.isArray(_)){let $=_.slice().sort();if($.length<=5)return $.join(", ");else return`${$.slice(0,5).join(", ")}, +${$.length-5}`}return`${_}`}var rX1=h6(nX1(),1);var oX1="Kafka",sX1=i4(oX1,()=>new rX1.KafkaJsInstrumentation({consumerHook(_){Z$(_,"auto.kafkajs.otel.consumer")},producerHook(_){Z$(_,"auto.kafkajs.otel.producer")}})),T34=()=>{return{name:oX1,setupOnce(){sX1()}}},tX1=a6(T34);var HQ1=h6(WQ1(),1);var VQ1="LruMemoizer",GQ1=i4(VQ1,()=>new HQ1.LruMemoizerInstrumentation),P34=()=>{return{name:VQ1,setupOnce(){GQ1()}}},UQ1=a6(P34);var jQ1=h6(IQ1(),1);var SQ1="Mongo",kQ1=i4(SQ1,()=>new jQ1.MongoDBInstrumentation({dbStatementSerializer:l34,responseHook(_){Z$(_,"auto.db.otel.mongo")}}));function l34(_){let $=bJ0(_);return JSON.stringify($)}function bJ0(_){if(Array.isArray(_))return _.map(($)=>bJ0($));if(p34(_)){let $={};return Object.entries(_).map(([X,Q])=>[X,bJ0(Q)]).reduce((X,Q)=>{if(a34(Q))X[Q[0]]=Q[1];return X},$)}return"?"}function p34(_){return typeof _==="object"&&_!==null&&!i34(_)}function i34(_){let $=!1;if(typeof Buffer<"u")$=Buffer.isBuffer(_);return $}function a34(_){return Array.isArray(_)}var n34=()=>{return{name:SQ1,setupOnce(){kQ1()}}},bQ1=a6(n34);var eQ1=h6(tQ1(),1);var _Y1="Mongoose",$Y1=i4(_Y1,()=>new eQ1.MongooseInstrumentation({responseHook(_){Z$(_,"auto.db.otel.mongoose")}})),OX4=()=>{return{name:_Y1,setupOnce(){$Y1()}}},XY1=a6(OX4);var DY1=h6(NY1(),1);var LY1="Mysql",AY1=i4(LY1,()=>new DY1.MySQLInstrumentation({})),mX4=()=>{return{name:LY1,setupOnce(){AY1()}}},MY1=a6(mX4);var uY1=h6(mY1(),1);var dY1="Mysql2",cY1=i4(dY1,()=>new uY1.MySQL2Instrumentation({responseHook(_){Z$(_,"auto.db.otel.mysql2")}})),BQ4=()=>{return{name:dY1,setupOnce(){cY1()}}},lY1=a6(BQ4);var cJ1=h6(WJ1(),1),lJ1=h6(gJ1(),1);var oQ4=["get","set","setex"],$Z0=["get","mget"],sQ4=["set","setex"];function Zb(_,$){return _.includes($.toLowerCase())}function XZ0(_){if(Zb($Z0,_))return"cache.get";else if(Zb(sQ4,_))return"cache.put";else return}function tQ4(_,$){return $.some((X)=>_.startsWith(X))}function mJ1(_,$){try{if($.length===0)return;let X=(Y)=>{if(typeof Y==="string"||typeof Y==="number"||Buffer.isBuffer(Y))return[Y.toString()];else if(Array.isArray(Y))return hJ1(Y.map((J)=>X(J)));else return["<unknown>"]},Q=$[0];if(Zb(oQ4,_)&&Q!=null)return X(Q);return hJ1($.map((Y)=>X(Y)))}catch{return}}function uJ1(_,$,X){if(!XZ0(_))return!1;for(let Q of $)if(tQ4(Q,X))return!0;return!1}function dJ1(_){let $=(X)=>{try{if(Buffer.isBuffer(X))return X.byteLength;else if(typeof X==="string")return X.length;else if(typeof X==="number")return X.toString().length;else if(X===null||X===void 0)return 0;return JSON.stringify(X).length}catch{return}};return Array.isArray(_)?_.reduce((X,Q)=>{let Y=$(Q);return typeof Y==="number"?X!==void 0?X+Y:Y:X},0):$(_)}function hJ1(_){let $=[],X=(Q)=>{Q.forEach((Y)=>{if(Array.isArray(Y))X(Y);else $.push(Y)})};return X(_),$}var np="Redis",Kb={},pJ1=(_,$,X,Q)=>{_.setAttribute(S_,"auto.db.otel.redis");let Y=mJ1($,X),J=XZ0($);if(!Y||!J||!Kb.cachePrefixes||!uJ1($,Y,Kb.cachePrefixes))return;let Z=F_(_).data["net.peer.name"],K=F_(_).data["net.peer.port"];if(K&&Z)_.setAttributes({"network.peer.address":Z,"network.peer.port":K});let z=dJ1(Q);if(z)_.setAttribute(iX0,z);if(Zb($Z0,$)&&z!==void 0)_.setAttribute(lX0,z>0);_.setAttributes({[e_]:J,[pX0]:Y});let H=Y.join(", ");_.updateName(Kb.maxCacheKeyLength?$B(H,Kb.maxCacheKeyLength):H)},eQ4=i4(`${np}.IORedis`,()=>{return new cJ1.IORedisInstrumentation({responseHook:pJ1})}),_Y4=i4(`${np}.Redis`,()=>{return new lJ1.RedisInstrumentation({responseHook:pJ1})}),iJ1=Object.assign(()=>{eQ4(),_Y4()},{id:np}),$Y4=(_={})=>{return{name:np,setupOnce(){Kb=_,iJ1()}}},aJ1=a6($Y4);var qZ1=h6(MZ1(),1);var TZ1="Postgres",EZ1=i4(TZ1,()=>new qZ1.PgInstrumentation({requireParentSpan:!0,requestHook(_){Z$(_,"auto.db.otel.postgres")}})),aY4=()=>{return{name:TZ1,setupOnce(){EZ1()}}},RZ1=a6(aY4);var XT=h6(G4(),1),vV=h6(Y8(),1),R7=h6(J$(),1);var $i="PostgresJs",CZ1=[">=3.0.0 <4"],nY4=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,_i=Symbol("sentryPostgresConnectionContext"),WZ0=Symbol.for("sentry.instrumented.postgresjs"),PZ1=Symbol.for("sentry.query.from.instrumented.sql"),IZ1=i4($i,(_)=>new jZ1({requireParentSpan:_?.requireParentSpan??!0,requestHook:_?.requestHook}));class jZ1 extends vV.InstrumentationBase{constructor(_){super("sentry-postgres-js",J9,_)}init(){let _=new vV.InstrumentationNodeModuleDefinition("postgres",CZ1,($)=>{try{return this._patchPostgres($)}catch(X){return o5&&g1.error("Failed to patch postgres module:",X),$}},($)=>$);return["src","cf/src","cjs/src"].forEach(($)=>{_.files.push(new vV.InstrumentationNodeModuleFile(`postgres/${$}/query.js`,CZ1,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),_}_patchPostgres(_){let $=typeof _==="function",X=$?_:_.default;if(typeof X!=="function")return o5&&g1.warn("postgres module does not export a function. Skipping instrumentation."),_;let Q=this,Y=function(...J){let Z=Reflect.construct(X,J);if(!Z||typeof Z!=="function")return o5&&g1.warn("postgres() did not return a valid instance"),Z;return Q._instrumentSqlInstance(Z)};Object.setPrototypeOf(Y,X),Object.setPrototypeOf(Y.prototype,X.prototype);for(let J of Object.getOwnPropertyNames(X))if(!["length","name","prototype"].includes(J)){let Z=Object.getOwnPropertyDescriptor(X,J);if(Z)Object.defineProperty(Y,J,Z)}if($)return Y;else return Nk(_,"default",Y),_}_wrapQueryMethod(_,$,X){let Q=this;return function(...Y){let J=Reflect.apply(_,$,Y);if(J&&typeof J==="object"&&"handle"in J)Q._wrapSingleQueryHandle(J,X);return J}}_wrapCallbackMethod(_,$,X){let Q=this;return function(...Y){let J=X[_i];if(typeof Y[Y.length-1]!=="function"){let W=Reflect.apply(_,$,Y);if(W&&typeof W.then==="function")return W.then((V)=>{return Q._instrumentSqlInstance(V,J)});return W}let K=Y.length===1?Y[0]:Y[1],z=function(W){let V=Q._instrumentSqlInstance(W,J);return K(V)},H=Y.length===1?[z]:[Y[0],z];return Reflect.apply(_,$,H)}}_setConnectionAttributes(_,$){if(!$)return;if($.ATTR_DB_NAMESPACE)_.setAttribute(R7.ATTR_DB_NAMESPACE,$.ATTR_DB_NAMESPACE);if($.ATTR_SERVER_ADDRESS)_.setAttribute(R7.ATTR_SERVER_ADDRESS,$.ATTR_SERVER_ADDRESS);if($.ATTR_SERVER_PORT!==void 0){let X=parseInt($.ATTR_SERVER_PORT,10);if(!isNaN(X))_.setAttribute(R7.ATTR_SERVER_PORT,X)}}_setOperationName(_,$,X){if(X){_.setAttribute(R7.ATTR_DB_OPERATION_NAME,X);return}let Q=$?.match(nY4);if(Q?.[1])_.setAttribute(R7.ATTR_DB_OPERATION_NAME,Q[1].toUpperCase())}_attachConnectionContext(_,$){let X=_;if(!X.options||typeof X.options!=="object")return;let Q=X.options,Y=Q.host?.[0]||"localhost",J=Q.port?.[0]||5432,Z={ATTR_DB_NAMESPACE:typeof Q.database==="string"&&Q.database!==""?Q.database:void 0,ATTR_SERVER_ADDRESS:Y,ATTR_SERVER_PORT:String(J)};$[_i]=Z}_instrumentSqlInstance(_,$){if(_[WZ0])return _;let X=this,Q=new Proxy(_,{apply(Y,J,Z){let K=Reflect.apply(Y,J,Z);if(K&&typeof K==="object"&&"handle"in K)X._wrapSingleQueryHandle(K,Q);return K},get(Y,J){let Z=Y[J];if(typeof J!=="string"||typeof Z!=="function")return Z;if(J==="unsafe"||J==="file")return X._wrapQueryMethod(Z,Y,Q);if(J==="begin"||J==="reserve")return X._wrapCallbackMethod(Z,Y,Q);return Z}});if($)Q[_i]=$;else this._attachConnectionContext(_,Q);return _[WZ0]=!0,Q[WZ0]=!0,Q}_wrapSingleQueryHandle(_,$){if(_.handle?.__sentryWrapped)return;_[PZ1]=!0;let X=_.handle,Q=this,Y=async function(...J){if(!Q._shouldCreateSpans())return X.apply(this,J);let Z=Q._reconstructQuery(_.strings),K=Q._sanitizeSqlQuery(Z);return wX({name:K||"postgresjs.query",op:"db"},(z)=>{Z$(z,"auto.db.postgresjs"),z.setAttributes({[R7.ATTR_DB_SYSTEM_NAME]:"postgres",[R7.ATTR_DB_QUERY_TEXT]:K});let H=$?$[_i]:void 0;Q._setConnectionAttributes(z,H);let W=Q.getConfig(),{requestHook:V}=W;if(V)vV.safeExecuteInTheMiddle(()=>V(z,K,H),(B)=>{if(B)z.setAttribute("sentry.hook.error","requestHook failed"),o5&&g1.error(`Error in requestHook for ${$i} integration:`,B)},!0);let G=this;G.resolve=new Proxy(G.resolve,{apply:(B,U,O)=>{try{Q._setOperationName(z,K,O?.[0]?.command),z.end()}catch(F){o5&&g1.error("Error ending span in resolve callback:",F)}return Reflect.apply(B,U,O)}}),G.reject=new Proxy(G.reject,{apply:(B,U,O)=>{try{z.setStatus({code:h8,message:O?.[0]?.message||"unknown_error"}),z.setAttribute(R7.ATTR_DB_RESPONSE_STATUS_CODE,O?.[0]?.code||"unknown"),z.setAttribute(R7.ATTR_ERROR_TYPE,O?.[0]?.name||"unknown"),Q._setOperationName(z,K),z.end()}catch(F){o5&&g1.error("Error ending span in reject callback:",F)}return Reflect.apply(B,U,O)}});try{return X.apply(this,J)}catch(B){throw z.setStatus({code:h8,message:B instanceof Error?B.message:"unknown_error"}),z.end(),B}})};Y.__sentryWrapped=!0,_.handle=Y}_shouldCreateSpans(){let _=this.getConfig();return XT.trace.getSpan(XT.context.active())!==void 0||!_.requireParentSpan}_reconstructQuery(_){if(!_?.length)return;if(_.length===1)return _[0]||void 0;return _.reduce(($,X,Q)=>Q===0?X:`${$}$${Q}${X}`,"")}_sanitizeSqlQuery(_){if(!_)return"Unknown SQL Query";return _.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 ($?)")}_patchQueryPrototype(_){let $=this,X=_.Query.prototype.handle;return _.Query.prototype.handle=async function(...Q){if(this[PZ1])return X.apply(this,Q);if(!$._shouldCreateSpans())return X.apply(this,Q);let Y=$._reconstructQuery(this.strings),J=$._sanitizeSqlQuery(Y);return wX({name:J||"postgresjs.query",op:"db"},(Z)=>{Z$(Z,"auto.db.postgresjs"),Z.setAttributes({[R7.ATTR_DB_SYSTEM_NAME]:"postgres",[R7.ATTR_DB_QUERY_TEXT]:J});let K=$.getConfig(),{requestHook:z}=K;if(z)vV.safeExecuteInTheMiddle(()=>z(Z,J,void 0),(V)=>{if(V)Z.setAttribute("sentry.hook.error","requestHook failed"),o5&&g1.error(`Error in requestHook for ${$i} integration:`,V)},!0);let H=this.resolve;this.resolve=new Proxy(H,{apply:(V,G,B)=>{try{$._setOperationName(Z,J,B?.[0]?.command),Z.end()}catch(U){o5&&g1.error("Error ending span in resolve callback:",U)}return Reflect.apply(V,G,B)}});let W=this.reject;this.reject=new Proxy(W,{apply:(V,G,B)=>{try{Z.setStatus({code:h8,message:B?.[0]?.message||"unknown_error"}),Z.setAttribute(R7.ATTR_DB_RESPONSE_STATUS_CODE,B?.[0]?.code||"unknown"),Z.setAttribute(R7.ATTR_ERROR_TYPE,B?.[0]?.name||"unknown"),$._setOperationName(Z,J),Z.end()}catch(U){o5&&g1.error("Error ending span in reject callback:",U)}return Reflect.apply(V,G,B)}});try{return X.apply(this,Q)}catch(V){throw Z.setStatus({code:h8,message:V instanceof Error?V.message:"unknown_error"}),Z.end(),V}})},_.Query.prototype.handle.__sentry_original__=X,_}_unpatchQueryPrototype(_){if(_.Query.prototype.handle.__sentry_original__)_.Query.prototype.handle=_.Query.prototype.handle.__sentry_original__;return _}}var rY4=(_)=>{return{name:$i,setupOnce(){IZ1(_)}}},SZ1=a6(rY4);var eZ=h6(G4(),1);var vZ1=h6(G4(),1),Xi=h6(Y8(),1),fB=h6(G4(),1);var oY4=process.env.PRISMA_SHOW_ALL_TRACES==="true",sY4="00-10-10-00";function tY4(_){switch(_){case"client":return fB.SpanKind.CLIENT;case"internal":default:return fB.SpanKind.INTERNAL}}var eY4=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:_,ignoreSpanTypes:$}){this.tracerProvider=_,this.ignoreSpanTypes=$}isEnabled(){return!0}getTraceParent(_){let $=fB.trace.getSpanContext(_??fB.context.active());if($)return`00-${$.traceId}-${$.spanId}-0${$.traceFlags}`;return sY4}dispatchEngineSpans(_){let $=this.tracerProvider.getTracer("prisma"),X=new Map,Q=_.filter((Y)=>Y.parentId===null);for(let Y of Q)xZ1($,Y,_,X,this.ignoreSpanTypes)}getActiveContext(){return fB.context.active()}runInChildSpan(_,$){if(typeof _==="string")_={name:_};if(_.internal&&!oY4)return $();let X=this.tracerProvider.getTracer("prisma"),Q=_.context??this.getActiveContext(),Y=`prisma:client:${_.name}`;if(fZ1(Y,this.ignoreSpanTypes))return $();if(_.active===!1){let J=X.startSpan(Y,_,Q);return kZ1(J,$(J,Q))}return X.startActiveSpan(Y,_,(J)=>kZ1(J,$(J,Q)))}};function xZ1(_,$,X,Q,Y){if(fZ1($.name,Y))return;let J={attributes:$.attributes,kind:tY4($.kind),startTime:$.startTime};_.startActiveSpan($.name,J,(Z)=>{if(Q.set($.id,Z.spanContext().spanId),$.links)Z.addLinks($.links.flatMap((z)=>{let H=Q.get(z);if(!H)return[];return{context:{spanId:H,traceId:Z.spanContext().traceId,traceFlags:Z.spanContext().traceFlags}}}));let K=X.filter((z)=>z.parentId===$.id);for(let z of K)xZ1(_,z,X,Q,Y);Z.end($.endTime)})}function kZ1(_,$){if(_J4($))return $.then((X)=>{return _.end(),X},(X)=>{throw _.end(),X});return _.end(),$}function _J4(_){return _!=null&&typeof _.then==="function"}function fZ1(_,$){return $.some((X)=>typeof X==="string"?X===_:X.test(_))}var yZ1={name:"@prisma/instrumentation",version:"6.19.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:{"@prisma/internals":"workspace:*","@types/node":"18.19.76","@opentelemetry/api":"1.9.0",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":">=0.52.0 <1"},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},VZ0=yZ1.version,$J4=VZ0.split(".")[0],bZ1="PRISMA_INSTRUMENTATION",HZ0=`V${$J4}_PRISMA_INSTRUMENTATION`,XJ4=yZ1.name,QJ4="@prisma/client",gZ1=class extends Xi.InstrumentationBase{tracerProvider;constructor(_={}){super(XJ4,VZ0,_)}setTracerProvider(_){this.tracerProvider=_}init(){return[new Xi.InstrumentationNodeModuleDefinition(QJ4,[VZ0])]}enable(){let _=this._config,$={helper:new eY4({tracerProvider:this.tracerProvider??vZ1.trace.getTracerProvider(),ignoreSpanTypes:_.ignoreSpanTypes??[]})};global[bZ1]=$,global[HZ0]=$}disable(){delete global[bZ1],delete global[HZ0]}isEnabled(){return Boolean(global[HZ0])}};var hZ1="Prisma";function YJ4(_){return!!_&&typeof _==="object"&&"dispatchEngineSpans"in _}function mZ1(){let _=globalThis.PRISMA_INSTRUMENTATION;return _&&typeof _==="object"&&"helper"in _?_.helper:void 0}class uZ1 extends gZ1{constructor(){super()}enable(){super.enable();let _=mZ1();if(YJ4(_))_.createEngineSpan=($)=>{let X=eZ.trace.getTracer("prismaV5Compatibility"),Q=X._idGenerator;if(!Q){q7(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{$.spans.forEach((Y)=>{let J=JJ4(Y.kind),Z=Y.parent_span_id,K=Y.span_id,z=Y.trace_id,H=Y.links?.map((V)=>{return{context:{traceId:V.trace_id,spanId:V.span_id,traceFlags:eZ.TraceFlags.SAMPLED}}}),W=eZ.trace.setSpanContext(eZ.context.active(),{traceId:z,spanId:Z,traceFlags:eZ.TraceFlags.SAMPLED});eZ.context.with(W,()=>{let V={generateTraceId:()=>{return z},generateSpanId:()=>{return K}};X._idGenerator=V,X.startSpan(Y.name,{kind:J,links:H,startTime:Y.start_time,attributes:Y.attributes}).end(Y.end_time),X._idGenerator=Q})})}finally{X._idGenerator=Q}}}}function JJ4(_){switch(_){case"client":return eZ.SpanKind.CLIENT;case"internal":default:return eZ.SpanKind.INTERNAL}}var ZJ4=i4(hZ1,(_)=>{return new uZ1}),dZ1=a6((_)=>{return{name:hZ1,setupOnce(){ZJ4()},setup($){if(!mZ1())return;$.on("spanStart",(X)=>{let Q=F_(X);if(Q.description?.startsWith("prisma:"))X.setAttribute(S_,"auto.db.otel.prisma");if(Q.description==="prisma:engine:db_query"&&Q.data["db.query.text"])X.updateName(Q.data["db.query.text"]);if(Q.description==="prisma:engine:db_query"&&!Q.data["db.system"])X.setAttribute("db.system","prisma")})}}});var H21=h6(W21(),1);var V21="Hapi",G21=i4(V21,()=>new H21.HapiInstrumentation),jJ4=()=>{return{name:V21,setupOnce(){G21()}}},U21=a6(jJ4);var Ji=h6(J$(),1);var gB={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Gb={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};var sN=h6(G4(),1),Yi=h6(Y8(),1);var SJ4="@sentry/instrumentation-hono",kJ4="0.0.1";class FZ0 extends Yi.InstrumentationBase{constructor(_={}){super(SJ4,kJ4,_)}init(){return[new Yi.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],(_)=>this._patch(_))]}_patch(_){let $=this;class X extends _.Hono{constructor(...Q){super(...Q);$._wrap(this,"get",$._patchHandler()),$._wrap(this,"post",$._patchHandler()),$._wrap(this,"put",$._patchHandler()),$._wrap(this,"delete",$._patchHandler()),$._wrap(this,"options",$._patchHandler()),$._wrap(this,"patch",$._patchHandler()),$._wrap(this,"all",$._patchHandler()),$._wrap(this,"on",$._patchOnHandler()),$._wrap(this,"use",$._patchMiddlewareHandler())}}try{_.Hono=X}catch{return{..._,Hono:X}}return _}_patchHandler(){let _=this;return function($){return function(...Q){if(typeof Q[0]==="string"){let Y=Q[0];if(Q.length===1)return $.apply(this,[Y]);let J=Q.slice(1);return $.apply(this,[Y,...J.map((Z)=>_._wrapHandler(Z))])}return $.apply(this,Q.map((Y)=>_._wrapHandler(Y)))}}}_patchOnHandler(){let _=this;return function($){return function(...Q){let Y=Q.slice(2);return $.apply(this,[...Q.slice(0,2),...Y.map((J)=>_._wrapHandler(J))])}}}_patchMiddlewareHandler(){let _=this;return function($){return function(...Q){if(typeof Q[0]==="string"){let Y=Q[0];if(Q.length===1)return $.apply(this,[Y]);let J=Q.slice(1);return $.apply(this,[Y,...J.map((Z)=>_._wrapHandler(Z))])}return $.apply(this,Q.map((Y)=>_._wrapHandler(Y)))}}}_wrapHandler(_){let $=this;return function(X,Q){if(!$.isEnabled())return _.apply(this,[X,Q]);let Y=X.req.path,J=$.tracer.startSpan(Y);return sN.context.with(sN.trace.setSpan(sN.context.active(),J),()=>{return $._safeExecute(()=>{let Z=_.apply(this,[X,Q]);if(gQ(Z))return Z.then((K)=>{let z=$._determineHandlerType(K);return J.setAttributes({[gB.HONO_TYPE]:z,[gB.HONO_NAME]:z===Gb.REQUEST_HANDLER?Y:_.name||"anonymous"}),$.getConfig().responseHook?.(J),K});else{let K=$._determineHandlerType(Z);return J.setAttributes({[gB.HONO_TYPE]:K,[gB.HONO_NAME]:K===Gb.REQUEST_HANDLER?Y:_.name||"anonymous"}),$.getConfig().responseHook?.(J),Z}},()=>J.end(),(Z)=>{$._handleError(J,Z),J.end()})})}}_safeExecute(_,$,X){try{let Q=_();if(gQ(Q))Q.then(()=>$(),(Y)=>X(Y));else $();return Q}catch(Q){throw X(Q),Q}}_determineHandlerType(_){return _===void 0?Gb.MIDDLEWARE:Gb.REQUEST_HANDLER}_handleError(_,$){if($ instanceof Error)_.setStatus({code:sN.SpanStatusCode.ERROR,message:$.message}),_.recordException($)}}var B21="Hono";function bJ4(_){let $=F_(_).data,X=$[gB.HONO_TYPE];if($[e_]||!X)return;_.setAttributes({[S_]:"auto.http.otel.hono",[e_]:`${X}.hono`});let Q=$[gB.HONO_NAME];if(typeof Q==="string")_.updateName(Q);if(H9()===RJ()){o5&&g1.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let Y=$[Ji.ATTR_HTTP_ROUTE],J=$[Ji.ATTR_HTTP_REQUEST_METHOD];if(typeof Y==="string"&&typeof J==="string")H9().setTransactionName(`${J} ${Y}`)}var O21=i4(B21,()=>new FZ0({responseHook:(_)=>{bJ4(_)}})),vJ4=()=>{return{name:B21,setupOnce(){O21()}}},F21=a6(vJ4);var h21=h6(g21(),1),m21=h6(J$(),1);var u21="Koa",d21=i4(u21,h21.KoaInstrumentation,(_={})=>{return{ignoreLayersType:_.ignoreLayersType,requestHook($,X){Z$($,"auto.http.otel.koa");let Q=F_($).data,Y=Q["koa.type"];if(Y)$.setAttribute(e_,`${Y}.koa`);let J=Q["koa.name"];if(typeof J==="string")$.updateName(J||"< unknown >");if(H9()===RJ()){o5&&g1.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let Z=Q[m21.ATTR_HTTP_ROUTE],K=X.context?.request?.method?.toUpperCase()||"GET";if(Z)H9().setTransactionName(`${K} ${Z}`)}}}),iJ4=(_={})=>{return{name:u21,setupOnce(){d21(_)}}},c21=a6(iJ4);var HK1=h6(WK1(),1);var VK1="Connect",GK1=i4(VK1,()=>new HK1.ConnectInstrumentation),ZZ4=()=>{return{name:VK1,setupOnce(){GK1()}}},UK1=a6(ZZ4);var SK1=h6(jK1(),1);var AZ4=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),kK1="Tedious",bK1=i4(kK1,()=>new SK1.TediousInstrumentation({})),MZ4=()=>{let _;return{name:kK1,setupOnce(){let $=bK1();_=yk($)},setup($){_?.(()=>$.on("spanStart",(X)=>{let{description:Q,data:Y}=F_(X);if(!Q||Y["db.system"]!=="mssql")return;let J=Q.split(" ")[0]||"";if(AZ4.has(J))X.setAttribute(S_,"auto.db.otel.tedious")}))}}},vK1=a6(MZ4);var lK1=h6(cK1(),1);var pK1="GenericPool",iK1=i4(pK1,()=>new lK1.GenericPoolInstrumentation({})),RZ4=()=>{let _;return{name:pK1,setupOnce(){let $=iK1();_=yk($)},setup($){_?.(()=>$.on("spanStart",(X)=>{let Y=F_(X).description;if(Y==="generic-pool.aquire"||Y==="generic-pool.acquire")X.setAttribute(S_,"auto.db.otel.generic_pool")}))}}},aK1=a6(RZ4);var wz1=h6(Fz1(),1);var Nz1="Amqplib",Z24={consumeEndHook:(_)=>{Z$(_,"auto.amqplib.otel.consumer")},publishHook:(_)=>{Z$(_,"auto.amqplib.otel.publisher")}},Dz1=i4(Nz1,()=>new wz1.AmqplibInstrumentation(Z24)),K24=()=>{return{name:Nz1,setupOnce(){Dz1()}}},Lz1=a6(K24);var wb="VercelAI";var Bi=h6(Y8(),1);var z24=[">=3.0.0 <7"],Az1=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function W24(_){if(typeof _!=="object"||_===null)return!1;let $=_;return"type"in $&&"error"in $&&"toolName"in $&&"toolCallId"in $&&$.type==="tool-error"&&$.error instanceof Error}function H24(_){if(typeof _!=="object"||_===null||!("content"in _))return;let $=_;if(!Array.isArray($.content))return;for(let X of $.content)if(W24(X)){let Q=hQ0(X.toolCallId);if(Q){let Y=Q.spanContext();CY((J)=>{J.setContext("trace",{trace_id:Y.traceId,span_id:Y.spanId}),J.setTag("vercel.ai.tool.name",X.toolName),J.setTag("vercel.ai.tool.callId",X.toolCallId),J.setLevel("error"),J8(X.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}),mQ0(X.toolCallId)}else CY((Y)=>{Y.setTag("vercel.ai.tool.name",X.toolName),Y.setTag("vercel.ai.tool.callId",X.toolCallId),Y.setLevel("error"),J8(X.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function V24(_,$,X,Q){let Y=_?.recordInputs!==void 0?_.recordInputs:$.recordInputs!==void 0?$.recordInputs:X===!0?!0:Q,J=_?.recordOutputs!==void 0?_.recordOutputs:$.recordOutputs!==void 0?$.recordOutputs:X===!0?!0:Q;return{recordInputs:Y,recordOutputs:J}}class Nb extends Bi.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(_={}){super("@sentry/instrumentation-vercel-ai",J9,_);Nb.prototype.__init.call(this),Nb.prototype.__init2.call(this)}init(){return new Bi.InstrumentationNodeModuleDefinition("ai",z24,this._patch.bind(this))}callWhenPatched(_){if(this._isPatched)_();else this._callbacks.push(_)}_patch(_){this._isPatched=!0,this._callbacks.forEach((X)=>X()),this._callbacks=[];let $=(X)=>{return new Proxy(X,{apply:(Q,Y,J)=>{let Z=J[0].experimental_telemetry||{},K=Z.isEnabled,z=E4(),H=z?.getIntegrationByName(wb),W=H?.options,V=H?Boolean(z?.getOptions().sendDefaultPii):!1,{recordInputs:G,recordOutputs:B}=V24(W,Z,K,V);return J[0].experimental_telemetry={...Z,isEnabled:K!==void 0?K:!0,recordInputs:G,recordOutputs:B},CJ(()=>Reflect.apply(Q,Y,J),(U)=>{if(U&&typeof U==="object")i7(U,"_sentry_active_span",LW())},()=>{},(U)=>{H24(U)})}})};if(Object.prototype.toString.call(_)==="[object Module]"){for(let X of Az1)_[X]=$(_[X]);return _}else{let X=Az1.reduce((Q,Y)=>{return Q[Y]=$(_[Y]),Q},{});return{..._,...X}}}}var Mz1=i4(wb,()=>new Nb({}));function G24(_){return!!_.getIntegrationByName("Modules")?.getModules?.()?.ai}var U24=(_={})=>{let $;return{name:wb,options:_,setupOnce(){$=Mz1()},afterAllSetup(X){if(_.force??G24(X))fl(X);else $?.callWhenPatched(()=>fl(X))}}},qz1=a6(U24);var Oi=h6(Y8(),1);var B24=[">=4.0.0 <7"];class xZ0 extends Oi.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-openai",J9,_)}init(){return new Oi.InstrumentationNodeModuleDefinition("openai",B24,this._patch.bind(this))}_patch(_){let $=_;return $=this._patchClient($,"OpenAI"),$=this._patchClient($,"AzureOpenAI"),$}_patchClient(_,$){let X=_[$];if(!X)return _;let Q=this.getConfig(),Y=function(...J){if(xN(MB))return Reflect.construct(X,J);let Z=Reflect.construct(X,J),K=E4(),z=Boolean(K?.getOptions().sendDefaultPii),H=Q.recordInputs??z,W=Q.recordOutputs??z;return hl(Z,{recordInputs:H,recordOutputs:W})};Object.setPrototypeOf(Y,X),Object.setPrototypeOf(Y.prototype,X.prototype);for(let J of Object.getOwnPropertyNames(X))if(!["length","name","prototype"].includes(J)){let Z=Object.getOwnPropertyDescriptor(X,J);if(Z)Object.defineProperty(Y,J,Z)}try{_[$]=Y}catch(J){Object.defineProperty(_,$,{value:Y,writable:!0,configurable:!0,enumerable:!0})}if(_.default===X)try{_.default=Y}catch(J){Object.defineProperty(_,"default",{value:Y,writable:!0,configurable:!0,enumerable:!0})}return _}}var Tz1=i4(MB,(_)=>new xZ0(_)),O24=(_={})=>{return{name:MB,setupOnce(){Tz1(_)}}},Ez1=a6(O24);var Fi=h6(Y8(),1);var F24=[">=0.19.2 <1.0.0"];class fZ0 extends Fi.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-anthropic-ai",J9,_)}init(){return new Fi.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",F24,this._patch.bind(this))}_patch(_){let $=_.Anthropic,X=this.getConfig(),Q=function(...Y){if(xN(qB))return Reflect.construct($,Y);let J=Reflect.construct($,Y),Z=E4(),K=Boolean(Z?.getOptions().sendDefaultPii),z=X.recordInputs??K,H=X.recordOutputs??K;return cQ0(J,{recordInputs:z,recordOutputs:H})};Object.setPrototypeOf(Q,$),Object.setPrototypeOf(Q.prototype,$.prototype);for(let Y of Object.getOwnPropertyNames($))if(!["length","name","prototype"].includes(Y)){let J=Object.getOwnPropertyDescriptor($,Y);if(J)Object.defineProperty(Q,Y,J)}try{_.Anthropic=Q}catch(Y){Object.defineProperty(_,"Anthropic",{value:Q,writable:!0,configurable:!0,enumerable:!0})}if(_.default===$)try{_.default=Q}catch(Y){Object.defineProperty(_,"default",{value:Q,writable:!0,configurable:!0,enumerable:!0})}return _}}var Rz1=i4(qB,(_)=>new fZ0(_)),w24=(_={})=>{return{name:qB,options:_,setupOnce(){Rz1(_)}}},Cz1=a6(w24);var KT=h6(Y8(),1);var Pz1=[">=0.10.0 <2"];class yZ0 extends KT.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-google-genai",J9,_)}init(){return new KT.InstrumentationNodeModuleDefinition("@google/genai",Pz1,($)=>this._patch($),($)=>$,[new KT.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",Pz1,($)=>this._patch($),($)=>$)])}_patch(_){let $=_.GoogleGenAI,X=this.getConfig();if(typeof $!=="function")return _;let Q=function(...Y){if(xN(TB))return Reflect.construct($,Y);let J=Reflect.construct($,Y),Z=E4(),K=Boolean(Z?.getOptions().sendDefaultPii),z=X,H=z?.recordInputs??K,W=z?.recordOutputs??K;return aQ0(J,{recordInputs:H,recordOutputs:W})};Object.setPrototypeOf(Q,$),Object.setPrototypeOf(Q.prototype,$.prototype);for(let Y of Object.getOwnPropertyNames($))if(!["length","name","prototype"].includes(Y)){let J=Object.getOwnPropertyDescriptor($,Y);if(J)Object.defineProperty(Q,Y,J)}return Nk(_,"GoogleGenAI",Q),_}}var Iz1=i4(TB,(_)=>new yZ0(_)),N24=(_={})=>{return{name:TB,setupOnce(){Iz1(_)}}},jz1=a6(N24);var uB=h6(Y8(),1);var wi=[">=0.1.0 <2.0.0"];function D24(_,$){if(!_)return[$];if(Array.isArray(_)){if(_.includes($))return _;return[..._,$]}if(typeof _==="object")return[_,$];return _}function L24(_,$,X){return new Proxy(_,{apply(Q,Y,J){let K=J[1];if(!K||typeof K!=="object"||Array.isArray(K))K={},J[1]=K;let z=K.callbacks,H=D24(z,$);return K.callbacks=H,Reflect.apply(Q,Y,J)}})}class gZ0 extends uB.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-langchain",J9,_)}init(){let _=[],$=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let X of $)_.push(new uB.InstrumentationNodeModuleDefinition(X,wi,this._patch.bind(this),(Q)=>Q,[new uB.InstrumentationNodeModuleFile(`${X}/dist/index.cjs`,wi,this._patch.bind(this),(Q)=>Q)]));return _.push(new uB.InstrumentationNodeModuleDefinition("langchain",wi,this._patch.bind(this),(X)=>X,[new uB.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",wi,this._patch.bind(this),(X)=>X)])),_}_patch(_){DQ0([MB,qB,TB]);let $=E4(),X=Boolean($?.getOptions().sendDefaultPii),Q=this.getConfig(),Y=Q?.recordInputs??X,J=Q?.recordOutputs??X,Z=ul({recordInputs:Y,recordOutputs:J});return this._patchRunnableMethods(_,Z),_}_patchRunnableMethods(_,$){let X=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],Q=_.universal_exports??_,Y=Object.values(Q).find((K)=>{return typeof K==="function"&&X.includes(K.name)});if(!Y)return;let J=Y.prototype,Z=["invoke","stream","batch"];for(let K of Z){let z=J[K];if(typeof z==="function")J[K]=L24(z,$)}}}var Sz1=i4(ml,(_)=>new gZ0(_)),A24=(_={})=>{return{name:ml,setupOnce(){Sz1(_)}}},kz1=a6(A24);var zT=h6(Y8(),1);var bz1=[">=0.0.0 <2.0.0"];class hZ0 extends zT.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-langgraph",J9,_)}init(){return new zT.InstrumentationNodeModuleDefinition("@langchain/langgraph",bz1,this._patch.bind(this),($)=>$,[new zT.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",bz1,this._patch.bind(this),($)=>$)])}_patch(_){let $=E4(),X=Boolean($?.getOptions().sendDefaultPii),Q=this.getConfig(),Y=Q.recordInputs??X,J=Q.recordOutputs??X,Z={recordInputs:Y,recordOutputs:J};if(_.StateGraph&&typeof _.StateGraph==="function"){let K=_.StateGraph;K.prototype.compile=oQ0(K.prototype.compile,Z)}return _}}var vz1=i4(dl,(_)=>new hZ0(_)),M24=(_={})=>{return{name:dl,setupOnce(){vz1(_)}}},xz1=a6(M24);var cz1=h6(Y8(),1);var fV=h6(G4(),1),yV=h6(Y8(),1),_2=h6(J$(),1);import*as yz1 from"net";function gz1(_,$,X,Q,Y){let Z=()=>{},K=Y.firestoreSpanCreationHook;if(typeof K==="function")Z=(W)=>{yV.safeExecuteInTheMiddle(()=>K(W),(V)=>{if(!V)return;fV.diag.error(V?.message)},!0)};let z=new yV.InstrumentationNodeModuleDefinition("@firebase/firestore",$,(W)=>fz1(W,X,Q,_,Z)),H=["@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 W of H)z.files.push(new yV.InstrumentationNodeModuleFile(W,$,(V)=>fz1(V,X,Q,_,Z),(V)=>hz1(V,Q)));return z}function fz1(_,$,X,Q,Y){return hz1(_,X),$(_,"addDoc",q24(Q,Y)),$(_,"getDocs",E24(Q,Y)),$(_,"setDoc",R24(Q,Y)),$(_,"deleteDoc",T24(Q,Y)),_}function hz1(_,$){for(let X of["addDoc","getDocs","setDoc","deleteDoc"])if(yV.isWrapped(_[X]))$(_,X);return _}function q24(_,$){return function(Q){return function(Y,J){let Z=Di(_,"addDoc",Y);return $(Z),Ni(Z,()=>{return Q(Y,J)})}}}function T24(_,$){return function(Q){return function(Y){let J=Di(_,"deleteDoc",Y.parent||Y);return $(J),Ni(J,()=>{return Q(Y)})}}}function E24(_,$){return function(Q){return function(Y){let J=Di(_,"getDocs",Y);return $(J),Ni(J,()=>{return Q(Y)})}}}function R24(_,$){return function(Q){return function(Y,J,Z){let K=Di(_,"setDoc",Y.parent||Y);return $(K),Ni(K,()=>{return typeof Z<"u"?Q(Y,J,Z):Q(Y,J)})}}}function Ni(_,$){return fV.context.with(fV.trace.setSpan(fV.context.active(),_),()=>{return yV.safeExecuteInTheMiddle(()=>{return $()},(X)=>{if(X)_.recordException(X);_.end()},!0)})}function Di(_,$,X){let Q=_.startSpan(`${$} ${X.path}`,{kind:fV.SpanKind.CLIENT});return P24(Q,X),Q.setAttribute(_2.ATTR_DB_OPERATION_NAME,$),Q}function C24(_){let $,X;if(typeof _.host==="string")if(_.host.startsWith("[")){if(_.host.endsWith("]"))$=_.host.replace(/^\[|\]$/g,"");else if(_.host.includes("]:")){let Q=_.host.lastIndexOf(":");if(Q!==-1)$=_.host.slice(1,Q).replace(/^\[|\]$/g,""),X=_.host.slice(Q+1)}}else if(yz1.isIPv6(_.host))$=_.host;else{let Q=_.host.lastIndexOf(":");if(Q!==-1)$=_.host.slice(0,Q),X=_.host.slice(Q+1);else $=_.host}return{address:$,port:X?parseInt(X,10):void 0}}function P24(_,$){let X=$.firestore.app,Q=X.options,J=($.firestore.toJSON()||{}).settings||{},Z={[_2.ATTR_DB_COLLECTION_NAME]:$.path,[_2.ATTR_DB_NAMESPACE]:X.name,[_2.ATTR_DB_SYSTEM_NAME]:"firebase.firestore","firebase.firestore.type":$.type,"firebase.firestore.options.projectId":Q.projectId,"firebase.firestore.options.appId":Q.appId,"firebase.firestore.options.messagingSenderId":Q.messagingSenderId,"firebase.firestore.options.storageBucket":Q.storageBucket},{address:K,port:z}=C24(J);if(K)Z[_2.ATTR_SERVER_ADDRESS]=K;if(z)Z[_2.ATTR_SERVER_PORT]=z;_.setAttributes(Z)}var SW=h6(G4(),1),gV=h6(Y8(),1);function mz1(_,$,X,Q,Y){let J=()=>{},Z=()=>{},K=Y.functions?.errorHook,z=Y.functions?.requestHook,H=Y.functions?.responseHook;if(typeof H==="function")Z=(G,B)=>{gV.safeExecuteInTheMiddle(()=>H(G,B),(U)=>{if(!U)return;SW.diag.error(U?.message)},!0)};if(typeof z==="function")J=(G)=>{gV.safeExecuteInTheMiddle(()=>z(G),(B)=>{if(!B)return;SW.diag.error(B?.message)},!0)};let W=new gV.InstrumentationNodeModuleDefinition("firebase-functions",$);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:G,triggerType:B})=>{W.files.push(new gV.InstrumentationNodeModuleFile(G,$,(U)=>I24(U,X,Q,_,{requestHook:J,responseHook:Z,errorHook:K},B),(U)=>uz1(U,Q)))}),W}function pQ(_,$,X){return function(Y){return function(...J){let Z=typeof J[0]==="function"?J[0]:J[1],K=typeof J[0]==="function"?void 0:J[0];if(!Z)return Y.call(this,...J);let z=async function(...H){let W=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",V=_.startSpan(`firebase.function.${X}`,{kind:SW.SpanKind.SERVER}),G={"faas.name":W,"faas.trigger":X,"faas.provider":"firebase"};if(process.env.GCLOUD_PROJECT)G["cloud.project_id"]=process.env.GCLOUD_PROJECT;if(process.env.EVENTARC_CLOUD_EVENT_SOURCE)G["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE;return V.setAttributes(G),$?.requestHook?.(V),SW.context.with(SW.trace.setSpan(SW.context.active(),V),async()=>{let B,U;try{U=await Z.apply(this,H)}catch(O){B=O}if($?.responseHook?.(V,B),B)V.recordException(B);if(V.end(),B)throw await $?.errorHook?.(V,B),B;return U})};if(K)return Y.call(this,K,z);else return Y.call(this,z)}}}function I24(_,$,X,Q,Y,J){switch(uz1(_,X),J){case"function":$(_,"onRequest",pQ(Q,Y,"http.request")),$(_,"onCall",pQ(Q,Y,"http.call"));break;case"firestore":$(_,"onDocumentCreated",pQ(Q,Y,"firestore.document.created")),$(_,"onDocumentUpdated",pQ(Q,Y,"firestore.document.updated")),$(_,"onDocumentDeleted",pQ(Q,Y,"firestore.document.deleted")),$(_,"onDocumentWritten",pQ(Q,Y,"firestore.document.written")),$(_,"onDocumentCreatedWithAuthContext",pQ(Q,Y,"firestore.document.created")),$(_,"onDocumentUpdatedWithAuthContext",pQ(Q,Y,"firestore.document.updated")),$(_,"onDocumentDeletedWithAuthContext",pQ(Q,Y,"firestore.document.deleted")),$(_,"onDocumentWrittenWithAuthContext",pQ(Q,Y,"firestore.document.written"));break;case"scheduler":$(_,"onSchedule",pQ(Q,Y,"scheduler.scheduled"));break;case"storage":$(_,"onObjectFinalized",pQ(Q,Y,"storage.object.finalized")),$(_,"onObjectArchived",pQ(Q,Y,"storage.object.archived")),$(_,"onObjectDeleted",pQ(Q,Y,"storage.object.deleted")),$(_,"onObjectMetadataUpdated",pQ(Q,Y,"storage.object.metadataUpdated"));break}return _}function uz1(_,$){let X=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let Q of X)if(gV.isWrapped(_[Q]))$(_,Q);return _}var dz1={},j24=[">=3.0.0 <5"],S24=[">=6.0.0 <7"];class mZ0 extends cz1.InstrumentationBase{constructor(_=dz1){super("@sentry/instrumentation-firebase",J9,_)}setConfig(_={}){super.setConfig({...dz1,..._})}init(){let _=[];return _.push(gz1(this.tracer,j24,this._wrap,this._unwrap,this.getConfig())),_.push(mz1(this.tracer,S24,this._wrap,this._unwrap,this.getConfig())),_}}var lz1="Firebase",k24={firestoreSpanCreationHook:(_)=>{Z$(_,"auto.firebase.otel.firestore"),_.setAttribute(e_,"db.query")},functions:{requestHook:(_)=>{Z$(_,"auto.firebase.otel.functions"),_.setAttribute(e_,"http.request")},errorHook:async(_,$)=>{if($)J8($,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await Ll(2000)}}},pz1=i4(lz1,()=>new mZ0(k24)),b24=()=>{return{name:lz1,setupOnce(){pz1()}}},iz1=a6(b24);function Db(){return[r71(),f31(),EX1(),F21(),bQ1(),XY1(),MY1(),lY1(),aJ1(),RZ1(),dZ1(),U21(),c21(),UK1(),vK1(),aK1(),tX1(),Lz1(),UQ1(),kz1(),xz1(),qz1(),Ez1(),Cz1(),jz1(),SZ1(),iz1()]}var WT=h6(G4(),1);var HT=h6(J$(),1);var uZ0=1e6;function az1(_,$={}){if(_.getOptions().debug)nY0();let[X,Q]=v24(_,$);_.traceProvider=X,_.asyncLocalStorageLookup=Q}function v24(_,$={}){let X=new Wp({sampler:new bY0(_),resource:qk().merge(Qp({[HT.ATTR_SERVICE_NAME]:"node",[HT.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[HT.ATTR_SERVICE_VERSION]:J9})),forceFlushTimeoutMillis:500,spanProcessors:[new kY0({timeout:x24(_.getOptions().maxSpanWaitDuration)}),...$.spanProcessors||[]]});WT.trace.setGlobalTracerProvider(X),WT.propagation.setGlobalPropagator(new SY0);let Q=new Fp;return WT.context.setGlobalContextManager(Q),[X,Q.getAsyncLocalStorageLookup()]}function x24(_){if(_==null)return;if(_>uZ0)return o5&&g1.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${uZ0}`),uZ0;else if(_<=0||Number.isNaN(_)){o5&&g1.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return _}function nz1(){return Ap().filter(($)=>$.name!=="Http"&&$.name!=="NodeFetch").concat(hk(),uk())}function rz1(_){return[...nz1(),...S5(_)?Db():[]]}function dZ0(_={}){return f24(_,rz1)}function f24(_={},$){MV(_,"node");let X=YJ0({..._,defaultIntegrations:_.defaultIntegrations??$(_)});if(X&&!_.skipOpenTelemetrySetup)az1(X,{spanProcessors:_.openTelemetrySpanProcessors}),Mp();return X}import*as _W1 from"os";var y24="BunServer",g24=()=>{return{name:y24,setupOnce(){h24()}}},tz1=a6(g24),oz1=!1;function h24(){if(oz1)return;Bun.serve=new Proxy(Bun.serve,{apply(_,$,X){sz1(X[0]);let Q=_.apply($,X),Y=Q.reload.bind(Q);return Q.reload=(J)=>{return sz1(J),Y(J)},Q}}),oz1=!0}function sz1(_){m24(_),u24(_)}function m24(_){if(typeof _.fetch!=="function")return;_.fetch=new Proxy(_.fetch,{apply($,X,Q){return cZ0($,X,Q)}})}function u24(_){if(!_.routes)return;if(typeof _.routes!=="object")return;Object.keys(_.routes).forEach(($)=>{let X=_.routes[$];if(typeof X==="function")_.routes[$]=new Proxy(X,{apply:(Q,Y,J)=>{return cZ0(Q,Y,J,$)}});if(X instanceof Response)return;if(typeof X==="object")Object.entries(X).forEach(([Q,Y])=>{if(typeof Y==="function")_.routes[$][Q]=new Proxy(Y,{apply:(J,Z,K)=>{return cZ0(J,Z,K,$)}})})})}function cZ0(_,$,X,Q){return TN((Y)=>{let J=X[0],Z=J.method.toUpperCase();if(Z==="OPTIONS"||Z==="HEAD")return _.apply($,X);let K=Zk(J.url),z=d24(K,J),H=K?.pathname||"/";if(J.params){if(Object.keys(J.params).forEach((W)=>{z[`url.path.parameter.${W}`]=J.params[W]}),Q)z[j5]="route",z["url.template"]=Q,H=Q}if(Q?.endsWith("/*"))z[j5]="route",z["url.template"]=Q,H=Q;return Object.assign(z,Bq(J.headers.toJSON(),E4()?.getOptions().sendDefaultPii??!1)),Y.setSDKProcessingMetadata({normalizedRequest:{url:J.url,method:J.method,headers:J.headers.toJSON(),query_string:K?.search}}),wl({sentryTrace:J.headers.get("sentry-trace")??"",baggage:J.headers.get("baggage")},()=>jJ({attributes:z,op:"http.server",name:`${J.method} ${H}`},async(W)=>{try{let V=await _.apply($,X);if(V?.status)$l(W,V.status),Y.setContext("response",{headers:V.headers.toJSON(),status_code:V.status});return V}catch(V){throw J8(V,{mechanism:{type:"auto.http.bun.serve",handled:!1}}),V}}))})}function d24(_,$){let X={[S_]:"auto.http.bun.serve",[aX0]:$.method||"GET",[j5]:"url"};if(_){if(_.search)X["url.query"]=_.search;if(_.hash)X["url.fragment"]=_.hash;if(_.pathname)X["url.path"]=_.pathname;if(!AQ0(_)){if(X["url.full"]=_.href,_.port)X["url.port"]=_.port;if(_.protocol)X["url.scheme"]=_.protocol;if(_.hostname)X["url.domain"]=_.hostname}}return X}function ez1(_){function $(X){let Q={body:X.body,method:"POST",headers:_.headers};try{return HB(()=>{return fetch(_.url,Q).then((Y)=>{return{statusCode:Y.status,headers:{"x-sentry-rate-limits":Y.headers.get("X-Sentry-Rate-Limits"),"retry-after":Y.headers.get("Retry-After")}}})})}catch(Y){return Promise.reject(Y)}}return vN(_,$)}function $W1(_){return[Fq(),Oq(),wq(),Nq(),Dq(),hk(),uk(),cq(),lq(),uq(),mq(),dq(),tz1(),...S5(_)?Db():[]]}function lZ0(_={}){MV(_,"bun");let $={..._,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:_.serverName||global.process.env.SENTRY_NAME||_W1.hostname()};if($.transport=$.transport||ez1,$.defaultIntegrations===void 0)$.defaultIntegrations=$W1($);return dZ0($)}lZ0({dsn:"https://f0ba950f2a01c32d24ccd8711de778be@o4510345514123264.ingest.us.sentry.io/4510346875043848",tracesSampleRate:1,sendDefaultPii:!1});import{readFileSync as XW1}from"fs";import{join as QW1}from"path";function r$(){return"3.3.0-beta.13"}function pZ0(_){let[$,X]=_.split("-"),Q=($||"0.0.0").split(".").map(Number),Y=null,J=0;if(X){let Z=X.match(/^([a-z]+)\.?(\d+)?$/i);if(Z)Y=Z[1]||null,J=parseInt(Z[2]||"0",10);else Y=X}return{major:Q[0]||0,minor:Q[1]||0,patch:Q[2]||0,preRelease:Y,preReleaseNum:J}}function hV(_){let $=pZ0(_);if(!$.preRelease)return"stable";if($.preRelease.startsWith("alpha"))return"alpha";return"beta"}function Lb(_,$){try{let X=pZ0(_),Q=pZ0($);if(X.major>Q.major)return!1;if(X.major<Q.major)return!1;if(Q.preRelease&&!X.preRelease)return!1;if(!Q.preRelease&&X.preRelease)return!1;if(Q.preRelease&&X.preRelease){if(X.minor<Q.minor)return!1;if(X.minor>Q.minor)return!0;if(X.patch>Q.patch)return!0;if(X.patch<Q.patch)return!1;return X.preReleaseNum>Q.preReleaseNum}if(X.minor>Q.minor)return!0;if(X.minor<Q.minor)return!1;if(X.patch>Q.patch)return!0;return!1}catch(X){return!1}}import{parseArgs as l24}from"util";var p24={debug:{type:"boolean",short:"d",default:!1,description:"Enable debug logging"},"mqtt-port":{type:"string",default:"8884",description:"MQTT broker port"},"terminal-port":{type:"string",default:"3001",description:"Terminal server port"},"router-port":{type:"string",default:"8883",description:"Router port"},username:{type:"string",short:"u",description:"MQTT broker username (required)"},password:{type:"string",short:"p",description:"MQTT broker password (required)"},"ngrok-token":{type:"string",description:"ngrok authentication token (optional)"},"ngrok-domain":{type:"string",description:"ngrok static domain (optional, paid plan)"},"no-auto-update":{type:"boolean",default:!1,description:"Disable auto-update checking"},"terminal-audit":{type:"boolean",default:!1,description:"Enable terminal input audit logging (logs commands, not output)"},"auto-update-check-interval":{type:"string",default:"60",description:"Auto-update check interval in minutes (default: 60)"},help:{type:"boolean",short:"h",default:!1,description:"Show help message"},version:{type:"boolean",short:"v",default:!1,description:"Show version"}};function YW1(){let _=l24({options:p24,allowPositionals:!1,strict:!0});if(_.values.version)console.log(`ccc v${r$()}`),process.exit(0);if(_.values.help)i24(),process.exit(0);let $=process.env.CCC_USERNAME||_.values.username,X=process.env.CCC_PASSWORD||_.values.password,Q=process.env.CCC_NGROK_TOKEN||_.values["ngrok-token"],Y=process.env.CCC_NGROK_DOMAIN||_.values["ngrok-domain"];if(!$||!X)console.error("\x1B[31mError: Authentication credentials are required.\x1B[0m"),console.error(""),console.error("These credentials secure the MQTT communication between the app and backend."),console.error(""),console.error("You can provide them via:"),console.error(""),console.error(" Environment variables (recommended for security):"),console.error(" export CCC_USERNAME=myuser"),console.error(" export CCC_PASSWORD=mypassword"),console.error(" export CCC_NGROK_TOKEN=your_token # optional"),console.error(" export CCC_NGROK_DOMAIN=your_domain # optional"),console.error(" ccc"),console.error(""),console.error(" Or CLI arguments:"),console.error(" ccc --username myuser --password mypassword"),console.error(" ccc -u myuser -p mypassword"),console.error(""),process.exit(1);return{debug:_.values.debug,mqttPort:parseInt(_.values["mqtt-port"],10),terminalPort:parseInt(_.values["terminal-port"],10),routerPort:parseInt(_.values["router-port"],10),username:$,password:X,ngrokToken:Q,ngrokDomain:Y,autoUpdate:!_.values["no-auto-update"],autoUpdateCheckInterval:parseInt(_.values["auto-update-check-interval"],10),terminalAudit:_.values["terminal-audit"]}}function i24(){console.log(`
891
+ >>> no match, partial?`,_,V,$,G),V===K)return!0}return!1}let U;if(typeof H==="string")U=W===H,this.debug("string match",H,W,U);else U=H.test(W),this.debug("pattern match",H,W,U);if(!U)return!1}if(J===K&&Z===z)return!0;else if(J===K)return X;else if(Z===z)return J===K-1&&_[J]==="";else throw Error("wtf?")}braceExpand(){return L31(this.pattern,this.options)}parse(_){lk(_);let $=this.options;if(_==="**")return aZ;if(_==="")return"";let X,Q=null;if(X=_.match(_74))Q=$.dot?X74:$74;else if(X=_.match(l54))Q=($.nocase?$.dot?n54:a54:$.dot?i54:p54)(X[1]);else if(X=_.match(Q74))Q=($.nocase?$.dot?J74:Y74:$.dot?Z74:K74)(X);else if(X=_.match(r54))Q=$.dot?s54:o54;else if(X=_.match(t54))Q=e54;let Y=DX.fromGlob(_,this.options).toMMPattern();if(Q&&typeof Y==="object")Reflect.defineProperty(Y,"test",{value:Q});return Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let _=this.set;if(!_.length)return this.regexp=!1,this.regexp;let $=this.options,X=$.noglobstar?H74:$.dot?V74:G74,Q=new Set($.nocase?["i"]:[]),Y=_.map((K)=>{let z=K.map((H)=>{if(H instanceof RegExp)for(let W of H.flags.split(""))Q.add(W);return typeof H==="string"?w74(H):H===aZ?aZ:H._src});return z.forEach((H,W)=>{let V=z[W+1],G=z[W-1];if(H!==aZ||G===aZ)return;if(G===void 0)if(V!==void 0&&V!==aZ)z[W+1]="(?:\\/|"+X+"\\/)?"+V;else z[W]=X;else if(V===void 0)z[W-1]=G+"(?:\\/|"+X+")?";else if(V!==aZ)z[W-1]=G+"(?:\\/|\\/"+X+"\\/)"+V,z[W+1]=aZ}),z.filter((H)=>H!==aZ).join("/")}).join("|"),[J,Z]=_.length>1?["(?:",")"]:["",""];if(Y="^"+J+Y+Z+"$",this.negate)Y="^(?!"+Y+").+$";try{this.regexp=new RegExp(Y,[...Q].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(_){if(this.preserveMultipleSlashes)return _.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(_))return["",..._.split(/\/+/)];else return _.split(/\/+/)}match(_,$=this.partial){if(this.debug("match",_,this.pattern),this.comment)return!1;if(this.empty)return _==="";if(_==="/"&&$)return!0;let X=this.options;if(this.isWindows)_=_.split("\\").join("/");let Q=this.slashSplit(_);this.debug(this.pattern,"split",Q);let Y=this.set;this.debug(this.pattern,"set",Y);let J=Q[Q.length-1];if(!J)for(let Z=Q.length-2;!J&&Z>=0;Z--)J=Q[Z];for(let Z=0;Z<Y.length;Z++){let K=Y[Z],z=Q;if(X.matchBase&&K.length===1)z=[J];if(this.matchOne(z,K,$)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(_){return LX.defaults(_).Minimatch}}LX.AST=DX;LX.Minimatch=ik;LX.escape=FJ0;LX.unescape=IB;var M31="@fastify/otel",D74="0.8.0",L74=">=4.0.0 <6",q31=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],a$={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},jB={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},IV="anonymous",dQ=Symbol("fastify otel instance"),SB=Symbol("fastify otel request spans"),ak=Symbol("fastify otel request context"),T31=Symbol("fastify otel addhook original"),E31=Symbol("fastify otel setnotfound original"),Ip=Symbol("fastify otel ignore path");class wJ0 extends R31.InstrumentationBase{constructor(_){super(M31,D74,_);if(this.servername=_?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[Ip]=null,this._logger=E7.diag.createComponentLogger({namespace:M31}),_?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let $=_?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof $!=="string"||$.length===0)&&typeof $!=="function")throw TypeError("ignorePaths must be a string or a function");let X=LX;this[Ip]=(Q)=>{if(typeof $==="function")return $(Q);else return X(Q.url,$)}}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let _=this.plugin();this._handleInitialization=($)=>{$.fastify.register(_)},A31.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){if(this._handleInitialization)A31.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0;return super.disable()}init(){return[]}plugin(){let _=this;return $[Symbol.for("skip-override")]=!0,$[Symbol.for("fastify.display-name")]="@fastify/otel",$[Symbol.for("plugin-meta")]={fastify:L74,name:"@fastify/otel"},$;function $(X,Q,Y){X.decorate(dQ,_),X.decorate(T31,X.addHook),X.decorate(E31,X.setNotFoundHandler),X.decorateRequest("opentelemetry",function(){let V=this[ak];return{span:this[SB],tracer:_.tracer,context:V,inject:(B,U)=>{return E7.propagation.inject(V,B,U)},extract:(B,U)=>{return E7.propagation.extract(V,B,U)}}}),X.decorateRequest(SB,null),X.decorateRequest(ak,null),X.addHook("onRoute",function(W){if(_[Ip]?.(W)===!0){_._logger.debug(`Ignoring route instrumentation ${W.method} ${W.url} because it matches the ignore path`);return}for(let V of q31)if(W[V]!=null){let G=W[V];if(typeof G==="function")W[V]=H(G,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[a$.FASTIFY_TYPE]:jB.ROUTE,[o7.ATTR_HTTP_ROUTE]:W.url,[a$.HOOK_CALLBACK_NAME]:G.name?.length>0?G.name:IV});else if(Array.isArray(G)){let B=[];for(let U of G)B.push(H(U,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[a$.FASTIFY_TYPE]:jB.ROUTE,[o7.ATTR_HTTP_ROUTE]:W.url,[a$.HOOK_CALLBACK_NAME]:U.name?.length>0?U.name:IV}));W[V]=B}}if(W.onSend!=null)W.onSend=Array.isArray(W.onSend)?[...W.onSend,J]:[W.onSend,J];else W.onSend=J;if(W.onError!=null)W.onError=Array.isArray(W.onError)?[...W.onError,Z]:[W.onError,Z];else W.onError=Z;W.handler=H(W.handler,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - route-handler`,[a$.FASTIFY_TYPE]:jB.HANDLER,[o7.ATTR_HTTP_ROUTE]:W.url,[a$.HOOK_CALLBACK_NAME]:W.handler.name.length>0?W.handler.name:IV})}),X.addHook("onRequest",function(W,V,G){if(this[dQ].isEnabled()===!1)return G();else if(this[dQ][Ip]?.({url:W.url,method:W.method})===!0)return this[dQ]._logger.debug(`Ignoring request ${W.method} ${W.url} because it matches the ignore path`),G();let B=E7.context.active();if(E7.trace.getSpan(B)==null)B=E7.propagation.extract(B,W.headers);let U=jp.getRPCMetadata(B);if(W.routeOptions.url!=null&&U?.type===jp.RPCType.HTTP)U.route=W.routeOptions.url;let O=this[dQ].tracer.startSpan("request",{attributes:{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.ROOT]:"@fastify/otel",[o7.ATTR_HTTP_ROUTE]:W.url,[o7.ATTR_HTTP_REQUEST_METHOD]:W.method}},B);W[ak]=E7.trace.setSpan(B,O),W[SB]=O,E7.context.with(W[ak],()=>{G()})}),X.addHook("onResponse",function(W,V,G){let B=W[SB];if(B!=null)B.setStatus({code:E7.SpanStatusCode.OK,message:"OK"}),B.setAttributes({[o7.ATTR_HTTP_RESPONSE_STATUS_CODE]:404}),B.end();W[SB]=null,G()}),X.addHook=K,X.setNotFoundHandler=z,Y();function J(W,V,G,B){let U=W[SB];if(U!=null){if(V.statusCode<500)U.setStatus({code:E7.SpanStatusCode.OK,message:"OK"});U.setAttributes({[o7.ATTR_HTTP_RESPONSE_STATUS_CODE]:V.statusCode}),U.end()}W[SB]=null,B(null,G)}function Z(W,V,G,B){let U=W[SB];if(U!=null)U.setStatus({code:E7.SpanStatusCode.ERROR,message:G.message}),U.recordException(G);B()}function K(W,V){let G=this[T31];if(q31.includes(W))return G.call(this,W,H(V,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - ${W}`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:IV}));else return G.call(this,W,V)}function z(W,V){let G=this[E31];if(typeof W==="function")V=H(W,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:W.name?.length>0?W.name:IV}),G.call(this,V);else{if(W.preValidation!=null)W.preValidation=H(W.preValidation,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:W.preValidation.name?.length>0?W.preValidation.name:IV});if(W.preHandler!=null)W.preHandler=H(W.preHandler,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:W.preHandler.name?.length>0?W.preHandler.name:IV});V=H(V,{[o7.ATTR_SERVICE_NAME]:X[dQ].servername,[a$.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[a$.FASTIFY_TYPE]:jB.INSTANCE,[a$.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:IV}),G.call(this,W,V)}}function H(W,V={}){return function(...B){let U=this[dQ],[O]=B;if(U.isEnabled()===!1)return W.call(this,...B);let F=O[ak]??E7.context.active(),N=U.tracer.startSpan(`handler - ${W.name?.length>0?W.name:this.pluginName??IV}`,{attributes:V},F);return E7.context.with(E7.trace.setSpan(F,N),function(){try{let w=W.call(this,...B);if(typeof w?.then==="function")return w.then((D)=>{return N.end(),D},(D)=>{return N.setStatus({code:E7.SpanStatusCode.ERROR,message:D.message}),N.recordException(D),N.end(),Promise.reject(D)});return N.end(),w}catch(w){throw N.setStatus({code:E7.SpanStatusCode.ERROR,message:w.message}),N.recordException(w),N.end(),w}},this)}}}}}var aK=h6(G4(),1),kp=h6(G5(),1),nN=h6(Y8(),1),S31=h6(J$(),1);var jV;(function(_){_.FASTIFY_NAME="fastify.name";let X="fastify.type";_.FASTIFY_TYPE=X;let Q="hook.name";_.HOOK_NAME=Q;let Y="plugin.name";_.PLUGIN_NAME=Y})(jV||(jV={}));var nk;(function(_){_.MIDDLEWARE="middleware";let X="request_handler";_.REQUEST_HANDLER=X})(nk||(nk={}));var rk;(function(_){_.MIDDLEWARE="middleware";let X="request handler";_.REQUEST_HANDLER=X})(rk||(rk={}));var P31=h6(G4(),1);var ok=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function NJ0(_,$,X,Q={}){let Y=$.startSpan(X,{attributes:Q}),J=_[ok]||[];return J.push(Y),Object.defineProperty(_,ok,{enumerable:!1,configurable:!0,value:J}),Y}function Sp(_,$){let X=_[ok]||[];if(!X.length)return;X.forEach((Q)=>{if($)Q.setStatus({code:P31.SpanStatusCode.ERROR,message:$.message}),Q.recordException($);Q.end()}),delete _[ok]}function I31(_,$,X){let Q,Y=void 0;try{if(Y=_(),C31(Y))Y.then((J)=>$(void 0,J),(J)=>$(J))}catch(J){Q=J}finally{if(!C31(Y)){if($(Q,Y),Q)throw Q}return Y}}function C31(_){return typeof _==="object"&&_&&typeof Object.getOwnPropertyDescriptor(_,"then")?.value==="function"||!1}var A74="0.1.0",M74="@sentry/instrumentation-fastify-v3",j31="anonymous",q74=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]);class DJ0 extends nN.InstrumentationBase{constructor(_={}){super(M74,A74,_)}init(){return[new nN.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],(_)=>{return this._patchConstructor(_)})]}_hookOnRequest(){let _=this;return function(X,Q,Y){if(!_.isEnabled())return Y();_._wrap(Q,"send",_._patchSend());let J=X,Z=kp.getRPCMetadata(aK.context.active()),K=J.routeOptions?J.routeOptions.url:X.routerPath;if(K&&Z?.type===kp.RPCType.HTTP)Z.route=K;let z=X.method||"GET";H9().setTransactionName(`${z} ${K}`),Y()}}_wrapHandler(_,$,X,Q){let Y=this;return this._diag.debug("Patching fastify route.handler function"),function(...J){if(!Y.isEnabled())return X.apply(this,J);let Z=X.name||_||j31,K=`${rk.MIDDLEWARE} - ${Z}`,z=J[1],H=NJ0(z,Y.tracer,K,{[jV.FASTIFY_TYPE]:nk.MIDDLEWARE,[jV.PLUGIN_NAME]:_,[jV.HOOK_NAME]:$}),W=Q&&J[J.length-1];if(W)J[J.length-1]=function(...V){Sp(z),W.apply(this,V)};return aK.context.with(aK.trace.setSpan(aK.context.active(),H),()=>{return I31(()=>{return X.apply(this,J)},(V)=>{if(V instanceof Error)H.setStatus({code:aK.SpanStatusCode.ERROR,message:V.message}),H.recordException(V);if(!Q)Sp(z)})})}}_wrapAddHook(){let _=this;return this._diag.debug("Patching fastify server.addHook function"),function($){return function(...Q){let Y=Q[0],J=Q[1],Z=this.pluginName;if(!q74.has(Y))return $.apply(this,Q);let K=typeof Q[Q.length-1]==="function"&&J.constructor.name!=="AsyncFunction";return $.apply(this,[Y,_._wrapHandler(Z,Y,J,K)])}}}_patchConstructor(_){let $=this;function X(...Q){let Y=_.fastify.apply(this,Q);return Y.addHook("onRequest",$._hookOnRequest()),Y.addHook("preHandler",$._hookPreHandler()),T74(),$._wrap(Y,"addHook",$._wrapAddHook()),Y}if(_.errorCodes!==void 0)X.errorCodes=_.errorCodes;return X.fastify=X,X.default=X,X}_patchSend(){let _=this;return this._diag.debug("Patching fastify reply.send function"),function(X){return function(...Y){let J=Y[0];if(!_.isEnabled())return X.apply(this,Y);return nN.safeExecuteInTheMiddle(()=>{return X.apply(this,Y)},(Z)=>{if(!Z&&J instanceof Error)Z=J;Sp(this,Z)})}}}_hookPreHandler(){let _=this;return this._diag.debug("Patching fastify preHandler function"),function(X,Q,Y){if(!_.isEnabled())return Y();let J=X,Z=J.routeOptions?.handler||J.context?.handler,K=Z?.name.startsWith("bound ")?Z.name.substring(6):Z?.name,z=`${rk.REQUEST_HANDLER} - ${K||this.pluginName||j31}`,H={[jV.PLUGIN_NAME]:this.pluginName,[jV.FASTIFY_TYPE]:nk.REQUEST_HANDLER,[S31.SEMATTRS_HTTP_ROUTE]:J.routeOptions?J.routeOptions.url:X.routerPath};if(K)H[jV.FASTIFY_NAME]=K;let W=NJ0(Q,_.tracer,z,H);k31(W);let{requestHook:V}=_.getConfig();if(V)nN.safeExecuteInTheMiddle(()=>V(W,{request:X}),(G)=>{if(G)_._diag.error("request hook failed",G)},!0);return aK.context.with(aK.trace.setSpan(aK.context.active(),W),()=>{Y()})}}}function T74(){let _=E4();if(_)_.on("spanStart",($)=>{k31($)})}function k31(_){let $=F_(_).data,X=$["fastify.type"];if($[e_]||!X)return;_.setAttributes({[S_]:"auto.http.otel.fastify",[e_]:`${X}.fastify`});let Q=$["fastify.name"]||$["plugin.name"]||$["hook.name"];if(typeof Q==="string"){let Y=Q.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");_.updateName(Y)}}var bp="Fastify",v31=i4(`${bp}.v3`,()=>new DJ0);function E74(){let _=E4();if(!_)return;else return _.getIntegrationByName(bp)}function b31(_,$,X,Q){let Y=E74()?.getShouldHandleError()||y31;if(Q==="diagnostics-channel")this.diagnosticsChannelExists=!0;if(this.diagnosticsChannelExists&&Q==="onError-hook"){o5&&g1.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}if(Y(_,$,X))J8(_,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var x31=i4(`${bp}.v5`,()=>{let _=new wJ0,$=_.plugin();return LJ0.subscribe("fastify.initialization",(X)=>{let Q=X.fastify;Q?.register($).after((Y)=>{if(Y)o5&&g1.error("Failed to setup Fastify instrumentation",Y);else if(C74(),Q)P74(Q)})}),LJ0.subscribe("tracing:fastify.request.handler:error",(X)=>{let{error:Q,request:Y,reply:J}=X;b31.call(b31,Q,Y,J,"diagnostics-channel")}),_}),R74=({shouldHandleError:_})=>{let $;return{name:bp,setupOnce(){$=_||y31,v31(),x31()},getShouldHandleError(){return $},setShouldHandleError(X){$=X}}},f31=a6((_={})=>R74(_));function y31(_,$,X){let Q=X.statusCode;return Q>=500||Q<=299}function g31(_){let $=F_(_),X=$.description,Q=$.data,Y=Q["fastify.type"],J=Y==="hook",Z=Y===X?.startsWith("handler -"),K=X==="request"||Y==="request-handler";if(Q[e_]||!Z&&!K&&!J)return;let z=J?"hook":Z?"middleware":K?"request-handler":"<unknown>";_.setAttributes({[S_]:"auto.http.otel.fastify",[e_]:`${z}.fastify`});let H=Q["fastify.name"]||Q["plugin.name"]||Q["hook.name"];if(typeof H==="string"){let W=H.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");_.updateName(W)}}function C74(){let _=E4();if(_)_.on("spanStart",($)=>{g31($)})}function P74(_){_.addHook("onRequest",async($,X)=>{if($.opentelemetry){let{span:J}=$.opentelemetry();if(J)g31(J)}let Q=$.routeOptions?.url,Y=$.method||"GET";H9().setTransactionName(`${Y} ${Q}`)})}var AX1=h6(G4(),1),MX1=h6(LX1(),1);var qX1="Graphql",TX1=i4(qX1,MX1.GraphQLInstrumentation,(_)=>{let $=RX1(_);return{...$,responseHook(X,Q){if(Z$(X,"auto.graphql.otel.graphql"),Q.errors?.length&&!F_(X).status)X.setStatus({code:AX1.SpanStatusCode.ERROR});let J=F_(X).data,Z=J["graphql.operation.type"],K=J["graphql.operation.name"];if($.useOperationNameForRootSpan&&Z){let z=n5(X),W=F_(z).data[xq]||[],V=K?`${Z} ${K}`:`${Z}`;if(Array.isArray(W))W.push(V),z.setAttribute(xq,W);else if(typeof W==="string")z.setAttribute(xq,[W,V]);else z.setAttribute(xq,V);if(!F_(z).data["original-description"])z.setAttribute("original-description",F_(z).description);z.updateName(`${F_(z).data["original-description"]} (${Y34(W)})`)}}}}),Q34=(_={})=>{return{name:qX1,setupOnce(){TX1(RX1(_))}}},EX1=a6(Q34);function RX1(_){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,..._}}function Y34(_){if(Array.isArray(_)){let $=_.slice().sort();if($.length<=5)return $.join(", ");else return`${$.slice(0,5).join(", ")}, +${$.length-5}`}return`${_}`}var rX1=h6(nX1(),1);var oX1="Kafka",sX1=i4(oX1,()=>new rX1.KafkaJsInstrumentation({consumerHook(_){Z$(_,"auto.kafkajs.otel.consumer")},producerHook(_){Z$(_,"auto.kafkajs.otel.producer")}})),T34=()=>{return{name:oX1,setupOnce(){sX1()}}},tX1=a6(T34);var HQ1=h6(WQ1(),1);var VQ1="LruMemoizer",GQ1=i4(VQ1,()=>new HQ1.LruMemoizerInstrumentation),P34=()=>{return{name:VQ1,setupOnce(){GQ1()}}},UQ1=a6(P34);var jQ1=h6(IQ1(),1);var SQ1="Mongo",kQ1=i4(SQ1,()=>new jQ1.MongoDBInstrumentation({dbStatementSerializer:l34,responseHook(_){Z$(_,"auto.db.otel.mongo")}}));function l34(_){let $=bJ0(_);return JSON.stringify($)}function bJ0(_){if(Array.isArray(_))return _.map(($)=>bJ0($));if(p34(_)){let $={};return Object.entries(_).map(([X,Q])=>[X,bJ0(Q)]).reduce((X,Q)=>{if(a34(Q))X[Q[0]]=Q[1];return X},$)}return"?"}function p34(_){return typeof _==="object"&&_!==null&&!i34(_)}function i34(_){let $=!1;if(typeof Buffer<"u")$=Buffer.isBuffer(_);return $}function a34(_){return Array.isArray(_)}var n34=()=>{return{name:SQ1,setupOnce(){kQ1()}}},bQ1=a6(n34);var eQ1=h6(tQ1(),1);var _Y1="Mongoose",$Y1=i4(_Y1,()=>new eQ1.MongooseInstrumentation({responseHook(_){Z$(_,"auto.db.otel.mongoose")}})),OX4=()=>{return{name:_Y1,setupOnce(){$Y1()}}},XY1=a6(OX4);var DY1=h6(NY1(),1);var LY1="Mysql",AY1=i4(LY1,()=>new DY1.MySQLInstrumentation({})),mX4=()=>{return{name:LY1,setupOnce(){AY1()}}},MY1=a6(mX4);var uY1=h6(mY1(),1);var dY1="Mysql2",cY1=i4(dY1,()=>new uY1.MySQL2Instrumentation({responseHook(_){Z$(_,"auto.db.otel.mysql2")}})),BQ4=()=>{return{name:dY1,setupOnce(){cY1()}}},lY1=a6(BQ4);var cJ1=h6(WJ1(),1),lJ1=h6(gJ1(),1);var oQ4=["get","set","setex"],$Z0=["get","mget"],sQ4=["set","setex"];function Zb(_,$){return _.includes($.toLowerCase())}function XZ0(_){if(Zb($Z0,_))return"cache.get";else if(Zb(sQ4,_))return"cache.put";else return}function tQ4(_,$){return $.some((X)=>_.startsWith(X))}function mJ1(_,$){try{if($.length===0)return;let X=(Y)=>{if(typeof Y==="string"||typeof Y==="number"||Buffer.isBuffer(Y))return[Y.toString()];else if(Array.isArray(Y))return hJ1(Y.map((J)=>X(J)));else return["<unknown>"]},Q=$[0];if(Zb(oQ4,_)&&Q!=null)return X(Q);return hJ1($.map((Y)=>X(Y)))}catch{return}}function uJ1(_,$,X){if(!XZ0(_))return!1;for(let Q of $)if(tQ4(Q,X))return!0;return!1}function dJ1(_){let $=(X)=>{try{if(Buffer.isBuffer(X))return X.byteLength;else if(typeof X==="string")return X.length;else if(typeof X==="number")return X.toString().length;else if(X===null||X===void 0)return 0;return JSON.stringify(X).length}catch{return}};return Array.isArray(_)?_.reduce((X,Q)=>{let Y=$(Q);return typeof Y==="number"?X!==void 0?X+Y:Y:X},0):$(_)}function hJ1(_){let $=[],X=(Q)=>{Q.forEach((Y)=>{if(Array.isArray(Y))X(Y);else $.push(Y)})};return X(_),$}var np="Redis",Kb={},pJ1=(_,$,X,Q)=>{_.setAttribute(S_,"auto.db.otel.redis");let Y=mJ1($,X),J=XZ0($);if(!Y||!J||!Kb.cachePrefixes||!uJ1($,Y,Kb.cachePrefixes))return;let Z=F_(_).data["net.peer.name"],K=F_(_).data["net.peer.port"];if(K&&Z)_.setAttributes({"network.peer.address":Z,"network.peer.port":K});let z=dJ1(Q);if(z)_.setAttribute(iX0,z);if(Zb($Z0,$)&&z!==void 0)_.setAttribute(lX0,z>0);_.setAttributes({[e_]:J,[pX0]:Y});let H=Y.join(", ");_.updateName(Kb.maxCacheKeyLength?$B(H,Kb.maxCacheKeyLength):H)},eQ4=i4(`${np}.IORedis`,()=>{return new cJ1.IORedisInstrumentation({responseHook:pJ1})}),_Y4=i4(`${np}.Redis`,()=>{return new lJ1.RedisInstrumentation({responseHook:pJ1})}),iJ1=Object.assign(()=>{eQ4(),_Y4()},{id:np}),$Y4=(_={})=>{return{name:np,setupOnce(){Kb=_,iJ1()}}},aJ1=a6($Y4);var qZ1=h6(MZ1(),1);var TZ1="Postgres",EZ1=i4(TZ1,()=>new qZ1.PgInstrumentation({requireParentSpan:!0,requestHook(_){Z$(_,"auto.db.otel.postgres")}})),aY4=()=>{return{name:TZ1,setupOnce(){EZ1()}}},RZ1=a6(aY4);var XT=h6(G4(),1),vV=h6(Y8(),1),R7=h6(J$(),1);var $i="PostgresJs",CZ1=[">=3.0.0 <4"],nY4=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,_i=Symbol("sentryPostgresConnectionContext"),WZ0=Symbol.for("sentry.instrumented.postgresjs"),PZ1=Symbol.for("sentry.query.from.instrumented.sql"),IZ1=i4($i,(_)=>new jZ1({requireParentSpan:_?.requireParentSpan??!0,requestHook:_?.requestHook}));class jZ1 extends vV.InstrumentationBase{constructor(_){super("sentry-postgres-js",J9,_)}init(){let _=new vV.InstrumentationNodeModuleDefinition("postgres",CZ1,($)=>{try{return this._patchPostgres($)}catch(X){return o5&&g1.error("Failed to patch postgres module:",X),$}},($)=>$);return["src","cf/src","cjs/src"].forEach(($)=>{_.files.push(new vV.InstrumentationNodeModuleFile(`postgres/${$}/query.js`,CZ1,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),_}_patchPostgres(_){let $=typeof _==="function",X=$?_:_.default;if(typeof X!=="function")return o5&&g1.warn("postgres module does not export a function. Skipping instrumentation."),_;let Q=this,Y=function(...J){let Z=Reflect.construct(X,J);if(!Z||typeof Z!=="function")return o5&&g1.warn("postgres() did not return a valid instance"),Z;return Q._instrumentSqlInstance(Z)};Object.setPrototypeOf(Y,X),Object.setPrototypeOf(Y.prototype,X.prototype);for(let J of Object.getOwnPropertyNames(X))if(!["length","name","prototype"].includes(J)){let Z=Object.getOwnPropertyDescriptor(X,J);if(Z)Object.defineProperty(Y,J,Z)}if($)return Y;else return Nk(_,"default",Y),_}_wrapQueryMethod(_,$,X){let Q=this;return function(...Y){let J=Reflect.apply(_,$,Y);if(J&&typeof J==="object"&&"handle"in J)Q._wrapSingleQueryHandle(J,X);return J}}_wrapCallbackMethod(_,$,X){let Q=this;return function(...Y){let J=X[_i];if(typeof Y[Y.length-1]!=="function"){let W=Reflect.apply(_,$,Y);if(W&&typeof W.then==="function")return W.then((V)=>{return Q._instrumentSqlInstance(V,J)});return W}let K=Y.length===1?Y[0]:Y[1],z=function(W){let V=Q._instrumentSqlInstance(W,J);return K(V)},H=Y.length===1?[z]:[Y[0],z];return Reflect.apply(_,$,H)}}_setConnectionAttributes(_,$){if(!$)return;if($.ATTR_DB_NAMESPACE)_.setAttribute(R7.ATTR_DB_NAMESPACE,$.ATTR_DB_NAMESPACE);if($.ATTR_SERVER_ADDRESS)_.setAttribute(R7.ATTR_SERVER_ADDRESS,$.ATTR_SERVER_ADDRESS);if($.ATTR_SERVER_PORT!==void 0){let X=parseInt($.ATTR_SERVER_PORT,10);if(!isNaN(X))_.setAttribute(R7.ATTR_SERVER_PORT,X)}}_setOperationName(_,$,X){if(X){_.setAttribute(R7.ATTR_DB_OPERATION_NAME,X);return}let Q=$?.match(nY4);if(Q?.[1])_.setAttribute(R7.ATTR_DB_OPERATION_NAME,Q[1].toUpperCase())}_attachConnectionContext(_,$){let X=_;if(!X.options||typeof X.options!=="object")return;let Q=X.options,Y=Q.host?.[0]||"localhost",J=Q.port?.[0]||5432,Z={ATTR_DB_NAMESPACE:typeof Q.database==="string"&&Q.database!==""?Q.database:void 0,ATTR_SERVER_ADDRESS:Y,ATTR_SERVER_PORT:String(J)};$[_i]=Z}_instrumentSqlInstance(_,$){if(_[WZ0])return _;let X=this,Q=new Proxy(_,{apply(Y,J,Z){let K=Reflect.apply(Y,J,Z);if(K&&typeof K==="object"&&"handle"in K)X._wrapSingleQueryHandle(K,Q);return K},get(Y,J){let Z=Y[J];if(typeof J!=="string"||typeof Z!=="function")return Z;if(J==="unsafe"||J==="file")return X._wrapQueryMethod(Z,Y,Q);if(J==="begin"||J==="reserve")return X._wrapCallbackMethod(Z,Y,Q);return Z}});if($)Q[_i]=$;else this._attachConnectionContext(_,Q);return _[WZ0]=!0,Q[WZ0]=!0,Q}_wrapSingleQueryHandle(_,$){if(_.handle?.__sentryWrapped)return;_[PZ1]=!0;let X=_.handle,Q=this,Y=async function(...J){if(!Q._shouldCreateSpans())return X.apply(this,J);let Z=Q._reconstructQuery(_.strings),K=Q._sanitizeSqlQuery(Z);return wX({name:K||"postgresjs.query",op:"db"},(z)=>{Z$(z,"auto.db.postgresjs"),z.setAttributes({[R7.ATTR_DB_SYSTEM_NAME]:"postgres",[R7.ATTR_DB_QUERY_TEXT]:K});let H=$?$[_i]:void 0;Q._setConnectionAttributes(z,H);let W=Q.getConfig(),{requestHook:V}=W;if(V)vV.safeExecuteInTheMiddle(()=>V(z,K,H),(B)=>{if(B)z.setAttribute("sentry.hook.error","requestHook failed"),o5&&g1.error(`Error in requestHook for ${$i} integration:`,B)},!0);let G=this;G.resolve=new Proxy(G.resolve,{apply:(B,U,O)=>{try{Q._setOperationName(z,K,O?.[0]?.command),z.end()}catch(F){o5&&g1.error("Error ending span in resolve callback:",F)}return Reflect.apply(B,U,O)}}),G.reject=new Proxy(G.reject,{apply:(B,U,O)=>{try{z.setStatus({code:h8,message:O?.[0]?.message||"unknown_error"}),z.setAttribute(R7.ATTR_DB_RESPONSE_STATUS_CODE,O?.[0]?.code||"unknown"),z.setAttribute(R7.ATTR_ERROR_TYPE,O?.[0]?.name||"unknown"),Q._setOperationName(z,K),z.end()}catch(F){o5&&g1.error("Error ending span in reject callback:",F)}return Reflect.apply(B,U,O)}});try{return X.apply(this,J)}catch(B){throw z.setStatus({code:h8,message:B instanceof Error?B.message:"unknown_error"}),z.end(),B}})};Y.__sentryWrapped=!0,_.handle=Y}_shouldCreateSpans(){let _=this.getConfig();return XT.trace.getSpan(XT.context.active())!==void 0||!_.requireParentSpan}_reconstructQuery(_){if(!_?.length)return;if(_.length===1)return _[0]||void 0;return _.reduce(($,X,Q)=>Q===0?X:`${$}$${Q}${X}`,"")}_sanitizeSqlQuery(_){if(!_)return"Unknown SQL Query";return _.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 ($?)")}_patchQueryPrototype(_){let $=this,X=_.Query.prototype.handle;return _.Query.prototype.handle=async function(...Q){if(this[PZ1])return X.apply(this,Q);if(!$._shouldCreateSpans())return X.apply(this,Q);let Y=$._reconstructQuery(this.strings),J=$._sanitizeSqlQuery(Y);return wX({name:J||"postgresjs.query",op:"db"},(Z)=>{Z$(Z,"auto.db.postgresjs"),Z.setAttributes({[R7.ATTR_DB_SYSTEM_NAME]:"postgres",[R7.ATTR_DB_QUERY_TEXT]:J});let K=$.getConfig(),{requestHook:z}=K;if(z)vV.safeExecuteInTheMiddle(()=>z(Z,J,void 0),(V)=>{if(V)Z.setAttribute("sentry.hook.error","requestHook failed"),o5&&g1.error(`Error in requestHook for ${$i} integration:`,V)},!0);let H=this.resolve;this.resolve=new Proxy(H,{apply:(V,G,B)=>{try{$._setOperationName(Z,J,B?.[0]?.command),Z.end()}catch(U){o5&&g1.error("Error ending span in resolve callback:",U)}return Reflect.apply(V,G,B)}});let W=this.reject;this.reject=new Proxy(W,{apply:(V,G,B)=>{try{Z.setStatus({code:h8,message:B?.[0]?.message||"unknown_error"}),Z.setAttribute(R7.ATTR_DB_RESPONSE_STATUS_CODE,B?.[0]?.code||"unknown"),Z.setAttribute(R7.ATTR_ERROR_TYPE,B?.[0]?.name||"unknown"),$._setOperationName(Z,J),Z.end()}catch(U){o5&&g1.error("Error ending span in reject callback:",U)}return Reflect.apply(V,G,B)}});try{return X.apply(this,Q)}catch(V){throw Z.setStatus({code:h8,message:V instanceof Error?V.message:"unknown_error"}),Z.end(),V}})},_.Query.prototype.handle.__sentry_original__=X,_}_unpatchQueryPrototype(_){if(_.Query.prototype.handle.__sentry_original__)_.Query.prototype.handle=_.Query.prototype.handle.__sentry_original__;return _}}var rY4=(_)=>{return{name:$i,setupOnce(){IZ1(_)}}},SZ1=a6(rY4);var eZ=h6(G4(),1);var vZ1=h6(G4(),1),Xi=h6(Y8(),1),fB=h6(G4(),1);var oY4=process.env.PRISMA_SHOW_ALL_TRACES==="true",sY4="00-10-10-00";function tY4(_){switch(_){case"client":return fB.SpanKind.CLIENT;case"internal":default:return fB.SpanKind.INTERNAL}}var eY4=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:_,ignoreSpanTypes:$}){this.tracerProvider=_,this.ignoreSpanTypes=$}isEnabled(){return!0}getTraceParent(_){let $=fB.trace.getSpanContext(_??fB.context.active());if($)return`00-${$.traceId}-${$.spanId}-0${$.traceFlags}`;return sY4}dispatchEngineSpans(_){let $=this.tracerProvider.getTracer("prisma"),X=new Map,Q=_.filter((Y)=>Y.parentId===null);for(let Y of Q)xZ1($,Y,_,X,this.ignoreSpanTypes)}getActiveContext(){return fB.context.active()}runInChildSpan(_,$){if(typeof _==="string")_={name:_};if(_.internal&&!oY4)return $();let X=this.tracerProvider.getTracer("prisma"),Q=_.context??this.getActiveContext(),Y=`prisma:client:${_.name}`;if(fZ1(Y,this.ignoreSpanTypes))return $();if(_.active===!1){let J=X.startSpan(Y,_,Q);return kZ1(J,$(J,Q))}return X.startActiveSpan(Y,_,(J)=>kZ1(J,$(J,Q)))}};function xZ1(_,$,X,Q,Y){if(fZ1($.name,Y))return;let J={attributes:$.attributes,kind:tY4($.kind),startTime:$.startTime};_.startActiveSpan($.name,J,(Z)=>{if(Q.set($.id,Z.spanContext().spanId),$.links)Z.addLinks($.links.flatMap((z)=>{let H=Q.get(z);if(!H)return[];return{context:{spanId:H,traceId:Z.spanContext().traceId,traceFlags:Z.spanContext().traceFlags}}}));let K=X.filter((z)=>z.parentId===$.id);for(let z of K)xZ1(_,z,X,Q,Y);Z.end($.endTime)})}function kZ1(_,$){if(_J4($))return $.then((X)=>{return _.end(),X},(X)=>{throw _.end(),X});return _.end(),$}function _J4(_){return _!=null&&typeof _.then==="function"}function fZ1(_,$){return $.some((X)=>typeof X==="string"?X===_:X.test(_))}var yZ1={name:"@prisma/instrumentation",version:"6.19.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:{"@prisma/internals":"workspace:*","@types/node":"18.19.76","@opentelemetry/api":"1.9.0",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":">=0.52.0 <1"},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},VZ0=yZ1.version,$J4=VZ0.split(".")[0],bZ1="PRISMA_INSTRUMENTATION",HZ0=`V${$J4}_PRISMA_INSTRUMENTATION`,XJ4=yZ1.name,QJ4="@prisma/client",gZ1=class extends Xi.InstrumentationBase{tracerProvider;constructor(_={}){super(XJ4,VZ0,_)}setTracerProvider(_){this.tracerProvider=_}init(){return[new Xi.InstrumentationNodeModuleDefinition(QJ4,[VZ0])]}enable(){let _=this._config,$={helper:new eY4({tracerProvider:this.tracerProvider??vZ1.trace.getTracerProvider(),ignoreSpanTypes:_.ignoreSpanTypes??[]})};global[bZ1]=$,global[HZ0]=$}disable(){delete global[bZ1],delete global[HZ0]}isEnabled(){return Boolean(global[HZ0])}};var hZ1="Prisma";function YJ4(_){return!!_&&typeof _==="object"&&"dispatchEngineSpans"in _}function mZ1(){let _=globalThis.PRISMA_INSTRUMENTATION;return _&&typeof _==="object"&&"helper"in _?_.helper:void 0}class uZ1 extends gZ1{constructor(){super()}enable(){super.enable();let _=mZ1();if(YJ4(_))_.createEngineSpan=($)=>{let X=eZ.trace.getTracer("prismaV5Compatibility"),Q=X._idGenerator;if(!Q){q7(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{$.spans.forEach((Y)=>{let J=JJ4(Y.kind),Z=Y.parent_span_id,K=Y.span_id,z=Y.trace_id,H=Y.links?.map((V)=>{return{context:{traceId:V.trace_id,spanId:V.span_id,traceFlags:eZ.TraceFlags.SAMPLED}}}),W=eZ.trace.setSpanContext(eZ.context.active(),{traceId:z,spanId:Z,traceFlags:eZ.TraceFlags.SAMPLED});eZ.context.with(W,()=>{let V={generateTraceId:()=>{return z},generateSpanId:()=>{return K}};X._idGenerator=V,X.startSpan(Y.name,{kind:J,links:H,startTime:Y.start_time,attributes:Y.attributes}).end(Y.end_time),X._idGenerator=Q})})}finally{X._idGenerator=Q}}}}function JJ4(_){switch(_){case"client":return eZ.SpanKind.CLIENT;case"internal":default:return eZ.SpanKind.INTERNAL}}var ZJ4=i4(hZ1,(_)=>{return new uZ1}),dZ1=a6((_)=>{return{name:hZ1,setupOnce(){ZJ4()},setup($){if(!mZ1())return;$.on("spanStart",(X)=>{let Q=F_(X);if(Q.description?.startsWith("prisma:"))X.setAttribute(S_,"auto.db.otel.prisma");if(Q.description==="prisma:engine:db_query"&&Q.data["db.query.text"])X.updateName(Q.data["db.query.text"]);if(Q.description==="prisma:engine:db_query"&&!Q.data["db.system"])X.setAttribute("db.system","prisma")})}}});var H21=h6(W21(),1);var V21="Hapi",G21=i4(V21,()=>new H21.HapiInstrumentation),jJ4=()=>{return{name:V21,setupOnce(){G21()}}},U21=a6(jJ4);var Ji=h6(J$(),1);var gB={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Gb={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};var sN=h6(G4(),1),Yi=h6(Y8(),1);var SJ4="@sentry/instrumentation-hono",kJ4="0.0.1";class FZ0 extends Yi.InstrumentationBase{constructor(_={}){super(SJ4,kJ4,_)}init(){return[new Yi.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],(_)=>this._patch(_))]}_patch(_){let $=this;class X extends _.Hono{constructor(...Q){super(...Q);$._wrap(this,"get",$._patchHandler()),$._wrap(this,"post",$._patchHandler()),$._wrap(this,"put",$._patchHandler()),$._wrap(this,"delete",$._patchHandler()),$._wrap(this,"options",$._patchHandler()),$._wrap(this,"patch",$._patchHandler()),$._wrap(this,"all",$._patchHandler()),$._wrap(this,"on",$._patchOnHandler()),$._wrap(this,"use",$._patchMiddlewareHandler())}}try{_.Hono=X}catch{return{..._,Hono:X}}return _}_patchHandler(){let _=this;return function($){return function(...Q){if(typeof Q[0]==="string"){let Y=Q[0];if(Q.length===1)return $.apply(this,[Y]);let J=Q.slice(1);return $.apply(this,[Y,...J.map((Z)=>_._wrapHandler(Z))])}return $.apply(this,Q.map((Y)=>_._wrapHandler(Y)))}}}_patchOnHandler(){let _=this;return function($){return function(...Q){let Y=Q.slice(2);return $.apply(this,[...Q.slice(0,2),...Y.map((J)=>_._wrapHandler(J))])}}}_patchMiddlewareHandler(){let _=this;return function($){return function(...Q){if(typeof Q[0]==="string"){let Y=Q[0];if(Q.length===1)return $.apply(this,[Y]);let J=Q.slice(1);return $.apply(this,[Y,...J.map((Z)=>_._wrapHandler(Z))])}return $.apply(this,Q.map((Y)=>_._wrapHandler(Y)))}}}_wrapHandler(_){let $=this;return function(X,Q){if(!$.isEnabled())return _.apply(this,[X,Q]);let Y=X.req.path,J=$.tracer.startSpan(Y);return sN.context.with(sN.trace.setSpan(sN.context.active(),J),()=>{return $._safeExecute(()=>{let Z=_.apply(this,[X,Q]);if(gQ(Z))return Z.then((K)=>{let z=$._determineHandlerType(K);return J.setAttributes({[gB.HONO_TYPE]:z,[gB.HONO_NAME]:z===Gb.REQUEST_HANDLER?Y:_.name||"anonymous"}),$.getConfig().responseHook?.(J),K});else{let K=$._determineHandlerType(Z);return J.setAttributes({[gB.HONO_TYPE]:K,[gB.HONO_NAME]:K===Gb.REQUEST_HANDLER?Y:_.name||"anonymous"}),$.getConfig().responseHook?.(J),Z}},()=>J.end(),(Z)=>{$._handleError(J,Z),J.end()})})}}_safeExecute(_,$,X){try{let Q=_();if(gQ(Q))Q.then(()=>$(),(Y)=>X(Y));else $();return Q}catch(Q){throw X(Q),Q}}_determineHandlerType(_){return _===void 0?Gb.MIDDLEWARE:Gb.REQUEST_HANDLER}_handleError(_,$){if($ instanceof Error)_.setStatus({code:sN.SpanStatusCode.ERROR,message:$.message}),_.recordException($)}}var B21="Hono";function bJ4(_){let $=F_(_).data,X=$[gB.HONO_TYPE];if($[e_]||!X)return;_.setAttributes({[S_]:"auto.http.otel.hono",[e_]:`${X}.hono`});let Q=$[gB.HONO_NAME];if(typeof Q==="string")_.updateName(Q);if(H9()===RJ()){o5&&g1.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let Y=$[Ji.ATTR_HTTP_ROUTE],J=$[Ji.ATTR_HTTP_REQUEST_METHOD];if(typeof Y==="string"&&typeof J==="string")H9().setTransactionName(`${J} ${Y}`)}var O21=i4(B21,()=>new FZ0({responseHook:(_)=>{bJ4(_)}})),vJ4=()=>{return{name:B21,setupOnce(){O21()}}},F21=a6(vJ4);var h21=h6(g21(),1),m21=h6(J$(),1);var u21="Koa",d21=i4(u21,h21.KoaInstrumentation,(_={})=>{return{ignoreLayersType:_.ignoreLayersType,requestHook($,X){Z$($,"auto.http.otel.koa");let Q=F_($).data,Y=Q["koa.type"];if(Y)$.setAttribute(e_,`${Y}.koa`);let J=Q["koa.name"];if(typeof J==="string")$.updateName(J||"< unknown >");if(H9()===RJ()){o5&&g1.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let Z=Q[m21.ATTR_HTTP_ROUTE],K=X.context?.request?.method?.toUpperCase()||"GET";if(Z)H9().setTransactionName(`${K} ${Z}`)}}}),iJ4=(_={})=>{return{name:u21,setupOnce(){d21(_)}}},c21=a6(iJ4);var HK1=h6(WK1(),1);var VK1="Connect",GK1=i4(VK1,()=>new HK1.ConnectInstrumentation),ZZ4=()=>{return{name:VK1,setupOnce(){GK1()}}},UK1=a6(ZZ4);var SK1=h6(jK1(),1);var AZ4=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),kK1="Tedious",bK1=i4(kK1,()=>new SK1.TediousInstrumentation({})),MZ4=()=>{let _;return{name:kK1,setupOnce(){let $=bK1();_=yk($)},setup($){_?.(()=>$.on("spanStart",(X)=>{let{description:Q,data:Y}=F_(X);if(!Q||Y["db.system"]!=="mssql")return;let J=Q.split(" ")[0]||"";if(AZ4.has(J))X.setAttribute(S_,"auto.db.otel.tedious")}))}}},vK1=a6(MZ4);var lK1=h6(cK1(),1);var pK1="GenericPool",iK1=i4(pK1,()=>new lK1.GenericPoolInstrumentation({})),RZ4=()=>{let _;return{name:pK1,setupOnce(){let $=iK1();_=yk($)},setup($){_?.(()=>$.on("spanStart",(X)=>{let Y=F_(X).description;if(Y==="generic-pool.aquire"||Y==="generic-pool.acquire")X.setAttribute(S_,"auto.db.otel.generic_pool")}))}}},aK1=a6(RZ4);var wz1=h6(Fz1(),1);var Nz1="Amqplib",Z24={consumeEndHook:(_)=>{Z$(_,"auto.amqplib.otel.consumer")},publishHook:(_)=>{Z$(_,"auto.amqplib.otel.publisher")}},Dz1=i4(Nz1,()=>new wz1.AmqplibInstrumentation(Z24)),K24=()=>{return{name:Nz1,setupOnce(){Dz1()}}},Lz1=a6(K24);var wb="VercelAI";var Bi=h6(Y8(),1);var z24=[">=3.0.0 <7"],Az1=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function W24(_){if(typeof _!=="object"||_===null)return!1;let $=_;return"type"in $&&"error"in $&&"toolName"in $&&"toolCallId"in $&&$.type==="tool-error"&&$.error instanceof Error}function H24(_){if(typeof _!=="object"||_===null||!("content"in _))return;let $=_;if(!Array.isArray($.content))return;for(let X of $.content)if(W24(X)){let Q=hQ0(X.toolCallId);if(Q){let Y=Q.spanContext();CY((J)=>{J.setContext("trace",{trace_id:Y.traceId,span_id:Y.spanId}),J.setTag("vercel.ai.tool.name",X.toolName),J.setTag("vercel.ai.tool.callId",X.toolCallId),J.setLevel("error"),J8(X.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}),mQ0(X.toolCallId)}else CY((Y)=>{Y.setTag("vercel.ai.tool.name",X.toolName),Y.setTag("vercel.ai.tool.callId",X.toolCallId),Y.setLevel("error"),J8(X.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function V24(_,$,X,Q){let Y=_?.recordInputs!==void 0?_.recordInputs:$.recordInputs!==void 0?$.recordInputs:X===!0?!0:Q,J=_?.recordOutputs!==void 0?_.recordOutputs:$.recordOutputs!==void 0?$.recordOutputs:X===!0?!0:Q;return{recordInputs:Y,recordOutputs:J}}class Nb extends Bi.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(_={}){super("@sentry/instrumentation-vercel-ai",J9,_);Nb.prototype.__init.call(this),Nb.prototype.__init2.call(this)}init(){return new Bi.InstrumentationNodeModuleDefinition("ai",z24,this._patch.bind(this))}callWhenPatched(_){if(this._isPatched)_();else this._callbacks.push(_)}_patch(_){this._isPatched=!0,this._callbacks.forEach((X)=>X()),this._callbacks=[];let $=(X)=>{return new Proxy(X,{apply:(Q,Y,J)=>{let Z=J[0].experimental_telemetry||{},K=Z.isEnabled,z=E4(),H=z?.getIntegrationByName(wb),W=H?.options,V=H?Boolean(z?.getOptions().sendDefaultPii):!1,{recordInputs:G,recordOutputs:B}=V24(W,Z,K,V);return J[0].experimental_telemetry={...Z,isEnabled:K!==void 0?K:!0,recordInputs:G,recordOutputs:B},CJ(()=>Reflect.apply(Q,Y,J),(U)=>{if(U&&typeof U==="object")i7(U,"_sentry_active_span",LW())},()=>{},(U)=>{H24(U)})}})};if(Object.prototype.toString.call(_)==="[object Module]"){for(let X of Az1)_[X]=$(_[X]);return _}else{let X=Az1.reduce((Q,Y)=>{return Q[Y]=$(_[Y]),Q},{});return{..._,...X}}}}var Mz1=i4(wb,()=>new Nb({}));function G24(_){return!!_.getIntegrationByName("Modules")?.getModules?.()?.ai}var U24=(_={})=>{let $;return{name:wb,options:_,setupOnce(){$=Mz1()},afterAllSetup(X){if(_.force??G24(X))fl(X);else $?.callWhenPatched(()=>fl(X))}}},qz1=a6(U24);var Oi=h6(Y8(),1);var B24=[">=4.0.0 <7"];class xZ0 extends Oi.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-openai",J9,_)}init(){return new Oi.InstrumentationNodeModuleDefinition("openai",B24,this._patch.bind(this))}_patch(_){let $=_;return $=this._patchClient($,"OpenAI"),$=this._patchClient($,"AzureOpenAI"),$}_patchClient(_,$){let X=_[$];if(!X)return _;let Q=this.getConfig(),Y=function(...J){if(xN(MB))return Reflect.construct(X,J);let Z=Reflect.construct(X,J),K=E4(),z=Boolean(K?.getOptions().sendDefaultPii),H=Q.recordInputs??z,W=Q.recordOutputs??z;return hl(Z,{recordInputs:H,recordOutputs:W})};Object.setPrototypeOf(Y,X),Object.setPrototypeOf(Y.prototype,X.prototype);for(let J of Object.getOwnPropertyNames(X))if(!["length","name","prototype"].includes(J)){let Z=Object.getOwnPropertyDescriptor(X,J);if(Z)Object.defineProperty(Y,J,Z)}try{_[$]=Y}catch(J){Object.defineProperty(_,$,{value:Y,writable:!0,configurable:!0,enumerable:!0})}if(_.default===X)try{_.default=Y}catch(J){Object.defineProperty(_,"default",{value:Y,writable:!0,configurable:!0,enumerable:!0})}return _}}var Tz1=i4(MB,(_)=>new xZ0(_)),O24=(_={})=>{return{name:MB,setupOnce(){Tz1(_)}}},Ez1=a6(O24);var Fi=h6(Y8(),1);var F24=[">=0.19.2 <1.0.0"];class fZ0 extends Fi.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-anthropic-ai",J9,_)}init(){return new Fi.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",F24,this._patch.bind(this))}_patch(_){let $=_.Anthropic,X=this.getConfig(),Q=function(...Y){if(xN(qB))return Reflect.construct($,Y);let J=Reflect.construct($,Y),Z=E4(),K=Boolean(Z?.getOptions().sendDefaultPii),z=X.recordInputs??K,H=X.recordOutputs??K;return cQ0(J,{recordInputs:z,recordOutputs:H})};Object.setPrototypeOf(Q,$),Object.setPrototypeOf(Q.prototype,$.prototype);for(let Y of Object.getOwnPropertyNames($))if(!["length","name","prototype"].includes(Y)){let J=Object.getOwnPropertyDescriptor($,Y);if(J)Object.defineProperty(Q,Y,J)}try{_.Anthropic=Q}catch(Y){Object.defineProperty(_,"Anthropic",{value:Q,writable:!0,configurable:!0,enumerable:!0})}if(_.default===$)try{_.default=Q}catch(Y){Object.defineProperty(_,"default",{value:Q,writable:!0,configurable:!0,enumerable:!0})}return _}}var Rz1=i4(qB,(_)=>new fZ0(_)),w24=(_={})=>{return{name:qB,options:_,setupOnce(){Rz1(_)}}},Cz1=a6(w24);var KT=h6(Y8(),1);var Pz1=[">=0.10.0 <2"];class yZ0 extends KT.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-google-genai",J9,_)}init(){return new KT.InstrumentationNodeModuleDefinition("@google/genai",Pz1,($)=>this._patch($),($)=>$,[new KT.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",Pz1,($)=>this._patch($),($)=>$)])}_patch(_){let $=_.GoogleGenAI,X=this.getConfig();if(typeof $!=="function")return _;let Q=function(...Y){if(xN(TB))return Reflect.construct($,Y);let J=Reflect.construct($,Y),Z=E4(),K=Boolean(Z?.getOptions().sendDefaultPii),z=X,H=z?.recordInputs??K,W=z?.recordOutputs??K;return aQ0(J,{recordInputs:H,recordOutputs:W})};Object.setPrototypeOf(Q,$),Object.setPrototypeOf(Q.prototype,$.prototype);for(let Y of Object.getOwnPropertyNames($))if(!["length","name","prototype"].includes(Y)){let J=Object.getOwnPropertyDescriptor($,Y);if(J)Object.defineProperty(Q,Y,J)}return Nk(_,"GoogleGenAI",Q),_}}var Iz1=i4(TB,(_)=>new yZ0(_)),N24=(_={})=>{return{name:TB,setupOnce(){Iz1(_)}}},jz1=a6(N24);var uB=h6(Y8(),1);var wi=[">=0.1.0 <2.0.0"];function D24(_,$){if(!_)return[$];if(Array.isArray(_)){if(_.includes($))return _;return[..._,$]}if(typeof _==="object")return[_,$];return _}function L24(_,$,X){return new Proxy(_,{apply(Q,Y,J){let K=J[1];if(!K||typeof K!=="object"||Array.isArray(K))K={},J[1]=K;let z=K.callbacks,H=D24(z,$);return K.callbacks=H,Reflect.apply(Q,Y,J)}})}class gZ0 extends uB.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-langchain",J9,_)}init(){let _=[],$=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let X of $)_.push(new uB.InstrumentationNodeModuleDefinition(X,wi,this._patch.bind(this),(Q)=>Q,[new uB.InstrumentationNodeModuleFile(`${X}/dist/index.cjs`,wi,this._patch.bind(this),(Q)=>Q)]));return _.push(new uB.InstrumentationNodeModuleDefinition("langchain",wi,this._patch.bind(this),(X)=>X,[new uB.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",wi,this._patch.bind(this),(X)=>X)])),_}_patch(_){DQ0([MB,qB,TB]);let $=E4(),X=Boolean($?.getOptions().sendDefaultPii),Q=this.getConfig(),Y=Q?.recordInputs??X,J=Q?.recordOutputs??X,Z=ul({recordInputs:Y,recordOutputs:J});return this._patchRunnableMethods(_,Z),_}_patchRunnableMethods(_,$){let X=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],Q=_.universal_exports??_,Y=Object.values(Q).find((K)=>{return typeof K==="function"&&X.includes(K.name)});if(!Y)return;let J=Y.prototype,Z=["invoke","stream","batch"];for(let K of Z){let z=J[K];if(typeof z==="function")J[K]=L24(z,$)}}}var Sz1=i4(ml,(_)=>new gZ0(_)),A24=(_={})=>{return{name:ml,setupOnce(){Sz1(_)}}},kz1=a6(A24);var zT=h6(Y8(),1);var bz1=[">=0.0.0 <2.0.0"];class hZ0 extends zT.InstrumentationBase{constructor(_={}){super("@sentry/instrumentation-langgraph",J9,_)}init(){return new zT.InstrumentationNodeModuleDefinition("@langchain/langgraph",bz1,this._patch.bind(this),($)=>$,[new zT.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",bz1,this._patch.bind(this),($)=>$)])}_patch(_){let $=E4(),X=Boolean($?.getOptions().sendDefaultPii),Q=this.getConfig(),Y=Q.recordInputs??X,J=Q.recordOutputs??X,Z={recordInputs:Y,recordOutputs:J};if(_.StateGraph&&typeof _.StateGraph==="function"){let K=_.StateGraph;K.prototype.compile=oQ0(K.prototype.compile,Z)}return _}}var vz1=i4(dl,(_)=>new hZ0(_)),M24=(_={})=>{return{name:dl,setupOnce(){vz1(_)}}},xz1=a6(M24);var cz1=h6(Y8(),1);var fV=h6(G4(),1),yV=h6(Y8(),1),_2=h6(J$(),1);import*as yz1 from"net";function gz1(_,$,X,Q,Y){let Z=()=>{},K=Y.firestoreSpanCreationHook;if(typeof K==="function")Z=(W)=>{yV.safeExecuteInTheMiddle(()=>K(W),(V)=>{if(!V)return;fV.diag.error(V?.message)},!0)};let z=new yV.InstrumentationNodeModuleDefinition("@firebase/firestore",$,(W)=>fz1(W,X,Q,_,Z)),H=["@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 W of H)z.files.push(new yV.InstrumentationNodeModuleFile(W,$,(V)=>fz1(V,X,Q,_,Z),(V)=>hz1(V,Q)));return z}function fz1(_,$,X,Q,Y){return hz1(_,X),$(_,"addDoc",q24(Q,Y)),$(_,"getDocs",E24(Q,Y)),$(_,"setDoc",R24(Q,Y)),$(_,"deleteDoc",T24(Q,Y)),_}function hz1(_,$){for(let X of["addDoc","getDocs","setDoc","deleteDoc"])if(yV.isWrapped(_[X]))$(_,X);return _}function q24(_,$){return function(Q){return function(Y,J){let Z=Di(_,"addDoc",Y);return $(Z),Ni(Z,()=>{return Q(Y,J)})}}}function T24(_,$){return function(Q){return function(Y){let J=Di(_,"deleteDoc",Y.parent||Y);return $(J),Ni(J,()=>{return Q(Y)})}}}function E24(_,$){return function(Q){return function(Y){let J=Di(_,"getDocs",Y);return $(J),Ni(J,()=>{return Q(Y)})}}}function R24(_,$){return function(Q){return function(Y,J,Z){let K=Di(_,"setDoc",Y.parent||Y);return $(K),Ni(K,()=>{return typeof Z<"u"?Q(Y,J,Z):Q(Y,J)})}}}function Ni(_,$){return fV.context.with(fV.trace.setSpan(fV.context.active(),_),()=>{return yV.safeExecuteInTheMiddle(()=>{return $()},(X)=>{if(X)_.recordException(X);_.end()},!0)})}function Di(_,$,X){let Q=_.startSpan(`${$} ${X.path}`,{kind:fV.SpanKind.CLIENT});return P24(Q,X),Q.setAttribute(_2.ATTR_DB_OPERATION_NAME,$),Q}function C24(_){let $,X;if(typeof _.host==="string")if(_.host.startsWith("[")){if(_.host.endsWith("]"))$=_.host.replace(/^\[|\]$/g,"");else if(_.host.includes("]:")){let Q=_.host.lastIndexOf(":");if(Q!==-1)$=_.host.slice(1,Q).replace(/^\[|\]$/g,""),X=_.host.slice(Q+1)}}else if(yz1.isIPv6(_.host))$=_.host;else{let Q=_.host.lastIndexOf(":");if(Q!==-1)$=_.host.slice(0,Q),X=_.host.slice(Q+1);else $=_.host}return{address:$,port:X?parseInt(X,10):void 0}}function P24(_,$){let X=$.firestore.app,Q=X.options,J=($.firestore.toJSON()||{}).settings||{},Z={[_2.ATTR_DB_COLLECTION_NAME]:$.path,[_2.ATTR_DB_NAMESPACE]:X.name,[_2.ATTR_DB_SYSTEM_NAME]:"firebase.firestore","firebase.firestore.type":$.type,"firebase.firestore.options.projectId":Q.projectId,"firebase.firestore.options.appId":Q.appId,"firebase.firestore.options.messagingSenderId":Q.messagingSenderId,"firebase.firestore.options.storageBucket":Q.storageBucket},{address:K,port:z}=C24(J);if(K)Z[_2.ATTR_SERVER_ADDRESS]=K;if(z)Z[_2.ATTR_SERVER_PORT]=z;_.setAttributes(Z)}var SW=h6(G4(),1),gV=h6(Y8(),1);function mz1(_,$,X,Q,Y){let J=()=>{},Z=()=>{},K=Y.functions?.errorHook,z=Y.functions?.requestHook,H=Y.functions?.responseHook;if(typeof H==="function")Z=(G,B)=>{gV.safeExecuteInTheMiddle(()=>H(G,B),(U)=>{if(!U)return;SW.diag.error(U?.message)},!0)};if(typeof z==="function")J=(G)=>{gV.safeExecuteInTheMiddle(()=>z(G),(B)=>{if(!B)return;SW.diag.error(B?.message)},!0)};let W=new gV.InstrumentationNodeModuleDefinition("firebase-functions",$);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:G,triggerType:B})=>{W.files.push(new gV.InstrumentationNodeModuleFile(G,$,(U)=>I24(U,X,Q,_,{requestHook:J,responseHook:Z,errorHook:K},B),(U)=>uz1(U,Q)))}),W}function pQ(_,$,X){return function(Y){return function(...J){let Z=typeof J[0]==="function"?J[0]:J[1],K=typeof J[0]==="function"?void 0:J[0];if(!Z)return Y.call(this,...J);let z=async function(...H){let W=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",V=_.startSpan(`firebase.function.${X}`,{kind:SW.SpanKind.SERVER}),G={"faas.name":W,"faas.trigger":X,"faas.provider":"firebase"};if(process.env.GCLOUD_PROJECT)G["cloud.project_id"]=process.env.GCLOUD_PROJECT;if(process.env.EVENTARC_CLOUD_EVENT_SOURCE)G["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE;return V.setAttributes(G),$?.requestHook?.(V),SW.context.with(SW.trace.setSpan(SW.context.active(),V),async()=>{let B,U;try{U=await Z.apply(this,H)}catch(O){B=O}if($?.responseHook?.(V,B),B)V.recordException(B);if(V.end(),B)throw await $?.errorHook?.(V,B),B;return U})};if(K)return Y.call(this,K,z);else return Y.call(this,z)}}}function I24(_,$,X,Q,Y,J){switch(uz1(_,X),J){case"function":$(_,"onRequest",pQ(Q,Y,"http.request")),$(_,"onCall",pQ(Q,Y,"http.call"));break;case"firestore":$(_,"onDocumentCreated",pQ(Q,Y,"firestore.document.created")),$(_,"onDocumentUpdated",pQ(Q,Y,"firestore.document.updated")),$(_,"onDocumentDeleted",pQ(Q,Y,"firestore.document.deleted")),$(_,"onDocumentWritten",pQ(Q,Y,"firestore.document.written")),$(_,"onDocumentCreatedWithAuthContext",pQ(Q,Y,"firestore.document.created")),$(_,"onDocumentUpdatedWithAuthContext",pQ(Q,Y,"firestore.document.updated")),$(_,"onDocumentDeletedWithAuthContext",pQ(Q,Y,"firestore.document.deleted")),$(_,"onDocumentWrittenWithAuthContext",pQ(Q,Y,"firestore.document.written"));break;case"scheduler":$(_,"onSchedule",pQ(Q,Y,"scheduler.scheduled"));break;case"storage":$(_,"onObjectFinalized",pQ(Q,Y,"storage.object.finalized")),$(_,"onObjectArchived",pQ(Q,Y,"storage.object.archived")),$(_,"onObjectDeleted",pQ(Q,Y,"storage.object.deleted")),$(_,"onObjectMetadataUpdated",pQ(Q,Y,"storage.object.metadataUpdated"));break}return _}function uz1(_,$){let X=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let Q of X)if(gV.isWrapped(_[Q]))$(_,Q);return _}var dz1={},j24=[">=3.0.0 <5"],S24=[">=6.0.0 <7"];class mZ0 extends cz1.InstrumentationBase{constructor(_=dz1){super("@sentry/instrumentation-firebase",J9,_)}setConfig(_={}){super.setConfig({...dz1,..._})}init(){let _=[];return _.push(gz1(this.tracer,j24,this._wrap,this._unwrap,this.getConfig())),_.push(mz1(this.tracer,S24,this._wrap,this._unwrap,this.getConfig())),_}}var lz1="Firebase",k24={firestoreSpanCreationHook:(_)=>{Z$(_,"auto.firebase.otel.firestore"),_.setAttribute(e_,"db.query")},functions:{requestHook:(_)=>{Z$(_,"auto.firebase.otel.functions"),_.setAttribute(e_,"http.request")},errorHook:async(_,$)=>{if($)J8($,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await Ll(2000)}}},pz1=i4(lz1,()=>new mZ0(k24)),b24=()=>{return{name:lz1,setupOnce(){pz1()}}},iz1=a6(b24);function Db(){return[r71(),f31(),EX1(),F21(),bQ1(),XY1(),MY1(),lY1(),aJ1(),RZ1(),dZ1(),U21(),c21(),UK1(),vK1(),aK1(),tX1(),Lz1(),UQ1(),kz1(),xz1(),qz1(),Ez1(),Cz1(),jz1(),SZ1(),iz1()]}var WT=h6(G4(),1);var HT=h6(J$(),1);var uZ0=1e6;function az1(_,$={}){if(_.getOptions().debug)nY0();let[X,Q]=v24(_,$);_.traceProvider=X,_.asyncLocalStorageLookup=Q}function v24(_,$={}){let X=new Wp({sampler:new bY0(_),resource:qk().merge(Qp({[HT.ATTR_SERVICE_NAME]:"node",[HT.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[HT.ATTR_SERVICE_VERSION]:J9})),forceFlushTimeoutMillis:500,spanProcessors:[new kY0({timeout:x24(_.getOptions().maxSpanWaitDuration)}),...$.spanProcessors||[]]});WT.trace.setGlobalTracerProvider(X),WT.propagation.setGlobalPropagator(new SY0);let Q=new Fp;return WT.context.setGlobalContextManager(Q),[X,Q.getAsyncLocalStorageLookup()]}function x24(_){if(_==null)return;if(_>uZ0)return o5&&g1.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${uZ0}`),uZ0;else if(_<=0||Number.isNaN(_)){o5&&g1.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return _}function nz1(){return Ap().filter(($)=>$.name!=="Http"&&$.name!=="NodeFetch").concat(hk(),uk())}function rz1(_){return[...nz1(),...S5(_)?Db():[]]}function dZ0(_={}){return f24(_,rz1)}function f24(_={},$){MV(_,"node");let X=YJ0({..._,defaultIntegrations:_.defaultIntegrations??$(_)});if(X&&!_.skipOpenTelemetrySetup)az1(X,{spanProcessors:_.openTelemetrySpanProcessors}),Mp();return X}import*as _W1 from"os";var y24="BunServer",g24=()=>{return{name:y24,setupOnce(){h24()}}},tz1=a6(g24),oz1=!1;function h24(){if(oz1)return;Bun.serve=new Proxy(Bun.serve,{apply(_,$,X){sz1(X[0]);let Q=_.apply($,X),Y=Q.reload.bind(Q);return Q.reload=(J)=>{return sz1(J),Y(J)},Q}}),oz1=!0}function sz1(_){m24(_),u24(_)}function m24(_){if(typeof _.fetch!=="function")return;_.fetch=new Proxy(_.fetch,{apply($,X,Q){return cZ0($,X,Q)}})}function u24(_){if(!_.routes)return;if(typeof _.routes!=="object")return;Object.keys(_.routes).forEach(($)=>{let X=_.routes[$];if(typeof X==="function")_.routes[$]=new Proxy(X,{apply:(Q,Y,J)=>{return cZ0(Q,Y,J,$)}});if(X instanceof Response)return;if(typeof X==="object")Object.entries(X).forEach(([Q,Y])=>{if(typeof Y==="function")_.routes[$][Q]=new Proxy(Y,{apply:(J,Z,K)=>{return cZ0(J,Z,K,$)}})})})}function cZ0(_,$,X,Q){return TN((Y)=>{let J=X[0],Z=J.method.toUpperCase();if(Z==="OPTIONS"||Z==="HEAD")return _.apply($,X);let K=Zk(J.url),z=d24(K,J),H=K?.pathname||"/";if(J.params){if(Object.keys(J.params).forEach((W)=>{z[`url.path.parameter.${W}`]=J.params[W]}),Q)z[j5]="route",z["url.template"]=Q,H=Q}if(Q?.endsWith("/*"))z[j5]="route",z["url.template"]=Q,H=Q;return Object.assign(z,Bq(J.headers.toJSON(),E4()?.getOptions().sendDefaultPii??!1)),Y.setSDKProcessingMetadata({normalizedRequest:{url:J.url,method:J.method,headers:J.headers.toJSON(),query_string:K?.search}}),wl({sentryTrace:J.headers.get("sentry-trace")??"",baggage:J.headers.get("baggage")},()=>jJ({attributes:z,op:"http.server",name:`${J.method} ${H}`},async(W)=>{try{let V=await _.apply($,X);if(V?.status)$l(W,V.status),Y.setContext("response",{headers:V.headers.toJSON(),status_code:V.status});return V}catch(V){throw J8(V,{mechanism:{type:"auto.http.bun.serve",handled:!1}}),V}}))})}function d24(_,$){let X={[S_]:"auto.http.bun.serve",[aX0]:$.method||"GET",[j5]:"url"};if(_){if(_.search)X["url.query"]=_.search;if(_.hash)X["url.fragment"]=_.hash;if(_.pathname)X["url.path"]=_.pathname;if(!AQ0(_)){if(X["url.full"]=_.href,_.port)X["url.port"]=_.port;if(_.protocol)X["url.scheme"]=_.protocol;if(_.hostname)X["url.domain"]=_.hostname}}return X}function ez1(_){function $(X){let Q={body:X.body,method:"POST",headers:_.headers};try{return HB(()=>{return fetch(_.url,Q).then((Y)=>{return{statusCode:Y.status,headers:{"x-sentry-rate-limits":Y.headers.get("X-Sentry-Rate-Limits"),"retry-after":Y.headers.get("Retry-After")}}})})}catch(Y){return Promise.reject(Y)}}return vN(_,$)}function $W1(_){return[Fq(),Oq(),wq(),Nq(),Dq(),hk(),uk(),cq(),lq(),uq(),mq(),dq(),tz1(),...S5(_)?Db():[]]}function lZ0(_={}){MV(_,"bun");let $={..._,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:_.serverName||global.process.env.SENTRY_NAME||_W1.hostname()};if($.transport=$.transport||ez1,$.defaultIntegrations===void 0)$.defaultIntegrations=$W1($);return dZ0($)}lZ0({dsn:"https://f0ba950f2a01c32d24ccd8711de778be@o4510345514123264.ingest.us.sentry.io/4510346875043848",tracesSampleRate:1,sendDefaultPii:!1});import{readFileSync as XW1}from"fs";import{join as QW1}from"path";function r$(){return"3.3.0-beta.14"}function pZ0(_){let[$,X]=_.split("-"),Q=($||"0.0.0").split(".").map(Number),Y=null,J=0;if(X){let Z=X.match(/^([a-z]+)\.?(\d+)?$/i);if(Z)Y=Z[1]||null,J=parseInt(Z[2]||"0",10);else Y=X}return{major:Q[0]||0,minor:Q[1]||0,patch:Q[2]||0,preRelease:Y,preReleaseNum:J}}function hV(_){let $=pZ0(_);if(!$.preRelease)return"stable";if($.preRelease.startsWith("alpha"))return"alpha";return"beta"}function Lb(_,$){try{let X=pZ0(_),Q=pZ0($);if(X.major>Q.major)return!1;if(X.major<Q.major)return!1;if(Q.preRelease&&!X.preRelease)return!1;if(!Q.preRelease&&X.preRelease)return!1;if(Q.preRelease&&X.preRelease){if(X.minor<Q.minor)return!1;if(X.minor>Q.minor)return!0;if(X.patch>Q.patch)return!0;if(X.patch<Q.patch)return!1;return X.preReleaseNum>Q.preReleaseNum}if(X.minor>Q.minor)return!0;if(X.minor<Q.minor)return!1;if(X.patch>Q.patch)return!0;return!1}catch(X){return!1}}import{parseArgs as l24}from"util";var p24={debug:{type:"boolean",short:"d",default:!1,description:"Enable debug logging"},"mqtt-port":{type:"string",default:"8884",description:"MQTT broker port"},"terminal-port":{type:"string",default:"3001",description:"Terminal server port"},"router-port":{type:"string",default:"8883",description:"Router port"},username:{type:"string",short:"u",description:"MQTT broker username (required)"},password:{type:"string",short:"p",description:"MQTT broker password (required)"},"ngrok-token":{type:"string",description:"ngrok authentication token (optional)"},"ngrok-domain":{type:"string",description:"ngrok static domain (optional, paid plan)"},"no-auto-update":{type:"boolean",default:!1,description:"Disable auto-update checking"},"terminal-audit":{type:"boolean",default:!1,description:"Enable terminal input audit logging (logs commands, not output)"},"auto-update-check-interval":{type:"string",default:"60",description:"Auto-update check interval in minutes (default: 60)"},help:{type:"boolean",short:"h",default:!1,description:"Show help message"},version:{type:"boolean",short:"v",default:!1,description:"Show version"}};function YW1(){let _=l24({options:p24,allowPositionals:!1,strict:!0});if(_.values.version)console.log(`ccc v${r$()}`),process.exit(0);if(_.values.help)i24(),process.exit(0);let $=process.env.CCC_USERNAME||_.values.username,X=process.env.CCC_PASSWORD||_.values.password,Q=process.env.CCC_NGROK_TOKEN||_.values["ngrok-token"],Y=process.env.CCC_NGROK_DOMAIN||_.values["ngrok-domain"];if(!$||!X)console.error("\x1B[31mError: Authentication credentials are required.\x1B[0m"),console.error(""),console.error("These credentials secure the MQTT communication between the app and backend."),console.error(""),console.error("You can provide them via:"),console.error(""),console.error(" Environment variables (recommended for security):"),console.error(" export CCC_USERNAME=myuser"),console.error(" export CCC_PASSWORD=mypassword"),console.error(" export CCC_NGROK_TOKEN=your_token # optional"),console.error(" export CCC_NGROK_DOMAIN=your_domain # optional"),console.error(" ccc"),console.error(""),console.error(" Or CLI arguments:"),console.error(" ccc --username myuser --password mypassword"),console.error(" ccc -u myuser -p mypassword"),console.error(""),process.exit(1);return{debug:_.values.debug,mqttPort:parseInt(_.values["mqtt-port"],10),terminalPort:parseInt(_.values["terminal-port"],10),routerPort:parseInt(_.values["router-port"],10),username:$,password:X,ngrokToken:Q,ngrokDomain:Y,autoUpdate:!_.values["no-auto-update"],autoUpdateCheckInterval:parseInt(_.values["auto-update-check-interval"],10),terminalAudit:_.values["terminal-audit"]}}function i24(){console.log(`
892
892
  Backend v2 - Clean modular architecture
893
893
 
894
894
  Usage:
@@ -525,22 +525,22 @@ for (const { name, target, outfile, ptyLib, ngrokLib, ngrokPkg } of selectedTarg
525
525
 
526
526
  // Build the binary (bun-pty and ngrok are now bundled via the generated loaders).
527
527
  //
528
- // --bytecode is safe again on Linux/macOSit previously broke
529
- // the Pi SDK loader (oven-sh/bun#6893, #11732) but the loader
530
- // now uses static imports of a bundled Pi so resolution happens
531
- // at build time. Bytecode caching => faster startup.
532
- //
533
- // On Windows, --bytecode + --compile triggers a Bun internal
534
- // panic ("Internal assertion failure: total_insertions ... !=
535
- // output_files.items.len ..."). Tracked in oven-sh/bun#23490
536
- // and elsewhere; intermittently reintroduced across Bun
537
- // releases. Skip --bytecode on Windows to keep the build green.
538
- const useBytecode = !target.startsWith('bun-windows');
528
+ // --bytecode is disabled across all targetsBun 1.3.13 has
529
+ // multiple regressions when combined with --compile:
530
+ // - Windows panics: "Internal assertion failure:
531
+ // total_insertions != output_files.items.len"
532
+ // (oven-sh/bun#23490)
533
+ // - Linux ARM64 binary loads but throws on first import:
534
+ // "TypeError: Expected CommonJS module to have a function
535
+ // wrapper" bytecode mangles CJS-shaped deps (some of
536
+ // pi-coding-agent's transitive deps are CJS).
537
+ // The startup speedup isn't worth shipping a broken binary on
538
+ // any platform. Re-enable per-target when Bun's bytecode +
539
+ // CJS interop stabilizes.
539
540
  const buildArgs = [
540
541
  'build',
541
542
  '--compile',
542
543
  '--minify',
543
- ...(useBytecode ? ['--bytecode'] : []),
544
544
  `--target=${target}`,
545
545
  '--define',
546
546
  `BUILD_VERSION="${VERSION}"`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naarang/ccc",
3
- "version": "3.3.0-beta.13",
3
+ "version": "3.3.0-beta.14",
4
4
  "description": "Code Chat Connect - Control Claude Code from your mobile device",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -525,22 +525,22 @@ for (const { name, target, outfile, ptyLib, ngrokLib, ngrokPkg } of selectedTarg
525
525
 
526
526
  // Build the binary (bun-pty and ngrok are now bundled via the generated loaders).
527
527
  //
528
- // --bytecode is safe again on Linux/macOSit previously broke
529
- // the Pi SDK loader (oven-sh/bun#6893, #11732) but the loader
530
- // now uses static imports of a bundled Pi so resolution happens
531
- // at build time. Bytecode caching => faster startup.
532
- //
533
- // On Windows, --bytecode + --compile triggers a Bun internal
534
- // panic ("Internal assertion failure: total_insertions ... !=
535
- // output_files.items.len ..."). Tracked in oven-sh/bun#23490
536
- // and elsewhere; intermittently reintroduced across Bun
537
- // releases. Skip --bytecode on Windows to keep the build green.
538
- const useBytecode = !target.startsWith('bun-windows');
528
+ // --bytecode is disabled across all targetsBun 1.3.13 has
529
+ // multiple regressions when combined with --compile:
530
+ // - Windows panics: "Internal assertion failure:
531
+ // total_insertions != output_files.items.len"
532
+ // (oven-sh/bun#23490)
533
+ // - Linux ARM64 binary loads but throws on first import:
534
+ // "TypeError: Expected CommonJS module to have a function
535
+ // wrapper" bytecode mangles CJS-shaped deps (some of
536
+ // pi-coding-agent's transitive deps are CJS).
537
+ // The startup speedup isn't worth shipping a broken binary on
538
+ // any platform. Re-enable per-target when Bun's bytecode +
539
+ // CJS interop stabilizes.
539
540
  const buildArgs = [
540
541
  'build',
541
542
  '--compile',
542
543
  '--minify',
543
- ...(useBytecode ? ['--bytecode'] : []),
544
544
  `--target=${target}`,
545
545
  '--define',
546
546
  `BUILD_VERSION="${VERSION}"`,