@tanagram/lore 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,38 +14,3 @@ The Lore CLI.
14
14
  - `lore disable` — stops and removes the macOS background uploader.
15
15
  - `lore restart` — restarts the macOS background uploader.
16
16
  - `lore status` / `lore status --json` — shows background uploader health.
17
-
18
- ## Dev vs prod
19
-
20
- The CLI is environment-stamped at build time (esbuild `--define`), not via
21
- runtime env vars. The published `@tanagram/lore` on npm is pinned to prod;
22
- anything built locally (`pnpm build`, `tsx`, `pnpm dev`) is pinned to dev.
23
-
24
- Because both can be installed on the same machine, they keep separate state
25
- dirs so they don't stomp each other:
26
-
27
- | Env | State dir | Log file |
28
- | ---- | --------------- | --------------------- |
29
- | prod | `~/.lore/` | `~/.lore/log.txt` |
30
- | dev | `~/.lore-dev/` | `~/.lore-dev/log.txt` |
31
-
32
- The macOS background uploader is also environment-specific: prod writes
33
- `~/Library/LaunchAgents/ai.tanagram.lore.plist`, while non-prod builds append
34
- the active environment name (for example,
35
- `~/Library/LaunchAgents/ai.tanagram.lore.dev.plist`).
36
-
37
- `lore login` stores its token in the active state dir as `token` (for example,
38
- `~/.lore-dev/token` in local dev). The CLI does not read token environment
39
- variables; use `lore logout` to remove the stored token.
40
-
41
- Run `lore logs` to print the active log file path. In dev, log lines also
42
- tee to stderr so you see them while iterating; in prod the file is the only
43
- sink so installed users don't see noise on every command.
44
-
45
- Run `lore enable` to have launchd watch Claude Code history and upload finished
46
- sessions in the background. The uploader snapshots transcript files to a temp
47
- location before creating upload sessions so file contents cannot change between
48
- MD5 calculation and presigned upload.
49
-
50
- `pnpm dev` runs the CLI postinstall hook before starting so bundled dev skills
51
- are refreshed in `~/.claude/skills` on each dev session.
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ Url: ${dm(t)}`),!0}return!1}function qce(t,e){return e?.length?am(t).some(n=>Ts(
35
35
  `),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),T=+(h[1]||0),S=h.slice(2).join(" "),R={};for(let I of f){if(!I)continue;let x=I.indexOf(":");if(x===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${I}"`));let F=I.slice(0,x).toLowerCase(),B=I.slice(x+1).trimStart(),se=R[F];typeof se=="string"?R[F]=[se,B]:Array.isArray(se)?se.push(B):R[F]=B}qh("got proxy server response: %o %o",m,R),i(),e({connect:{statusCode:T,statusText:S,headers:R},buffered:d})}t.on("error",c),t.on("end",a),s()})}function Fp(...t){g.log("[https-proxy-agent]",...t)}var Vp=class extends Vh{static __initStatic(){this.protocols=["http","https"]}constructor(e,n){super(n),this.options={},this.proxy=typeof e=="string"?new URL(e):e,this.proxyHeaders=n?.headers??{},Fp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?VV(n,"headers"):null,host:r,port:o}}async connect(e,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Fp("Creating `tls.Socket`: %o",this.connectOpts);let _=this.connectOpts.servername||this.connectOpts.host;o=PO.connect({...this.connectOpts,servername:_&&Vo.isIP(_)?void 0:_})}else Fp("Creating `net.Socket`: %o",this.connectOpts),o=Vo.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=Vo.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
36
36
  `;if(r.username||r.password){let _=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(_).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let _ of Object.keys(s))a+=`${_}: ${s[_]}\r
37
37
  `;let c=FV(o);o.write(`${a}\r
38
- `);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Sme),n.secureEndpoint){Fp("Upgrading socket connection to TLS");let _=n.servername||n.host;return PO.connect({...VV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Fp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};Vp.__initStatic();function Sme(t){t.resume()}function VV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Ime=1024*32;function Ome(t){return new Rme({read(){this.push(t),this.push(null)}})}function qV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),up(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Nme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Ame:gme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Vp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=bme(t,t.httpModule??o,i);return up(t,a)}function Nme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function bme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{xc(()=>{let _=Ome(l.body),f={...t.headers};l.body.length>Ime&&(f["content-encoding"]="gzip",_=_.pipe(yme()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let S=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function $V(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=Uc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as Cme,sep as Pme}from"node:path";function YV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function WV(t=process.argv[1]?My(process.argv[1]):process.cwd(),e=Pme==="\\"){let n=e?YV(t):t;return r=>{if(!r)return;let o=e?YV(r):r,{dir:s,base:i,ext:a}=Cme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function zV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return e||n||r||t}var KV=xf(cI(WV()));b();var XV=K(ne(),1);import*as QV from"node:os";import{threadId as Mme,isMainThread as xme}from"worker_threads";var vme=6e4,$h=class extends lp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||QV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,XV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Ki(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${xme?"main":`worker-${Mme}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Lc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??vme).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){yy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?eV(this,e):[void 0,void 0]}};var JV=K(cR(),1);import*as ZV from"module";function MO(){if(MV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,JV.createAddHookMessageChannel)();ZV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Yh(){return[_m(),pm(),fm(),mm(),HV(),Dy(),Tm(),yH(),CH(),UV(),wV(),gV(),CV(),fV(),pV(),kV(),DV()]}function xO(t={}){return Lme(t,Yh)}function Lme(t={},e){let n=Dme(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&MO(),rV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===bO)&&n.integrations.push(BV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Ki(n,"node-core");let o=new $h(n);return he().setClient(o),o.init(),g.log(`SDK initialized from ${jp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),kme(),jF(o),nV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function vO(){if(!re)return;let t=qF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function Dme(t,e){let n=Ume(t.release),r=$V(t.spotlight),o=wme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??qV,stackParser:yR(t.stackParser||KV),release:n,tracesSampleRate:o,spotlight:r,debug:Uc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:my({defaultIntegrations:a,integrations:i})}}function Ume(t){if(t!==void 0)return t;let e=zV();if(e!==void 0)return e}function wme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function kme(){if(Uc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Kl(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function qp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var LO="Http",eq="@opentelemetry_sentry-patched/instrumentation-http",Wh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,Gme=w(`${LO}.sentry`,t=>new ra(t)),Bme=w(LO,t=>{let e=new tq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:eq}),e.instrumentationName=eq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function jme(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&Wh)}var nq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Op(r),i=Np(o),a=e&&!n;return{name:LO,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=jme(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:Wh||!l,createSpansForOutgoingRequests:Wh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=qp(_);if(f.startsWith("data:")){let m=wc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(Gme(p),l){let d=Hme(t);Bme(d)}},processEvent(c){return i.processEvent(c)}}};function Hme(t={}){return{disableOutgoingRequestInstrumentation:Wh,ignoreOutgoingRequestHook:n=>{let r=qp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=qp(r);if(o.startsWith("data:")){let s=wc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var cq=K(iq(),1);var uq="NodeFetch",qme=w(uq,cq.UndiciInstrumentation,t=>zme(t)),$me=w(`${uq}.sentry`,oa,t=>t),Yme=(t={})=>({name:"NodeFetch",setupOnce(){Wme(t,H()?.getOptions())&&qme(t),$me(t)}}),lq=Yme;function aq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Wme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function zme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=aq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=aq(n.origin,n.path);if(r.startsWith("data:")){let o=wc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Aq=K(gq(),1);var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Rq="Express";function lhe(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function phe(t,e){if(ue()===er())return mt&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var yq=w(Rq,()=>new Aq.ExpressInstrumentation({requestHook:t=>lhe(t),spanNameHook:(t,e)=>phe(t,e)})),dhe=()=>({name:Rq,setupOnce(){yq()}}),Iq=dhe;var Q$=K(q$(),1);import*as RN from"node:diagnostics_channel";b();var UT=K(Te(),1),_a=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var ad;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(ad||(ad={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(cd||(cd={}));b();var ud=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function AN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ud]||[];return s.push(o),Object.defineProperty(t,ud,{enumerable:!1,configurable:!0,value:s}),o}function LT(t,e){let n=t[ud]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ud])}function Y$(t,e,n){let r,o;try{o=t(),$$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!$$(o)&&(e(r,o),r))throw r;return o}}function $$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var uSe="0.1.0",lSe="@sentry/instrumentation-fastify-v3",W$="anonymous",pSe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),DT=class extends _a.InstrumentationBase{constructor(e={}){super(lSe,uSe,e)}init(){return[new _a.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,UT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===UT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||W$,c=`${cd.MIDDLEWARE} - ${a}`,l=i[1],p=AN(l,s.tracer,c,{[$o.FASTIFY_TYPE]:ad.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){LT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>Y$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||LT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!pSe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),dSe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,_a.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),LT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${cd.REQUEST_HANDLER} - ${c||this.pluginName||W$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:ad.REQUEST_HANDLER,[oA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=AN(o,e.tracer,l,p);z$(d);let{requestHook:_}=e.getConfig();return _&&(0,_a.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function dSe(){let t=H();t&&t.on("spanStart",e=>{z$(e)})}function z$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var wT="Fastify",X$=w(`${wT}.v3`,()=>new DT);function _Se(){let t=H();if(t)return t.getIntegrationByName(wT)}function K$(t,e,n,r){let o=_Se()?.getShouldHandleError()||eY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){mt&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var J$=w(`${wT}.v5`,()=>{let t=new Q$.FastifyOtelInstrumentation,e=t.plugin();return RN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?mt&&g.error("Failed to setup Fastify instrumentation",o):(mSe(),r&&hSe(r))})}),RN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;K$.call(K$,r,o,s,"diagnostics-channel")}),t}),fSe=({shouldHandleError:t})=>{let e;return{name:wT,setupOnce(){e=t||eY,X$(),J$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},Z$=(t={})=>fSe(t);function eY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function tY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function mSe(){let t=H();t&&t.on("spanStart",e=>{tY(e)})}function hSe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&tY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var RY=K(AY(),1);var yY="Graphql",IY=w(yY,RY.GraphQLInstrumentation,t=>{let e=NY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[au]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(au,p)):typeof p=="string"?c.setAttribute(au,[p,d]):c.setAttribute(au,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${kSe(p)})`)}}}}),wSe=(t={})=>({name:yY,setupOnce(){IY(NY(t))}}),OY=wSe;function NY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function kSe(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var GY=K(kY(),1);var BY="Kafka",jY=w(BY,()=>new GY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),BSe=()=>({name:BY,setupOnce(){jY()}}),HY=BSe;var zY=K(WY(),1);var KY="LruMemoizer",QY=w(KY,()=>new zY.LruMemoizerInstrumentation),HSe=()=>({name:KY,setupOnce(){QY()}}),XY=HSe;var iW=K(sW(),1);var aW="Mongo",cW=w(aW,()=>new iW.MongoDBInstrumentation({dbStatementSerializer:YSe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function YSe(t){let e=xN(t);return JSON.stringify(e)}function xN(t){if(Array.isArray(t))return t.map(e=>xN(e));if(WSe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xN(r)]).reduce((n,r)=>(KSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function WSe(t){return typeof t=="object"&&t!==null&&!zSe(t)}function zSe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function KSe(t){return Array.isArray(t)}var QSe=()=>({name:aW,setupOnce(){cW()}}),uW=QSe;var gW=K(SW(),1);var AW="Mongoose",RW=w(AW,()=>new gW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),sge=()=>({name:AW,setupOnce(){RW()}}),yW=sge;var xW=K(MW(),1);var vW="Mysql",LW=w(vW,()=>new xW.MySQLInstrumentation({})),mge=()=>({name:vW,setupOnce(){LW()}}),DW=mge;var FW=K(HW(),1);var VW="Mysql2",qW=w(VW,()=>new FW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),Mge=()=>({name:VW,setupOnce(){qW()}}),$W=Mge;var Tz=K(ZW(),1),Ez=K(dz(),1);var Kge=["get","set","setex"],JN=["get","mget"],Qge=["set","setex"];function yd(t,e){return t.includes(e.toLowerCase())}function ZN(t){return yd(JN,t)?"cache.get":yd(Qge,t)?"cache.put":void 0}function Xge(t,e){return e.some(n=>t.startsWith(n))}function fz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?_z(o.map(s=>n(s))):["<unknown>"],r=e[0];return yd(Kge,t)&&r!=null?n(r):_z(e.map(o=>n(o)))}catch{return}}function mz(t,e,n){if(!ZN(t))return!1;for(let r of e)if(Xge(r,n))return!0;return!1}function hz(t){let e=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function _z(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var SE="Redis",Id={},Sz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=fz(e,n),s=ZN(e);if(!o||!s||!Id.cachePrefixes||!mz(e,o,Id.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=hz(r);c&&t.setAttribute(KR,c),yd(JN,e)&&c!==void 0&&t.setAttribute(WR,c>0),t.setAttributes({[ee]:s,[zR]:o});let l=o.join(", ");t.updateName(Id.maxCacheKeyLength?hs(l,Id.maxCacheKeyLength):l)},Jge=w(`${SE}.IORedis`,()=>new Tz.IORedisInstrumentation({responseHook:Sz})),Zge=w(`${SE}.Redis`,()=>new Ez.RedisInstrumentation({responseHook:Sz})),gz=Object.assign(()=>{Jge(),Zge()},{id:SE}),eAe=(t={})=>({name:SE,setupOnce(){Id=t,gz()}}),Az=eAe;var Gz=K(kz(),1);var Bz="Postgres",jz=w(Bz,Gz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),mAe=t=>({name:Bz,setupOnce(){jz(t)}}),Hz=mAe;b();var ei=K(ne(),1);le();var ib="PostgresJs",Fz=[">=3.0.0 <4"],hAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,TAe=Symbol.for("sentry.query.from.instrumented.sql"),Vz=w(ib,t=>new sb({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),sb=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",Fz,n=>{try{return this._patchPostgres(n)}catch(r){return mt&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,Fz,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return mt&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return mt&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Ly(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(Rp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(ec,r);return}let o=n?.match(hAe);o?.[1]&&e.setAttribute(ec,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[TAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return It({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[Mi]:"postgres",[pA]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),mt&&g.error(`Error in requestHook for ${ib} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){mt&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(dA,m?.[0]?.code||"unknown"),a.setAttribute(_A,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){mt&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},EAe=t=>({name:ib,setupOnce(){Vz(t)}}),qz=EAe;b();b();var WE=K(bK(),1);b();var BRe={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},jRe=BRe.version.split(".")[0],Mb="PRISMA_INSTRUMENTATION",xb=`V${jRe}_PRISMA_INSTRUMENTATION`,Yu=globalThis;function HRe(){let t=Yu[xb];return t?.helper?t.helper:Yu[Mb]?.helper}function FRe(t){let e={helper:t};Yu[xb]=e,Yu[Mb]=e}function VRe(){delete Yu[xb],delete Yu[Mb]}var qRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",$Re="00-10-10-00";function YRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var WRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:$Re}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)MK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!qRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(xK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return CK(s,e(s,r))}return n.startActiveSpan(o,t,s=>CK(s,e(s,r)))}};function MK(t,e,n,r,o){if(xK(e.name,o))return;let s={attributes:e.attributes,kind:YRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)MK(t,c,n,r,o);i.end(e.endTime)})}function CK(t,e){return zRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function zRe(t){return t!=null&&typeof t.then=="function"}function xK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var vK={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},PK=vK.version,KRe=vK.name,QRe="@prisma/client",LK=class extends WE.InstrumentationBase{tracerProvider;constructor(t={}){super(KRe,PK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new WE.InstrumentationNodeModuleDefinition(QRe,[PK])]}enable(){let t=this._config;FRe(new WRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){VRe()}isEnabled(){return HRe()!==void 0}};var DK="Prisma";function XRe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function UK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var vb=class extends LK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=UK();XRe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=JRe(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function JRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var ZRe=w(DK,t=>new vb(t)),wK=t=>({name:DK,setupOnce(){ZRe(t)},setup(e){UK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var YK=K($K(),1);var WK="Hapi",zK=w(WK,()=>new YK.HapiInstrumentation),dye=()=>({name:WK,setupOnce(){zK()}}),KK=dye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Gd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var XE=K(ne(),1);var _ye="@sentry/instrumentation-hono",fye="0.0.1",QE=class extends XE.InstrumentationBase{constructor(e={}){super(_ye,fye,e)}init(){return[new XE.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Lt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return Lt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Gd.MIDDLEWARE:Gd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var QK="Hono";function mye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[xi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var XK=w(QK,()=>new QE({responseHook:t=>{mye(t)}})),hye=()=>({name:QK,setupOnce(){XK()}}),JK=hye;var l2=K(u2(),1);le();var p2="Koa",d2=w(p2,l2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),Oye=(t={})=>({name:p2,setupOnce(){d2(t)}}),_2=Oye;var R2=K(A2(),1);var y2="Connect",I2=w(y2,()=>new R2.ConnectInstrumentation),Uye=()=>({name:y2,setupOnce(){I2()}}),O2=Uye;var U2=K(D2(),1);var jye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),w2="Tedious",k2=w(w2,()=>new U2.TediousInstrumentation({})),Hye=()=>{let t;return{name:w2,setupOnce(){let e=k2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";jye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},G2=Hye;var V2=K(F2(),1);var q2="GenericPool",$2=w(q2,()=>new V2.GenericPoolInstrumentation({})),Vye=()=>{let t;return{name:q2,setupOnce(){let e=$2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},Y2=Vye;var n4=K(t4(),1);var r4="Amqplib",eIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},o4=w(r4,()=>new n4.AmqplibInstrumentation(eIe)),tIe=()=>({name:r4,setupOnce(){o4()}}),s4=tIe;var Vd="VercelAI";var fS=K(ne(),1);var nIe=[">=3.0.0 <7"],i4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function rIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function oIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(sIe(e.content),iIe(e.content))}function sIe(t){for(let e of t){if(!rIe(e))continue;let n=Zy(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function iIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&eI(e.toolCallId)}function aIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var _S=class t extends fS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new fS.InstrumentationNodeModuleDefinition("ai",nIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(Vd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=aIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{oIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=i4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var a4=w(Vd,()=>new _S({}));function cIe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var uIe=(t={})=>{let e;return{name:Vd,options:t,setupOnce(){e=a4()},afterAllSetup(n){t.force??cIe(n)?Nm(n):e?.callWhenPatched(()=>Nm(n))}}},c4=uIe;var hS=K(ne(),1);var lIe=[">=4.0.0 <7"],mS=class extends hS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new hS.InstrumentationNodeModuleDefinition("openai",lIe,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(zi(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Cm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var u4=w(ws,t=>new mS(t)),pIe=(t={})=>({name:ws,setupOnce(){u4(t)}}),l4=pIe;var ES=K(ne(),1);var dIe=[">=0.19.2 <1.0.0"],TS=class extends ES.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new ES.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",dIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(zi(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Pm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var p4=w(ks,t=>new TS(t)),_Ie=(t={})=>({name:ks,options:t,setupOnce(){p4(t)}}),d4=_Ie;var sl=K(ne(),1);var _4=[">=0.10.0 <2"],SS=class extends sl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new sl.InstrumentationNodeModuleDefinition("@google/genai",_4,n=>this._patch(n),n=>n,[new sl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",_4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(zi(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Mm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return Rp(e,"GoogleGenAI",o),e}};var f4=w(Gs,t=>new SS(t)),fIe=(t={})=>({name:Gs,setupOnce(){f4(t)}}),m4=fIe;var _i=K(ne(),1);var gS=[">=0.1.0 <2.0.0"];function mIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function hIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=mIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var AS=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,gS,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,gS,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",gS,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",gS,this._patch.bind(this),r=>r)])),e}_patch(e){Ry([ws,ks,Gs]);let n=vm(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=hIe(l,n))}}};var h4=w(xm,t=>new AS(t)),TIe=(t={})=>({name:xm,setupOnce(){h4(t)}}),T4=TIe;var il=K(ne(),1);var E4=[">=0.0.0 <2.0.0"],RS=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@langchain/langgraph",E4,this._patch.bind(this),n=>n,[new il.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",E4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Dm(e.StateGraph.prototype,this.getConfig()),e}};var S4=w(Lm,t=>new RS(t)),EIe=(t={})=>({name:Lm,setupOnce(){S4(t)}}),g4=EIe;var C4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as R4 from"node:net";function y4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>A4(p,n,r,t,i)),l=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>A4(d,n,r,t,i),d=>I4(d,r)));return c}function A4(t,e,n,r,o){return I4(t,n),e(t,"addDoc",SIe(r,o)),e(t,"getDocs",AIe(r,o)),e(t,"setDoc",RIe(r,o)),e(t,"deleteDoc",gIe(r,o)),t}function I4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function SIe(t,e){return function(r){return function(o,s){let i=IS(t,"addDoc",o);return e(i),yS(i,()=>r(o,s))}}}function gIe(t,e){return function(r){return function(o){let s=IS(t,"deleteDoc",o.parent||o);return e(s),yS(s,()=>r(o))}}}function AIe(t,e){return function(r){return function(o){let s=IS(t,"getDocs",o);return e(s),yS(s,()=>r(o))}}}function RIe(t,e){return function(r){return function(o,s,i){let a=IS(t,"setDoc",o.parent||o);return e(a),yS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function yS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function IS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ne.CLIENT});return IIe(r,n),r.setAttribute(ec,e),r}function yIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(R4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function IIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[uA]:e.path,[lA]:n.name,[Mi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=yIe(s);a&&(i[EA]=a),c&&(i[SA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function O4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("firebase-functions",e);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>OIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>N4(m,r)))}),p}function Sn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Ne.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function OIe(t,e,n,r,o,s){switch(N4(t,n),s){case"function":e(t,"onRequest",Sn(r,o,"http.request")),e(t,"onCall",Sn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Sn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Sn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Sn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Sn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Sn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Sn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Sn(r,o,"storage.object.metadataUpdated"));break}return t}function N4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var b4={},NIe=[">=3.0.0 <5"],bIe=[">=6.0.0 <7"],OS=class extends C4.InstrumentationBase{constructor(e=b4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...b4,...e})}init(){let e=[];return e.push(y4(this.tracer,NIe,this._wrap,this._unwrap,this.getConfig())),e.push(O4(this.tracer,bIe,this._wrap,this._unwrap,this.getConfig())),e}};var P4="Firebase",CIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await nm(2e3))}}},M4=w(P4,()=>new OS(CIe)),PIe=()=>({name:P4,setupOnce(){M4()}}),x4=PIe;function v4(){return[Iq(),Z$(),OY(),JK(),uW(),yW(),DW(),$W(),Az(),Hz(),wK(),KK(),_2(),O2(),G2(),Y2(),HY(),s4(),XY(),T4(),g4(),c4(),l4(),d4(),m4(),qz(),x4()]}b();var NS=K(DI(),1),L4=K(iO(),1);le();var Xb=1e6;function D4(t,e={}){t.getOptions().debug&&RO();let[n,r]=MIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function MIe(t,e={}){let n=new L4.BasicTracerProvider({sampler:new Gh(t),resource:(0,NS.defaultResource)().merge((0,NS.resourceFromAttributes)({[gA]:"node",[cA]:"sentry",[AA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new kh({timeout:xIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new wh);let r=new AO;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function xIe(t){if(t!=null){if(t>Xb)return mt&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Xb}`),Xb;if(t<=0||Number.isNaN(t)){mt&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function U4(){return Yh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(nq(),lq())}function w4(t){return[...U4(),...Xe(t)?v4():[]]}function Jb(t={}){return vIe(t,w4)}function vIe(t={},e){Ki(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(D4(n,{spanProcessors:t.openTelemetrySpanProcessors}),vO()),n}var LIe="prod",G4="0.1.10",DIe=`@tanagram/lore/${G4}`;function xt(){return LIe}function bS(){return G4}function B4(){return DIe}Jb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:xt(),release:bS(),sendDefaultPii:!0});tm("service_name","lore-cli");import{pathToFileURL as fxe}from"node:url";var UIe=/\d/,wIe=["-","_","/","."];function kIe(t=""){if(!UIe.test(t))return t!==t.toLowerCase()}function j4(t,e){let n=e??wIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=kIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function GIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function BIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function jIe(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>GIe(e?.normalize?n.toLowerCase():n)).join(""):""}function qd(t,e){return BIe(jIe(t||"",e))}function CS(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function H4(t){return CS(t||"","_")}import{parseArgs as HIe}from"node:util";function LS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
38
+ `);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Sme),n.secureEndpoint){Fp("Upgrading socket connection to TLS");let _=n.servername||n.host;return PO.connect({...VV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Fp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};Vp.__initStatic();function Sme(t){t.resume()}function VV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Ime=1024*32;function Ome(t){return new Rme({read(){this.push(t),this.push(null)}})}function qV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),up(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Nme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Ame:gme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Vp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=bme(t,t.httpModule??o,i);return up(t,a)}function Nme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function bme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{xc(()=>{let _=Ome(l.body),f={...t.headers};l.body.length>Ime&&(f["content-encoding"]="gzip",_=_.pipe(yme()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let S=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function $V(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=Uc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as Cme,sep as Pme}from"node:path";function YV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function WV(t=process.argv[1]?My(process.argv[1]):process.cwd(),e=Pme==="\\"){let n=e?YV(t):t;return r=>{if(!r)return;let o=e?YV(r):r,{dir:s,base:i,ext:a}=Cme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function zV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return e||n||r||t}var KV=xf(cI(WV()));b();var XV=K(ne(),1);import*as QV from"node:os";import{threadId as Mme,isMainThread as xme}from"worker_threads";var vme=6e4,$h=class extends lp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||QV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,XV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Ki(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${xme?"main":`worker-${Mme}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Lc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??vme).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){yy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?eV(this,e):[void 0,void 0]}};var JV=K(cR(),1);import*as ZV from"module";function MO(){if(MV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,JV.createAddHookMessageChannel)();ZV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Yh(){return[_m(),pm(),fm(),mm(),HV(),Dy(),Tm(),yH(),CH(),UV(),wV(),gV(),CV(),fV(),pV(),kV(),DV()]}function xO(t={}){return Lme(t,Yh)}function Lme(t={},e){let n=Dme(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&MO(),rV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===bO)&&n.integrations.push(BV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Ki(n,"node-core");let o=new $h(n);return he().setClient(o),o.init(),g.log(`SDK initialized from ${jp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),kme(),jF(o),nV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function vO(){if(!re)return;let t=qF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function Dme(t,e){let n=Ume(t.release),r=$V(t.spotlight),o=wme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??qV,stackParser:yR(t.stackParser||KV),release:n,tracesSampleRate:o,spotlight:r,debug:Uc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:my({defaultIntegrations:a,integrations:i})}}function Ume(t){if(t!==void 0)return t;let e=zV();if(e!==void 0)return e}function wme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function kme(){if(Uc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Kl(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function qp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var LO="Http",eq="@opentelemetry_sentry-patched/instrumentation-http",Wh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,Gme=w(`${LO}.sentry`,t=>new ra(t)),Bme=w(LO,t=>{let e=new tq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:eq}),e.instrumentationName=eq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function jme(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&Wh)}var nq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Op(r),i=Np(o),a=e&&!n;return{name:LO,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=jme(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:Wh||!l,createSpansForOutgoingRequests:Wh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=qp(_);if(f.startsWith("data:")){let m=wc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(Gme(p),l){let d=Hme(t);Bme(d)}},processEvent(c){return i.processEvent(c)}}};function Hme(t={}){return{disableOutgoingRequestInstrumentation:Wh,ignoreOutgoingRequestHook:n=>{let r=qp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=qp(r);if(o.startsWith("data:")){let s=wc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var cq=K(iq(),1);var uq="NodeFetch",qme=w(uq,cq.UndiciInstrumentation,t=>zme(t)),$me=w(`${uq}.sentry`,oa,t=>t),Yme=(t={})=>({name:"NodeFetch",setupOnce(){Wme(t,H()?.getOptions())&&qme(t),$me(t)}}),lq=Yme;function aq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Wme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function zme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=aq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=aq(n.origin,n.path);if(r.startsWith("data:")){let o=wc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Aq=K(gq(),1);var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Rq="Express";function lhe(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function phe(t,e){if(ue()===er())return mt&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var yq=w(Rq,()=>new Aq.ExpressInstrumentation({requestHook:t=>lhe(t),spanNameHook:(t,e)=>phe(t,e)})),dhe=()=>({name:Rq,setupOnce(){yq()}}),Iq=dhe;var Q$=K(q$(),1);import*as RN from"node:diagnostics_channel";b();var UT=K(Te(),1),_a=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var ad;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(ad||(ad={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(cd||(cd={}));b();var ud=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function AN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ud]||[];return s.push(o),Object.defineProperty(t,ud,{enumerable:!1,configurable:!0,value:s}),o}function LT(t,e){let n=t[ud]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ud])}function Y$(t,e,n){let r,o;try{o=t(),$$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!$$(o)&&(e(r,o),r))throw r;return o}}function $$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var uSe="0.1.0",lSe="@sentry/instrumentation-fastify-v3",W$="anonymous",pSe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),DT=class extends _a.InstrumentationBase{constructor(e={}){super(lSe,uSe,e)}init(){return[new _a.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,UT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===UT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||W$,c=`${cd.MIDDLEWARE} - ${a}`,l=i[1],p=AN(l,s.tracer,c,{[$o.FASTIFY_TYPE]:ad.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){LT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>Y$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||LT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!pSe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),dSe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,_a.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),LT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${cd.REQUEST_HANDLER} - ${c||this.pluginName||W$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:ad.REQUEST_HANDLER,[oA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=AN(o,e.tracer,l,p);z$(d);let{requestHook:_}=e.getConfig();return _&&(0,_a.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function dSe(){let t=H();t&&t.on("spanStart",e=>{z$(e)})}function z$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var wT="Fastify",X$=w(`${wT}.v3`,()=>new DT);function _Se(){let t=H();if(t)return t.getIntegrationByName(wT)}function K$(t,e,n,r){let o=_Se()?.getShouldHandleError()||eY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){mt&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var J$=w(`${wT}.v5`,()=>{let t=new Q$.FastifyOtelInstrumentation,e=t.plugin();return RN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?mt&&g.error("Failed to setup Fastify instrumentation",o):(mSe(),r&&hSe(r))})}),RN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;K$.call(K$,r,o,s,"diagnostics-channel")}),t}),fSe=({shouldHandleError:t})=>{let e;return{name:wT,setupOnce(){e=t||eY,X$(),J$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},Z$=(t={})=>fSe(t);function eY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function tY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function mSe(){let t=H();t&&t.on("spanStart",e=>{tY(e)})}function hSe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&tY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var RY=K(AY(),1);var yY="Graphql",IY=w(yY,RY.GraphQLInstrumentation,t=>{let e=NY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[au]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(au,p)):typeof p=="string"?c.setAttribute(au,[p,d]):c.setAttribute(au,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${kSe(p)})`)}}}}),wSe=(t={})=>({name:yY,setupOnce(){IY(NY(t))}}),OY=wSe;function NY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function kSe(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var GY=K(kY(),1);var BY="Kafka",jY=w(BY,()=>new GY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),BSe=()=>({name:BY,setupOnce(){jY()}}),HY=BSe;var zY=K(WY(),1);var KY="LruMemoizer",QY=w(KY,()=>new zY.LruMemoizerInstrumentation),HSe=()=>({name:KY,setupOnce(){QY()}}),XY=HSe;var iW=K(sW(),1);var aW="Mongo",cW=w(aW,()=>new iW.MongoDBInstrumentation({dbStatementSerializer:YSe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function YSe(t){let e=xN(t);return JSON.stringify(e)}function xN(t){if(Array.isArray(t))return t.map(e=>xN(e));if(WSe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xN(r)]).reduce((n,r)=>(KSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function WSe(t){return typeof t=="object"&&t!==null&&!zSe(t)}function zSe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function KSe(t){return Array.isArray(t)}var QSe=()=>({name:aW,setupOnce(){cW()}}),uW=QSe;var gW=K(SW(),1);var AW="Mongoose",RW=w(AW,()=>new gW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),sge=()=>({name:AW,setupOnce(){RW()}}),yW=sge;var xW=K(MW(),1);var vW="Mysql",LW=w(vW,()=>new xW.MySQLInstrumentation({})),mge=()=>({name:vW,setupOnce(){LW()}}),DW=mge;var FW=K(HW(),1);var VW="Mysql2",qW=w(VW,()=>new FW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),Mge=()=>({name:VW,setupOnce(){qW()}}),$W=Mge;var Tz=K(ZW(),1),Ez=K(dz(),1);var Kge=["get","set","setex"],JN=["get","mget"],Qge=["set","setex"];function yd(t,e){return t.includes(e.toLowerCase())}function ZN(t){return yd(JN,t)?"cache.get":yd(Qge,t)?"cache.put":void 0}function Xge(t,e){return e.some(n=>t.startsWith(n))}function fz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?_z(o.map(s=>n(s))):["<unknown>"],r=e[0];return yd(Kge,t)&&r!=null?n(r):_z(e.map(o=>n(o)))}catch{return}}function mz(t,e,n){if(!ZN(t))return!1;for(let r of e)if(Xge(r,n))return!0;return!1}function hz(t){let e=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function _z(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var SE="Redis",Id={},Sz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=fz(e,n),s=ZN(e);if(!o||!s||!Id.cachePrefixes||!mz(e,o,Id.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=hz(r);c&&t.setAttribute(KR,c),yd(JN,e)&&c!==void 0&&t.setAttribute(WR,c>0),t.setAttributes({[ee]:s,[zR]:o});let l=o.join(", ");t.updateName(Id.maxCacheKeyLength?hs(l,Id.maxCacheKeyLength):l)},Jge=w(`${SE}.IORedis`,()=>new Tz.IORedisInstrumentation({responseHook:Sz})),Zge=w(`${SE}.Redis`,()=>new Ez.RedisInstrumentation({responseHook:Sz})),gz=Object.assign(()=>{Jge(),Zge()},{id:SE}),eAe=(t={})=>({name:SE,setupOnce(){Id=t,gz()}}),Az=eAe;var Gz=K(kz(),1);var Bz="Postgres",jz=w(Bz,Gz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),mAe=t=>({name:Bz,setupOnce(){jz(t)}}),Hz=mAe;b();var ei=K(ne(),1);le();var ib="PostgresJs",Fz=[">=3.0.0 <4"],hAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,TAe=Symbol.for("sentry.query.from.instrumented.sql"),Vz=w(ib,t=>new sb({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),sb=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",Fz,n=>{try{return this._patchPostgres(n)}catch(r){return mt&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,Fz,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return mt&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return mt&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Ly(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(Rp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(ec,r);return}let o=n?.match(hAe);o?.[1]&&e.setAttribute(ec,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[TAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return It({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[Mi]:"postgres",[pA]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),mt&&g.error(`Error in requestHook for ${ib} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){mt&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(dA,m?.[0]?.code||"unknown"),a.setAttribute(_A,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){mt&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},EAe=t=>({name:ib,setupOnce(){Vz(t)}}),qz=EAe;b();b();var WE=K(bK(),1);b();var BRe={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},jRe=BRe.version.split(".")[0],Mb="PRISMA_INSTRUMENTATION",xb=`V${jRe}_PRISMA_INSTRUMENTATION`,Yu=globalThis;function HRe(){let t=Yu[xb];return t?.helper?t.helper:Yu[Mb]?.helper}function FRe(t){let e={helper:t};Yu[xb]=e,Yu[Mb]=e}function VRe(){delete Yu[xb],delete Yu[Mb]}var qRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",$Re="00-10-10-00";function YRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var WRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:$Re}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)MK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!qRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(xK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return CK(s,e(s,r))}return n.startActiveSpan(o,t,s=>CK(s,e(s,r)))}};function MK(t,e,n,r,o){if(xK(e.name,o))return;let s={attributes:e.attributes,kind:YRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)MK(t,c,n,r,o);i.end(e.endTime)})}function CK(t,e){return zRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function zRe(t){return t!=null&&typeof t.then=="function"}function xK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var vK={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},PK=vK.version,KRe=vK.name,QRe="@prisma/client",LK=class extends WE.InstrumentationBase{tracerProvider;constructor(t={}){super(KRe,PK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new WE.InstrumentationNodeModuleDefinition(QRe,[PK])]}enable(){let t=this._config;FRe(new WRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){VRe()}isEnabled(){return HRe()!==void 0}};var DK="Prisma";function XRe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function UK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var vb=class extends LK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=UK();XRe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=JRe(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function JRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var ZRe=w(DK,t=>new vb(t)),wK=t=>({name:DK,setupOnce(){ZRe(t)},setup(e){UK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var YK=K($K(),1);var WK="Hapi",zK=w(WK,()=>new YK.HapiInstrumentation),dye=()=>({name:WK,setupOnce(){zK()}}),KK=dye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Gd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var XE=K(ne(),1);var _ye="@sentry/instrumentation-hono",fye="0.0.1",QE=class extends XE.InstrumentationBase{constructor(e={}){super(_ye,fye,e)}init(){return[new XE.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Lt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return Lt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Gd.MIDDLEWARE:Gd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var QK="Hono";function mye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[xi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var XK=w(QK,()=>new QE({responseHook:t=>{mye(t)}})),hye=()=>({name:QK,setupOnce(){XK()}}),JK=hye;var l2=K(u2(),1);le();var p2="Koa",d2=w(p2,l2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),Oye=(t={})=>({name:p2,setupOnce(){d2(t)}}),_2=Oye;var R2=K(A2(),1);var y2="Connect",I2=w(y2,()=>new R2.ConnectInstrumentation),Uye=()=>({name:y2,setupOnce(){I2()}}),O2=Uye;var U2=K(D2(),1);var jye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),w2="Tedious",k2=w(w2,()=>new U2.TediousInstrumentation({})),Hye=()=>{let t;return{name:w2,setupOnce(){let e=k2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";jye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},G2=Hye;var V2=K(F2(),1);var q2="GenericPool",$2=w(q2,()=>new V2.GenericPoolInstrumentation({})),Vye=()=>{let t;return{name:q2,setupOnce(){let e=$2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},Y2=Vye;var n4=K(t4(),1);var r4="Amqplib",eIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},o4=w(r4,()=>new n4.AmqplibInstrumentation(eIe)),tIe=()=>({name:r4,setupOnce(){o4()}}),s4=tIe;var Vd="VercelAI";var fS=K(ne(),1);var nIe=[">=3.0.0 <7"],i4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function rIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function oIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(sIe(e.content),iIe(e.content))}function sIe(t){for(let e of t){if(!rIe(e))continue;let n=Zy(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function iIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&eI(e.toolCallId)}function aIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var _S=class t extends fS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new fS.InstrumentationNodeModuleDefinition("ai",nIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(Vd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=aIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{oIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=i4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var a4=w(Vd,()=>new _S({}));function cIe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var uIe=(t={})=>{let e;return{name:Vd,options:t,setupOnce(){e=a4()},afterAllSetup(n){t.force??cIe(n)?Nm(n):e?.callWhenPatched(()=>Nm(n))}}},c4=uIe;var hS=K(ne(),1);var lIe=[">=4.0.0 <7"],mS=class extends hS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new hS.InstrumentationNodeModuleDefinition("openai",lIe,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(zi(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Cm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var u4=w(ws,t=>new mS(t)),pIe=(t={})=>({name:ws,setupOnce(){u4(t)}}),l4=pIe;var ES=K(ne(),1);var dIe=[">=0.19.2 <1.0.0"],TS=class extends ES.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new ES.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",dIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(zi(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Pm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var p4=w(ks,t=>new TS(t)),_Ie=(t={})=>({name:ks,options:t,setupOnce(){p4(t)}}),d4=_Ie;var sl=K(ne(),1);var _4=[">=0.10.0 <2"],SS=class extends sl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new sl.InstrumentationNodeModuleDefinition("@google/genai",_4,n=>this._patch(n),n=>n,[new sl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",_4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(zi(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Mm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return Rp(e,"GoogleGenAI",o),e}};var f4=w(Gs,t=>new SS(t)),fIe=(t={})=>({name:Gs,setupOnce(){f4(t)}}),m4=fIe;var _i=K(ne(),1);var gS=[">=0.1.0 <2.0.0"];function mIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function hIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=mIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var AS=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,gS,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,gS,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",gS,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",gS,this._patch.bind(this),r=>r)])),e}_patch(e){Ry([ws,ks,Gs]);let n=vm(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=hIe(l,n))}}};var h4=w(xm,t=>new AS(t)),TIe=(t={})=>({name:xm,setupOnce(){h4(t)}}),T4=TIe;var il=K(ne(),1);var E4=[">=0.0.0 <2.0.0"],RS=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@langchain/langgraph",E4,this._patch.bind(this),n=>n,[new il.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",E4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Dm(e.StateGraph.prototype,this.getConfig()),e}};var S4=w(Lm,t=>new RS(t)),EIe=(t={})=>({name:Lm,setupOnce(){S4(t)}}),g4=EIe;var C4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as R4 from"node:net";function y4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>A4(p,n,r,t,i)),l=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>A4(d,n,r,t,i),d=>I4(d,r)));return c}function A4(t,e,n,r,o){return I4(t,n),e(t,"addDoc",SIe(r,o)),e(t,"getDocs",AIe(r,o)),e(t,"setDoc",RIe(r,o)),e(t,"deleteDoc",gIe(r,o)),t}function I4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function SIe(t,e){return function(r){return function(o,s){let i=IS(t,"addDoc",o);return e(i),yS(i,()=>r(o,s))}}}function gIe(t,e){return function(r){return function(o){let s=IS(t,"deleteDoc",o.parent||o);return e(s),yS(s,()=>r(o))}}}function AIe(t,e){return function(r){return function(o){let s=IS(t,"getDocs",o);return e(s),yS(s,()=>r(o))}}}function RIe(t,e){return function(r){return function(o,s,i){let a=IS(t,"setDoc",o.parent||o);return e(a),yS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function yS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function IS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ne.CLIENT});return IIe(r,n),r.setAttribute(ec,e),r}function yIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(R4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function IIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[uA]:e.path,[lA]:n.name,[Mi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=yIe(s);a&&(i[EA]=a),c&&(i[SA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function O4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("firebase-functions",e);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>OIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>N4(m,r)))}),p}function Sn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Ne.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function OIe(t,e,n,r,o,s){switch(N4(t,n),s){case"function":e(t,"onRequest",Sn(r,o,"http.request")),e(t,"onCall",Sn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Sn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Sn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Sn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Sn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Sn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Sn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Sn(r,o,"storage.object.metadataUpdated"));break}return t}function N4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var b4={},NIe=[">=3.0.0 <5"],bIe=[">=6.0.0 <7"],OS=class extends C4.InstrumentationBase{constructor(e=b4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...b4,...e})}init(){let e=[];return e.push(y4(this.tracer,NIe,this._wrap,this._unwrap,this.getConfig())),e.push(O4(this.tracer,bIe,this._wrap,this._unwrap,this.getConfig())),e}};var P4="Firebase",CIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await nm(2e3))}}},M4=w(P4,()=>new OS(CIe)),PIe=()=>({name:P4,setupOnce(){M4()}}),x4=PIe;function v4(){return[Iq(),Z$(),OY(),JK(),uW(),yW(),DW(),$W(),Az(),Hz(),wK(),KK(),_2(),O2(),G2(),Y2(),HY(),s4(),XY(),T4(),g4(),c4(),l4(),d4(),m4(),qz(),x4()]}b();var NS=K(DI(),1),L4=K(iO(),1);le();var Xb=1e6;function D4(t,e={}){t.getOptions().debug&&RO();let[n,r]=MIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function MIe(t,e={}){let n=new L4.BasicTracerProvider({sampler:new Gh(t),resource:(0,NS.defaultResource)().merge((0,NS.resourceFromAttributes)({[gA]:"node",[cA]:"sentry",[AA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new kh({timeout:xIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new wh);let r=new AO;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function xIe(t){if(t!=null){if(t>Xb)return mt&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Xb}`),Xb;if(t<=0||Number.isNaN(t)){mt&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function U4(){return Yh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(nq(),lq())}function w4(t){return[...U4(),...Xe(t)?v4():[]]}function Jb(t={}){return vIe(t,w4)}function vIe(t={},e){Ki(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(D4(n,{spanProcessors:t.openTelemetrySpanProcessors}),vO()),n}var LIe="prod",G4="0.1.11",DIe=`@tanagram/lore/${G4}`;function xt(){return LIe}function bS(){return G4}function B4(){return DIe}Jb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:xt(),release:bS(),sendDefaultPii:!0});tm("service_name","lore-cli");import{pathToFileURL as fxe}from"node:url";var UIe=/\d/,wIe=["-","_","/","."];function kIe(t=""){if(!UIe.test(t))return t!==t.toLowerCase()}function j4(t,e){let n=e??wIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=kIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function GIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function BIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function jIe(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>GIe(e?.normalize?n.toLowerCase():n)).join(""):""}function qd(t,e){return BIe(jIe(t||"",e))}function CS(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function H4(t){return CS(t||"","_")}import{parseArgs as HIe}from"node:util";function LS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
39
39
  `)}function Kn(t){return typeof t=="function"?t():t}var Ia=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function FIe(t=[],e={}){let n=new Set(e.boolean||[]),r=new Set(e.string||[]),o=e.alias||{},s=e.default||{},i=new Map,a=new Map;for(let[T,S]of Object.entries(o)){let R=S;for(let I of R)i.set(T,I),a.has(I)||a.set(I,[]),a.get(I).push(T),i.set(I,T),a.has(T)||a.set(T,[]),a.get(T).push(I)}let c={};function l(T){if(n.has(T))return"boolean";let S=a.get(T)||[];for(let R of S)if(n.has(R))return"boolean";return"string"}function p(T){if(r.has(T))return!0;let S=a.get(T)||[];for(let R of S)if(r.has(R))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(s)]);for(let T of d)c[T]||(c[T]={type:l(T),default:s[T]});for(let[T,S]of i.entries())T.length===1&&c[S]&&!c[S].short&&(c[S].short=T);let _=[],f={};for(let T=0;T<t.length;T++){let S=t[T];if(S==="--"){_.push(...t.slice(T));break}if(S.startsWith("--no-")){let R=S.slice(5);f[R]=!0;continue}_.push(S)}let m;try{m=HIe({args:_,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:_}}let h={_:[]};h._=m.positionals;for(let[T,S]of Object.entries(m.values)){let R=S;l(T)==="boolean"&&typeof S=="string"?R=S!=="false":p(T)&&typeof S=="boolean"&&(R=""),h[T]=R}for(let[T]of Object.entries(f)){h[T]=!1;let S=i.get(T);S&&(h[S]=!1);let R=a.get(T);if(R)for(let I of R)h[I]=!1}for(let[T,S]of i.entries())h[T]!==void 0&&h[S]===void 0&&(h[S]=h[T]),h[S]!==void 0&&h[T]===void 0&&(h[T]=h[S]),h[T]!==h[S]&&s[S]===h[S]&&(h[S]=h[T]);return h}var VIe=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),DS=(t,e=39)=>n=>VIe?n:`\x1B[${t}m${n}\x1B[${e}m`,PS=DS(1,22),Gr=DS(36),xS=DS(90),MS=DS(4,24);function qIe(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=q4(e);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=qd(a.name),l=CS(a.name);if(c!==a.name||l!==a.name){let p=LS(n.alias[a.name]||[]);c!==a.name&&!p.includes(c)&&p.push(c),l!==a.name&&!p.includes(l)&&p.push(l),p.length>0&&(n.alias[a.name]=p)}}let o=FIe(t,n),[...s]=o._,i=new Proxy(o,{get(a,c){return a[c]??a[qd(c)]??a[CS(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=s.shift();if(c!==void 0)i[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new Ia(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let c=i[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new Ia(`Invalid value for argument: ${Gr(`--${a.name}`)} (${Gr(c)}). Expected one of: ${l.map(p=>Gr(p)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new Ia(`Missing required argument: --${a.name}`,"EARG");return i}function q4(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:LS(r.alias)});return e}async function $Ie(t){return Promise.all(t.map(e=>Kn(e)))}async function vS(t,e){let n=await Kn(t.args||{}),r=qIe(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await $Ie(t.plugins??[]),i,a;try{for(let p of s)await p.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let l=await Kn(t.subCommands);if(l&&Object.keys(l).length>0){let p=YIe(e.rawArgs,n),d=e.rawArgs[p];if(d){let _=await F4(l,d);if(!_)throw new Ia(`Unknown command ${Gr(d)}`,"E_UNKNOWN_COMMAND");await vS(_,{rawArgs:e.rawArgs.slice(p+1)})}else{let _=await Kn(t.default);if(_){if(t.run)throw new Ia("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let f=await F4(l,_);if(!f)throw new Ia(`Default sub command ${Gr(_)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await vS(f,{rawArgs:e.rawArgs})}else if(!t.run)throw new Ia("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(l){a=l}let c=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(l){c.push(l)}for(let l of[...s].reverse())try{await l.cleanup?.(o)}catch(p){c.push(p)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:i}}async function F4(t,e){if(e in t)return Kn(t[e]);for(let n of Object.values(t)){let r=await Kn(n),o=await Kn(r?.meta);if(o?.alias&&LS(o.alias).includes(e))return r}}function YIe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&WIe(r,e)&&n++;continue}return n}return-1}function WIe(t,e){let n=t.replace(/^-{1,2}/,""),r=qd(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===qd(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var zIe=/^no[-A-Z]/;async function $4(t,e){let n=await Kn(t.meta||{}),r=q4(await Kn(t.args||{})),o=await Kn(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],c=[],l=[];for(let f of r)if(f.type==="positional"){let m=f.name.toUpperCase(),h=f.required!==!1&&f.default===void 0;a.push([Gr(m+eC(f)),V4(f,h)]),l.push(h?`<${m}>`:`[${m}]`)}else{let m=f.required===!0&&f.default===void 0,h=[...(f.alias||[]).map(T=>`-${T}`),`--${f.name}`].join(", ")+eC(f);if(i.push([Gr(h),V4(f,m)]),f.type==="boolean"&&(f.default===!0||f.negativeDescription)&&!zIe.test(f.name)){let T=[...(f.alias||[]).map(S=>`--no-${S}`),`--no-${f.name}`].join(", ");i.push([Gr(T),[f.negativeDescription,m?xS("(Required)"):""].filter(Boolean).join(" ")])}m&&l.push(`--${f.name}`+eC(f))}if(t.subCommands){let f=[],m=await Kn(t.subCommands);for(let[h,T]of Object.entries(m)){let S=await Kn((await Kn(T))?.meta);if(S?.hidden)continue;let R=LS(S?.alias),I=[h,...R].join(", ");c.push([Gr(I),S?.description||""]),f.push(h,...R)}l.push(f.join("|"))}let p=[],d=n.version||o.version;p.push(xS(`${n.description} (${s+(d?` v${d}`:"")})`),"");let _=i.length>0||a.length>0;return p.push(`${MS(PS("USAGE"))} ${Gr(`${s}${_?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(p.push(MS(PS("ARGUMENTS")),""),p.push(Zb(a," ")),p.push("")),i.length>0&&(p.push(MS(PS("OPTIONS")),""),p.push(Zb(i," ")),p.push("")),c.length>0&&(p.push(MS(PS("COMMANDS")),""),p.push(Zb(c," ")),p.push("",`Use ${Gr(`${s} <command> --help`)} for more information about a command.`)),p.filter(f=>typeof f=="string").join(`
40
40
  `)}function eC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${H4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function V4(t,e){let n=e?xS("(Required)"):"",r=t.default===void 0?"":xS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{execFile as mOe}from"node:child_process";import tn from"node:fs/promises";import hOe from"node:os";import So from"node:path";import{promisify as TOe}from"node:util";import Y4 from"node:os";import Oa from"node:path";function Zo(){let t=xt()==="dev"?".lore-dev":".lore";return Oa.join(Y4.homedir(),t)}function US(){return Oa.join(Zo(),"log.txt")}function tC(){return Oa.join(Zo(),"sync_state.json")}function wS(){return Oa.join(Zo(),"status.json")}function $d(){return Oa.join(Zo(),"install_source.json")}function Yd(){return Oa.join(Zo(),"bin","lore")}function Wd(){let t=xt();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function zd(){return Oa.join(Y4.homedir(),"Library","LaunchAgents",`${Wd()}.plist`)}import al from"node:fs/promises";import GS from"node:os";import en from"node:path";function fi(t,e){return t!==null&&typeof t=="object"&&"code"in t&&t.code===e}import z4 from"node:fs";var W4=null;function KIe(){let t=Zo();W4!==t&&(z4.mkdirSync(t,{recursive:!0}),W4=t)}function QIe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function XIe(t,e,n){let r=`${new Date().toISOString()} ${t} ${e}`;if(!n)return`${r}
41
41
  `;let o=Object.entries(n).map(([s,i])=>`${s}=${QIe(i)}`).join(" ");return o?`${r} ${o}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanagram/lore",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Lore CLI",
5
5
  "type": "module",
6
6
  "bin": {