@tanagram/lore 0.1.17 → 0.1.19
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ Url: ${dh(t)}`),!0}return!1}function $fe(t,e){return e?.length?ih(t).some(n=>Gs(
|
|
|
35
35
|
`),m=_.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),g=+(h[1]||0),E=h.slice(2).join(" "),S={};for(let y of _){if(!y)continue;let R=y.indexOf(":");if(R===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${y}"`));let I=y.slice(0,R).toLowerCase(),N=y.slice(R+1).trimStart(),H=S[I];typeof H=="string"?S[I]=[H,N]:Array.isArray(H)?H.push(N):S[I]=N}Vg("got proxy server response: %o %o",m,S),i(),e({connect:{statusCode:g,statusText:E,headers:S},buffered:p})}t.on("error",u),t.on("end",a),s()})}function Mp(...t){A.log("[https-proxy-agent]",...t)}var vp=class extends Hg{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??{},Mp("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?zH(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:"){Mp("Creating `tls.Socket`: %o",this.connectOpts);let f=this.connectOpts.servername||this.connectOpts.host;o=eO.connect({...this.connectOpts,servername:f&&cs.isIP(f)?void 0:f})}else Mp("Creating `net.Socket`: %o",this.connectOpts),o=cs.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=cs.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
|
|
36
36
|
`;if(r.username||r.password){let f=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(f).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let f of Object.keys(s))a+=`${f}: ${s[f]}\r
|
|
37
37
|
`;let u=$H(o);o.write(`${a}\r
|
|
38
|
-
`);let{connect:c,buffered:d}=await u;if(e.emit("proxyConnect",c),this.emit("proxyConnect",c,e),c.statusCode===200){if(e.once("socket",SSe),n.secureEndpoint){Mp("Upgrading socket connection to TLS");let f=n.servername||n.host;return eO.connect({...zH(n,"host","path","port"),socket:o,servername:cs.isIP(f)?void 0:f})}return o}o.destroy();let p=new cs.Socket({writable:!1});return p.readable=!0,e.once("socket",f=>{Mp("Replaying proxy buffer for failed request"),f.push(d),f.push(null)}),p}};vp.__initStatic();function SSe(t){t.resume()}function zH(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var ISe=1024*32;function OSe(t){return new ySe({read(){this.push(t),this.push(null)}})}function YH(t){let e;try{e=new URL(t.url)}catch{return Ze(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),Xd(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=NSe(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?bSe:ASe,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new vp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=CSe(t,t.httpModule??o,i);return Xd(t,a)}function NSe(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function CSe(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(c){return new Promise((d,p)=>{pc(()=>{let f=OSe(c.body),_={...t.headers};c.body.length>ISe&&(_["content-encoding"]="gzip",f=f.pipe(RSe()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:_,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},g=>{g.on("data",()=>{}),g.on("end",()=>{}),g.setEncoding("utf8");let E=g.headers["retry-after"]??null,S=g.headers["x-sentry-rate-limits"]??null;d({statusCode:g.statusCode,headers:{"retry-after":E,"x-sentry-rate-limits":Array.isArray(S)?S[0]||null:S}})});h.on("error",p),f.pipe(h)})})}}function WH(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=hc(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 xSe,sep as PSe}from"node:path";function KH(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function QH(t=process.argv[1]?tR(process.argv[1]):process.cwd(),e=PSe==="\\"){let n=e?KH(t):t;return r=>{if(!r)return;let o=e?KH(r):r,{dir:s,base:i,ext:a}=xSe.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let u=decodeURIComponent(i);s||(s=".");let c=s.lastIndexOf("/node_modules");if(c>-1)return`${s.slice(c+14).replace(/\//g,".")}:${u}`;if(s.startsWith(n)){let d=s.slice(n.length+1).replace(/\//g,".");return d?`${d}:${u}`:u}return u}}function JH(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(Z.SENTRY_RELEASE?.id)return Z.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 XH=Pm(LR(QH()));P();var eV=Q(re(),1);import*as ZH from"node:os";import{threadId as MSe,isMainThread as vSe}from"worker_threads";var LSe=6e4,qg=class extends Zd{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||ZH.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,eV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),ya(r,"node"),A.log(`Initializing Sentry: process: ${process.pid}, thread: ${vSe?"main":`worker-${MSe}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{_c(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=de,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(()=>{oe&&A.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??LSe).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){Wy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?rH(this,e):[void 0,void 0]}};var tV=Q(Lb(),1);import*as nV from"module";function tO(){if(LH()&&!Z._sentryEsmLoaderHookRegistered){Z._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,tV.createAddHookMessageChannel)();nV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){A.warn("Failed to register 'import-in-the-middle' hook",t)}}}function $g(){return[ph(),lh(),fh(),_h(),qH(),sR(),hh(),Oj(),Mj(),BH(),GH(),yH(),MH(),gH(),_H(),FH(),UH()]}function nO(t={}){return DSe(t,$g)}function DSe(t={},e){let n=kSe(t,e);n.debug===!0&&(oe?A.enable():Ze(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&tO(),iH(),Te().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===XI)&&n.integrations.push(HH({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),ya(n,"node-core");let o=new qg(n);return Te().setClient(o),o.init(),A.log(`SDK initialized from ${xp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),BSe(),V6(o),sH(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function rO(){if(!oe)return;let t=Y6(),e=["SentryContextManager","SentryPropagator"];et()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||A.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||A.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 kSe(t,e){let n=wSe(t.release),r=WH(t.spotlight),o=USe(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??YH,stackParser:Wb(t.stackParser||XH),release:n,tracesSampleRate:o,spotlight:r,debug:hc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:Fy({defaultIntegrations:a,integrations:i})}}function wSe(t){if(t!==void 0)return t;let e=JH();if(e!==void 0)return e}function USe(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 BSe(){if(hc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Bd(t,e);Te().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function Lp(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 oO="Http",rV="@opentelemetry_sentry-patched/instrumentation-http",zg=qr.major===22&&qr.minor>=12||qr.major===23&&qr.minor>=2||qr.major>=24,GSe=B(`${oO}.sentry`,t=>new Ma(t)),FSe=B(oO,t=>{let e=new oV.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=qn.createComponentLogger({namespace:rV}),e.instrumentationName=rV}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function jSe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!et(e)&&zg)}var sV=(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=_p(r),i=mp(o),a=e&&!n;return{name:oO,setup(u){let c=u.getOptions();a&&et(c)&&i.setup(u)},setupOnce(){let u=V()?.getOptions()||{},c=jSe(t,u);s.setupOnce();let d={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:zg||!c,createSpansForOutgoingRequests:zg,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(p,f)=>{let _=Lp(f);if(_.startsWith("data:")){let m=gc(_);p.setAttribute("http.url",m),p.setAttribute(Vs,m),p.updateName(`${f.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(p,f)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(GSe(d),c){let p=HSe(t);FSe(p)}},processEvent(u){return i.processEvent(u)}}};function HSe(t={}){return{disableOutgoingRequestInstrumentation:zg,ignoreOutgoingRequestHook:n=>{let r=Lp(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=Lp(r);if(o.startsWith("data:")){let s=gc(o);n.setAttribute("http.url",s),n.setAttribute(Vs,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 dV=Q(cV(),1);var pV="NodeFetch",$Se=B(pV,dV.UndiciInstrumentation,t=>KSe(t)),zSe=B(`${pV}.sentry`,va,t=>t),YSe=(t={})=>({name:"NodeFetch",setupOnce(){WSe(t,V()?.getOptions())&&$Se(t),zSe(t)}}),fV=YSe;function lV(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function WSe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&et(e)}function KSe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=lV(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=lV(n.origin,n.path);if(r.startsWith("data:")){let o=gc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[Vs]:o,[dr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var RV=Q(yV(),1);var St=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var IV="Express";function d0e(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(te,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function p0e(t,e){if(ce()===lr())return St&&A.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";ce().setTransactionName(`${r} ${t.route}`)}return e}var OV=B(IV,()=>new RV.ExpressInstrumentation({requestHook:t=>d0e(t),spanNameHook:(t,e)=>p0e(t,e)})),f0e=()=>({name:IV,setupOnce(){OV()}}),NV=f0e;var Z8=Q(Y8(),1);import*as YO from"node:diagnostics_channel";P();var DT=Q(Ee(),1),ja=Q(re(),1);le();var ds;(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})(ds||(ds={}));var Qp;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(Qp||(Qp={}));var Jp;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(Jp||(Jp={}));P();var Xp=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function zO(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[Xp]||[];return s.push(o),Object.defineProperty(t,Xp,{enumerable:!1,configurable:!0,value:s}),o}function vT(t,e){let n=t[Xp]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:je.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[Xp])}function K8(t,e,n){let r,o;try{o=t(),W8(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!W8(o)&&(e(r,o),r))throw r;return o}}function W8(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var lye="0.1.0",dye="@sentry/instrumentation-fastify-v3",Q8="anonymous",pye=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),LT=class extends ja.InstrumentationBase{constructor(e={}){super(dye,lye,e)}init(){return[new ja.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,DT.getRPCMetadata)(v.active()),u=i.routeOptions?i.routeOptions.url:r.routerPath;u&&a?.type===DT.RPCType.HTTP&&(a.route=u);let c=r.method||"GET";ce().setTransactionName(`${c} ${u}`),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||Q8,u=`${Jp.MIDDLEWARE} - ${a}`,c=i[1],d=zO(c,s.tracer,u,{[ds.FASTIFY_TYPE]:Qp.MIDDLEWARE,[ds.PLUGIN_NAME]:e,[ds.HOOK_NAME]:n}),p=o&&i[i.length-1];return p&&(i[i.length-1]=function(...f){vT(c),p.apply(this,f)}),v.with(X.setSpan(v.active(),d),()=>K8(()=>r.apply(this,i),f=>{f instanceof Error&&(d.setStatus({code:je.ERROR,message:f.message}),d.recordException(f)),o||vT(c)}))}}_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(!pye.has(s))return n.apply(this,o);let u=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,u)])}}}_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()),fye(),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,ja.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),vT(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,u=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,c=`${Jp.REQUEST_HANDLER} - ${u||this.pluginName||Q8}`,d={[ds.PLUGIN_NAME]:this.pluginName,[ds.FASTIFY_TYPE]:Qp.REQUEST_HANDLER,[xA]:i.routeOptions?i.routeOptions.url:r.routerPath};u&&(d[ds.FASTIFY_NAME]=u);let p=zO(o,e.tracer,c,d);J8(p);let{requestHook:f}=e.getConfig();return f&&(0,ja.safeExecuteInTheMiddle)(()=>f(p,{request:r}),_=>{_&&e._diag.error("request hook failed",_)},!0),v.with(X.setSpan(v.active(),p),()=>{s()})}}};function fye(){let t=V();t&&t.on("spanStart",e=>{J8(e)})}function J8(t){let e=Y(t).data,n=e["fastify.type"];if(e[te]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[te]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var kT="Fastify",eq=B(`${kT}.v3`,()=>new LT);function _ye(){let t=V();if(t)return t.getIntegrationByName(kT)}function X8(t,e,n,r){let o=_ye()?.getShouldHandleError()||rq;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){St&&A.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)&&ne(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var tq=B(`${kT}.v5`,()=>{let t=new Z8.FastifyOtelInstrumentation,e=t.plugin();return YO.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?St&&A.error("Failed to setup Fastify instrumentation",o):(hye(),r&&gye(r))})}),YO.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;X8.call(X8,r,o,s,"diagnostics-channel")}),t}),mye=({shouldHandleError:t})=>{let e;return{name:kT,setupOnce(){e=t||rq,eq(),tq()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},nq=(t={})=>mye(t);function rq(t,e,n){let r=n.statusCode;return r>=500||r<=299}function oq(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[te]||!i&&!a&&!s)return;let u=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[te]:`${u}.fastify`});let c=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof c=="string"){let d=c.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(d)}}function hye(){let t=V();t&&t.on("spanStart",e=>{oq(e)})}function gye(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&oq(s)}let r=e.routeOptions?.url,o=e.method||"GET";ce().setTransactionName(`${o} ${r}`)})}P();var Iq=Q(Rq(),1);var Oq="Graphql",Nq=B(Oq,Iq.GraphQLInstrumentation,t=>{let e=xq(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:je.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let u=He(n),d=Y(u).data[Hc]||[],p=a?`${i} ${a}`:`${i}`;Array.isArray(d)?(d.push(p),u.setAttribute(Hc,d)):typeof d=="string"?u.setAttribute(Hc,[d,p]):u.setAttribute(Hc,p),Y(u).data["original-description"]||u.setAttribute("original-description",Y(u).description),u.updateName(`${Y(u).data["original-description"]} (${Bye(d)})`)}}}}),Uye=(t={})=>({name:Oq,setupOnce(){Nq(xq(t))}}),Cq=Uye;function xq(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function Bye(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 jq=Q(Fq(),1);var Hq="Kafka",Vq=B(Hq,()=>new jq.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),Fye=()=>({name:Hq,setupOnce(){Vq()}}),qq=Fye;var Jq=Q(Qq(),1);var Xq="LruMemoizer",Zq=B(Xq,()=>new Jq.LruMemoizerInstrumentation),Hye=()=>({name:Xq,setupOnce(){Zq()}}),e5=Hye;var c5=Q(u5(),1);var l5="Mongo",d5=B(l5,()=>new c5.MongoDBInstrumentation({dbStatementSerializer:Yye,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function Yye(t){let e=nN(t);return JSON.stringify(e)}function nN(t){if(Array.isArray(t))return t.map(e=>nN(e));if(Wye(t)){let e={};return Object.entries(t).map(([n,r])=>[n,nN(r)]).reduce((n,r)=>(Qye(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function Wye(t){return typeof t=="object"&&t!==null&&!Kye(t)}function Kye(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function Qye(t){return Array.isArray(t)}var Jye=()=>({name:l5,setupOnce(){d5()}}),p5=Jye;var y5=Q(b5(),1);var R5="Mongoose",I5=B(R5,()=>new y5.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),iRe=()=>({name:R5,setupOnce(){I5()}}),O5=iRe;var D5=Q(L5(),1);var k5="Mysql",w5=B(k5,()=>new D5.MySQLInstrumentation({})),hRe=()=>({name:k5,setupOnce(){w5()}}),U5=hRe;var $5=Q(q5(),1);var z5="Mysql2",Y5=B(z5,()=>new $5.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),MRe=()=>({name:z5,setupOnce(){Y5()}}),W5=MRe;var S9=Q(n9(),1),A9=Q(m9(),1);var QRe=["get","set","setex"],yN=["get","mget"],JRe=["set","setex"];function ff(t,e){return t.includes(e.toLowerCase())}function RN(t){return ff(yN,t)?"cache.get":ff(JRe,t)?"cache.put":void 0}function XRe(t,e){return e.some(n=>t.startsWith(n))}function g9(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)?h9(o.map(s=>n(s))):["<unknown>"],r=e[0];return ff(QRe,t)&&r!=null?n(r):h9(e.map(o=>n(o)))}catch{return}}function T9(t,e,n){if(!RN(t))return!1;for(let r of e)if(XRe(r,n))return!0;return!1}function E9(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 h9(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var TE="Redis",_f={},b9=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=g9(e,n),s=RN(e);if(!o||!s||!_f.cachePrefixes||!T9(e,o,_f.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 u=E9(r);u&&t.setAttribute(Sy,u),ff(yN,e)&&u!==void 0&&t.setAttribute(Ty,u>0),t.setAttributes({[te]:s,[Ey]:o});let c=o.join(", ");t.updateName(_f.maxCacheKeyLength?Bs(c,_f.maxCacheKeyLength):c)},ZRe=B(`${TE}.IORedis`,()=>new S9.IORedisInstrumentation({responseHook:b9})),eIe=B(`${TE}.Redis`,()=>new A9.RedisInstrumentation({responseHook:b9})),y9=Object.assign(()=>{ZRe(),eIe()},{id:TE}),tIe=(t={})=>({name:TE,setupOnce(){_f=t,y9()}}),R9=tIe;var j9=Q(F9(),1);var H9="Postgres",V9=B(H9,j9.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),hIe=t=>({name:H9,setupOnce(){V9(t)}}),q9=hIe;P();var bi=Q(re(),1);le();var MN="PostgresJs",$9=[">=3.0.0 <4"],gIe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,TIe=Symbol.for("sentry.query.from.instrumented.sql"),z9=B(MN,t=>new PN({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),PN=class extends bi.InstrumentationBase{constructor(e){super("sentry-postgres-js",de,e)}init(){let e=new bi.InstrumentationNodeModuleDefinition("postgres",$9,n=>{try{return this._patchPostgres(n)}catch(r){return St&&A.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new bi.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,$9,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 St&&A.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 St&&A.warn("postgres() did not return a valid instance"),a;let u=o.getConfig();return oR(a,{requireParentSpan:u.requireParentSpan,requestHook:u.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:(dp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(v.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(ku,r);return}let o=n?.match(gIe);o?.[1]&&e.setAttribute(ku,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[TIe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return Ct({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[oa]:"postgres",[wA]:i});let u=n.getConfig(),{requestHook:c}=u;c&&(0,bi.safeExecuteInTheMiddle)(()=>c(a,i,void 0),f=>{f&&(a.setAttribute("sentry.hook.error","requestHook failed"),St&&A.error(`Error in requestHook for ${MN} integration:`,f))},!0);let d=this.resolve;this.resolve=new Proxy(d,{apply:(f,_,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){St&&A.error("Error ending span in resolve callback:",h)}return Reflect.apply(f,_,m)}});let p=this.reject;this.reject=new Proxy(p,{apply:(f,_,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(UA,m?.[0]?.code||"unknown"),a.setAttribute(BA,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){St&&A.error("Error ending span in reject callback:",h)}return Reflect.apply(f,_,m)}});try{return r.apply(this,o)}catch(f){throw a.setStatus({code:2,message:f instanceof Error?f.message:"unknown_error"}),a.end(),f}})},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}},EIe=t=>({name:MN,setupOnce(){z9(t)}}),Y9=EIe;P();P();var zE=Q(P$(),1);P();var FOe={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"}},jOe=FOe.version.split(".")[0],tC="PRISMA_INSTRUMENTATION",nC=`V${jOe}_PRISMA_INSTRUMENTATION`,Nl=globalThis;function HOe(){let t=Nl[nC];return t?.helper?t.helper:Nl[tC]?.helper}function VOe(t){let e={helper:t};Nl[nC]=e,Nl[tC]=e}function qOe(){delete Nl[nC],delete Nl[tC]}var $Oe=process.env.PRISMA_SHOW_ALL_TRACES==="true",zOe="00-10-10-00";function YOe(t){switch(t){case"client":return Ce.CLIENT;case"internal":default:return Ce.INTERNAL}}var WOe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??v.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:zOe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)L$(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return v.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!$Oe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(D$(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return M$(s,e(s,r))}return n.startActiveSpan(o,t,s=>M$(s,e(s,r)))}};function L$(t,e,n,r,o){if(D$(e.name,o))return;let s={attributes:e.attributes,kind:YOe(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(u=>{let c=r.get(u);return c?{context:{spanId:c,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(u=>u.parentId===e.id);for(let u of a)L$(t,u,n,r,o);i.end(e.endTime)})}function M$(t,e){return KOe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function KOe(t){return t!=null&&typeof t.then=="function"}function D$(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var k$={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},v$=k$.version,QOe=k$.name,JOe="@prisma/client",w$=class extends zE.InstrumentationBase{tracerProvider;constructor(t={}){super(QOe,v$,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new zE.InstrumentationNodeModuleDefinition(JOe,[v$])]}enable(){let t=this._config;VOe(new WOe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){qOe()}isEnabled(){return HOe()!==void 0}};var U$="Prisma";function XOe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function B$(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var rC=class extends w${constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=B$();XOe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Ze(()=>{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=ZOe(s.kind),a=s.parent_span_id,u=s.span_id,c=s.trace_id,d=s.links?.map(f=>({context:{traceId:f.trace_id,spanId:f.span_id,traceFlags:Kt.SAMPLED}})),p=X.setSpanContext(v.active(),{traceId:c,spanId:a,traceFlags:Kt.SAMPLED});v.with(p,()=>{let f={generateTraceId:()=>c,generateSpanId:()=>u};r._idGenerator=f,r.startSpan(s.name,{kind:i,links:d,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function ZOe(t){switch(t){case"client":return Ce.CLIENT;case"internal":default:return Ce.INTERNAL}}var eNe=B(U$,t=>new rC(t)),G$=t=>({name:U$,setupOnce(){eNe(t)},setup(e){B$()&&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 K$=Q(W$(),1);var Q$="Hapi",J$=B(Q$,()=>new K$.HapiInstrumentation),fNe=()=>({name:Q$,setupOnce(){J$()}}),X$=fNe;le();var Oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Cf={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};P();var QE=Q(re(),1);var _Ne="@sentry/instrumentation-hono",mNe="0.0.1",KE=class extends QE.InstrumentationBase{constructor(e={}){super(_Ne,mNe,e)}init(){return[new QE.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 v.with(X.setSpan(v.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Bt(a))return a.then(u=>{let c=n._determineHandlerType(u);return i.setAttributes({[Oi.HONO_TYPE]:c,[Oi.HONO_NAME]:c===Cf.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),u});{let u=n._determineHandlerType(a);return i.setAttributes({[Oi.HONO_TYPE]:u,[Oi.HONO_NAME]:u===Cf.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 Bt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Cf.MIDDLEWARE:Cf.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:je.ERROR,message:n.message}),e.recordException(n))}};var Z$="Hono";function hNe(t){let e=Y(t).data,n=e[Oi.HONO_TYPE];if(e[te]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[te]:`${n}.hono`});let r=e[Oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ce()===lr()){St&&A.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Wo],s=e[sa];typeof o=="string"&&typeof s=="string"&&ce().setTransactionName(`${s} ${o}`)}var ez=B(Z$,()=>new KE({responseHook:t=>{hNe(t)}})),gNe=()=>({name:Z$,setupOnce(){ez()}}),tz=gNe;var fz=Q(pz(),1);le();var _z="Koa",mz=B(_z,fz.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(te,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ce()===lr()){St&&A.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Wo],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ce().setTransactionName(`${a} ${i}`)}})),ONe=(t={})=>({name:_z,setupOnce(){mz(t)}}),hz=ONe;var Iz=Q(Rz(),1);var Oz="Connect",Nz=B(Oz,()=>new Iz.ConnectInstrumentation),wNe=()=>({name:Oz,setupOnce(){Nz()}}),Cz=wNe;var Bz=Q(Uz(),1);var jNe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),Gz="Tedious",Fz=B(Gz,()=>new Bz.TediousInstrumentation({})),HNe=()=>{let t;return{name:Gz,setupOnce(){let e=Fz();t=fp(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]||"";jNe.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},jz=HNe;var zz=Q($z(),1);var Yz="GenericPool",Wz=B(Yz,()=>new zz.GenericPoolInstrumentation({})),qNe=()=>{let t;return{name:Yz,setupOnce(){let e=Wz();t=fp(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")}))}}},Kz=qNe;var sY=Q(oY(),1);var iY="Amqplib",tCe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},aY=B(iY,()=>new sY.AmqplibInstrumentation(tCe)),nCe=()=>({name:iY,setupOnce(){aY()}}),uY=nCe;var Lf="VercelAI";var fS=Q(re(),1);var rCe=[">=3.0.0 <7"],cY=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function oCe(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 sCe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(iCe(e.content),aCe(e.content))}function iCe(t){for(let e of t){if(!oCe(e))continue;let n=RR(e.toolCallId);n?zn(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"),ne(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):zn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),ne(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function aCe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&IR(e.toolCallId)}function uCe(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 pS=class t extends fS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",de,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new fS.InstrumentationNodeModuleDefinition("ai",rCe,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||{},u=a.isEnabled,c=V(),d=c?.getIntegrationByName(Lf),p=d?.options,f=d?!!c?.getOptions().sendDefaultPii:!1,{recordInputs:_,recordOutputs:m}=uCe(p,a,u,f);return i[0].experimental_telemetry={...a,isEnabled:u!==void 0?u:!0,recordInputs:_,recordOutputs:m},jr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&ut(h,"_sentry_active_span",pr())},()=>{},h=>{sCe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of cY)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=cY.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var lY=B(Lf,()=>new pS({}));function cCe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var lCe=(t={})=>{let e;return{name:Lf,options:t,setupOnce(){e=lY()},afterAllSetup(n){t.force??cCe(n)?Ih(n):e?.callWhenPatched(()=>Ih(n))}}},dY=lCe;var mS=Q(re(),1);var dCe=[">=4.0.0 <7"],_S=class extends mS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",de,e)}init(){return new mS.InstrumentationNodeModuleDefinition("openai",dCe,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(ba(oi))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Nh(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 pY=B(oi,t=>new _S(t)),pCe=(t={})=>({name:oi,setupOnce(){pY(t)}}),fY=pCe;var gS=Q(re(),1);var fCe=[">=0.19.2 <1.0.0"],hS=class extends gS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",de,e)}init(){return new gS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",fCe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(ba(si))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Ch(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 _Y=B(si,t=>new hS(t)),_Ce=(t={})=>({name:si,options:t,setupOnce(){_Y(t)}}),mY=_Ce;var Fl=Q(re(),1);var hY=[">=0.10.0 <2"],TS=class extends Fl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",de,e)}init(){return new Fl.InstrumentationNodeModuleDefinition("@google/genai",hY,n=>this._patch(n),n=>n,[new Fl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",hY,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(ba(ii))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return xh(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 dp(e,"GoogleGenAI",o),e}};var gY=B(ii,t=>new TS(t)),mCe=(t={})=>({name:ii,setupOnce(){gY(t)}}),TY=mCe;var ki=Q(re(),1);var ES=[">=0.1.0 <2.0.0"];function hCe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function gCe(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 u=a.callbacks,c=hCe(u,e);return a.callbacks=c,Reflect.apply(r,o,s)}})}var SS=class extends ki.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",de,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 ki.InstrumentationNodeModuleDefinition(r,ES,this._patch.bind(this),o=>o,[new ki.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,ES,this._patch.bind(this),o=>o)]));return e.push(new ki.InstrumentationNodeModuleDefinition("langchain",ES,this._patch.bind(this),r=>r,[new ki.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",ES,this._patch.bind(this),r=>r)])),e}_patch(e){Yy([oi,si,ii]);let n=Mh(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(u=>typeof u=="function"&&r.includes(u.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let u of a){let c=i[u];typeof c=="function"&&(i[u]=gCe(c,n))}}};var EY=B(Ph,t=>new SS(t)),TCe=(t={})=>({name:Ph,setupOnce(){EY(t)}}),SY=TCe;var jl=Q(re(),1);var AY=[">=0.0.0 <2.0.0"],AS=class extends jl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",de,e)}init(){return new jl.InstrumentationNodeModuleDefinition("@langchain/langgraph",AY,this._patch.bind(this),n=>n,[new jl.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",AY,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Lh(e.StateGraph.prototype,this.getConfig()),e}};var bY=B(vh,t=>new AS(t)),ECe=(t={})=>({name:vh,setupOnce(){bY(t)}}),yY=ECe;var MY=Q(re(),1);P();var gs=Q(re(),1);le();import*as IY from"node:net";function OY(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=d=>{(0,gs.safeExecuteInTheMiddle)(()=>a(d),p=>{p&&qn.error(p?.message)},!0)});let u=new gs.InstrumentationNodeModuleDefinition("@firebase/firestore",e,d=>RY(d,n,r,t,i)),c=["@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 d of c)u.files.push(new gs.InstrumentationNodeModuleFile(d,e,p=>RY(p,n,r,t,i),p=>NY(p,r)));return u}function RY(t,e,n,r,o){return NY(t,n),e(t,"addDoc",SCe(r,o)),e(t,"getDocs",bCe(r,o)),e(t,"setDoc",yCe(r,o)),e(t,"deleteDoc",ACe(r,o)),t}function NY(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,gs.isWrapped)(t[n])&&e(t,n);return t}function SCe(t,e){return function(r){return function(o,s){let i=yS(t,"addDoc",o);return e(i),bS(i,()=>r(o,s))}}}function ACe(t,e){return function(r){return function(o){let s=yS(t,"deleteDoc",o.parent||o);return e(s),bS(s,()=>r(o))}}}function bCe(t,e){return function(r){return function(o){let s=yS(t,"getDocs",o);return e(s),bS(s,()=>r(o))}}}function yCe(t,e){return function(r){return function(o,s,i){let a=yS(t,"setDoc",o.parent||o);return e(a),bS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function bS(t,e){return v.with(X.setSpan(v.active(),t),()=>(0,gs.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function yS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ce.CLIENT});return ICe(r,n),r.setAttribute(ku,e),r}function RCe(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(IY.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 ICe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[DA]:e.path,[kA]:n.name,[oa]:"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:u}=RCe(s);a&&(i[VA]=a),u&&(i[qA]=u),t.setAttributes(i)}P();var Ts=Q(re(),1);function CY(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,u=o.functions?.requestHook,c=o.functions?.responseHook;typeof c=="function"&&(i=(f,_)=>{(0,Ts.safeExecuteInTheMiddle)(()=>c(f,_),m=>{m&&qn.error(m?.message)},!0)}),typeof u=="function"&&(s=f=>{(0,Ts.safeExecuteInTheMiddle)(()=>u(f),_=>{_&&qn.error(_?.message)},!0)});let d=new Ts.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:f,triggerType:_})=>{d.files.push(new Ts.InstrumentationNodeModuleFile(f,e,m=>OCe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},_),m=>xY(m,r)))}),d}function In(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 u=async function(...c){let d=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",p=t.startSpan(`firebase.function.${n}`,{kind:Ce.SERVER}),f={"faas.name":d,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(f["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(f["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),p.setAttributes(f),e?.requestHook?.(p),v.with(X.setSpan(v.active(),p),async()=>{let _,m;try{m=await i.apply(this,c)}catch(h){_=h}if(e?.responseHook?.(p,_),_&&p.recordException(_),p.end(),_)throw await e?.errorHook?.(p,_),_;return m})};return a?o.call(this,a,u):o.call(this,u)}}}function OCe(t,e,n,r,o,s){switch(xY(t,n),s){case"function":e(t,"onRequest",In(r,o,"http.request")),e(t,"onCall",In(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",In(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",In(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",In(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",In(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",In(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",In(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",In(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",In(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",In(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",In(r,o,"storage.object.finalized")),e(t,"onObjectArchived",In(r,o,"storage.object.archived")),e(t,"onObjectDeleted",In(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",In(r,o,"storage.object.metadataUpdated"));break}return t}function xY(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,Ts.isWrapped)(t[r])&&e(t,r);return t}var PY={},NCe=[">=3.0.0 <5"],CCe=[">=6.0.0 <7"],RS=class extends MY.InstrumentationBase{constructor(e=PY){super("@sentry/instrumentation-firebase",de,e)}setConfig(e={}){super.setConfig({...PY,...e})}init(){let e=[];return e.push(OY(this.tracer,NCe,this._wrap,this._unwrap,this.getConfig())),e.push(CY(this.tracer,CCe,this._wrap,this._unwrap,this.getConfig())),e}};var vY="Firebase",xCe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(te,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(te,"http.request")},errorHook:async(t,e)=>{e&&(ne(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await th(2e3))}}},LY=B(vY,()=>new RS(xCe)),PCe=()=>({name:vY,setupOnce(){LY()}}),DY=PCe;function kY(){return[NV(),nq(),Cq(),tz(),p5(),O5(),U5(),W5(),R9(),q9(),G$(),X$(),hz(),Cz(),jz(),Kz(),qq(),uY(),e5(),SY(),yY(),dY(),fY(),mY(),TY(),Y9(),DY()]}P();var IS=Q(sI(),1),wY=Q(MI(),1);le();var bC=1e6;function UY(t,e={}){t.getOptions().debug&&YI();let[n,r]=MCe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function MCe(t,e={}){let n=new wY.BasicTracerProvider({sampler:new Ug(t),resource:(0,IS.defaultResource)().merge((0,IS.resourceFromAttributes)({[$A]:"node",[LA]:"sentry",[zA]:de})),forceFlushTimeoutMillis:500,spanProcessors:[new wg({timeout:vCe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),vr.setGlobalPropagator(new kg);let r=new zI;return v.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function vCe(t){if(t!=null){if(t>bC)return St&&A.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${bC}`),bC;if(t<=0||Number.isNaN(t)){St&&A.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function BY(){return $g().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(sV(),fV())}function GY(t){return[...BY(),...et(t)?kY():[]]}function yC(t={}){return LCe(t,GY)}function LCe(t={},e){ya(t,"node");let n=nO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(UY(n,{spanProcessors:t.openTelemetrySpanProcessors}),rO()),n}var DCe="prod",jY="0.1.17",kCe=`@tanagram/lore/${jY}`;function Ke(){return DCe}function Kr(){return jY}function HY(){return kCe}yC({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:Ke(),release:Kr(),sendDefaultPii:!0});eh("service_name","lore-cli");import{realpathSync as a2e}from"node:fs";import{fileURLToPath as u2e,pathToFileURL as wQ}from"node:url";var wCe=/\d/,UCe=["-","_","/","."];function BCe(t=""){if(!wCe.test(t))return t!==t.toLowerCase()}function VY(t,e){let n=e??UCe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let u=n.includes(a);if(u===!0){r.push(o),o="",s=void 0;continue}let c=BCe(a);if(i===!1){if(s===!1&&c===!0){r.push(o),o=a,s=c;continue}if(s===!0&&c===!1&&o.length>1){let d=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=d+a,s=c;continue}}o+=a,s=c,i=u}return r.push(o),r}function GCe(t){return t?t[0].toUpperCase()+t.slice(1):""}function FCe(t){return t?t[0].toLowerCase()+t.slice(1):""}function jCe(t,e){return t?(Array.isArray(t)?t:VY(t)).map(n=>GCe(e?.normalize?n.toLowerCase():n)).join(""):""}function Df(t,e){return FCe(jCe(t||"",e))}function OS(t,e){return t?(Array.isArray(t)?t:VY(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function qY(t){return OS(t||"","_")}import{parseArgs as HCe}from"node:util";function MS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function RC(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:c,buffered:d}=await u;if(e.emit("proxyConnect",c),this.emit("proxyConnect",c,e),c.statusCode===200){if(e.once("socket",SSe),n.secureEndpoint){Mp("Upgrading socket connection to TLS");let f=n.servername||n.host;return eO.connect({...zH(n,"host","path","port"),socket:o,servername:cs.isIP(f)?void 0:f})}return o}o.destroy();let p=new cs.Socket({writable:!1});return p.readable=!0,e.once("socket",f=>{Mp("Replaying proxy buffer for failed request"),f.push(d),f.push(null)}),p}};vp.__initStatic();function SSe(t){t.resume()}function zH(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var ISe=1024*32;function OSe(t){return new ySe({read(){this.push(t),this.push(null)}})}function YH(t){let e;try{e=new URL(t.url)}catch{return Ze(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),Xd(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=NSe(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?bSe:ASe,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new vp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=CSe(t,t.httpModule??o,i);return Xd(t,a)}function NSe(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function CSe(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(c){return new Promise((d,p)=>{pc(()=>{let f=OSe(c.body),_={...t.headers};c.body.length>ISe&&(_["content-encoding"]="gzip",f=f.pipe(RSe()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:_,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},g=>{g.on("data",()=>{}),g.on("end",()=>{}),g.setEncoding("utf8");let E=g.headers["retry-after"]??null,S=g.headers["x-sentry-rate-limits"]??null;d({statusCode:g.statusCode,headers:{"retry-after":E,"x-sentry-rate-limits":Array.isArray(S)?S[0]||null:S}})});h.on("error",p),f.pipe(h)})})}}function WH(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=hc(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 xSe,sep as PSe}from"node:path";function KH(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function QH(t=process.argv[1]?tR(process.argv[1]):process.cwd(),e=PSe==="\\"){let n=e?KH(t):t;return r=>{if(!r)return;let o=e?KH(r):r,{dir:s,base:i,ext:a}=xSe.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let u=decodeURIComponent(i);s||(s=".");let c=s.lastIndexOf("/node_modules");if(c>-1)return`${s.slice(c+14).replace(/\//g,".")}:${u}`;if(s.startsWith(n)){let d=s.slice(n.length+1).replace(/\//g,".");return d?`${d}:${u}`:u}return u}}function JH(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(Z.SENTRY_RELEASE?.id)return Z.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 XH=Pm(LR(QH()));P();var eV=Q(re(),1);import*as ZH from"node:os";import{threadId as MSe,isMainThread as vSe}from"worker_threads";var LSe=6e4,qg=class extends Zd{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||ZH.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,eV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),ya(r,"node"),A.log(`Initializing Sentry: process: ${process.pid}, thread: ${vSe?"main":`worker-${MSe}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{_c(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=de,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(()=>{oe&&A.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??LSe).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){Wy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?rH(this,e):[void 0,void 0]}};var tV=Q(Lb(),1);import*as nV from"module";function tO(){if(LH()&&!Z._sentryEsmLoaderHookRegistered){Z._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,tV.createAddHookMessageChannel)();nV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){A.warn("Failed to register 'import-in-the-middle' hook",t)}}}function $g(){return[ph(),lh(),fh(),_h(),qH(),sR(),hh(),Oj(),Mj(),BH(),GH(),yH(),MH(),gH(),_H(),FH(),UH()]}function nO(t={}){return DSe(t,$g)}function DSe(t={},e){let n=kSe(t,e);n.debug===!0&&(oe?A.enable():Ze(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&tO(),iH(),Te().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===XI)&&n.integrations.push(HH({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),ya(n,"node-core");let o=new qg(n);return Te().setClient(o),o.init(),A.log(`SDK initialized from ${xp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),BSe(),V6(o),sH(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function rO(){if(!oe)return;let t=Y6(),e=["SentryContextManager","SentryPropagator"];et()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||A.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||A.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 kSe(t,e){let n=wSe(t.release),r=WH(t.spotlight),o=USe(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??YH,stackParser:Wb(t.stackParser||XH),release:n,tracesSampleRate:o,spotlight:r,debug:hc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:Fy({defaultIntegrations:a,integrations:i})}}function wSe(t){if(t!==void 0)return t;let e=JH();if(e!==void 0)return e}function USe(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 BSe(){if(hc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Bd(t,e);Te().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function Lp(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 oO="Http",rV="@opentelemetry_sentry-patched/instrumentation-http",zg=qr.major===22&&qr.minor>=12||qr.major===23&&qr.minor>=2||qr.major>=24,GSe=B(`${oO}.sentry`,t=>new Ma(t)),FSe=B(oO,t=>{let e=new oV.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=qn.createComponentLogger({namespace:rV}),e.instrumentationName=rV}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function jSe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!et(e)&&zg)}var sV=(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=_p(r),i=mp(o),a=e&&!n;return{name:oO,setup(u){let c=u.getOptions();a&&et(c)&&i.setup(u)},setupOnce(){let u=V()?.getOptions()||{},c=jSe(t,u);s.setupOnce();let d={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:zg||!c,createSpansForOutgoingRequests:zg,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(p,f)=>{let _=Lp(f);if(_.startsWith("data:")){let m=gc(_);p.setAttribute("http.url",m),p.setAttribute(Vs,m),p.updateName(`${f.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(p,f)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(GSe(d),c){let p=HSe(t);FSe(p)}},processEvent(u){return i.processEvent(u)}}};function HSe(t={}){return{disableOutgoingRequestInstrumentation:zg,ignoreOutgoingRequestHook:n=>{let r=Lp(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=Lp(r);if(o.startsWith("data:")){let s=gc(o);n.setAttribute("http.url",s),n.setAttribute(Vs,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 dV=Q(cV(),1);var pV="NodeFetch",$Se=B(pV,dV.UndiciInstrumentation,t=>KSe(t)),zSe=B(`${pV}.sentry`,va,t=>t),YSe=(t={})=>({name:"NodeFetch",setupOnce(){WSe(t,V()?.getOptions())&&$Se(t),zSe(t)}}),fV=YSe;function lV(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function WSe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&et(e)}function KSe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=lV(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=lV(n.origin,n.path);if(r.startsWith("data:")){let o=gc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[Vs]:o,[dr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var RV=Q(yV(),1);var St=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var IV="Express";function d0e(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(te,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function p0e(t,e){if(ce()===lr())return St&&A.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";ce().setTransactionName(`${r} ${t.route}`)}return e}var OV=B(IV,()=>new RV.ExpressInstrumentation({requestHook:t=>d0e(t),spanNameHook:(t,e)=>p0e(t,e)})),f0e=()=>({name:IV,setupOnce(){OV()}}),NV=f0e;var Z8=Q(Y8(),1);import*as YO from"node:diagnostics_channel";P();var DT=Q(Ee(),1),ja=Q(re(),1);le();var ds;(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})(ds||(ds={}));var Qp;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(Qp||(Qp={}));var Jp;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(Jp||(Jp={}));P();var Xp=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function zO(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[Xp]||[];return s.push(o),Object.defineProperty(t,Xp,{enumerable:!1,configurable:!0,value:s}),o}function vT(t,e){let n=t[Xp]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:je.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[Xp])}function K8(t,e,n){let r,o;try{o=t(),W8(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!W8(o)&&(e(r,o),r))throw r;return o}}function W8(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var lye="0.1.0",dye="@sentry/instrumentation-fastify-v3",Q8="anonymous",pye=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),LT=class extends ja.InstrumentationBase{constructor(e={}){super(dye,lye,e)}init(){return[new ja.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,DT.getRPCMetadata)(v.active()),u=i.routeOptions?i.routeOptions.url:r.routerPath;u&&a?.type===DT.RPCType.HTTP&&(a.route=u);let c=r.method||"GET";ce().setTransactionName(`${c} ${u}`),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||Q8,u=`${Jp.MIDDLEWARE} - ${a}`,c=i[1],d=zO(c,s.tracer,u,{[ds.FASTIFY_TYPE]:Qp.MIDDLEWARE,[ds.PLUGIN_NAME]:e,[ds.HOOK_NAME]:n}),p=o&&i[i.length-1];return p&&(i[i.length-1]=function(...f){vT(c),p.apply(this,f)}),v.with(X.setSpan(v.active(),d),()=>K8(()=>r.apply(this,i),f=>{f instanceof Error&&(d.setStatus({code:je.ERROR,message:f.message}),d.recordException(f)),o||vT(c)}))}}_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(!pye.has(s))return n.apply(this,o);let u=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,u)])}}}_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()),fye(),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,ja.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),vT(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,u=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,c=`${Jp.REQUEST_HANDLER} - ${u||this.pluginName||Q8}`,d={[ds.PLUGIN_NAME]:this.pluginName,[ds.FASTIFY_TYPE]:Qp.REQUEST_HANDLER,[xA]:i.routeOptions?i.routeOptions.url:r.routerPath};u&&(d[ds.FASTIFY_NAME]=u);let p=zO(o,e.tracer,c,d);J8(p);let{requestHook:f}=e.getConfig();return f&&(0,ja.safeExecuteInTheMiddle)(()=>f(p,{request:r}),_=>{_&&e._diag.error("request hook failed",_)},!0),v.with(X.setSpan(v.active(),p),()=>{s()})}}};function fye(){let t=V();t&&t.on("spanStart",e=>{J8(e)})}function J8(t){let e=Y(t).data,n=e["fastify.type"];if(e[te]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[te]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var kT="Fastify",eq=B(`${kT}.v3`,()=>new LT);function _ye(){let t=V();if(t)return t.getIntegrationByName(kT)}function X8(t,e,n,r){let o=_ye()?.getShouldHandleError()||rq;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){St&&A.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)&&ne(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var tq=B(`${kT}.v5`,()=>{let t=new Z8.FastifyOtelInstrumentation,e=t.plugin();return YO.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?St&&A.error("Failed to setup Fastify instrumentation",o):(hye(),r&&gye(r))})}),YO.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;X8.call(X8,r,o,s,"diagnostics-channel")}),t}),mye=({shouldHandleError:t})=>{let e;return{name:kT,setupOnce(){e=t||rq,eq(),tq()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},nq=(t={})=>mye(t);function rq(t,e,n){let r=n.statusCode;return r>=500||r<=299}function oq(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[te]||!i&&!a&&!s)return;let u=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[te]:`${u}.fastify`});let c=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof c=="string"){let d=c.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(d)}}function hye(){let t=V();t&&t.on("spanStart",e=>{oq(e)})}function gye(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&oq(s)}let r=e.routeOptions?.url,o=e.method||"GET";ce().setTransactionName(`${o} ${r}`)})}P();var Iq=Q(Rq(),1);var Oq="Graphql",Nq=B(Oq,Iq.GraphQLInstrumentation,t=>{let e=xq(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:je.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let u=He(n),d=Y(u).data[Hc]||[],p=a?`${i} ${a}`:`${i}`;Array.isArray(d)?(d.push(p),u.setAttribute(Hc,d)):typeof d=="string"?u.setAttribute(Hc,[d,p]):u.setAttribute(Hc,p),Y(u).data["original-description"]||u.setAttribute("original-description",Y(u).description),u.updateName(`${Y(u).data["original-description"]} (${Bye(d)})`)}}}}),Uye=(t={})=>({name:Oq,setupOnce(){Nq(xq(t))}}),Cq=Uye;function xq(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function Bye(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 jq=Q(Fq(),1);var Hq="Kafka",Vq=B(Hq,()=>new jq.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),Fye=()=>({name:Hq,setupOnce(){Vq()}}),qq=Fye;var Jq=Q(Qq(),1);var Xq="LruMemoizer",Zq=B(Xq,()=>new Jq.LruMemoizerInstrumentation),Hye=()=>({name:Xq,setupOnce(){Zq()}}),e5=Hye;var c5=Q(u5(),1);var l5="Mongo",d5=B(l5,()=>new c5.MongoDBInstrumentation({dbStatementSerializer:Yye,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function Yye(t){let e=nN(t);return JSON.stringify(e)}function nN(t){if(Array.isArray(t))return t.map(e=>nN(e));if(Wye(t)){let e={};return Object.entries(t).map(([n,r])=>[n,nN(r)]).reduce((n,r)=>(Qye(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function Wye(t){return typeof t=="object"&&t!==null&&!Kye(t)}function Kye(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function Qye(t){return Array.isArray(t)}var Jye=()=>({name:l5,setupOnce(){d5()}}),p5=Jye;var y5=Q(b5(),1);var R5="Mongoose",I5=B(R5,()=>new y5.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),iRe=()=>({name:R5,setupOnce(){I5()}}),O5=iRe;var D5=Q(L5(),1);var k5="Mysql",w5=B(k5,()=>new D5.MySQLInstrumentation({})),hRe=()=>({name:k5,setupOnce(){w5()}}),U5=hRe;var $5=Q(q5(),1);var z5="Mysql2",Y5=B(z5,()=>new $5.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),MRe=()=>({name:z5,setupOnce(){Y5()}}),W5=MRe;var S9=Q(n9(),1),A9=Q(m9(),1);var QRe=["get","set","setex"],yN=["get","mget"],JRe=["set","setex"];function ff(t,e){return t.includes(e.toLowerCase())}function RN(t){return ff(yN,t)?"cache.get":ff(JRe,t)?"cache.put":void 0}function XRe(t,e){return e.some(n=>t.startsWith(n))}function g9(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)?h9(o.map(s=>n(s))):["<unknown>"],r=e[0];return ff(QRe,t)&&r!=null?n(r):h9(e.map(o=>n(o)))}catch{return}}function T9(t,e,n){if(!RN(t))return!1;for(let r of e)if(XRe(r,n))return!0;return!1}function E9(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 h9(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var TE="Redis",_f={},b9=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=g9(e,n),s=RN(e);if(!o||!s||!_f.cachePrefixes||!T9(e,o,_f.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 u=E9(r);u&&t.setAttribute(Sy,u),ff(yN,e)&&u!==void 0&&t.setAttribute(Ty,u>0),t.setAttributes({[te]:s,[Ey]:o});let c=o.join(", ");t.updateName(_f.maxCacheKeyLength?Bs(c,_f.maxCacheKeyLength):c)},ZRe=B(`${TE}.IORedis`,()=>new S9.IORedisInstrumentation({responseHook:b9})),eIe=B(`${TE}.Redis`,()=>new A9.RedisInstrumentation({responseHook:b9})),y9=Object.assign(()=>{ZRe(),eIe()},{id:TE}),tIe=(t={})=>({name:TE,setupOnce(){_f=t,y9()}}),R9=tIe;var j9=Q(F9(),1);var H9="Postgres",V9=B(H9,j9.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),hIe=t=>({name:H9,setupOnce(){V9(t)}}),q9=hIe;P();var bi=Q(re(),1);le();var MN="PostgresJs",$9=[">=3.0.0 <4"],gIe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,TIe=Symbol.for("sentry.query.from.instrumented.sql"),z9=B(MN,t=>new PN({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),PN=class extends bi.InstrumentationBase{constructor(e){super("sentry-postgres-js",de,e)}init(){let e=new bi.InstrumentationNodeModuleDefinition("postgres",$9,n=>{try{return this._patchPostgres(n)}catch(r){return St&&A.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new bi.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,$9,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 St&&A.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 St&&A.warn("postgres() did not return a valid instance"),a;let u=o.getConfig();return oR(a,{requireParentSpan:u.requireParentSpan,requestHook:u.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:(dp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(v.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(ku,r);return}let o=n?.match(gIe);o?.[1]&&e.setAttribute(ku,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[TIe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return Ct({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[oa]:"postgres",[wA]:i});let u=n.getConfig(),{requestHook:c}=u;c&&(0,bi.safeExecuteInTheMiddle)(()=>c(a,i,void 0),f=>{f&&(a.setAttribute("sentry.hook.error","requestHook failed"),St&&A.error(`Error in requestHook for ${MN} integration:`,f))},!0);let d=this.resolve;this.resolve=new Proxy(d,{apply:(f,_,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){St&&A.error("Error ending span in resolve callback:",h)}return Reflect.apply(f,_,m)}});let p=this.reject;this.reject=new Proxy(p,{apply:(f,_,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(UA,m?.[0]?.code||"unknown"),a.setAttribute(BA,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){St&&A.error("Error ending span in reject callback:",h)}return Reflect.apply(f,_,m)}});try{return r.apply(this,o)}catch(f){throw a.setStatus({code:2,message:f instanceof Error?f.message:"unknown_error"}),a.end(),f}})},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}},EIe=t=>({name:MN,setupOnce(){z9(t)}}),Y9=EIe;P();P();var zE=Q(P$(),1);P();var FOe={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"}},jOe=FOe.version.split(".")[0],tC="PRISMA_INSTRUMENTATION",nC=`V${jOe}_PRISMA_INSTRUMENTATION`,Nl=globalThis;function HOe(){let t=Nl[nC];return t?.helper?t.helper:Nl[tC]?.helper}function VOe(t){let e={helper:t};Nl[nC]=e,Nl[tC]=e}function qOe(){delete Nl[nC],delete Nl[tC]}var $Oe=process.env.PRISMA_SHOW_ALL_TRACES==="true",zOe="00-10-10-00";function YOe(t){switch(t){case"client":return Ce.CLIENT;case"internal":default:return Ce.INTERNAL}}var WOe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??v.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:zOe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)L$(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return v.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!$Oe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(D$(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return M$(s,e(s,r))}return n.startActiveSpan(o,t,s=>M$(s,e(s,r)))}};function L$(t,e,n,r,o){if(D$(e.name,o))return;let s={attributes:e.attributes,kind:YOe(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(u=>{let c=r.get(u);return c?{context:{spanId:c,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(u=>u.parentId===e.id);for(let u of a)L$(t,u,n,r,o);i.end(e.endTime)})}function M$(t,e){return KOe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function KOe(t){return t!=null&&typeof t.then=="function"}function D$(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var k$={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},v$=k$.version,QOe=k$.name,JOe="@prisma/client",w$=class extends zE.InstrumentationBase{tracerProvider;constructor(t={}){super(QOe,v$,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new zE.InstrumentationNodeModuleDefinition(JOe,[v$])]}enable(){let t=this._config;VOe(new WOe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){qOe()}isEnabled(){return HOe()!==void 0}};var U$="Prisma";function XOe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function B$(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var rC=class extends w${constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=B$();XOe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Ze(()=>{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=ZOe(s.kind),a=s.parent_span_id,u=s.span_id,c=s.trace_id,d=s.links?.map(f=>({context:{traceId:f.trace_id,spanId:f.span_id,traceFlags:Kt.SAMPLED}})),p=X.setSpanContext(v.active(),{traceId:c,spanId:a,traceFlags:Kt.SAMPLED});v.with(p,()=>{let f={generateTraceId:()=>c,generateSpanId:()=>u};r._idGenerator=f,r.startSpan(s.name,{kind:i,links:d,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function ZOe(t){switch(t){case"client":return Ce.CLIENT;case"internal":default:return Ce.INTERNAL}}var eNe=B(U$,t=>new rC(t)),G$=t=>({name:U$,setupOnce(){eNe(t)},setup(e){B$()&&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 K$=Q(W$(),1);var Q$="Hapi",J$=B(Q$,()=>new K$.HapiInstrumentation),fNe=()=>({name:Q$,setupOnce(){J$()}}),X$=fNe;le();var Oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Cf={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};P();var QE=Q(re(),1);var _Ne="@sentry/instrumentation-hono",mNe="0.0.1",KE=class extends QE.InstrumentationBase{constructor(e={}){super(_Ne,mNe,e)}init(){return[new QE.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 v.with(X.setSpan(v.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Bt(a))return a.then(u=>{let c=n._determineHandlerType(u);return i.setAttributes({[Oi.HONO_TYPE]:c,[Oi.HONO_NAME]:c===Cf.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),u});{let u=n._determineHandlerType(a);return i.setAttributes({[Oi.HONO_TYPE]:u,[Oi.HONO_NAME]:u===Cf.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 Bt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Cf.MIDDLEWARE:Cf.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:je.ERROR,message:n.message}),e.recordException(n))}};var Z$="Hono";function hNe(t){let e=Y(t).data,n=e[Oi.HONO_TYPE];if(e[te]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[te]:`${n}.hono`});let r=e[Oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ce()===lr()){St&&A.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Wo],s=e[sa];typeof o=="string"&&typeof s=="string"&&ce().setTransactionName(`${s} ${o}`)}var ez=B(Z$,()=>new KE({responseHook:t=>{hNe(t)}})),gNe=()=>({name:Z$,setupOnce(){ez()}}),tz=gNe;var fz=Q(pz(),1);le();var _z="Koa",mz=B(_z,fz.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(te,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ce()===lr()){St&&A.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Wo],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ce().setTransactionName(`${a} ${i}`)}})),ONe=(t={})=>({name:_z,setupOnce(){mz(t)}}),hz=ONe;var Iz=Q(Rz(),1);var Oz="Connect",Nz=B(Oz,()=>new Iz.ConnectInstrumentation),wNe=()=>({name:Oz,setupOnce(){Nz()}}),Cz=wNe;var Bz=Q(Uz(),1);var jNe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),Gz="Tedious",Fz=B(Gz,()=>new Bz.TediousInstrumentation({})),HNe=()=>{let t;return{name:Gz,setupOnce(){let e=Fz();t=fp(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]||"";jNe.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},jz=HNe;var zz=Q($z(),1);var Yz="GenericPool",Wz=B(Yz,()=>new zz.GenericPoolInstrumentation({})),qNe=()=>{let t;return{name:Yz,setupOnce(){let e=Wz();t=fp(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")}))}}},Kz=qNe;var sY=Q(oY(),1);var iY="Amqplib",tCe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},aY=B(iY,()=>new sY.AmqplibInstrumentation(tCe)),nCe=()=>({name:iY,setupOnce(){aY()}}),uY=nCe;var Lf="VercelAI";var fS=Q(re(),1);var rCe=[">=3.0.0 <7"],cY=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function oCe(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 sCe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(iCe(e.content),aCe(e.content))}function iCe(t){for(let e of t){if(!oCe(e))continue;let n=RR(e.toolCallId);n?zn(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"),ne(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):zn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),ne(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function aCe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&IR(e.toolCallId)}function uCe(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 pS=class t extends fS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",de,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new fS.InstrumentationNodeModuleDefinition("ai",rCe,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||{},u=a.isEnabled,c=V(),d=c?.getIntegrationByName(Lf),p=d?.options,f=d?!!c?.getOptions().sendDefaultPii:!1,{recordInputs:_,recordOutputs:m}=uCe(p,a,u,f);return i[0].experimental_telemetry={...a,isEnabled:u!==void 0?u:!0,recordInputs:_,recordOutputs:m},jr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&ut(h,"_sentry_active_span",pr())},()=>{},h=>{sCe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of cY)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=cY.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var lY=B(Lf,()=>new pS({}));function cCe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var lCe=(t={})=>{let e;return{name:Lf,options:t,setupOnce(){e=lY()},afterAllSetup(n){t.force??cCe(n)?Ih(n):e?.callWhenPatched(()=>Ih(n))}}},dY=lCe;var mS=Q(re(),1);var dCe=[">=4.0.0 <7"],_S=class extends mS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",de,e)}init(){return new mS.InstrumentationNodeModuleDefinition("openai",dCe,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(ba(oi))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Nh(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 pY=B(oi,t=>new _S(t)),pCe=(t={})=>({name:oi,setupOnce(){pY(t)}}),fY=pCe;var gS=Q(re(),1);var fCe=[">=0.19.2 <1.0.0"],hS=class extends gS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",de,e)}init(){return new gS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",fCe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(ba(si))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Ch(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 _Y=B(si,t=>new hS(t)),_Ce=(t={})=>({name:si,options:t,setupOnce(){_Y(t)}}),mY=_Ce;var Fl=Q(re(),1);var hY=[">=0.10.0 <2"],TS=class extends Fl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",de,e)}init(){return new Fl.InstrumentationNodeModuleDefinition("@google/genai",hY,n=>this._patch(n),n=>n,[new Fl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",hY,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(ba(ii))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return xh(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 dp(e,"GoogleGenAI",o),e}};var gY=B(ii,t=>new TS(t)),mCe=(t={})=>({name:ii,setupOnce(){gY(t)}}),TY=mCe;var ki=Q(re(),1);var ES=[">=0.1.0 <2.0.0"];function hCe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function gCe(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 u=a.callbacks,c=hCe(u,e);return a.callbacks=c,Reflect.apply(r,o,s)}})}var SS=class extends ki.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",de,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 ki.InstrumentationNodeModuleDefinition(r,ES,this._patch.bind(this),o=>o,[new ki.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,ES,this._patch.bind(this),o=>o)]));return e.push(new ki.InstrumentationNodeModuleDefinition("langchain",ES,this._patch.bind(this),r=>r,[new ki.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",ES,this._patch.bind(this),r=>r)])),e}_patch(e){Yy([oi,si,ii]);let n=Mh(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(u=>typeof u=="function"&&r.includes(u.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let u of a){let c=i[u];typeof c=="function"&&(i[u]=gCe(c,n))}}};var EY=B(Ph,t=>new SS(t)),TCe=(t={})=>({name:Ph,setupOnce(){EY(t)}}),SY=TCe;var jl=Q(re(),1);var AY=[">=0.0.0 <2.0.0"],AS=class extends jl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",de,e)}init(){return new jl.InstrumentationNodeModuleDefinition("@langchain/langgraph",AY,this._patch.bind(this),n=>n,[new jl.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",AY,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Lh(e.StateGraph.prototype,this.getConfig()),e}};var bY=B(vh,t=>new AS(t)),ECe=(t={})=>({name:vh,setupOnce(){bY(t)}}),yY=ECe;var MY=Q(re(),1);P();var gs=Q(re(),1);le();import*as IY from"node:net";function OY(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=d=>{(0,gs.safeExecuteInTheMiddle)(()=>a(d),p=>{p&&qn.error(p?.message)},!0)});let u=new gs.InstrumentationNodeModuleDefinition("@firebase/firestore",e,d=>RY(d,n,r,t,i)),c=["@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 d of c)u.files.push(new gs.InstrumentationNodeModuleFile(d,e,p=>RY(p,n,r,t,i),p=>NY(p,r)));return u}function RY(t,e,n,r,o){return NY(t,n),e(t,"addDoc",SCe(r,o)),e(t,"getDocs",bCe(r,o)),e(t,"setDoc",yCe(r,o)),e(t,"deleteDoc",ACe(r,o)),t}function NY(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,gs.isWrapped)(t[n])&&e(t,n);return t}function SCe(t,e){return function(r){return function(o,s){let i=yS(t,"addDoc",o);return e(i),bS(i,()=>r(o,s))}}}function ACe(t,e){return function(r){return function(o){let s=yS(t,"deleteDoc",o.parent||o);return e(s),bS(s,()=>r(o))}}}function bCe(t,e){return function(r){return function(o){let s=yS(t,"getDocs",o);return e(s),bS(s,()=>r(o))}}}function yCe(t,e){return function(r){return function(o,s,i){let a=yS(t,"setDoc",o.parent||o);return e(a),bS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function bS(t,e){return v.with(X.setSpan(v.active(),t),()=>(0,gs.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function yS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ce.CLIENT});return ICe(r,n),r.setAttribute(ku,e),r}function RCe(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(IY.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 ICe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[DA]:e.path,[kA]:n.name,[oa]:"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:u}=RCe(s);a&&(i[VA]=a),u&&(i[qA]=u),t.setAttributes(i)}P();var Ts=Q(re(),1);function CY(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,u=o.functions?.requestHook,c=o.functions?.responseHook;typeof c=="function"&&(i=(f,_)=>{(0,Ts.safeExecuteInTheMiddle)(()=>c(f,_),m=>{m&&qn.error(m?.message)},!0)}),typeof u=="function"&&(s=f=>{(0,Ts.safeExecuteInTheMiddle)(()=>u(f),_=>{_&&qn.error(_?.message)},!0)});let d=new Ts.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:f,triggerType:_})=>{d.files.push(new Ts.InstrumentationNodeModuleFile(f,e,m=>OCe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},_),m=>xY(m,r)))}),d}function In(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 u=async function(...c){let d=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",p=t.startSpan(`firebase.function.${n}`,{kind:Ce.SERVER}),f={"faas.name":d,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(f["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(f["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),p.setAttributes(f),e?.requestHook?.(p),v.with(X.setSpan(v.active(),p),async()=>{let _,m;try{m=await i.apply(this,c)}catch(h){_=h}if(e?.responseHook?.(p,_),_&&p.recordException(_),p.end(),_)throw await e?.errorHook?.(p,_),_;return m})};return a?o.call(this,a,u):o.call(this,u)}}}function OCe(t,e,n,r,o,s){switch(xY(t,n),s){case"function":e(t,"onRequest",In(r,o,"http.request")),e(t,"onCall",In(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",In(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",In(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",In(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",In(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",In(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",In(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",In(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",In(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",In(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",In(r,o,"storage.object.finalized")),e(t,"onObjectArchived",In(r,o,"storage.object.archived")),e(t,"onObjectDeleted",In(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",In(r,o,"storage.object.metadataUpdated"));break}return t}function xY(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,Ts.isWrapped)(t[r])&&e(t,r);return t}var PY={},NCe=[">=3.0.0 <5"],CCe=[">=6.0.0 <7"],RS=class extends MY.InstrumentationBase{constructor(e=PY){super("@sentry/instrumentation-firebase",de,e)}setConfig(e={}){super.setConfig({...PY,...e})}init(){let e=[];return e.push(OY(this.tracer,NCe,this._wrap,this._unwrap,this.getConfig())),e.push(CY(this.tracer,CCe,this._wrap,this._unwrap,this.getConfig())),e}};var vY="Firebase",xCe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(te,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(te,"http.request")},errorHook:async(t,e)=>{e&&(ne(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await th(2e3))}}},LY=B(vY,()=>new RS(xCe)),PCe=()=>({name:vY,setupOnce(){LY()}}),DY=PCe;function kY(){return[NV(),nq(),Cq(),tz(),p5(),O5(),U5(),W5(),R9(),q9(),G$(),X$(),hz(),Cz(),jz(),Kz(),qq(),uY(),e5(),SY(),yY(),dY(),fY(),mY(),TY(),Y9(),DY()]}P();var IS=Q(sI(),1),wY=Q(MI(),1);le();var bC=1e6;function UY(t,e={}){t.getOptions().debug&&YI();let[n,r]=MCe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function MCe(t,e={}){let n=new wY.BasicTracerProvider({sampler:new Ug(t),resource:(0,IS.defaultResource)().merge((0,IS.resourceFromAttributes)({[$A]:"node",[LA]:"sentry",[zA]:de})),forceFlushTimeoutMillis:500,spanProcessors:[new wg({timeout:vCe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),vr.setGlobalPropagator(new kg);let r=new zI;return v.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function vCe(t){if(t!=null){if(t>bC)return St&&A.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${bC}`),bC;if(t<=0||Number.isNaN(t)){St&&A.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function BY(){return $g().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(sV(),fV())}function GY(t){return[...BY(),...et(t)?kY():[]]}function yC(t={}){return LCe(t,GY)}function LCe(t={},e){ya(t,"node");let n=nO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(UY(n,{spanProcessors:t.openTelemetrySpanProcessors}),rO()),n}var DCe="prod",jY="0.1.19",kCe=`@tanagram/lore/${jY}`;function Ke(){return DCe}function Kr(){return jY}function HY(){return kCe}yC({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:Ke(),release:Kr(),sendDefaultPii:!0});eh("service_name","lore-cli");import{realpathSync as a2e}from"node:fs";import{fileURLToPath as u2e,pathToFileURL as wQ}from"node:url";var wCe=/\d/,UCe=["-","_","/","."];function BCe(t=""){if(!wCe.test(t))return t!==t.toLowerCase()}function VY(t,e){let n=e??UCe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let u=n.includes(a);if(u===!0){r.push(o),o="",s=void 0;continue}let c=BCe(a);if(i===!1){if(s===!1&&c===!0){r.push(o),o=a,s=c;continue}if(s===!0&&c===!1&&o.length>1){let d=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=d+a,s=c;continue}}o+=a,s=c,i=u}return r.push(o),r}function GCe(t){return t?t[0].toUpperCase()+t.slice(1):""}function FCe(t){return t?t[0].toLowerCase()+t.slice(1):""}function jCe(t,e){return t?(Array.isArray(t)?t:VY(t)).map(n=>GCe(e?.normalize?n.toLowerCase():n)).join(""):""}function Df(t,e){return FCe(jCe(t||"",e))}function OS(t,e){return t?(Array.isArray(t)?t:VY(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function qY(t){return OS(t||"","_")}import{parseArgs as HCe}from"node:util";function MS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function RC(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 rr(t){return typeof t=="function"?t():t}var Xa=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function VCe(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[g,E]of Object.entries(o)){let S=E;for(let y of S)i.set(g,y),a.has(y)||a.set(y,[]),a.get(y).push(g),i.set(y,g),a.has(g)||a.set(g,[]),a.get(g).push(y)}let u={};function c(g){if(n.has(g))return"boolean";let E=a.get(g)||[];for(let S of E)if(n.has(S))return"boolean";return"string"}function d(g){if(r.has(g))return!0;let E=a.get(g)||[];for(let S of E)if(r.has(S))return!0;return!1}let p=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(s)]);for(let g of p)u[g]||(u[g]={type:c(g),default:s[g]});for(let[g,E]of i.entries())g.length===1&&u[E]&&!u[E].short&&(u[E].short=g);let f=[],_={};for(let g=0;g<t.length;g++){let E=t[g];if(E==="--"){f.push(...t.slice(g));break}if(E.startsWith("--no-")){let S=E.slice(5);_[S]=!0;continue}f.push(E)}let m;try{m=HCe({args:f,options:Object.keys(u).length>0?u:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:f}}let h={_:[]};h._=m.positionals;for(let[g,E]of Object.entries(m.values)){let S=E;c(g)==="boolean"&&typeof E=="string"?S=E!=="false":d(g)&&typeof E=="boolean"&&(S=""),h[g]=S}for(let[g]of Object.entries(_)){h[g]=!1;let E=i.get(g);E&&(h[E]=!1);let S=a.get(g);if(S)for(let y of S)h[y]=!1}for(let[g,E]of i.entries())h[g]!==void 0&&h[E]===void 0&&(h[E]=h[g]),h[E]!==void 0&&h[g]===void 0&&(h[g]=h[E]),h[g]!==h[E]&&s[E]===h[E]&&(h[E]=h[g]);return h}var qCe=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),vS=(t,e=39)=>n=>qCe?n:`\x1B[${t}m${n}\x1B[${e}m`,NS=vS(1,22),Qr=vS(36),xS=vS(90),CS=vS(4,24);function $Ce(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=YY(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 u=Df(a.name),c=OS(a.name);if(u!==a.name||c!==a.name){let d=MS(n.alias[a.name]||[]);u!==a.name&&!d.includes(u)&&d.push(u),c!==a.name&&!d.includes(c)&&d.push(c),d.length>0&&(n.alias[a.name]=d)}}let o=VCe(t,n),[...s]=o._,i=new Proxy(o,{get(a,u){return a[u]??a[Df(u)]??a[OS(u)]}});for(let[,a]of r.entries())if(a.type==="positional"){let u=s.shift();if(u!==void 0)i[a.name]=u;else{if(a.default===void 0&&a.required!==!1)throw new Xa(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let u=i[a.name],c=a.options||[];if(u!==void 0&&c.length>0&&!c.includes(u))throw new Xa(`Invalid value for argument: ${Qr(`--${a.name}`)} (${Qr(u)}). Expected one of: ${c.map(d=>Qr(d)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new Xa(`Missing required argument: --${a.name}`,"EARG");return i}function YY(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:MS(r.alias)});return e}async function zCe(t){return Promise.all(t.map(e=>rr(e)))}async function PS(t,e){let n=await rr(t.args||{}),r=$Ce(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await zCe(t.plugins??[]),i,a;try{for(let d of s)await d.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let c=await rr(t.subCommands);if(c&&Object.keys(c).length>0){let d=YCe(e.rawArgs,n),p=e.rawArgs[d];if(p){let f=await $Y(c,p);if(!f)throw new Xa(`Unknown command ${Qr(p)}`,"E_UNKNOWN_COMMAND");await PS(f,{rawArgs:e.rawArgs.slice(d+1)})}else{let f=await rr(t.default);if(f){if(t.run)throw new Xa("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let _=await $Y(c,f);if(!_)throw new Xa(`Default sub command ${Qr(f)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await PS(_,{rawArgs:e.rawArgs})}else if(!t.run)throw new Xa("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(c){a=c}let u=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(c){u.push(c)}for(let c of[...s].reverse())try{await c.cleanup?.(o)}catch(d){u.push(d)}if(a)throw a;if(u.length===1)throw u[0];if(u.length>1)throw new Error("Multiple cleanup errors",{cause:u});return{result:i}}async function $Y(t,e){if(e in t)return rr(t[e]);for(let n of Object.values(t)){let r=await rr(n),o=await rr(r?.meta);if(o?.alias&&MS(o.alias).includes(e))return r}}function YCe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&WCe(r,e)&&n++;continue}return n}return-1}function WCe(t,e){let n=t.replace(/^-{1,2}/,""),r=Df(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===Df(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var KCe=/^no[-A-Z]/;async function LS(t,e){let n=await rr(t.meta||{}),r=YY(await rr(t.args||{})),o=await rr(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],u=[],c=[];for(let _ of r)if(_.type==="positional"){let m=_.name.toUpperCase(),h=_.required!==!1&&_.default===void 0;a.push([Qr(m+IC(_)),zY(_,h)]),c.push(h?`<${m}>`:`[${m}]`)}else{let m=_.required===!0&&_.default===void 0,h=[...(_.alias||[]).map(g=>`-${g}`),`--${_.name}`].join(", ")+IC(_);if(i.push([Qr(h),zY(_,m)]),_.type==="boolean"&&(_.default===!0||_.negativeDescription)&&!KCe.test(_.name)){let g=[...(_.alias||[]).map(E=>`--no-${E}`),`--no-${_.name}`].join(", ");i.push([Qr(g),[_.negativeDescription,m?xS("(Required)"):""].filter(Boolean).join(" ")])}m&&c.push(`--${_.name}`+IC(_))}if(t.subCommands){let _=[],m=await rr(t.subCommands);for(let[h,g]of Object.entries(m)){let E=await rr((await rr(g))?.meta);if(E?.hidden)continue;let S=MS(E?.alias),y=[h,...S].join(", ");u.push([Qr(y),E?.description||""]),_.push(h,...S)}c.push(_.join("|"))}let d=[],p=n.version||o.version;d.push(xS(`${n.description} (${s+(p?` v${p}`:"")})`),"");let f=i.length>0||a.length>0;return d.push(`${CS(NS("USAGE"))} ${Qr(`${s}${f?" [OPTIONS]":""} ${c.join(" ")}`)}`,""),a.length>0&&(d.push(CS(NS("ARGUMENTS")),""),d.push(RC(a," ")),d.push("")),i.length>0&&(d.push(CS(NS("OPTIONS")),""),d.push(RC(i," ")),d.push("")),u.length>0&&(d.push(CS(NS("COMMANDS")),""),d.push(RC(u," ")),d.push("",`Use ${Qr(`${s} <command> --help`)} for more information about a command.`)),d.filter(_=>typeof _=="string").join(`
|
|
40
40
|
`)}function IC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${qY(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function zY(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{spawn as Kve}from"node:child_process";import X7 from"node:crypto";import Qve from"node:http";var l={};Ji(l,{BRAND:()=>Axe,DIRTY:()=>Za,EMPTY_PATH:()=>ZCe,INVALID:()=>J,NEVER:()=>sPe,OK:()=>an,ParseStatus:()=>Yt,Schema:()=>ue,ZodAny:()=>Bi,ZodArray:()=>bs,ZodBigInt:()=>tu,ZodBoolean:()=>nu,ZodBranded:()=>wf,ZodCatch:()=>fu,ZodDate:()=>ru,ZodDefault:()=>pu,ZodDiscriminatedUnion:()=>wS,ZodEffects:()=>xr,ZodEnum:()=>lu,ZodError:()=>Bn,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>BS,ZodIntersection:()=>au,ZodIssueCode:()=>x,ZodLazy:()=>uu,ZodLiteral:()=>cu,ZodMap:()=>Yl,ZodNaN:()=>Kl,ZodNativeEnum:()=>du,ZodNever:()=>Jr,ZodNull:()=>su,ZodNullable:()=>Do,ZodNumber:()=>eu,ZodObject:()=>Gn,ZodOptional:()=>Nr,ZodParsedType:()=>w,ZodPipeline:()=>Uf,ZodPromise:()=>Gi,ZodReadonly:()=>_u,ZodRecord:()=>US,ZodSchema:()=>ue,ZodSet:()=>Wl,ZodString:()=>Ui,ZodSymbol:()=>$l,ZodTransformer:()=>xr,ZodTuple:()=>Lo,ZodType:()=>ue,ZodUndefined:()=>ou,ZodUnion:()=>iu,ZodUnknown:()=>As,ZodVoid:()=>zl,addIssueToContext:()=>L,any:()=>Pxe,array:()=>Dxe,bigint:()=>Ixe,boolean:()=>o7,coerce:()=>oPe,custom:()=>t7,date:()=>Oxe,datetimeRegex:()=>ZY,defaultErrorMap:()=>Es,discriminatedUnion:()=>Bxe,effect:()=>Qxe,enum:()=>Yxe,function:()=>qxe,getErrorMap:()=>Hl,getParsedType:()=>vo,instanceof:()=>yxe,intersection:()=>Gxe,isAborted:()=>DS,isAsync:()=>Vl,isDirty:()=>kS,isValid:()=>wi,late:()=>bxe,lazy:()=>$xe,literal:()=>zxe,makeIssue:()=>kf,map:()=>Hxe,nan:()=>Rxe,nativeEnum:()=>Wxe,never:()=>vxe,null:()=>xxe,nullable:()=>Xxe,number:()=>r7,object:()=>kxe,objectUtil:()=>OC,oboolean:()=>rPe,onumber:()=>nPe,optional:()=>Jxe,ostring:()=>tPe,pipeline:()=>ePe,preprocess:()=>Zxe,promise:()=>Kxe,quotelessJson:()=>QCe,record:()=>jxe,set:()=>Vxe,setErrorMap:()=>XCe,strictObject:()=>wxe,string:()=>n7,symbol:()=>Nxe,transformer:()=>Qxe,tuple:()=>Fxe,undefined:()=>Cxe,union:()=>Uxe,unknown:()=>Mxe,util:()=>pe,void:()=>Lxe});var pe;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(pe||(pe={}));var OC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(OC||(OC={}));var w=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vo=t=>{switch(typeof t){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(t)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(t)?w.array:t===null?w.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?w.promise:typeof Map<"u"&&t instanceof Map?w.map:typeof Set<"u"&&t instanceof Set?w.set:typeof Date<"u"&&t instanceof Date?w.date:w.object;default:return w.unknown}};var x=pe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),QCe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Bn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,u=0;for(;u<i.path.length;){let c=i.path[u];u===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Bn.create=t=>new Bn(t);var JCe=(t,e)=>{let n;switch(t.code){case x.invalid_type:t.received===w.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,pe.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:n=`Unrecognized key(s) in object: ${pe.joinValues(t.keys,", ")}`;break;case x.invalid_union:n="Invalid input";break;case x.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${pe.joinValues(t.options)}`;break;case x.invalid_enum_value:n=`Invalid enum value. Expected ${pe.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:n="Invalid function arguments";break;case x.invalid_return_type:n="Invalid function return type";break;case x.invalid_date:n="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:pe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case x.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case x.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case x.custom:n="Invalid input";break;case x.invalid_intersection_types:n="Intersection results could not be merged";break;case x.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:n="Number must be finite";break;default:n=e.defaultError,pe.assertNever(t)}return{message:n}},Es=JCe;var WY=Es;function XCe(t){WY=t}function Hl(){return WY}var kf=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",u=r.filter(c=>!!c).slice().reverse();for(let c of u)a=c(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},ZCe=[];function L(t,e){let n=Hl(),r=kf({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Es?void 0:Es].filter(o=>!!o)});t.common.issues.push(r)}var Yt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return J;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return J;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},J=Object.freeze({status:"aborted"}),Za=t=>({status:"dirty",value:t}),an=t=>({status:"valid",value:t}),DS=t=>t.status==="aborted",kS=t=>t.status==="dirty",wi=t=>t.status==="valid",Vl=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Cr=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},KY=(t,e)=>{if(wi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Bn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:u}=t;return i.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:u??n??a.defaultError}},description:o}}var ue=class{get description(){return this._def.description}_getType(e){return vo(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:vo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yt,ctx:{common:e.parent.common,data:e.data,parsedType:vo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Vl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vo(e)},o=this._parseSync({data:e,path:r.path,parent:r});return KY(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vo(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return wi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>wi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vo(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(Vl(o)?o:Promise.resolve(o));return KY(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:x.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new xr({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Nr.create(this,this._def)}nullable(){return Do.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bs.create(this)}promise(){return Gi.create(this,this._def)}or(e){return iu.create([this,e],this._def)}and(e){return au.create(this,e,this._def)}transform(e){return new xr({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new pu({...ie(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new wf({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new fu({...ie(this._def),innerType:this,catchValue:n,typeName:ee.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Uf.create(this,e)}readonly(){return _u.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},exe=/^c[^\s-]{8,}$/i,txe=/^[0-9a-z]+$/,nxe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rxe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,oxe=/^[a-z0-9_-]{21}$/i,sxe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ixe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,axe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uxe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",NC,cxe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lxe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dxe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,pxe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fxe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_xe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,JY="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",mxe=new RegExp(`^${JY}$`);function XY(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function hxe(t){return new RegExp(`^${XY(t)}$`)}function ZY(t){let e=`${JY}T${XY(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function gxe(t,e){return!!((e==="v4"||!e)&&cxe.test(t)||(e==="v6"||!e)&&dxe.test(t))}function Txe(t,e){if(!sxe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Exe(t,e){return!!((e==="v4"||!e)&&lxe.test(t)||(e==="v6"||!e)&&pxe.test(t))}var Ui=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){let s=this._getOrReturnCtx(e);return L(s,{code:x.invalid_type,expected:w.string,received:s.parsedType}),J}let r=new Yt,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),L(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),L(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?L(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&L(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")axe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"email",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")NC||(NC=new RegExp(uxe,"u")),NC.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"emoji",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")rxe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"uuid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")oxe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"nanoid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")exe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"cuid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")txe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"cuid2",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")nxe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"ulid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),L(o,{validation:"url",code:x.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"regex",code:x.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),L(o,{code:x.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),L(o,{code:x.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),L(o,{code:x.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?ZY(s).test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{code:x.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?mxe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{code:x.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?hxe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{code:x.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?ixe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"duration",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?gxe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"ip",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Txe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"jwt",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Exe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"cidr",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?fxe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"base64",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?_xe.test(e.data)||(o=this._getOrReturnCtx(e,o),L(o,{validation:"base64url",code:x.invalid_string,message:s.message}),r.dirty()):pe.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:x.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ui.create=t=>new Ui({checks:[],typeName:ee.ZodString,coerce:t?.coerce??!1,...ie(t)});function Sxe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var eu=class t extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){let s=this._getOrReturnCtx(e);return L(s,{code:x.invalid_type,expected:w.number,received:s.parsedType}),J}let r,o=new Yt;for(let s of this._def.checks)s.kind==="int"?pe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),L(r,{code:x.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),L(r,{code:x.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),L(r,{code:x.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Sxe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),L(r,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),L(r,{code:x.not_finite,message:s.message}),o.dirty()):pe.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&pe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};eu.create=t=>new eu({checks:[],typeName:ee.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var tu=class t extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let r,o=new Yt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),L(r,{code:x.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),L(r,{code:x.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),L(r,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):pe.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return L(n,{code:x.invalid_type,expected:w.bigint,received:n.parsedType}),J}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};tu.create=t=>new tu({checks:[],typeName:ee.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var nu=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let r=this._getOrReturnCtx(e);return L(r,{code:x.invalid_type,expected:w.boolean,received:r.parsedType}),J}return an(e.data)}};nu.create=t=>new nu({typeName:ee.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var ru=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){let s=this._getOrReturnCtx(e);return L(s,{code:x.invalid_type,expected:w.date,received:s.parsedType}),J}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return L(s,{code:x.invalid_date}),J}let r=new Yt,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),L(o,{code:x.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),L(o,{code:x.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):pe.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};ru.create=t=>new ru({checks:[],coerce:t?.coerce||!1,typeName:ee.ZodDate,...ie(t)});var $l=class extends ue{_parse(e){if(this._getType(e)!==w.symbol){let r=this._getOrReturnCtx(e);return L(r,{code:x.invalid_type,expected:w.symbol,received:r.parsedType}),J}return an(e.data)}};$l.create=t=>new $l({typeName:ee.ZodSymbol,...ie(t)});var ou=class extends ue{_parse(e){if(this._getType(e)!==w.undefined){let r=this._getOrReturnCtx(e);return L(r,{code:x.invalid_type,expected:w.undefined,received:r.parsedType}),J}return an(e.data)}};ou.create=t=>new ou({typeName:ee.ZodUndefined,...ie(t)});var su=class extends ue{_parse(e){if(this._getType(e)!==w.null){let r=this._getOrReturnCtx(e);return L(r,{code:x.invalid_type,expected:w.null,received:r.parsedType}),J}return an(e.data)}};su.create=t=>new su({typeName:ee.ZodNull,...ie(t)});var Bi=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return an(e.data)}};Bi.create=t=>new Bi({typeName:ee.ZodAny,...ie(t)});var As=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return an(e.data)}};As.create=t=>new As({typeName:ee.ZodUnknown,...ie(t)});var Jr=class extends ue{_parse(e){let n=this._getOrReturnCtx(e);return L(n,{code:x.invalid_type,expected:w.never,received:n.parsedType}),J}};Jr.create=t=>new Jr({typeName:ee.ZodNever,...ie(t)});var zl=class extends ue{_parse(e){if(this._getType(e)!==w.undefined){let r=this._getOrReturnCtx(e);return L(r,{code:x.invalid_type,expected:w.void,received:r.parsedType}),J}return an(e.data)}};zl.create=t=>new zl({typeName:ee.ZodVoid,...ie(t)});var bs=class t extends ue{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==w.array)return L(n,{code:x.invalid_type,expected:w.array,received:n.parsedType}),J;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(L(n,{code:i?x.too_big:x.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(L(n,{code:x.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(L(n,{code:x.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Cr(n,i,n.path,a)))).then(i=>Yt.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Cr(n,i,n.path,a)));return Yt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};bs.create=(t,e)=>new bs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function ql(t){if(t instanceof Gn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Nr.create(ql(r))}return new Gn({...t._def,shape:()=>e})}else return t instanceof bs?new bs({...t._def,type:ql(t.element)}):t instanceof Nr?Nr.create(ql(t.unwrap())):t instanceof Do?Do.create(ql(t.unwrap())):t instanceof Lo?Lo.create(t.items.map(e=>ql(e))):t}var Gn=class t extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=pe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==w.object){let c=this._getOrReturnCtx(e);return L(c,{code:x.invalid_type,expected:w.object,received:c.parsedType}),J}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Jr&&this._def.unknownKeys==="strip"))for(let c in o.data)i.includes(c)||a.push(c);let u=[];for(let c of i){let d=s[c],p=o.data[c];u.push({key:{status:"valid",value:c},value:d._parse(new Cr(o,p,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Jr){let c=this._def.unknownKeys;if(c==="passthrough")for(let d of a)u.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(c==="strict")a.length>0&&(L(o,{code:x.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let d of a){let p=o.data[d];u.push({key:{status:"valid",value:d},value:c._parse(new Cr(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let d of u){let p=await d.key,f=await d.value;c.push({key:p,value:f,alwaysSet:d.alwaysSet})}return c}).then(c=>Yt.mergeObjectSync(r,c)):Yt.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ee.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of pe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of pe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return ql(this)}partial(e){let n={};for(let r of pe.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of pe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Nr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return e7(pe.objectKeys(this.shape))}};Gn.create=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strip",catchall:Jr.create(),typeName:ee.ZodObject,...ie(e)});Gn.strictCreate=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strict",catchall:Jr.create(),typeName:ee.ZodObject,...ie(e)});Gn.lazycreate=(t,e)=>new Gn({shape:t,unknownKeys:"strip",catchall:Jr.create(),typeName:ee.ZodObject,...ie(e)});var iu=class extends ue{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Bn(a.ctx.common.issues));return L(n,{code:x.invalid_union,unionErrors:i}),J}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let u of r){let c={...n,common:{...n.common,issues:[]},parent:null},d=u._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(u=>new Bn(u));return L(n,{code:x.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}};iu.create=(t,e)=>new iu({options:t,typeName:ee.ZodUnion,...ie(e)});var Ss=t=>t instanceof uu?Ss(t.schema):t instanceof xr?Ss(t.innerType()):t instanceof cu?[t.value]:t instanceof lu?t.options:t instanceof du?pe.objectValues(t.enum):t instanceof pu?Ss(t._def.innerType):t instanceof ou?[void 0]:t instanceof su?[null]:t instanceof Nr?[void 0,...Ss(t.unwrap())]:t instanceof Do?[null,...Ss(t.unwrap())]:t instanceof wf||t instanceof _u?Ss(t.unwrap()):t instanceof fu?Ss(t._def.innerType):[],wS=class t extends ue{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==w.object)return L(n,{code:x.invalid_type,expected:w.object,received:n.parsedType}),J;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(L(n,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),J)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=Ss(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function CC(t,e){let n=vo(t),r=vo(e);if(t===e)return{valid:!0,data:t};if(n===w.object&&r===w.object){let o=pe.objectKeys(e),s=pe.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let u=CC(t[a],e[a]);if(!u.valid)return{valid:!1};i[a]=u.data}return{valid:!0,data:i}}else if(n===w.array&&r===w.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],u=CC(i,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return n===w.date&&r===w.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var au=class extends ue{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(DS(s)||DS(i))return J;let a=CC(s.value,i.value);return a.valid?((kS(s)||kS(i))&&n.dirty(),{status:n.value,value:a.data}):(L(r,{code:x.invalid_intersection_types}),J)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};au.create=(t,e,n)=>new au({left:t,right:e,typeName:ee.ZodIntersection,...ie(n)});var Lo=class t extends ue{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.array)return L(r,{code:x.invalid_type,expected:w.array,received:r.parsedType}),J;if(r.data.length<this._def.items.length)return L(r,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J;!this._def.rest&&r.data.length>this._def.items.length&&(L(r,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Cr(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Yt.mergeArray(n,i)):Yt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Lo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lo({items:t,typeName:ee.ZodTuple,rest:null,...ie(e)})};var US=class t extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.object)return L(r,{code:x.invalid_type,expected:w.object,received:r.parsedType}),J;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Cr(r,a,r.path,a)),value:i._parse(new Cr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Yt.mergeObjectAsync(n,o):Yt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ue?new t({keyType:e,valueType:n,typeName:ee.ZodRecord,...ie(r)}):new t({keyType:Ui.create(),valueType:e,typeName:ee.ZodRecord,...ie(n)})}},Yl=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.map)return L(r,{code:x.invalid_type,expected:w.map,received:r.parsedType}),J;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,u],c)=>({key:o._parse(new Cr(r,a,r.path,[c,"key"])),value:s._parse(new Cr(r,u,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of i){let c=await u.key,d=await u.value;if(c.status==="aborted"||d.status==="aborted")return J;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let u of i){let c=u.key,d=u.value;if(c.status==="aborted"||d.status==="aborted")return J;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}}}};Yl.create=(t,e,n)=>new Yl({valueType:e,keyType:t,typeName:ee.ZodMap,...ie(n)});var Wl=class t extends ue{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==w.set)return L(r,{code:x.invalid_type,expected:w.set,received:r.parsedType}),J;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(L(r,{code:x.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(L(r,{code:x.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(u){let c=new Set;for(let d of u){if(d.status==="aborted")return J;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((u,c)=>s._parse(new Cr(r,u,r.path,c)));return r.common.async?Promise.all(a).then(u=>i(u)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Wl.create=(t,e)=>new Wl({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var BS=class t extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==w.function)return L(n,{code:x.invalid_type,expected:w.function,received:n.parsedType}),J;function r(a,u){return kf({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hl(),Es].filter(c=>!!c),issueData:{code:x.invalid_arguments,argumentsError:u}})}function o(a,u){return kf({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hl(),Es].filter(c=>!!c),issueData:{code:x.invalid_return_type,returnTypeError:u}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Gi){let a=this;return an(async function(...u){let c=new Bn([]),d=await a._def.args.parseAsync(u,s).catch(_=>{throw c.addIssue(r(u,_)),c}),p=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(p,s).catch(_=>{throw c.addIssue(o(p,_)),c})})}else{let a=this;return an(function(...u){let c=a._def.args.safeParse(u,s);if(!c.success)throw new Bn([r(u,c.error)]);let d=Reflect.apply(i,this,c.data),p=a._def.returns.safeParse(d,s);if(!p.success)throw new Bn([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Lo.create(e).rest(As.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Lo.create([]).rest(As.create()),returns:n||As.create(),typeName:ee.ZodFunction,...ie(r)})}},uu=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};uu.create=(t,e)=>new uu({getter:t,typeName:ee.ZodLazy,...ie(e)});var cu=class extends ue{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return L(n,{received:n.data,code:x.invalid_literal,expected:this._def.value}),J}return{status:"valid",value:e.data}}get value(){return this._def.value}};cu.create=(t,e)=>new cu({value:t,typeName:ee.ZodLiteral,...ie(e)});function e7(t,e){return new lu({values:t,typeName:ee.ZodEnum,...ie(e)})}var lu=class t extends ue{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return L(n,{expected:pe.joinValues(r),received:n.parsedType,code:x.invalid_type}),J}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return L(n,{received:n.data,code:x.invalid_enum_value,options:r}),J}return an(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};lu.create=e7;var du=class extends ue{_parse(e){let n=pe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==w.string&&r.parsedType!==w.number){let o=pe.objectValues(n);return L(r,{expected:pe.joinValues(o),received:r.parsedType,code:x.invalid_type}),J}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=pe.objectValues(n);return L(r,{received:r.data,code:x.invalid_enum_value,options:o}),J}return an(e.data)}get enum(){return this._def.values}};du.create=(t,e)=>new du({values:t,typeName:ee.ZodNativeEnum,...ie(e)});var Gi=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==w.promise&&n.common.async===!1)return L(n,{code:x.invalid_type,expected:w.promise,received:n.parsedType}),J;let r=n.parsedType===w.promise?n.data:Promise.resolve(n.data);return an(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Gi.create=(t,e)=>new Gi({type:t,typeName:ee.ZodPromise,...ie(e)});var xr=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{L(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return J;let u=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return u.status==="aborted"?J:u.status==="dirty"?Za(u.value):n.value==="dirty"?Za(u.value):u});{if(n.value==="aborted")return J;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?J:a.status==="dirty"?Za(a.value):n.value==="dirty"?Za(a.value):a}}if(o.type==="refinement"){let i=a=>{let u=o.refinement(a,s);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?J:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?J:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!wi(i))return J;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>wi(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):J);pe.assertNever(o)}};xr.create=(t,e,n)=>new xr({schema:t,typeName:ee.ZodEffects,effect:e,...ie(n)});xr.createWithPreprocess=(t,e,n)=>new xr({schema:e,effect:{type:"preprocess",transform:t},typeName:ee.ZodEffects,...ie(n)});var Nr=class extends ue{_parse(e){return this._getType(e)===w.undefined?an(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Nr.create=(t,e)=>new Nr({innerType:t,typeName:ee.ZodOptional,...ie(e)});var Do=class extends ue{_parse(e){return this._getType(e)===w.null?an(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Do.create=(t,e)=>new Do({innerType:t,typeName:ee.ZodNullable,...ie(e)});var pu=class extends ue{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===w.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};pu.create=(t,e)=>new pu({innerType:t,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var fu=class extends ue{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vl(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Bn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Bn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};fu.create=(t,e)=>new fu({innerType:t,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var Kl=class extends ue{_parse(e){if(this._getType(e)!==w.nan){let r=this._getOrReturnCtx(e);return L(r,{code:x.invalid_type,expected:w.nan,received:r.parsedType}),J}return{status:"valid",value:e.data}}};Kl.create=t=>new Kl({typeName:ee.ZodNaN,...ie(t)});var Axe=Symbol("zod_brand"),wf=class extends ue{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Uf=class t extends ue{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?J:s.status==="dirty"?(n.dirty(),Za(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?J:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ee.ZodPipeline})}},_u=class extends ue{_parse(e){let n=this._def.innerType._parse(e),r=o=>(wi(o)&&(o.value=Object.freeze(o.value)),o);return Vl(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};_u.create=(t,e)=>new _u({innerType:t,typeName:ee.ZodReadonly,...ie(e)});function QY(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function t7(t,e={},n){return t?Bi.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=QY(e,r),u=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!s){let i=QY(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Bi.create()}var bxe={object:Gn.lazycreate},ee;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ee||(ee={}));var yxe=(t,e={message:`Input not instance of ${t.name}`})=>t7(n=>n instanceof t,e),n7=Ui.create,r7=eu.create,Rxe=Kl.create,Ixe=tu.create,o7=nu.create,Oxe=ru.create,Nxe=$l.create,Cxe=ou.create,xxe=su.create,Pxe=Bi.create,Mxe=As.create,vxe=Jr.create,Lxe=zl.create,Dxe=bs.create,kxe=Gn.create,wxe=Gn.strictCreate,Uxe=iu.create,Bxe=wS.create,Gxe=au.create,Fxe=Lo.create,jxe=US.create,Hxe=Yl.create,Vxe=Wl.create,qxe=BS.create,$xe=uu.create,zxe=cu.create,Yxe=lu.create,Wxe=du.create,Kxe=Gi.create,Qxe=xr.create,Jxe=Nr.create,Xxe=Do.create,Zxe=xr.createWithPreprocess,ePe=Uf.create,tPe=()=>n7().optional(),nPe=()=>r7().optional(),rPe=()=>o7().optional(),oPe={string:t=>Ui.create({...t,coerce:!0}),number:t=>eu.create({...t,coerce:!0}),boolean:t=>nu.create({...t,coerce:!0}),bigint:t=>tu.create({...t,coerce:!0}),date:t=>ru.create({...t,coerce:!0})};var sPe=J;var iPe=t=>typeof t?.safeParse=="function";var xC=t=>typeof t?.passthrough=="function";var aPe=(t,e)=>xC(t)?xC(e)?t.merge(e):t:xC(e)?e:Object.assign({},t,e);var Ent=l.object({name:l.literal("ZodError"),issues:l.array(l.object({path:l.array(l.union([l.string(),l.number()])),message:l.string().optional(),code:l.nativeEnum(l.ZodIssueCode)}).catchall(l.any()))}),uPe=Symbol("ContractNoBody"),i7=t=>"method"in t&&"path"in t;var a7=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return i7(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:aPe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,a7(r,e)]})),PC=Symbol("ContractPlainType"),Pr=()=>({router:(t,e)=>a7(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>PC,body:()=>PC,type:()=>PC,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>uPe}),cPe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},lPe=(t,e=!1)=>{let n=e?dPe(t):pPe(t);return n?.length>0?"?"+n:""},dPe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",pPe=t=>t?Object.keys(t).flatMap(e=>MC(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",MC=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>MC(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>MC(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var vC=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var fPe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),u=a.headers.get("content-type");if(u?.includes("application/")&&u?.includes("json")){let c={status:a.status,body:await a.json(),headers:a.headers},d=t.responses[c.status];return(s??t.validateResponseOnClient)&&iPe(d)?{...c,body:d.parse(c.body)}:c}return u?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},_Pe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},s7=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),mPe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:u}=t,c=n.api||fPe,d=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([_,m])=>typeof m=="function"?[_,m(t)]:[_,m])),p={...d&&s7(d),...s7(a)};Object.keys(p).forEach(_=>{p[_]===void 0&&delete p[_]});let f={route:r,path:e,method:r.method,headers:p,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...u},...u?.signal&&{signal:u.signal},...u?.cache&&{cache:u.cache},...u&&"next"in u&&!!u?.next&&{next:u.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?f={...f,contentType:"multipart/form-data",body:o instanceof FormData?o:_Pe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?f={...f,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",...f.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(f={...f,contentType:"application/json",headers:{"content-type":"application/json",...f.headers},body:JSON.stringify(o)})),c({...f,...i})},hPe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:u,fetchOptions:c,cache:d,next:p,...f}=n||{},_={...e,...u};return{path:gPe(r,_.baseUrl,o,t,!!_.jsonQuery),clientArgs:_,route:t,body:s,query:r,extraInputArgs:f,fetchOptions:{...d&&{cache:d},...p&&{next:p},...c},headers:{...a,...i}}},gPe=(t,e,n,r,o)=>{let s=cPe({path:r.path,params:n}),i=lPe(t,o);return`${e}${s}${i}`},TPe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=hPe(t,e,r),s=await mPe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new vC(s,n)}},LC=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>i7(r)?[n,TPe(r,e)]:[n,LC(r,e)]));var DC=["free","creator","team"],u7=typeof process<"u"&&process.env?.NODE_ENV!=="production",EPe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:u7?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:u7?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var c7=EPe.stripe.plans,Ant=Object.freeze(Object.fromEntries(c7.map(t=>[t.tier,t])));var SPe=Pr(),un=l.object({message:l.string()}),kC=l.record(l.unknown()),mu=l.string().regex(/^doc_[0-9A-Za-z]{22}$/),GS=l.string().regex(/^proj_[0-9A-Za-z]{22}$/),APe=["active","archived"],FS=l.enum(APe),l7=l.object({id:l.string().min(1),display_name:l.string().min(1)}),d7=l.object({id:GS,name:l.string().min(1)}),wC=l.object({id:mu,title:l.string().min(1),status:FS,author:l7,project:d7.nullable(),created_at:l.string().datetime(),updated_at:l.string().datetime(),archived_at:l.string().datetime().nullable()}),bPe=l.object({type:l.literal("list"),list_type:l.literal("doc"),objects:l.array(wC)}),yPe=l.object({project_id:GS.optional(),status:FS.optional()}),RPe=l.object({title:l.string().trim().min(1).max(300).optional(),prosemirror_json:kC.optional(),project_id:GS.nullable().optional()}),IPe=l.object({id:mu,created_at:l.string().datetime()}),OPe=l.object({title:l.string().trim().min(1).max(300).optional(),prosemirror_json:kC.optional(),project_id:GS.nullable().optional(),status:FS.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),NPe=l.object({id:mu,updated_at:l.string().datetime()}),CPe=l.object({id:mu,title:l.string().min(1),prosemirror_json:kC,status:FS,author:l7,project:d7.nullable(),created_at:l.string().datetime(),updated_at:l.string().datetime(),archived_at:l.string().datetime().nullable()}),p7=SPe.router({listDocs:{method:"GET",path:"/docs",headers:l.object({authorization:l.string().min(1).optional()}),query:yPe,responses:{200:bPe,401:un,403:un},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:l.object({authorization:l.string().min(1).optional()}),body:RPe,responses:{201:IPe,401:un,403:un,404:un,422:un},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:l.object({docId:mu}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:CPe,401:un,403:un,404:un},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:l.object({docId:mu}),headers:l.object({authorization:l.string().min(1).optional()}),body:OPe,responses:{200:NPe,401:un,403:un,404:un,422:un},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:l.object({docId:mu}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{204:l.object({}),401:un,403:un,404:un},summary:"Hard-delete a doc and any mention references it owns"}});var xPe=Pr(),rt=l.object({message:l.string()}),UC=l.record(l.unknown()),ko=l.string().regex(/^proj_[0-9A-Za-z]{22}$/),PPe=["active","archived"],jS=l.enum(PPe),BC=l.object({id:l.string().min(1),display_name:l.string().min(1)}),f7=l.object({thread_id:l.string().min(1),title:l.string().min(1),added_at:l.string().datetime(),added_by:BC}),MPe=l.object({id:ko,name:l.string().min(1),status:jS,author:BC,thread_count:l.number().int().nonnegative(),doc_count:l.number().int().nonnegative(),created_at:l.string().datetime(),updated_at:l.string().datetime(),archived_at:l.string().datetime().nullable()}),vPe=l.object({type:l.literal("list"),list_type:l.literal("project"),objects:l.array(MPe)}),LPe=l.object({status:jS.optional()}),DPe=l.object({name:l.string().trim().min(1).max(200),prosemirror_json:UC.optional()}),kPe=l.object({id:ko,created_at:l.string().datetime()}),wPe=l.object({name:l.string().trim().min(1).max(200).optional(),prosemirror_json:UC.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),UPe=l.object({id:ko,updated_at:l.string().datetime()}),BPe=l.object({archived:l.boolean()}),GPe=l.object({id:ko,status:jS,archived_at:l.string().datetime().nullable()}),FPe=l.object({id:ko,name:l.string().min(1),prosemirror_json:UC,status:jS,author:BC,created_at:l.string().datetime(),updated_at:l.string().datetime(),archived_at:l.string().datetime().nullable(),threads:l.array(f7),docs:l.array(wC)}),jPe=l.object({thread_id:l.string().min(1).max(64)}),HPe=f7,_7=xPe.router({listProjects:{method:"GET",path:"/projects",headers:l.object({authorization:l.string().min(1).optional()}),query:LPe,responses:{200:vPe,401:rt},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:l.object({authorization:l.string().min(1).optional()}),body:DPe,responses:{201:kPe,401:rt,422:rt},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:l.object({projectId:ko}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:FPe,401:rt,403:rt,404:rt},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:l.object({projectId:ko}),headers:l.object({authorization:l.string().min(1).optional()}),body:wPe,responses:{200:UPe,401:rt,403:rt,404:rt,422:rt},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:l.object({projectId:ko}),headers:l.object({authorization:l.string().min(1).optional()}),body:BPe,responses:{200:GPe,401:rt,403:rt,404:rt},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:l.object({projectId:ko}),headers:l.object({authorization:l.string().min(1).optional()}),body:jPe,responses:{201:HPe,401:rt,403:rt,404:rt,409:rt,422:rt},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:l.object({projectId:ko,threadId:l.string().min(1).max(64)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{204:l.object({}),401:rt,403:rt,404:rt},summary:"Remove a thread membership from a project"}});var VPe=Pr(),HS=l.object({message:l.string()}),qPe=["thread","plan","doc","user"],VS=l.enum(qPe),$Pe=["doc","project"],zPe=l.enum($Pe),YPe=l.object({kind:VS,id:l.string().min(1),title:l.string().min(1),href:l.string().min(1)}),WPe=l.object({type:l.literal("list"),list_type:l.literal("mention"),objects:l.array(YPe)}),KPe=l.object({q:l.string().trim().min(1).max(50),kinds:l.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(l.array(VS).optional())}),QPe=l.object({source_kind:zPe,source_id:l.string().min(1),source_title:l.string().min(1),source_href:l.string().min(1),target_kind:VS,target_id:l.string().min(1),created_at:l.string().datetime()}),JPe=l.object({type:l.literal("list"),list_type:l.literal("backlink"),objects:l.array(QPe)}),XPe=l.object({target_kind:VS,target_id:l.string().min(1).max(64)}),m7=VPe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:l.object({authorization:l.string().min(1).optional()}),query:KPe,responses:{200:WPe,401:HS,422:HS},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:l.object({authorization:l.string().min(1).optional()}),query:XPe,responses:{200:JPe,401:HS,403:HS},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var ZPe=Pr(),e1e=l.object({type:l.literal("list"),list_type:l.literal("thread"),has_more:l.boolean(),objects:l.array(l.unknown())}),Fi=l.object({message:l.string()}),h7=l.object({thread_id:l.string().min(1),is_favorited:l.boolean(),favorited_at:l.string().datetime().nullable()}),t1e=l.object({before:l.string().min(1).max(64).optional()}),g7=ZPe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:l.object({id:l.string().min(1).max(64)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{201:h7,401:Fi,403:Fi,404:Fi},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:l.object({id:l.string().min(1).max(64)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:h7,401:Fi,403:Fi,404:Fi},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:l.object({authorization:l.string().min(1).optional()}),query:t1e,responses:{200:e1e,401:Fi,403:Fi},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var n1e=Pr(),GC=l.object({message:l.string()}),r1e=l.object({id:l.string().min(1),title:l.string(),href:l.string().min(1),author_display_name:l.string().nullable(),author_handle:l.string().nullable()}),o1e=l.object({name:l.string().min(1),usage_count:l.number().int().nonnegative(),href:l.string().min(1)}),s1e=l.object({id:l.string().min(1),display_name:l.string(),handle:l.string().nullable(),avatar_url:l.string().nullable(),href:l.string().min(1)}),i1e=l.object({type:l.literal("global_search"),threads:l.array(r1e),skills:l.array(o1e),people:l.array(s1e)}),a1e=l.object({q:l.string().trim().min(1).max(80)}),T7=n1e.router({globalSearch:{method:"GET",path:"/search",headers:l.object({authorization:l.string().min(1).optional()}),query:a1e,responses:{200:i1e,401:GC,403:GC,422:GC},summary:"Global navbar search across threads, skills, and people. Org-scoped, max 5 results per kind."}});var u1e=Pr(),c1e=l.object({id:l.string().uuid(),role:l.enum(["user","assistant"]),content:l.string().min(1),timestamp:l.string().datetime()}),l1e=l.object({id:l.string().uuid(),title:l.string().min(1),author:l.string().min(1),authorAvatar:l.string().min(1).max(4),model:l.string().min(1),turnCount:l.number().int().nonnegative(),createdAt:l.string().datetime(),preview:l.string()}),ort=l1e.extend({messages:l.array(c1e)}),b=l.object({message:l.string()}),d1e=/^[a-zA-Z0-9_-]{2,32}$/,O7=l.string().regex(d1e,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),FC=l.object({id:l.string(),first_name:l.string().min(1),last_name:l.string().min(1),display_name:l.string().min(1),stytch_id:l.string().nullable(),handle:l.string().nullable(),bio:l.string().max(280).nullable(),avatar_url:l.string().nullable(),banner_url:l.string().nullable(),share_new_threads_to_workspace:l.boolean(),experimental_features_enabled:l.boolean(),onboarded_at:l.string().nullable()}),p1e=l.object({stytchMemberId:l.string().min(1).optional(),emailAddress:l.string().email(),name:l.string().nullable(),user:FC,is_admin:l.boolean()}),f1e=l.object({share_new_threads_to_workspace:l.boolean().optional(),experimental_features_enabled:l.boolean().optional(),onboarded_at:l.union([l.literal("now"),l.null()]).optional(),display_name:l.string().min(1).max(120).optional(),handle:O7.optional(),bio:l.string().max(280).nullable().optional(),avatar_storage_url:l.string().min(1).nullable().optional(),banner_storage_url:l.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),_1e=l.object({id:l.string(),display_name:l.string(),handle:l.string().nullable(),avatar_url:l.string().nullable(),visible_thread_count:l.number().int().nonnegative(),last_active_at:l.string().datetime().nullable()}),N7=l.object({id:l.string().min(1),display_name:l.string().min(1),handle:l.string().nullable(),bio:l.string().max(280).nullable(),avatar_url:l.string().nullable(),banner_url:l.string().nullable(),organization_name:l.string().min(1).nullable(),created_at:l.string().min(1),visible_thread_count:l.number().int().nonnegative(),follower_count:l.number().int().nonnegative(),following_count:l.number().int().nonnegative(),published_project_count:l.number().int().nonnegative(),is_following:l.boolean(),is_self:l.boolean()}),m1e=l.object({type:l.literal("list"),list_type:l.literal("organization_member"),objects:l.array(_1e)}),h1e=l.object({email_address:l.string().email()}),g1e=l.object({email_address:l.string().email(),member_id:l.string().min(1)}),T1e=l.object({location:l.string().trim().min(1),contact:l.string().trim().email()}),E1e=l.object({location:l.string().min(1),contact:l.string().email(),created_at:l.string().datetime()}),S1e=l.object({first_name:l.string().min(1),last_name:l.string().min(1),display_name:l.string().min(1),stytch_id:l.string().min(1).optional()}),A1e=l.object({name:l.string().min(1),email_domains:l.array(l.string().min(1)).nonempty(),stytch_org_id:l.string().min(1)}),b1e=l.object({user:S1e,organization:A1e}),y1e=l.object({path_glob:l.string().min(1),name:l.string().min(1),description:l.string().min(1)}),R1e=l.object({repo_origin_path:l.string().min(1),building_blocks:l.array(y1e)}),C7=l.string().regex(/^th_[0-9A-Za-z]{22}$/),$S=l.string().regex(/^tb_[0-9A-Za-z]{22}$/),I1e=l.object({id:C7,author:l.object({id:l.string().min(1),display_name:l.string().min(1)}),body:l.string(),created_at:l.string().datetime(),repo_origin_path:l.string().min(1),latest_revision_id:$S,revision_count:l.number().int().positive()}),O1e=l.object({id:l.string().min(1),display_name:l.string().min(1)}),N1e=l.object({id:l.string().min(1),author_id:l.string().min(1).nullable(),author:O1e.nullable(),created_at:l.string().datetime(),deleted_at:l.string().datetime().nullable(),content:l.string().min(1)}),C1e=l.object({id:l.string().min(1),thread_block_id:l.string().min(1),created_at:l.string().datetime(),resolved_at:l.string().datetime().nullable(),comments:l.array(N1e)}),x1e=l.object({thread_block_id:$S,from_position:l.number().int().positive(),to_position:l.number().int().positive(),selected_text:l.string().min(1),content:l.string().trim().min(1)}),P1e=l.object({id:l.string().min(1)}),M1e=l.object({content:l.string().trim().min(1)}),v1e=l.object({id:l.string().min(1)}),L1e=l.object({content:l.string().trim().min(1)}),D1e=l.object({id:l.string().min(1)}),k1e=l.object({content:l.string().trim().min(1)}),w1e=l.object({id:l.string().min(1)}),U1e=l.object({resolved:l.boolean()}),B1e=l.object({id:l.string().min(1),resolved_at:l.string().datetime().nullable()}),G1e=l.object({resolved:l.boolean()}),F1e=l.object({id:l.string().min(1),resolved_at:l.string().datetime().nullable()}),x7=l.record(l.unknown()),j1e=l.object({id:$S,body:l.string(),created_at:l.string().datetime(),prosemirror_json:x7,comment_threads:l.array(C1e)}),H1e=l.object({id:C7,created_at:l.string().datetime(),repo_origin_path:l.string().min(1),author:l.object({id:l.string().min(1),display_name:l.string().min(1)}),latest_revision_id:$S,revision_count:l.number().int().positive(),revisions:l.array(j1e)}),V1e=l.object({type:l.literal("list"),list_type:l.literal("plan"),has_more:l.boolean(),objects:l.array(I1e)}),q1e=l.object({before:l.string().min(1).optional(),after:l.string().min(1).optional(),author_id:l.string().min(1).optional(),repo_origin_path:l.string().min(1).optional()}),P7=l.object({id:l.string().min(1),organization_id:l.string().min(1),created_at:l.string().min(1),repo_origin_path:l.string().min(1),path_glob:l.string().min(1),name:l.string().min(1),description:l.string().min(1)}),$1e=l.array(P7),z1e=l.object({type:l.literal("list"),list_type:l.literal("building_block"),has_more:l.boolean(),objects:l.array(P7)}),Y1e=l.object({repo_origin_path:l.string().min(1),before:l.string().min(1).optional(),after:l.string().min(1).optional()}),W1e=l.enum(["thread","building_block"]),K1e=l.object({repo_origin_path:l.string().min(1),sources:l.array(W1e).nonempty()}),Q1e=l.object({type:l.literal("list"),list_type:l.literal("repository"),has_more:l.boolean(),objects:l.array(K1e)}),ji=l.enum(["claudeCode","codex","amp","cursor","unspecified"]),J1e=["transcript","plan"],X1e=l.enum(J1e),Z1e=l.object({md5:l.string().min(1),harness:ji,filename:l.string().min(1).optional(),repo_origin_path:l.string().min(1).optional(),harness_internal_id:l.string().min(1).optional(),file_type:X1e.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),HC=l.object({id:l.string().min(1),display_name:l.string().min(1)}),eMe=l.object({id:l.string().min(1),display_name:l.string().min(1)}),M7=l.object({id:l.string().min(1),author_id:l.string().min(1).nullable(),author:eMe.nullable(),created_at:l.string().datetime(),deleted_at:l.string().datetime().nullable(),content:l.string().min(1)}),v7=l.object({id:l.string().min(1),thread_block_id:l.string().min(1),created_at:l.string().datetime(),resolved_at:l.string().datetime().nullable()}),tMe=v7.extend({comments:l.array(M7)}),Bf=l.object({id:l.string().min(1),type:l.string().min(1),index_in_thread:l.number().int().nonnegative(),isCritiqued:l.boolean(),comment_threads:l.array(tMe).optional()}).passthrough(),L7=l.object({type:l.literal("list"),list_type:l.literal("thread_block"),has_more:l.boolean(),objects:l.array(Bf)}),E7=Bf.extend({type:l.literal("plan"),prosemirror_json:x7,thread_file_id:l.string().min(1)}),nMe=l.union([l.literal(-1),l.literal(1)]),D7=l.union([l.literal(-1),l.literal(0),l.literal(1)]),S7=l.object({score:l.number().int(),up_count:l.number().int().nonnegative(),down_count:l.number().int().nonnegative(),viewer_vote:D7}),rMe=l.object({value:nMe}),oMe=l.object({id:l.string().min(1),display_name:l.string().min(1),avatar_url:l.string().nullable()}),hu=l.object({id:l.string().min(1),thread_id:l.string().min(1),author_id:l.string().min(1).nullable(),author:oMe.nullable(),parent_comment_id:l.string().min(1).nullable(),content:l.string(),created_at:l.string().datetime(),updated_at:l.string().datetime(),deleted_at:l.string().datetime().nullable()}),sMe=l.object({type:l.literal("list"),list_type:l.literal("thread_comment"),objects:l.array(hu)}),iMe=l.object({content:l.string().trim().min(1).max(4e3),parent_comment_id:l.string().min(1).optional()}),aMe=hu,uMe=l.object({content:l.string().trim().min(1).max(4e3)}),cMe=hu,lMe=hu,srt=l.discriminatedUnion("kind",[l.object({kind:l.literal("created"),thread_id:l.string().min(1),actor_user_id:l.string().min(1),version:l.number(),comment:hu}),l.object({kind:l.literal("updated"),thread_id:l.string().min(1),actor_user_id:l.string().min(1),version:l.number(),comment:hu}),l.object({kind:l.literal("deleted"),thread_id:l.string().min(1),actor_user_id:l.string().min(1),version:l.number(),comment:hu})]),dMe=l.enum(["pending","generating","ready","failed"]),pMe=l.enum(["pending","generating","ready","failed"]),fMe=l.enum(["pending","placeholder","ai","user"]),k7=l.enum(["pending","generating","ready","failed"]),VC=l.enum(["pending","generating","ready","failed","disabled"]),w7=l.enum(["pending","generating","ready","failed"]),_Me=l.object({title:l.string().min(1),body:l.string().min(1),files:l.array(l.string()).optional()}),mMe=l.object({status:VC,url:l.string().nullable(),url_expires_at:l.string().nullable(),generated_at:l.string().nullable(),model:l.string().nullable()}),hMe=l.object({status:w7,steps:l.array(_Me),generated_at:l.string().nullable()}),gMe=l.object({remix_of_thread_id:l.string().nullable(),remix_count:l.number().int().nonnegative()}),TMe=l.object({cover:mMe,how_to:hMe,lineage:gMe}),EMe=l.object({id:l.string().min(1),title:l.string().min(1),author:l.object({id:l.string().min(1),display_name:l.string(),handle:l.string().nullable(),avatar_url:l.string().nullable()}),cover:l.object({url:l.string(),url_expires_at:l.string()}),remix_count:l.number().int().nonnegative(),started_at:l.string(),cover_generated_at:l.string()}),SMe=l.object({type:l.literal("list"),list_type:l.literal("card_feed_item"),has_more:l.boolean(),objects:l.array(EMe)}),AMe=l.enum(["asked","requested","decided","corrected","shared"]),bMe=l.object({id:l.string().min(1),kind:AMe,summary:l.string().min(1),block_id:l.string().min(1)}),yMe=l.object({type:l.literal("list"),list_type:l.literal("thread_decision"),status:k7,generated_at:l.string().nullable(),objects:l.array(bMe)}),Ql=l.object({id:l.string().min(1),thread_file_id:l.string().min(1),organization_id:l.string().min(1),author:HC,repo:l.string().min(1),title:l.string().min(1),started_at:l.string().min(1),blocks:L7,user_message_count:l.number().int().nonnegative(),files_touched:l.array(l.string()),skills_invoked:l.array(l.string()),harness:ji,transcript_parsing_state:l.enum(["pending","parsed","too_large_to_parse"]),visibility:l.enum(["private","workspace","public"]),has_plan:l.boolean().optional(),summary:l.string().nullable(),summary_status:dMe,summary_generated_at:l.string().nullable(),title_status:pMe,title_generated_at:l.string().nullable(),title_source:fMe,decisions_status:k7,decisions_generated_at:l.string().nullable(),score:l.number().int(),up_count:l.number().int().nonnegative(),down_count:l.number().int().nonnegative(),viewer_vote:D7,comment_count:l.number().int().nonnegative(),is_favorited:l.boolean(),card:TMe}),RMe=l.object({storage_url:l.string().min(1)}),IMe=l.object({storage_url:l.string(),harness:ji,thread:Ql.nullable()}),OMe=l.object({status:l.literal("complete"),thread_files:l.array(IMe)}),NMe=l.object({id:l.string(),presigned_url:l.string().nullable(),presigned_url_expires_at:l.string().nullable(),storage_url:l.string(),harness:ji,expected_md5:l.string(),error:l.string().nullable(),thread:Ql.nullable()}),CMe=l.object({id:l.string(),substrate:l.enum(["s3","filesystem"]),status:l.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:l.array(NMe)}),xMe=l.object({visibility:l.enum(["private","workspace","public"]).optional(),title:l.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),PMe=l.discriminatedUnion("visibility",[l.object({visibility:l.literal("private")}),l.object({visibility:l.literal("workspace")}),l.object({visibility:l.literal("public"),title:l.string().min(1),author_display_name:l.string().min(1),author_avatar_url:l.string().nullable(),first_user_message:l.string().nullable(),summary:l.string().nullable(),started_at:l.string().min(1),harness:ji,cover_url:l.string().nullable()})]),MMe=Ql,A7=l.object({type:l.literal("list"),list_type:l.literal("thread"),has_more:l.boolean(),objects:l.array(MMe)}),vMe=l.enum(["recent","popular"]),LMe=Ql,DMe=l.object({type:l.literal("list"),list_type:l.literal("discover_thread"),has_more:l.boolean(),objects:l.array(LMe)}),kMe=l.object({before:l.string().min(1).optional(),after:l.string().min(1).optional(),sort:vMe.optional(),harness:ji.optional(),search:l.string().max(200).optional()}),wMe=l.object({thread_count:l.number().int().nonnegative(),author_count:l.number().int().nonnegative(),organization_count:l.number().int().nonnegative(),harness_breakdown:l.record(ji,l.number().int().nonnegative())}),UMe=l.object({id:l.string(),status:l.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:l.string(),thread_count:l.number().int().nonnegative()}),BMe=l.object({type:l.literal("list"),list_type:l.literal("upload_session"),objects:l.array(UMe)}),GMe=l.object({before:l.string().min(1).optional(),after:l.string().min(1).optional()}),FMe=l.object({before:l.string().min(1).optional(),after:l.string().min(1).optional(),author_ids:l.string().min(1).optional(),created_at:l.string().min(1).optional(),filepath_prefixes:l.string().min(1).optional()}),jMe=l.object({path:l.string().min(1),start_offset:l.number().int().nonnegative(),end_offset:l.number().int().positive()}),HMe=l.object({name:l.string(),usage_count:l.number().int().nonnegative(),author_count:l.number().int().nonnegative(),first_used_at:l.string().nullable(),last_used_at:l.string().nullable(),usage_count_last_24h:l.number().int().nonnegative(),usage_count_last_7d:l.number().int().nonnegative()}),VMe=l.object({type:l.literal("list"),list_type:l.literal("skill"),objects:l.array(HMe)}),qMe=l.object({id:l.string(),title:l.string(),visibility:l.enum(["private","workspace","public"]),started_at:l.string(),author:HC,skills_invoked:l.array(l.string())}),$Me=l.object({name:l.string(),usage_count:l.number().int().nonnegative(),author_count:l.number().int().nonnegative(),first_used_at:l.string().nullable(),last_used_at:l.string().nullable(),threads:l.array(qMe)}),zMe=l.object({path:l.string().min(1),text:l.string().max(64e3)}),YMe=l.enum(["text_edit","redact","delete_block"]),WMe=l.object({id:l.string(),thread_block_id:l.string(),editor:l.object({id:l.string(),display_name:l.string()}),kind:YMe,path:l.string().nullable(),previous_text:l.string().nullable(),new_text:l.string().nullable(),created_at:l.string()}),KMe=l.object({type:l.literal("list"),list_type:l.literal("thread_block_edit"),objects:l.array(WMe)}),QMe=l.object({organization_count:l.number().int().nonnegative(),user_count:l.number().int().nonnegative(),thread_count:l.number().int().nonnegative(),thread_count_last_24h:l.number().int().nonnegative(),user_count_last_24h:l.number().int().nonnegative()}),JMe=l.object({id:l.string(),name:l.string(),email_domains:l.array(l.string()),stytch_org_id:l.string(),member_count:l.number().int().nonnegative(),thread_count:l.number().int().nonnegative(),default_thread_visibility:l.enum(["private","workspace","public"]),created_at:l.string()}),XMe=l.object({type:l.literal("list"),list_type:l.literal("admin_organization"),objects:l.array(JMe)}),U7=l.object({id:l.string(),name:l.string()}),ZMe=l.object({id:l.string(),display_name:l.string(),stytch_id:l.string().nullable(),thread_count:l.number().int().nonnegative(),onboarded_at:l.string().nullable(),created_at:l.string(),organizations:l.array(U7)}),eve=l.object({type:l.literal("list"),list_type:l.literal("admin_user"),objects:l.array(ZMe)}),tve=l.object({id:l.string(),title:l.string(),started_at:l.string(),created_at:l.string(),deleted_at:l.string().nullable(),visibility:l.enum(["private","workspace","public"]),harness:ji,author:HC,organization:U7}),nve=l.object({type:l.literal("list"),list_type:l.literal("admin_thread"),has_more:l.boolean(),objects:l.array(tve)}),rve=l.object({before:l.string().min(1).optional(),after:l.string().min(1).optional()}),b7=l.object({token:l.string().min(1),thread_id:l.string().min(1)}),ove=l.object({visitor:l.string().min(1).max(64).optional()}),sve=l.object({user_id:l.string(),display_name:l.string(),shares_sent:l.number().int().nonnegative(),unique_viewers:l.number().int().nonnegative(),attributed_signups:l.number().int().nonnegative()}),ive=l.object({window_days:l.number().int().positive(),shares_sent:l.number().int().nonnegative(),unique_viewers:l.number().int().nonnegative(),attributed_signups:l.number().int().nonnegative(),active_sharers:l.number().int().nonnegative(),k_factor:l.number().nullable(),shares_sent_sparkline:l.array(l.number().int().nonnegative()),top_sharers:l.array(sve)}),ave=l.object({windows:l.array(ive)}),uve=l.object({quoted_text:l.string().min(1),comment:l.string().nullable(),type:l.enum(["comment","highlight:trapdoor"])}),cve=v7,lve=M7.extend({comment_thread_id:l.string().min(1)}),dve=l.object({markdown:l.string().min(1)}),pve=l.object({storage_url:l.string().min(1),thread_file_id:l.string().min(1),parsed_plan_block:E7,critiqued_plan_block:E7,annotations:l.array(uve),comment_threads:l.array(cve),comments:l.array(lve)}),Jl=l.enum(DC),B7=l.object({skills:l.boolean(),workspace_scope:l.boolean(),review:l.boolean(),shared_thread_ttl_days:l.number().int().positive().nullable()}),jC=l.object({subject_type:l.enum(["user","organization"]),subject_id:l.string().min(1),effective_plan:Jl,admin_override:Jl.nullable(),stripe_subscription_status:l.string().nullable(),cancel_at_period_end:l.boolean(),current_period_end:l.string().nullable(),seat_quantity:l.number().int().positive(),member_count:l.number().int().nonnegative().nullable(),features:B7}),fve=l.object({effective_plan:Jl,features:B7,user:jC,organization:jC.nullable()}),_ve=l.object({plan:l.enum(["creator","team"]),seat_quantity:l.number().int().positive().optional()}),mve=l.object({checkout_url:l.string().min(1)}),hve=l.object({portal_url:l.string().min(1)}),gve=l.object({seat_quantity:l.number().int().positive()}),y7=l.object({plan:Jl.nullable()}),qS=l.object({subject_type:l.enum(["user","organization"]),subject_id:l.string().min(1),label:l.string().min(1),effective_plan:Jl,admin_override:Jl.nullable(),stripe_subscription_status:l.string().nullable(),seat_quantity:l.number().int().positive()}),Tve=l.object({users:l.array(qS),organizations:l.array(qS)}),Eve=l.object({id:l.string().min(1),display_name:l.string().min(1),handle:l.string().nullable(),avatar_url:l.string().nullable()}),Sve=l.object({thread_id:l.string().min(1),title:l.string().min(1),author:Eve,last_active_at:l.string().datetime(),last_block_excerpt:l.string().nullable(),last_block_kind:l.string().min(1).nullable(),is_streaming:l.boolean()}),Ave=l.object({type:l.literal("list"),list_type:l.literal("live_thread"),objects:l.array(Sve)}),bve=l.object({thread_id:l.string().min(1)}),yve=l.object({thread_id:l.string().min(1),last_seen_at:l.string().datetime(),started_at:l.string().datetime()}),Rve=l.object({follower_id:l.string().min(1),followee_id:l.string().min(1),is_following:l.literal(!0),follower_count:l.number().int().nonnegative()}),Ive=l.object({follower_id:l.string().min(1),followee_id:l.string().min(1),is_following:l.literal(!1),follower_count:l.number().int().nonnegative()}),G7=l.object({id:l.string().min(1),display_name:l.string().min(1),handle:l.string().nullable(),avatar_url:l.string().nullable(),bio:l.string().max(280).nullable(),is_following:l.boolean(),is_self:l.boolean()}),R7=l.object({type:l.literal("list"),list_type:l.literal("user_follow"),objects:l.array(G7)}),Ove=l.object({date:l.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:l.number().int().nonnegative()}),Nve=l.object({window_start:l.string().datetime(),window_end:l.string().datetime(),total_contributions:l.number().int().nonnegative(),days_active:l.number().int().nonnegative(),daily_average:l.number().nonnegative(),current_streak_days:l.number().int().nonnegative(),days:l.array(Ove)}),Cve=l.object({type:l.literal("thread_created"),occurred_at:l.string().datetime(),id:l.string().min(1),thread:l.object({id:l.string().min(1),title:l.string(),visibility:l.enum(["private","workspace","public"])})}),xve=l.object({type:l.literal("comment_posted"),occurred_at:l.string().datetime(),id:l.string().min(1),comment_excerpt:l.string(),thread:l.object({id:l.string().min(1),title:l.string(),visibility:l.enum(["private","workspace","public"])})}),Pve=l.object({type:l.literal("project_published"),occurred_at:l.string().datetime(),id:l.string().min(1),project:l.object({id:l.string().min(1),name:l.string().min(1)})}),Mve=l.object({type:l.literal("user_followed"),occurred_at:l.string().datetime(),id:l.string().min(1),followee:G7}),vve=l.discriminatedUnion("type",[Cve,xve,Pve,Mve]),Lve=l.object({type:l.literal("list"),list_type:l.literal("user_activity"),objects:l.array(vve)}),Dve=l.object({id:l.string().min(1),name:l.string().min(1),excerpt:l.string(),published_at:l.string().datetime(),updated_at:l.string().datetime()}),kve=l.object({type:l.literal("list"),list_type:l.literal("profile_published_project"),objects:l.array(Dve)}),I7=l.object({id:l.string().min(1),published_at:l.string().datetime().nullable()}),wve=l.enum(["avatar","banner"]),F7=l.enum(["image/png","image/jpeg","image/webp","image/gif"]),Uve=l.object({kind:wve,content_type:F7,base64_data:l.string().min(1)}),Bve=l.object({substrate:l.enum(["s3","filesystem"]),storage_url:l.string().min(1)}),Gve=l.object({content_type:F7,base64_data:l.string().min(1)}),Fve=l.object({cover_status:VC,cover_url:l.string().min(1),cover_url_expires_at:l.string().min(1),cover_generated_at:l.string().min(1)}),jve=N7,j7=u1e.router({health:{method:"GET",path:"/health",responses:{200:l.object({status:l.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:l.object({authorization:l.string().min(1).optional(),"x-lore-referral-token":l.string().min(1).max(16).optional()}),responses:{200:p1e,401:b},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:l.object({authorization:l.string().min(1).optional()}),body:bve,responses:{200:yve,401:b,403:b,404:b,422:b},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:Ave,401:b,403:b},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:l.object({authorization:l.string().min(1).optional()}),query:FMe,responses:{200:A7,401:b},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:Ql,404:b},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:A7,404:b,409:b},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),query:GMe,responses:{200:L7,401:b},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:M1e,responses:{201:v1e,401:b,404:b},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1),commentThreadId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:k1e,responses:{201:w1e,401:b,404:b,409:b},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1),commentThreadId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:G1e,responses:{200:F1e,401:b,404:b},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:VMe,401:b},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:l.object({name:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:$Me,401:b,404:b},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:jMe,responses:{200:Bf,401:b,403:b,404:b,422:b},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:zMe,responses:{200:Bf,401:b,403:b,404:b,422:b},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:Bf,401:b,403:b,404:b,409:b,422:b},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{204:l.null(),401:b,403:b,404:b},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:l.object({threadId:l.string().min(1),blockId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:KMe,401:b,404:b},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:yMe,401:b,404:b},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:xMe,responses:{200:Ql,401:b,403:b,404:b},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{204:l.null(),401:b,403:b,404:b},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:l.object({cover_status:VC,how_to_status:w7}),401:b,403:b,404:b,429:b.extend({retry_after_seconds:l.number().int().nonnegative()})},summary:"Enqueue cover image + how-to recipe generation for the thread. Author-only. Idempotent \u2014 recently-fired statuses are not double-enqueued. Rate-limited: at most one cover generation per minute per thread (cooldown begins when the previous cover finishes). Used to populate cards on legacy threads (created before Lore Cards) and to retry after a 'failed' status or opt back in from 'disabled'."},uploadThreadCover:{method:"POST",path:"/threads/:id/card/cover/upload",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:Gve,responses:{200:Fve,401:b,403:b,404:b,413:b,422:b},summary:"Upload a custom cover image for a thread. Author or Tanagram admin only. Bytes go to the same storage substrate the AI cover uses (S3 in prod, filesystem in dev), and the threads row is updated atomically with the new cover_storage_url, cover_status='ready', cover_generated_at=now, cover_model='user-uploaded' so subsequent re-rolls / how-to fan-outs treat the upload like any other ready cover."},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:rMe,responses:{200:S7,401:b,403:b,404:b,422:b},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:S7,401:b,404:b},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:l.object({threadId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:sMe,403:b,404:b},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:l.object({threadId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:iMe,responses:{201:aMe,401:b,403:b,404:b,422:b},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:l.object({threadId:l.string().min(1),commentId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:uMe,responses:{200:cMe,401:b,403:b,404:b,422:b},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:l.object({threadId:l.string().min(1),commentId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:lMe,401:b,403:b,404:b},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:l.object({id:l.string().min(1)}),responses:{200:PMe,404:b},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:l.object({authorization:l.string().min(1).optional()}),body:b1e,responses:{201:FC,401:b},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:N7,404:b},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:l.object({authorization:l.string().min(1).optional()}),body:f1e,responses:{200:FC,401:b,409:b,422:b},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:l.object({handle:O7}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:jve,404:b},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),query:l.object({limit:l.coerce.number().int().positive().max(100).optional()}),responses:{200:Lve,404:b},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:Nve,404:b},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:R7,404:b},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:R7,404:b},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:Rve,401:b,404:b,409:b,422:b},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:Ive,401:b,404:b},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:kve,404:b},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:I7,401:b,403:b,404:b},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{200:I7,401:b,403:b,404:b},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:l.object({authorization:l.string().min(1).optional()}),body:Uve,responses:{200:Bve,401:b,413:b,422:b},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:m1e,401:b},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:l.object({authorization:l.string().min(1).optional()}),body:h1e,responses:{201:g1e,401:b,403:b,409:b,422:b},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:Q1e,401:b,403:b},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:l.object({authorization:l.string().min(1).optional()}),body:R1e,responses:{201:$1e,401:b,403:b},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:H1e,401:b,403:b,404:b},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:x1e,responses:{201:P1e,401:b,403:b,404:b,422:b},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:l.object({id:l.string().min(1),threadId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:L1e,responses:{201:D1e,401:b,403:b,404:b,409:b},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:l.object({id:l.string().min(1),threadId:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:U1e,responses:{200:B1e,401:b,403:b,404:b},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:l.object({authorization:l.string().min(1).optional()}),query:q1e,responses:{200:V1e,401:b,403:b},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:l.object({authorization:l.string().min(1).optional()}),query:Y1e,responses:{200:z1e,401:b,403:b},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:BMe,401:b},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({thread_files:l.array(Z1e).nonempty()}),responses:{201:CMe,400:b,401:b},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({thread_files:l.array(RMe).nonempty()}),responses:{200:OMe,400:b,401:b,404:b,409:b,422:b},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:QMe,401:b,403:b},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:XMe,401:b,403:b},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:eve,401:b,403:b},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:l.object({authorization:l.string().min(1).optional()}),query:rve,responses:{200:nve,401:b,403:b},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{204:l.null(),401:b,403:b,404:b},summary:"Permanently remove a thread. Tanagram admins only."},listCardFeed:{method:"GET",path:"/cards/feed",query:l.object({limit:l.coerce.number().int().min(1).max(48).optional()}),responses:{200:SMe},summary:"Slim feed of public threads with a ready cover image, ordered by cover_generated_at descending. Powers the landing-page UGC card scroll. Returns presigned cover URLs inline so the grid renders without a follow-up round trip per card."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:l.object({authorization:l.string().min(1).optional()}),query:kMe,responses:{200:DMe},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:wMe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:T1e,responses:{201:E1e,409:b},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({}).optional(),responses:{201:b7,401:b,403:b,404:b,409:b},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:l.object({token:l.string().min(1).max(16)}),query:ove,responses:{200:b7,404:b},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:ave,401:b,403:b},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:l.object({authorization:l.string().min(1).optional()}),body:dve,responses:{200:pve,401:b,403:b,409:b},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:fve,401:b},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:l.object({authorization:l.string().min(1).optional()}),body:_ve,responses:{200:mve,400:b,401:b,403:b,503:b},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:l.object({authorization:l.string().min(1).optional()}),body:l.object({subject_type:l.enum(["user","organization"]).default("user")}).optional(),responses:{200:hve,401:b,404:b,503:b},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:l.object({authorization:l.string().min(1).optional()}),body:gve,responses:{200:jC,400:b,401:b,403:b,404:b,503:b},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:l.object({authorization:l.string().min(1).optional()}),responses:{200:Tve,401:b,403:b},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:y7,responses:{200:qS,401:b,403:b,404:b},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:l.object({id:l.string().min(1)}),headers:l.object({authorization:l.string().min(1).optional()}),body:y7,responses:{200:qS,401:b,403:b,404:b},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:_7,docs:p7,mentions:m7,favorites:g7,search:T7},{pathPrefix:"/api"});import jf from"node:fs";import q7 from"node:path";import H7 from"node:os";import Hi from"node:path";function wo(){let t=Ke()==="dev"?".lore-dev":".lore";return Hi.join(H7.homedir(),t)}function Gf(){return Hi.join(wo(),"log.txt")}function qC(){return Hi.join(wo(),"sync_state.json")}function V7(){return Hi.join(wo(),"upload_filters.json")}function zS(){return Hi.join(wo(),"status.json")}function gu(){return Hi.join(wo(),"install_source.json")}function Tu(){return Hi.join(wo(),"bin","lore")}function Ff(){let t=Ke();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function Xl(){return Hi.join(H7.homedir(),"Library","LaunchAgents",`${Ff()}.plist`)}function YS(){return q7.join(wo(),"token")}function $C(){let t;try{t=jf.readFileSync(YS(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||Vve(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function WS(){return $C().token}function $7(){return jf.existsSync(YS())}function z7(t){let e=YS();jf.mkdirSync(q7.dirname(e),{recursive:!0,mode:448}),jf.writeFileSync(e,t,{mode:384})}function Y7(){try{jf.rmSync(YS())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function Hve(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function Vve(t,e){let n;try{n=Hve(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var qve={dev:"http://localhost:4000",prod:"https://lore-api.tanagram.ai"};function Vi(t={}){let e=t.token??WS();return LC(j7,{baseUrl:qve[Ke()],baseHeaders:{"User-Agent":HY(),...e?{authorization:`Bearer ${e}`}:{}}})}import K7 from"node:fs";var W7=null;function $ve(){let t=wo();W7!==t&&(K7.mkdirSync(t,{recursive:!0}),W7=t)}function zve(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function Yve(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}=${zve(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.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Lore CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"esbuild": "^0.24.0",
|
|
22
22
|
"tsx": "^4.20.6",
|
|
23
23
|
"typescript": "^5.9.3",
|
|
24
|
-
"@lore/contracts": "0.1.0"
|
|
24
|
+
"@lore/contracts": "0.1.0",
|
|
25
|
+
"@lore/transcripts": "0.1.0"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@sentry/node": "^10.47.0",
|
|
28
|
-
"citty": "^0.2.2"
|
|
29
|
-
"@lore/transcripts": "0.1.0"
|
|
29
|
+
"citty": "^0.2.2"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"dev": "pnpm run postinstall && tsx src/index.ts",
|