@tanagram/lore 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ Url: ${vh(t)}`),!0}return!1}function o_e(t,e){return e?.length?Ch(t).some(n=>Ws(
|
|
|
35
35
|
`),_=m.shift();if(!_)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=_.split(" "),g=+(h[1]||0),E=h.slice(2).join(" "),S={};for(let b of m){if(!b)continue;let R=b.indexOf(":");if(R===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${b}"`));let I=b.slice(0,R).toLowerCase(),C=b.slice(R+1).trimStart(),H=S[I];typeof H=="string"?S[I]=[H,C]:Array.isArray(H)?H.push(C):S[I]=C}lT("got proxy server response: %o %o",_,S),i(),e({connect:{statusCode:g,statusText:E,headers:S},buffered:p})}t.on("error",u),t.on("end",a),s()})}function Wp(...t){y.log("[https-proxy-agent]",...t)}var Kp=class extends cT{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??{},Wp("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?EV(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:"){Wp("Creating `tls.Socket`: %o",this.connectOpts);let f=this.connectOpts.servername||this.connectOpts.host;o=CO.connect({...this.connectOpts,servername:f&&hs.isIP(f)?void 0:f})}else Wp("Creating `net.Socket`: %o",this.connectOpts),o=hs.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=hs.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=TV(o);o.write(`${a}\r
|
|
38
|
-
`);let{connect:l,buffered:d}=await u;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",k0e),n.secureEndpoint){Wp("Upgrading socket connection to TLS");let f=n.servername||n.host;return CO.connect({...EV(n,"host","path","port"),socket:o,servername:hs.isIP(f)?void 0:f})}return o}o.destroy();let p=new hs.Socket({writable:!1});return p.readable=!0,e.once("socket",f=>{Wp("Replaying proxy buffer for failed request"),f.push(d),f.push(null)}),p}};Kp.__initStatic();function k0e(t){t.resume()}function EV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var B0e=1024*32;function F0e(t){return new D0e({read(){this.push(t),this.push(null)}})}function SV(t){let e;try{e=new URL(t.url)}catch{return nt(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),_p(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=G0e(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?w0e:L0e,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Kp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=j0e(t,t.httpModule??o,i);return _p(t,a)}function G0e(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function j0e(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((d,p)=>{Ec(()=>{let f=F0e(l.body),m={...t.headers};l.body.length>B0e&&(m["content-encoding"]="gzip",f=f.pipe(U0e()));let _=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:m,hostname:_?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 AV(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=bc(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 H0e,sep as V0e}from"node:path";function yV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function bV(t=process.argv[1]?NR(process.argv[1]):process.cwd(),e=V0e==="\\"){let n=e?yV(t):t;return r=>{if(!r)return;let o=e?yV(r):r,{dir:s,base:i,ext:a}=H0e.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let u=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+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 RV(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 IV=J_(iI(bV()));P();var CV=Q(re(),1);import*as OV from"node:os";import{threadId as q0e,isMainThread as $0e}from"worker_threads";var z0e=6e4,dT=class extends hp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||OV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,CV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Oa(r,"node"),y.log(`Initializing Sentry: process: ${process.pid}, thread: ${$0e?"main":`worker-${q0e}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Ac(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{oe&&y.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??z0e).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){AR(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?PH(this,e):[void 0,void 0]}};var NV=Q(ib(),1);import*as xV from"module";function NO(){if(iV()&&!Z._sentryEsmLoaderHookRegistered){Z._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,NV.createAddHookMessageChannel)();xV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){y.warn("Failed to register 'import-in-the-middle' hook",t)}}}function pT(){return[kh(),Mh(),Lh(),wh(),gV(),vR(),Uh(),Zj(),o6(),dV(),pV(),QH(),oV(),qH(),jH(),fV(),lV()]}function xO(t={}){return Y0e(t,pT)}function Y0e(t={},e){let n=W0e(t,e);n.debug===!0&&(oe?y.enable():nt(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&NO(),kH(),Ee().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===IO)&&n.integrations.push(_V({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Oa(n,"node-core");let o=new dT(n);return Ee().setClient(o),o.init(),y.log(`SDK initialized from ${zp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),J0e(),hH(o),vH(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function PO(){if(!oe)return;let t=SH(),e=["SentryContextManager","SentryPropagator"];rt()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||y.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||y.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 W0e(t,e){let n=K0e(t.release),r=AV(t.spotlight),o=Q0e(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??SV,stackParser:Ab(t.stackParser||IV),release:n,tracesSampleRate:o,spotlight:r,debug:bc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:fR({defaultIntegrations:a,integrations:i})}}function K0e(t){if(t!==void 0)return t;let e=RV();if(e!==void 0)return e}function Q0e(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 J0e(){if(bc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=tp(t,e);Ee().setPropagationContext(n)}}function Oe(t,e){t.setAttribute(W,e)}function Qp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var MO="Http",PV="@opentelemetry_sentry-patched/instrumentation-http",fT=Qr.major===22&&Qr.minor>=12||Qr.major===23&&Qr.minor>=2||Qr.major>=24,X0e=B(`${MO}.sentry`,t=>new La(t)),Z0e=B(MO,t=>{let e=new MV.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=Wn.createComponentLogger({namespace:PV}),e.instrumentationName=PV}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function eAe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!rt(e)&&fT)}var vV=(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=Mp(r),i=vp(o),a=e&&!n;return{name:MO,setup(u){let l=u.getOptions();a&&rt(l)&&i.setup(u)},setupOnce(){let u=V()?.getOptions()||{},l=eAe(t,u);s.setupOnce();let d={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:fT||!l,createSpansForOutgoingRequests:fT,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(p,f)=>{let m=Qp(f);if(m.startsWith("data:")){let _=Rc(m);p.setAttribute("http.url",_),p.setAttribute(Xs,_),p.updateName(`${f.method||"GET"} ${_}`)}t.instrumentation?.requestHook?.(p,f)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(X0e(d),l){let p=tAe(t);Z0e(p)}},processEvent(u){return i.processEvent(u)}}};function tAe(t={}){return{disableOutgoingRequestInstrumentation:fT,ignoreOutgoingRequestHook:n=>{let r=Qp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Oe(n,"auto.http.otel.http");let o=Qp(r);if(o.startsWith("data:")){let s=Rc(o);n.setAttribute("http.url",s),n.setAttribute(Xs,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 BV=Q(DV(),1);var FV="NodeFetch",oAe=B(FV,BV.UndiciInstrumentation,t=>uAe(t)),sAe=B(`${FV}.sentry`,wa,t=>t),iAe=(t={})=>({name:"NodeFetch",setupOnce(){aAe(t,V()?.getOptions())&&oAe(t),sAe(t)}}),GV=iAe;function UV(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function aAe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&rt(e)}function uAe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=UV(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=UV(n.origin,n.path);if(r.startsWith("data:")){let o=Rc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[Xs]:o,[gr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var JV=Q(QV(),1);var yt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var XV="Express";function RAe(t){Oe(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 IAe(t,e){if(le()===hr())return yt&&y.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";le().setTransactionName(`${r} ${t.route}`)}return e}var ZV=B(XV,()=>new JV.ExpressInstrumentation({requestHook:t=>RAe(t),spanNameHook:(t,e)=>IAe(t,e)})),OAe=()=>({name:XV,setupOnce(){ZV()}}),e8=OAe;var Oq=Q(Sq(),1);import*as SC from"node:diagnostics_channel";P();var tE=Q(Ae(),1),qa=Q(re(),1);de();var Ts;(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})(Ts||(Ts={}));var mf;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(mf||(mf={}));var _f;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(_f||(_f={}));P();var hf=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function EC(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[hf]||[];return s.push(o),Object.defineProperty(t,hf,{enumerable:!1,configurable:!0,value:s}),o}function ZT(t,e){let n=t[hf]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:qe.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[hf])}function yq(t,e,n){let r,o;try{o=t(),Aq(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!Aq(o)&&(e(r,o),r))throw r;return o}}function Aq(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var bRe="0.1.0",RRe="@sentry/instrumentation-fastify-v3",bq="anonymous",IRe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),eE=class extends qa.InstrumentationBase{constructor(e={}){super(RRe,bRe,e)}init(){return[new qa.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,tE.getRPCMetadata)(v.active()),u=i.routeOptions?i.routeOptions.url:r.routerPath;u&&a?.type===tE.RPCType.HTTP&&(a.route=u);let l=r.method||"GET";le().setTransactionName(`${l} ${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||bq,u=`${_f.MIDDLEWARE} - ${a}`,l=i[1],d=EC(l,s.tracer,u,{[Ts.FASTIFY_TYPE]:mf.MIDDLEWARE,[Ts.PLUGIN_NAME]:e,[Ts.HOOK_NAME]:n}),p=o&&i[i.length-1];return p&&(i[i.length-1]=function(...f){ZT(l),p.apply(this,f)}),v.with(X.setSpan(v.active(),d),()=>yq(()=>r.apply(this,i),f=>{f instanceof Error&&(d.setStatus({code:qe.ERROR,message:f.message}),d.recordException(f)),o||ZT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!IRe.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()),ORe(),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,qa.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),ZT(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,l=`${_f.REQUEST_HANDLER} - ${u||this.pluginName||bq}`,d={[Ts.PLUGIN_NAME]:this.pluginName,[Ts.FASTIFY_TYPE]:mf.REQUEST_HANDLER,[ny]:i.routeOptions?i.routeOptions.url:r.routerPath};u&&(d[Ts.FASTIFY_NAME]=u);let p=EC(o,e.tracer,l,d);Rq(p);let{requestHook:f}=e.getConfig();return f&&(0,qa.safeExecuteInTheMiddle)(()=>f(p,{request:r}),m=>{m&&e._diag.error("request hook failed",m)},!0),v.with(X.setSpan(v.active(),p),()=>{s()})}}};function ORe(){let t=V();t&&t.on("spanStart",e=>{Rq(e)})}function Rq(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 nE="Fastify",Cq=B(`${nE}.v3`,()=>new eE);function CRe(){let t=V();if(t)return t.getIntegrationByName(nE)}function Iq(t,e,n,r){let o=CRe()?.getShouldHandleError()||Pq;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){yt&&y.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 Nq=B(`${nE}.v5`,()=>{let t=new Oq.FastifyOtelInstrumentation,e=t.plugin();return SC.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?yt&&y.error("Failed to setup Fastify instrumentation",o):(xRe(),r&&PRe(r))})}),SC.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;Iq.call(Iq,r,o,s,"diagnostics-channel")}),t}),NRe=({shouldHandleError:t})=>{let e;return{name:nE,setupOnce(){e=t||Pq,Cq(),Nq()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},xq=(t={})=>NRe(t);function Pq(t,e,n){let r=n.statusCode;return r>=500||r<=299}function Mq(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 l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let d=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(d)}}function xRe(){let t=V();t&&t.on("spanStart",e=>{Mq(e)})}function PRe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&Mq(s)}let r=e.routeOptions?.url,o=e.method||"GET";le().setTransactionName(`${o} ${r}`)})}P();var Xq=Q(Jq(),1);var Zq="Graphql",e5=B(Zq,Xq.GraphQLInstrumentation,t=>{let e=n5(t);return{...e,responseHook(n,r){Oe(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:qe.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let u=$e(n),d=Y(u).data[Kc]||[],p=a?`${i} ${a}`:`${i}`;Array.isArray(d)?(d.push(p),u.setAttribute(Kc,d)):typeof d=="string"?u.setAttribute(Kc,[d,p]):u.setAttribute(Kc,p),Y(u).data["original-description"]||u.setAttribute("original-description",Y(u).description),u.updateName(`${Y(u).data["original-description"]} (${JRe(d)})`)}}}}),QRe=(t={})=>({name:Zq,setupOnce(){e5(n5(t))}}),t5=QRe;function n5(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function JRe(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 m5=Q(f5(),1);var _5="Kafka",h5=B(_5,()=>new m5.KafkaJsInstrumentation({consumerHook(t){Oe(t,"auto.kafkajs.otel.consumer")},producerHook(t){Oe(t,"auto.kafkajs.otel.producer")}})),ZRe=()=>({name:_5,setupOnce(){h5()}}),g5=ZRe;var R5=Q(b5(),1);var I5="LruMemoizer",O5=B(I5,()=>new R5.LruMemoizerInstrumentation),tIe=()=>({name:I5,setupOnce(){O5()}}),C5=tIe;var D5=Q(w5(),1);var U5="Mongo",B5=B(U5,()=>new D5.MongoDBInstrumentation({dbStatementSerializer:iIe,responseHook(t){Oe(t,"auto.db.otel.mongo")}}));function iIe(t){let e=xC(t);return JSON.stringify(e)}function xC(t){if(Array.isArray(t))return t.map(e=>xC(e));if(aIe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xC(r)]).reduce((n,r)=>(cIe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function aIe(t){return typeof t=="object"&&t!==null&&!uIe(t)}function uIe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function cIe(t){return Array.isArray(t)}var lIe=()=>({name:U5,setupOnce(){B5()}}),F5=lIe;var Q5=Q(K5(),1);var J5="Mongoose",X5=B(J5,()=>new Q5.MongooseInstrumentation({responseHook(t){Oe(t,"auto.db.otel.mongoose")}})),EIe=()=>({name:J5,setupOnce(){X5()}}),Z5=EIe;var a9=Q(i9(),1);var u9="Mysql",c9=B(u9,()=>new a9.MySQLInstrumentation({})),xIe=()=>({name:u9,setupOnce(){c9()}}),l9=xIe;var T9=Q(g9(),1);var E9="Mysql2",S9=B(E9,()=>new T9.MySQL2Instrumentation({responseHook(t){Oe(t,"auto.db.otel.mysql2")}})),qIe=()=>({name:E9,setupOnce(){S9()}}),A9=qIe;var Y9=Q(x9(),1),W9=Q(H9(),1);var cOe=["get","set","setex"],QC=["get","mget"],lOe=["set","setex"];function Pf(t,e){return t.includes(e.toLowerCase())}function JC(t){return Pf(QC,t)?"cache.get":Pf(lOe,t)?"cache.put":void 0}function dOe(t,e){return e.some(n=>t.startsWith(n))}function q9(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)?V9(o.map(s=>n(s))):["<unknown>"],r=e[0];return Pf(cOe,t)&&r!=null?n(r):V9(e.map(o=>n(o)))}catch{return}}function $9(t,e,n){if(!JC(t))return!1;for(let r of e)if(dOe(r,n))return!0;return!1}function z9(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 V9(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var FE="Redis",Mf={},K9=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=q9(e,n),s=JC(e);if(!o||!s||!Mf.cachePrefixes||!$9(e,o,Mf.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=z9(r);u&&t.setAttribute(Yb,u),Pf(QC,e)&&u!==void 0&&t.setAttribute($b,u>0),t.setAttributes({[te]:s,[zb]:o});let l=o.join(", ");t.updateName(Mf.maxCacheKeyLength?Ys(l,Mf.maxCacheKeyLength):l)},pOe=B(`${FE}.IORedis`,()=>new Y9.IORedisInstrumentation({responseHook:K9})),fOe=B(`${FE}.Redis`,()=>new W9.RedisInstrumentation({responseHook:K9})),Q9=Object.assign(()=>{pOe(),fOe()},{id:FE}),mOe=(t={})=>({name:FE,setupOnce(){Mf=t,Q9()}}),J9=mOe;var m$=Q(f$(),1);var _$="Postgres",h$=B(_$,m$.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Oe(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),xOe=t=>({name:_$,setupOnce(){h$(t)}}),g$=xOe;P();var Mi=Q(re(),1);de();var oN="PostgresJs",T$=[">=3.0.0 <4"],POe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,MOe=Symbol.for("sentry.query.from.instrumented.sql"),E$=B(oN,t=>new rN({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),rN=class extends Mi.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new Mi.InstrumentationNodeModuleDefinition("postgres",T$,n=>{try{return this._patchPostgres(n)}catch(r){return yt&&y.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new Mi.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,T$,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 yt&&y.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 yt&&y.warn("postgres() did not return a valid instance"),a;let u=o.getConfig();return MR(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:(Np(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(Hu,r);return}let o=n?.match(POe);o?.[1]&&e.setAttribute(Hu,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[MOe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return Pt({name:i||"postgresjs.query",op:"db"},a=>{Oe(a,"auto.db.postgresjs"),a.setAttributes({[aa]:"postgres",[cy]:i});let u=n.getConfig(),{requestHook:l}=u;l&&(0,Mi.safeExecuteInTheMiddle)(()=>l(a,i,void 0),f=>{f&&(a.setAttribute("sentry.hook.error","requestHook failed"),yt&&y.error(`Error in requestHook for ${oN} integration:`,f))},!0);let d=this.resolve;this.resolve=new Proxy(d,{apply:(f,m,_)=>{try{n._setOperationName(a,i,_?.[0]?.command),a.end()}catch(h){yt&&y.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:_?.[0]?.message||"unknown_error"}),a.setAttribute(ly,_?.[0]?.code||"unknown"),a.setAttribute(dy,_?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){yt&&y.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}},vOe=t=>({name:oN,setupOnce(){E$(t)}}),S$=vOe;P();P();var fS=Q(rz(),1);P();var ZCe={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"}},eNe=ZCe.version.split(".")[0],NN="PRISMA_INSTRUMENTATION",xN=`V${eNe}_PRISMA_INSTRUMENTATION`,Ll=globalThis;function tNe(){let t=Ll[xN];return t?.helper?t.helper:Ll[NN]?.helper}function nNe(t){let e={helper:t};Ll[xN]=e,Ll[NN]=e}function rNe(){delete Ll[xN],delete Ll[NN]}var oNe=process.env.PRISMA_SHOW_ALL_TRACES==="true",sNe="00-10-10-00";function iNe(t){switch(t){case"client":return Pe.CLIENT;case"internal":default:return Pe.INTERNAL}}var aNe=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}`:sNe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)iz(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return v.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!oNe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(az(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return oz(s,e(s,r))}return n.startActiveSpan(o,t,s=>oz(s,e(s,r)))}};function iz(t,e,n,r,o){if(az(e.name,o))return;let s={attributes:e.attributes,kind:iNe(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 l=r.get(u);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(u=>u.parentId===e.id);for(let u of a)iz(t,u,n,r,o);i.end(e.endTime)})}function oz(t,e){return uNe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function uNe(t){return t!=null&&typeof t.then=="function"}function az(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var uz={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},sz=uz.version,cNe=uz.name,lNe="@prisma/client",cz=class extends fS.InstrumentationBase{tracerProvider;constructor(t={}){super(cNe,sz,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new fS.InstrumentationNodeModuleDefinition(lNe,[sz])]}enable(){let t=this._config;nNe(new aNe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){rNe()}isEnabled(){return tNe()!==void 0}};var lz="Prisma";function dNe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function dz(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var PN=class extends cz{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=dz();dNe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){nt(()=>{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=pNe(s.kind),a=s.parent_span_id,u=s.span_id,l=s.trace_id,d=s.links?.map(f=>({context:{traceId:f.trace_id,spanId:f.span_id,traceFlags:Zt.SAMPLED}})),p=X.setSpanContext(v.active(),{traceId:l,spanId:a,traceFlags:Zt.SAMPLED});v.with(p,()=>{let f={generateTraceId:()=>l,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 pNe(t){switch(t){case"client":return Pe.CLIENT;case"internal":default:return Pe.INTERNAL}}var fNe=B(lz,t=>new PN(t)),pz=t=>({name:lz,setupOnce(){fNe(t)},setup(e){dz()&&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 yz=Q(Az(),1);var bz="Hapi",Rz=B(bz,()=>new yz.HapiInstrumentation),ONe=()=>({name:bz,setupOnce(){Rz()}}),Iz=ONe;de();var wi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},$f={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};P();var gS=Q(re(),1);var CNe="@sentry/instrumentation-hono",NNe="0.0.1",hS=class extends gS.InstrumentationBase{constructor(e={}){super(CNe,NNe,e)}init(){return[new gS.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(Ht(a))return a.then(u=>{let l=n._determineHandlerType(u);return i.setAttributes({[wi.HONO_TYPE]:l,[wi.HONO_NAME]:l===$f.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),u});{let u=n._determineHandlerType(a);return i.setAttributes({[wi.HONO_TYPE]:u,[wi.HONO_NAME]:u===$f.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 Ht(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?$f.MIDDLEWARE:$f.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:qe.ERROR,message:n.message}),e.recordException(n))}};var Oz="Hono";function xNe(t){let e=Y(t).data,n=e[wi.HONO_TYPE];if(e[te]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[te]:`${n}.hono`});let r=e[wi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),le()===hr()){yt&&y.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[ts],s=e[ua];typeof o=="string"&&typeof s=="string"&&le().setTransactionName(`${s} ${o}`)}var Cz=B(Oz,()=>new hS({responseHook:t=>{xNe(t)}})),PNe=()=>({name:Oz,setupOnce(){Cz()}}),Nz=PNe;var Gz=Q(Fz(),1);de();var jz="Koa",Hz=B(jz,Gz.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Oe(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 >"),le()===hr()){yt&&y.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[ts],a=n.context?.request?.method?.toUpperCase()||"GET";i&&le().setTransactionName(`${a} ${i}`)}})),FNe=(t={})=>({name:jz,setupOnce(){Hz(t)}}),Vz=FNe;var Xz=Q(Jz(),1);var Zz="Connect",eY=B(Zz,()=>new Xz.ConnectInstrumentation),KNe=()=>({name:Zz,setupOnce(){eY()}}),tY=KNe;var dY=Q(lY(),1);var exe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),pY="Tedious",fY=B(pY,()=>new dY.TediousInstrumentation({})),txe=()=>{let t;return{name:pY,setupOnce(){let e=fY();t=Pp(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]||"";exe.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},mY=txe;var EY=Q(TY(),1);var SY="GenericPool",AY=B(SY,()=>new EY.GenericPoolInstrumentation({})),rxe=()=>{let t;return{name:SY,setupOnce(){let e=AY();t=Pp(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")}))}}},yY=rxe;var vY=Q(MY(),1);var kY="Amqplib",mxe={consumeEndHook:t=>{Oe(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Oe(t,"auto.amqplib.otel.publisher")}},LY=B(kY,()=>new vY.AmqplibInstrumentation(mxe)),_xe=()=>({name:kY,setupOnce(){LY()}}),wY=_xe;var Qf="VercelAI";var LS=Q(re(),1);var hxe=[">=3.0.0 <7"],DY=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function gxe(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 Txe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(Exe(e.content),Sxe(e.content))}function Exe(t){for(let e of t){if(!gxe(e))continue;let n=JR(e.toolCallId);n?Qn(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}})}):Qn(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 Sxe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&XR(e.toolCallId)}function Axe(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 kS=class t extends LS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new LS.InstrumentationNodeModuleDefinition("ai",hxe,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,l=V(),d=l?.getIntegrationByName(Qf),p=d?.options,f=d?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:m,recordOutputs:_}=Axe(p,a,u,f);return i[0].experimental_telemetry={...a,isEnabled:u!==void 0?u:!0,recordInputs:m,recordOutputs:_},Yr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&<(h,"_sentry_active_span",Tr())},()=>{},h=>{Txe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of DY)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=DY.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var UY=B(Qf,()=>new kS({}));function yxe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var bxe=(t={})=>{let e;return{name:Qf,options:t,setupOnce(){e=UY()},afterAllSetup(n){t.force??yxe(n)?zh(n):e?.callWhenPatched(()=>zh(n))}}},BY=bxe;var DS=Q(re(),1);var Rxe=[">=4.0.0 <7"],wS=class extends DS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new DS.InstrumentationNodeModuleDefinition("openai",Rxe,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(Ia(fi))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Wh(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 FY=B(fi,t=>new wS(t)),Ixe=(t={})=>({name:fi,setupOnce(){FY(t)}}),GY=Ixe;var BS=Q(re(),1);var Oxe=[">=0.19.2 <1.0.0"],US=class extends BS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new BS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",Oxe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ia(mi))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Kh(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 jY=B(mi,t=>new US(t)),Cxe=(t={})=>({name:mi,options:t,setupOnce(){jY(t)}}),HY=Cxe;var Yl=Q(re(),1);var VY=[">=0.10.0 <2"],FS=class extends Yl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new Yl.InstrumentationNodeModuleDefinition("@google/genai",VY,n=>this._patch(n),n=>n,[new Yl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",VY,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(Ia(_i))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Qh(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 Np(e,"GoogleGenAI",o),e}};var qY=B(_i,t=>new FS(t)),Nxe=(t={})=>({name:_i,setupOnce(){qY(t)}}),$Y=Nxe;var qi=Q(re(),1);var GS=[">=0.1.0 <2.0.0"];function xxe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function Pxe(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,l=xxe(u,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var jS=class extends qi.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new qi.InstrumentationNodeModuleDefinition(r,GS,this._patch.bind(this),o=>o,[new qi.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,GS,this._patch.bind(this),o=>o)]));return e.push(new qi.InstrumentationNodeModuleDefinition("langchain",GS,this._patch.bind(this),r=>r,[new qi.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",GS,this._patch.bind(this),r=>r)])),e}_patch(e){SR([fi,mi,_i]);let n=Xh(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 l=i[u];typeof l=="function"&&(i[u]=Pxe(l,n))}}};var zY=B(Jh,t=>new jS(t)),Mxe=(t={})=>({name:Jh,setupOnce(){zY(t)}}),YY=Mxe;var Wl=Q(re(),1);var WY=[">=0.0.0 <2.0.0"],HS=class extends Wl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new Wl.InstrumentationNodeModuleDefinition("@langchain/langgraph",WY,this._patch.bind(this),n=>n,[new Wl.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",WY,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&eg(e.StateGraph.prototype,this.getConfig()),e}};var KY=B(Zh,t=>new HS(t)),vxe=(t={})=>({name:Zh,setupOnce(){KY(t)}}),QY=vxe;var o7=Q(re(),1);P();var Rs=Q(re(),1);de();import*as XY from"node:net";function ZY(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=d=>{(0,Rs.safeExecuteInTheMiddle)(()=>a(d),p=>{p&&Wn.error(p?.message)},!0)});let u=new Rs.InstrumentationNodeModuleDefinition("@firebase/firestore",e,d=>JY(d,n,r,t,i)),l=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let d of l)u.files.push(new Rs.InstrumentationNodeModuleFile(d,e,p=>JY(p,n,r,t,i),p=>e7(p,r)));return u}function JY(t,e,n,r,o){return e7(t,n),e(t,"addDoc",kxe(r,o)),e(t,"getDocs",wxe(r,o)),e(t,"setDoc",Dxe(r,o)),e(t,"deleteDoc",Lxe(r,o)),t}function e7(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Rs.isWrapped)(t[n])&&e(t,n);return t}function kxe(t,e){return function(r){return function(o,s){let i=qS(t,"addDoc",o);return e(i),VS(i,()=>r(o,s))}}}function Lxe(t,e){return function(r){return function(o){let s=qS(t,"deleteDoc",o.parent||o);return e(s),VS(s,()=>r(o))}}}function wxe(t,e){return function(r){return function(o){let s=qS(t,"getDocs",o);return e(s),VS(s,()=>r(o))}}}function Dxe(t,e){return function(r){return function(o,s,i){let a=qS(t,"setDoc",o.parent||o);return e(a),VS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function VS(t,e){return v.with(X.setSpan(v.active(),t),()=>(0,Rs.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function qS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Pe.CLIENT});return Bxe(r,n),r.setAttribute(Hu,e),r}function Uxe(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(XY.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 Bxe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[ay]:e.path,[uy]:n.name,[aa]:"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}=Uxe(s);a&&(i[hy]=a),u&&(i[gy]=u),t.setAttributes(i)}P();var Is=Q(re(),1);function t7(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,u=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(f,m)=>{(0,Is.safeExecuteInTheMiddle)(()=>l(f,m),_=>{_&&Wn.error(_?.message)},!0)}),typeof u=="function"&&(s=f=>{(0,Is.safeExecuteInTheMiddle)(()=>u(f),m=>{m&&Wn.error(m?.message)},!0)});let d=new Is.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:m})=>{d.files.push(new Is.InstrumentationNodeModuleFile(f,e,_=>Fxe(_,n,r,t,{requestHook:s,responseHook:i,errorHook:a},m),_=>n7(_,r)))}),d}function xn(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(...l){let d=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",p=t.startSpan(`firebase.function.${n}`,{kind:Pe.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{_=await i.apply(this,l)}catch(h){m=h}if(e?.responseHook?.(p,m),m&&p.recordException(m),p.end(),m)throw await e?.errorHook?.(p,m),m;return _})};return a?o.call(this,a,u):o.call(this,u)}}}function Fxe(t,e,n,r,o,s){switch(n7(t,n),s){case"function":e(t,"onRequest",xn(r,o,"http.request")),e(t,"onCall",xn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",xn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",xn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",xn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",xn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",xn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",xn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",xn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",xn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",xn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",xn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",xn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",xn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",xn(r,o,"storage.object.metadataUpdated"));break}return t}function n7(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,Is.isWrapped)(t[r])&&e(t,r);return t}var r7={},Gxe=[">=3.0.0 <5"],jxe=[">=6.0.0 <7"],$S=class extends o7.InstrumentationBase{constructor(e=r7){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...r7,...e})}init(){let e=[];return e.push(ZY(this.tracer,Gxe,this._wrap,this._unwrap,this.getConfig())),e.push(t7(this.tracer,jxe,this._wrap,this._unwrap,this.getConfig())),e}};var s7="Firebase",Hxe={firestoreSpanCreationHook:t=>{Oe(t,"auto.firebase.otel.firestore"),t.setAttribute(te,"db.query")},functions:{requestHook:t=>{Oe(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 yh(2e3))}}},i7=B(s7,()=>new $S(Hxe)),Vxe=()=>({name:s7,setupOnce(){i7()}}),a7=Vxe;function u7(){return[e8(),xq(),t5(),Nz(),F5(),Z5(),l9(),A9(),J9(),g$(),pz(),Iz(),Vz(),tY(),mY(),yY(),g5(),wY(),C5(),YY(),QY(),BY(),GY(),HY(),$Y(),S$(),a7()]}P();var zS=Q(vI(),1),c7=Q(oO(),1);de();var KN=1e6;function l7(t,e={}){t.getOptions().debug&&SO();let[n,r]=qxe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function qxe(t,e={}){let n=new c7.BasicTracerProvider({sampler:new oT(t),resource:(0,zS.defaultResource)().merge((0,zS.resourceFromAttributes)({[Ty]:"node",[iy]:"sentry",[Ey]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new rT({timeout:$xe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Br.setGlobalPropagator(new nT);let r=new EO;return v.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function $xe(t){if(t!=null){if(t>KN)return yt&&y.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${KN}`),KN;if(t<=0||Number.isNaN(t)){yt&&y.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function d7(){return pT().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(vV(),GV())}function p7(t){return[...d7(),...rt(t)?u7():[]]}function QN(t={}){return zxe(t,p7)}function zxe(t={},e){Oa(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(l7(n,{spanProcessors:t.openTelemetrySpanProcessors}),PO()),n}var Yxe="prod",m7="0.1.32",Wxe=`@tanagram/lore/${m7}`;function Ve(){return Yxe}function to(){return m7}function _7(){return Wxe}QN({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:Ve(),release:to(),sendDefaultPii:!0});Ah("service_name","lore-cli");import{realpathSync as GBe}from"node:fs";import{fileURLToPath as jBe,pathToFileURL as KJ}from"node:url";var Kxe=/\d/,Qxe=["-","_","/","."];function Jxe(t=""){if(!Kxe.test(t))return t!==t.toLowerCase()}function h7(t,e){let n=e??Qxe,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 l=Jxe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let d=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=d+a,s=l;continue}}o+=a,s=l,i=u}return r.push(o),r}function Xxe(t){return t?t[0].toUpperCase()+t.slice(1):""}function Zxe(t){return t?t[0].toLowerCase()+t.slice(1):""}function ePe(t,e){return t?(Array.isArray(t)?t:h7(t)).map(n=>Xxe(e?.normalize?n.toLowerCase():n)).join(""):""}function Jf(t,e){return Zxe(ePe(t||"",e))}function YS(t,e){return t?(Array.isArray(t)?t:h7(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function g7(t){return YS(t||"","_")}import{parseArgs as tPe}from"node:util";function XS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function JN(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
|
|
38
|
+
`);let{connect:l,buffered:d}=await u;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",k0e),n.secureEndpoint){Wp("Upgrading socket connection to TLS");let f=n.servername||n.host;return CO.connect({...EV(n,"host","path","port"),socket:o,servername:hs.isIP(f)?void 0:f})}return o}o.destroy();let p=new hs.Socket({writable:!1});return p.readable=!0,e.once("socket",f=>{Wp("Replaying proxy buffer for failed request"),f.push(d),f.push(null)}),p}};Kp.__initStatic();function k0e(t){t.resume()}function EV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var B0e=1024*32;function F0e(t){return new D0e({read(){this.push(t),this.push(null)}})}function SV(t){let e;try{e=new URL(t.url)}catch{return nt(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),_p(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=G0e(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?w0e:L0e,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Kp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=j0e(t,t.httpModule??o,i);return _p(t,a)}function G0e(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function j0e(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((d,p)=>{Ec(()=>{let f=F0e(l.body),m={...t.headers};l.body.length>B0e&&(m["content-encoding"]="gzip",f=f.pipe(U0e()));let _=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:m,hostname:_?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 AV(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=bc(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 H0e,sep as V0e}from"node:path";function yV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function bV(t=process.argv[1]?NR(process.argv[1]):process.cwd(),e=V0e==="\\"){let n=e?yV(t):t;return r=>{if(!r)return;let o=e?yV(r):r,{dir:s,base:i,ext:a}=H0e.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let u=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+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 RV(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 IV=J_(iI(bV()));P();var CV=Q(re(),1);import*as OV from"node:os";import{threadId as q0e,isMainThread as $0e}from"worker_threads";var z0e=6e4,dT=class extends hp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||OV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,CV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Oa(r,"node"),y.log(`Initializing Sentry: process: ${process.pid}, thread: ${$0e?"main":`worker-${q0e}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Ac(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{oe&&y.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??z0e).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){AR(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?PH(this,e):[void 0,void 0]}};var NV=Q(ib(),1);import*as xV from"module";function NO(){if(iV()&&!Z._sentryEsmLoaderHookRegistered){Z._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,NV.createAddHookMessageChannel)();xV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){y.warn("Failed to register 'import-in-the-middle' hook",t)}}}function pT(){return[kh(),Mh(),Lh(),wh(),gV(),vR(),Uh(),Zj(),o6(),dV(),pV(),QH(),oV(),qH(),jH(),fV(),lV()]}function xO(t={}){return Y0e(t,pT)}function Y0e(t={},e){let n=W0e(t,e);n.debug===!0&&(oe?y.enable():nt(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&NO(),kH(),Ee().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===IO)&&n.integrations.push(_V({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Oa(n,"node-core");let o=new dT(n);return Ee().setClient(o),o.init(),y.log(`SDK initialized from ${zp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),J0e(),hH(o),vH(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function PO(){if(!oe)return;let t=SH(),e=["SentryContextManager","SentryPropagator"];rt()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||y.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||y.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 W0e(t,e){let n=K0e(t.release),r=AV(t.spotlight),o=Q0e(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??SV,stackParser:Ab(t.stackParser||IV),release:n,tracesSampleRate:o,spotlight:r,debug:bc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:fR({defaultIntegrations:a,integrations:i})}}function K0e(t){if(t!==void 0)return t;let e=RV();if(e!==void 0)return e}function Q0e(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 J0e(){if(bc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=tp(t,e);Ee().setPropagationContext(n)}}function Oe(t,e){t.setAttribute(W,e)}function Qp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var MO="Http",PV="@opentelemetry_sentry-patched/instrumentation-http",fT=Qr.major===22&&Qr.minor>=12||Qr.major===23&&Qr.minor>=2||Qr.major>=24,X0e=B(`${MO}.sentry`,t=>new La(t)),Z0e=B(MO,t=>{let e=new MV.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=Wn.createComponentLogger({namespace:PV}),e.instrumentationName=PV}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function eAe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!rt(e)&&fT)}var vV=(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=Mp(r),i=vp(o),a=e&&!n;return{name:MO,setup(u){let l=u.getOptions();a&&rt(l)&&i.setup(u)},setupOnce(){let u=V()?.getOptions()||{},l=eAe(t,u);s.setupOnce();let d={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:fT||!l,createSpansForOutgoingRequests:fT,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(p,f)=>{let m=Qp(f);if(m.startsWith("data:")){let _=Rc(m);p.setAttribute("http.url",_),p.setAttribute(Xs,_),p.updateName(`${f.method||"GET"} ${_}`)}t.instrumentation?.requestHook?.(p,f)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(X0e(d),l){let p=tAe(t);Z0e(p)}},processEvent(u){return i.processEvent(u)}}};function tAe(t={}){return{disableOutgoingRequestInstrumentation:fT,ignoreOutgoingRequestHook:n=>{let r=Qp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Oe(n,"auto.http.otel.http");let o=Qp(r);if(o.startsWith("data:")){let s=Rc(o);n.setAttribute("http.url",s),n.setAttribute(Xs,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 BV=Q(DV(),1);var FV="NodeFetch",oAe=B(FV,BV.UndiciInstrumentation,t=>uAe(t)),sAe=B(`${FV}.sentry`,wa,t=>t),iAe=(t={})=>({name:"NodeFetch",setupOnce(){aAe(t,V()?.getOptions())&&oAe(t),sAe(t)}}),GV=iAe;function UV(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function aAe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&rt(e)}function uAe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=UV(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=UV(n.origin,n.path);if(r.startsWith("data:")){let o=Rc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[Xs]:o,[gr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var JV=Q(QV(),1);var yt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var XV="Express";function RAe(t){Oe(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 IAe(t,e){if(le()===hr())return yt&&y.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";le().setTransactionName(`${r} ${t.route}`)}return e}var ZV=B(XV,()=>new JV.ExpressInstrumentation({requestHook:t=>RAe(t),spanNameHook:(t,e)=>IAe(t,e)})),OAe=()=>({name:XV,setupOnce(){ZV()}}),e8=OAe;var Oq=Q(Sq(),1);import*as SC from"node:diagnostics_channel";P();var tE=Q(Ae(),1),qa=Q(re(),1);de();var Ts;(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})(Ts||(Ts={}));var mf;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(mf||(mf={}));var _f;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(_f||(_f={}));P();var hf=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function EC(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[hf]||[];return s.push(o),Object.defineProperty(t,hf,{enumerable:!1,configurable:!0,value:s}),o}function ZT(t,e){let n=t[hf]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:qe.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[hf])}function yq(t,e,n){let r,o;try{o=t(),Aq(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!Aq(o)&&(e(r,o),r))throw r;return o}}function Aq(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var bRe="0.1.0",RRe="@sentry/instrumentation-fastify-v3",bq="anonymous",IRe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),eE=class extends qa.InstrumentationBase{constructor(e={}){super(RRe,bRe,e)}init(){return[new qa.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,tE.getRPCMetadata)(v.active()),u=i.routeOptions?i.routeOptions.url:r.routerPath;u&&a?.type===tE.RPCType.HTTP&&(a.route=u);let l=r.method||"GET";le().setTransactionName(`${l} ${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||bq,u=`${_f.MIDDLEWARE} - ${a}`,l=i[1],d=EC(l,s.tracer,u,{[Ts.FASTIFY_TYPE]:mf.MIDDLEWARE,[Ts.PLUGIN_NAME]:e,[Ts.HOOK_NAME]:n}),p=o&&i[i.length-1];return p&&(i[i.length-1]=function(...f){ZT(l),p.apply(this,f)}),v.with(X.setSpan(v.active(),d),()=>yq(()=>r.apply(this,i),f=>{f instanceof Error&&(d.setStatus({code:qe.ERROR,message:f.message}),d.recordException(f)),o||ZT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!IRe.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()),ORe(),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,qa.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),ZT(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,l=`${_f.REQUEST_HANDLER} - ${u||this.pluginName||bq}`,d={[Ts.PLUGIN_NAME]:this.pluginName,[Ts.FASTIFY_TYPE]:mf.REQUEST_HANDLER,[ny]:i.routeOptions?i.routeOptions.url:r.routerPath};u&&(d[Ts.FASTIFY_NAME]=u);let p=EC(o,e.tracer,l,d);Rq(p);let{requestHook:f}=e.getConfig();return f&&(0,qa.safeExecuteInTheMiddle)(()=>f(p,{request:r}),m=>{m&&e._diag.error("request hook failed",m)},!0),v.with(X.setSpan(v.active(),p),()=>{s()})}}};function ORe(){let t=V();t&&t.on("spanStart",e=>{Rq(e)})}function Rq(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 nE="Fastify",Cq=B(`${nE}.v3`,()=>new eE);function CRe(){let t=V();if(t)return t.getIntegrationByName(nE)}function Iq(t,e,n,r){let o=CRe()?.getShouldHandleError()||Pq;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){yt&&y.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 Nq=B(`${nE}.v5`,()=>{let t=new Oq.FastifyOtelInstrumentation,e=t.plugin();return SC.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?yt&&y.error("Failed to setup Fastify instrumentation",o):(xRe(),r&&PRe(r))})}),SC.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;Iq.call(Iq,r,o,s,"diagnostics-channel")}),t}),NRe=({shouldHandleError:t})=>{let e;return{name:nE,setupOnce(){e=t||Pq,Cq(),Nq()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},xq=(t={})=>NRe(t);function Pq(t,e,n){let r=n.statusCode;return r>=500||r<=299}function Mq(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 l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let d=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(d)}}function xRe(){let t=V();t&&t.on("spanStart",e=>{Mq(e)})}function PRe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&Mq(s)}let r=e.routeOptions?.url,o=e.method||"GET";le().setTransactionName(`${o} ${r}`)})}P();var Xq=Q(Jq(),1);var Zq="Graphql",e5=B(Zq,Xq.GraphQLInstrumentation,t=>{let e=n5(t);return{...e,responseHook(n,r){Oe(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:qe.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let u=$e(n),d=Y(u).data[Kc]||[],p=a?`${i} ${a}`:`${i}`;Array.isArray(d)?(d.push(p),u.setAttribute(Kc,d)):typeof d=="string"?u.setAttribute(Kc,[d,p]):u.setAttribute(Kc,p),Y(u).data["original-description"]||u.setAttribute("original-description",Y(u).description),u.updateName(`${Y(u).data["original-description"]} (${JRe(d)})`)}}}}),QRe=(t={})=>({name:Zq,setupOnce(){e5(n5(t))}}),t5=QRe;function n5(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function JRe(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 m5=Q(f5(),1);var _5="Kafka",h5=B(_5,()=>new m5.KafkaJsInstrumentation({consumerHook(t){Oe(t,"auto.kafkajs.otel.consumer")},producerHook(t){Oe(t,"auto.kafkajs.otel.producer")}})),ZRe=()=>({name:_5,setupOnce(){h5()}}),g5=ZRe;var R5=Q(b5(),1);var I5="LruMemoizer",O5=B(I5,()=>new R5.LruMemoizerInstrumentation),tIe=()=>({name:I5,setupOnce(){O5()}}),C5=tIe;var D5=Q(w5(),1);var U5="Mongo",B5=B(U5,()=>new D5.MongoDBInstrumentation({dbStatementSerializer:iIe,responseHook(t){Oe(t,"auto.db.otel.mongo")}}));function iIe(t){let e=xC(t);return JSON.stringify(e)}function xC(t){if(Array.isArray(t))return t.map(e=>xC(e));if(aIe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xC(r)]).reduce((n,r)=>(cIe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function aIe(t){return typeof t=="object"&&t!==null&&!uIe(t)}function uIe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function cIe(t){return Array.isArray(t)}var lIe=()=>({name:U5,setupOnce(){B5()}}),F5=lIe;var Q5=Q(K5(),1);var J5="Mongoose",X5=B(J5,()=>new Q5.MongooseInstrumentation({responseHook(t){Oe(t,"auto.db.otel.mongoose")}})),EIe=()=>({name:J5,setupOnce(){X5()}}),Z5=EIe;var a9=Q(i9(),1);var u9="Mysql",c9=B(u9,()=>new a9.MySQLInstrumentation({})),xIe=()=>({name:u9,setupOnce(){c9()}}),l9=xIe;var T9=Q(g9(),1);var E9="Mysql2",S9=B(E9,()=>new T9.MySQL2Instrumentation({responseHook(t){Oe(t,"auto.db.otel.mysql2")}})),qIe=()=>({name:E9,setupOnce(){S9()}}),A9=qIe;var Y9=Q(x9(),1),W9=Q(H9(),1);var cOe=["get","set","setex"],QC=["get","mget"],lOe=["set","setex"];function Pf(t,e){return t.includes(e.toLowerCase())}function JC(t){return Pf(QC,t)?"cache.get":Pf(lOe,t)?"cache.put":void 0}function dOe(t,e){return e.some(n=>t.startsWith(n))}function q9(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)?V9(o.map(s=>n(s))):["<unknown>"],r=e[0];return Pf(cOe,t)&&r!=null?n(r):V9(e.map(o=>n(o)))}catch{return}}function $9(t,e,n){if(!JC(t))return!1;for(let r of e)if(dOe(r,n))return!0;return!1}function z9(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 V9(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var FE="Redis",Mf={},K9=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=q9(e,n),s=JC(e);if(!o||!s||!Mf.cachePrefixes||!$9(e,o,Mf.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=z9(r);u&&t.setAttribute(Yb,u),Pf(QC,e)&&u!==void 0&&t.setAttribute($b,u>0),t.setAttributes({[te]:s,[zb]:o});let l=o.join(", ");t.updateName(Mf.maxCacheKeyLength?Ys(l,Mf.maxCacheKeyLength):l)},pOe=B(`${FE}.IORedis`,()=>new Y9.IORedisInstrumentation({responseHook:K9})),fOe=B(`${FE}.Redis`,()=>new W9.RedisInstrumentation({responseHook:K9})),Q9=Object.assign(()=>{pOe(),fOe()},{id:FE}),mOe=(t={})=>({name:FE,setupOnce(){Mf=t,Q9()}}),J9=mOe;var m$=Q(f$(),1);var _$="Postgres",h$=B(_$,m$.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Oe(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),xOe=t=>({name:_$,setupOnce(){h$(t)}}),g$=xOe;P();var Mi=Q(re(),1);de();var oN="PostgresJs",T$=[">=3.0.0 <4"],POe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,MOe=Symbol.for("sentry.query.from.instrumented.sql"),E$=B(oN,t=>new rN({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),rN=class extends Mi.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new Mi.InstrumentationNodeModuleDefinition("postgres",T$,n=>{try{return this._patchPostgres(n)}catch(r){return yt&&y.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new Mi.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,T$,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 yt&&y.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 yt&&y.warn("postgres() did not return a valid instance"),a;let u=o.getConfig();return MR(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:(Np(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(Hu,r);return}let o=n?.match(POe);o?.[1]&&e.setAttribute(Hu,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[MOe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return Pt({name:i||"postgresjs.query",op:"db"},a=>{Oe(a,"auto.db.postgresjs"),a.setAttributes({[aa]:"postgres",[cy]:i});let u=n.getConfig(),{requestHook:l}=u;l&&(0,Mi.safeExecuteInTheMiddle)(()=>l(a,i,void 0),f=>{f&&(a.setAttribute("sentry.hook.error","requestHook failed"),yt&&y.error(`Error in requestHook for ${oN} integration:`,f))},!0);let d=this.resolve;this.resolve=new Proxy(d,{apply:(f,m,_)=>{try{n._setOperationName(a,i,_?.[0]?.command),a.end()}catch(h){yt&&y.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:_?.[0]?.message||"unknown_error"}),a.setAttribute(ly,_?.[0]?.code||"unknown"),a.setAttribute(dy,_?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){yt&&y.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}},vOe=t=>({name:oN,setupOnce(){E$(t)}}),S$=vOe;P();P();var fS=Q(rz(),1);P();var ZCe={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"}},eNe=ZCe.version.split(".")[0],NN="PRISMA_INSTRUMENTATION",xN=`V${eNe}_PRISMA_INSTRUMENTATION`,Ll=globalThis;function tNe(){let t=Ll[xN];return t?.helper?t.helper:Ll[NN]?.helper}function nNe(t){let e={helper:t};Ll[xN]=e,Ll[NN]=e}function rNe(){delete Ll[xN],delete Ll[NN]}var oNe=process.env.PRISMA_SHOW_ALL_TRACES==="true",sNe="00-10-10-00";function iNe(t){switch(t){case"client":return Pe.CLIENT;case"internal":default:return Pe.INTERNAL}}var aNe=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}`:sNe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)iz(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return v.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!oNe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(az(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return oz(s,e(s,r))}return n.startActiveSpan(o,t,s=>oz(s,e(s,r)))}};function iz(t,e,n,r,o){if(az(e.name,o))return;let s={attributes:e.attributes,kind:iNe(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 l=r.get(u);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(u=>u.parentId===e.id);for(let u of a)iz(t,u,n,r,o);i.end(e.endTime)})}function oz(t,e){return uNe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function uNe(t){return t!=null&&typeof t.then=="function"}function az(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var uz={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},sz=uz.version,cNe=uz.name,lNe="@prisma/client",cz=class extends fS.InstrumentationBase{tracerProvider;constructor(t={}){super(cNe,sz,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new fS.InstrumentationNodeModuleDefinition(lNe,[sz])]}enable(){let t=this._config;nNe(new aNe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){rNe()}isEnabled(){return tNe()!==void 0}};var lz="Prisma";function dNe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function dz(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var PN=class extends cz{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=dz();dNe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){nt(()=>{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=pNe(s.kind),a=s.parent_span_id,u=s.span_id,l=s.trace_id,d=s.links?.map(f=>({context:{traceId:f.trace_id,spanId:f.span_id,traceFlags:Zt.SAMPLED}})),p=X.setSpanContext(v.active(),{traceId:l,spanId:a,traceFlags:Zt.SAMPLED});v.with(p,()=>{let f={generateTraceId:()=>l,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 pNe(t){switch(t){case"client":return Pe.CLIENT;case"internal":default:return Pe.INTERNAL}}var fNe=B(lz,t=>new PN(t)),pz=t=>({name:lz,setupOnce(){fNe(t)},setup(e){dz()&&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 yz=Q(Az(),1);var bz="Hapi",Rz=B(bz,()=>new yz.HapiInstrumentation),ONe=()=>({name:bz,setupOnce(){Rz()}}),Iz=ONe;de();var wi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},$f={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};P();var gS=Q(re(),1);var CNe="@sentry/instrumentation-hono",NNe="0.0.1",hS=class extends gS.InstrumentationBase{constructor(e={}){super(CNe,NNe,e)}init(){return[new gS.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(Ht(a))return a.then(u=>{let l=n._determineHandlerType(u);return i.setAttributes({[wi.HONO_TYPE]:l,[wi.HONO_NAME]:l===$f.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),u});{let u=n._determineHandlerType(a);return i.setAttributes({[wi.HONO_TYPE]:u,[wi.HONO_NAME]:u===$f.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 Ht(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?$f.MIDDLEWARE:$f.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:qe.ERROR,message:n.message}),e.recordException(n))}};var Oz="Hono";function xNe(t){let e=Y(t).data,n=e[wi.HONO_TYPE];if(e[te]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[te]:`${n}.hono`});let r=e[wi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),le()===hr()){yt&&y.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[ts],s=e[ua];typeof o=="string"&&typeof s=="string"&&le().setTransactionName(`${s} ${o}`)}var Cz=B(Oz,()=>new hS({responseHook:t=>{xNe(t)}})),PNe=()=>({name:Oz,setupOnce(){Cz()}}),Nz=PNe;var Gz=Q(Fz(),1);de();var jz="Koa",Hz=B(jz,Gz.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Oe(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 >"),le()===hr()){yt&&y.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[ts],a=n.context?.request?.method?.toUpperCase()||"GET";i&&le().setTransactionName(`${a} ${i}`)}})),FNe=(t={})=>({name:jz,setupOnce(){Hz(t)}}),Vz=FNe;var Xz=Q(Jz(),1);var Zz="Connect",eY=B(Zz,()=>new Xz.ConnectInstrumentation),KNe=()=>({name:Zz,setupOnce(){eY()}}),tY=KNe;var dY=Q(lY(),1);var exe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),pY="Tedious",fY=B(pY,()=>new dY.TediousInstrumentation({})),txe=()=>{let t;return{name:pY,setupOnce(){let e=fY();t=Pp(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]||"";exe.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},mY=txe;var EY=Q(TY(),1);var SY="GenericPool",AY=B(SY,()=>new EY.GenericPoolInstrumentation({})),rxe=()=>{let t;return{name:SY,setupOnce(){let e=AY();t=Pp(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")}))}}},yY=rxe;var vY=Q(MY(),1);var kY="Amqplib",mxe={consumeEndHook:t=>{Oe(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Oe(t,"auto.amqplib.otel.publisher")}},LY=B(kY,()=>new vY.AmqplibInstrumentation(mxe)),_xe=()=>({name:kY,setupOnce(){LY()}}),wY=_xe;var Qf="VercelAI";var LS=Q(re(),1);var hxe=[">=3.0.0 <7"],DY=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function gxe(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 Txe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(Exe(e.content),Sxe(e.content))}function Exe(t){for(let e of t){if(!gxe(e))continue;let n=JR(e.toolCallId);n?Qn(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}})}):Qn(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 Sxe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&XR(e.toolCallId)}function Axe(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 kS=class t extends LS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new LS.InstrumentationNodeModuleDefinition("ai",hxe,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,l=V(),d=l?.getIntegrationByName(Qf),p=d?.options,f=d?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:m,recordOutputs:_}=Axe(p,a,u,f);return i[0].experimental_telemetry={...a,isEnabled:u!==void 0?u:!0,recordInputs:m,recordOutputs:_},Yr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&<(h,"_sentry_active_span",Tr())},()=>{},h=>{Txe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of DY)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=DY.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var UY=B(Qf,()=>new kS({}));function yxe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var bxe=(t={})=>{let e;return{name:Qf,options:t,setupOnce(){e=UY()},afterAllSetup(n){t.force??yxe(n)?zh(n):e?.callWhenPatched(()=>zh(n))}}},BY=bxe;var DS=Q(re(),1);var Rxe=[">=4.0.0 <7"],wS=class extends DS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new DS.InstrumentationNodeModuleDefinition("openai",Rxe,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(Ia(fi))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Wh(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 FY=B(fi,t=>new wS(t)),Ixe=(t={})=>({name:fi,setupOnce(){FY(t)}}),GY=Ixe;var BS=Q(re(),1);var Oxe=[">=0.19.2 <1.0.0"],US=class extends BS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new BS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",Oxe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ia(mi))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Kh(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 jY=B(mi,t=>new US(t)),Cxe=(t={})=>({name:mi,options:t,setupOnce(){jY(t)}}),HY=Cxe;var Yl=Q(re(),1);var VY=[">=0.10.0 <2"],FS=class extends Yl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new Yl.InstrumentationNodeModuleDefinition("@google/genai",VY,n=>this._patch(n),n=>n,[new Yl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",VY,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(Ia(_i))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Qh(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 Np(e,"GoogleGenAI",o),e}};var qY=B(_i,t=>new FS(t)),Nxe=(t={})=>({name:_i,setupOnce(){qY(t)}}),$Y=Nxe;var qi=Q(re(),1);var GS=[">=0.1.0 <2.0.0"];function xxe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function Pxe(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,l=xxe(u,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var jS=class extends qi.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new qi.InstrumentationNodeModuleDefinition(r,GS,this._patch.bind(this),o=>o,[new qi.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,GS,this._patch.bind(this),o=>o)]));return e.push(new qi.InstrumentationNodeModuleDefinition("langchain",GS,this._patch.bind(this),r=>r,[new qi.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",GS,this._patch.bind(this),r=>r)])),e}_patch(e){SR([fi,mi,_i]);let n=Xh(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 l=i[u];typeof l=="function"&&(i[u]=Pxe(l,n))}}};var zY=B(Jh,t=>new jS(t)),Mxe=(t={})=>({name:Jh,setupOnce(){zY(t)}}),YY=Mxe;var Wl=Q(re(),1);var WY=[">=0.0.0 <2.0.0"],HS=class extends Wl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new Wl.InstrumentationNodeModuleDefinition("@langchain/langgraph",WY,this._patch.bind(this),n=>n,[new Wl.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",WY,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&eg(e.StateGraph.prototype,this.getConfig()),e}};var KY=B(Zh,t=>new HS(t)),vxe=(t={})=>({name:Zh,setupOnce(){KY(t)}}),QY=vxe;var o7=Q(re(),1);P();var Rs=Q(re(),1);de();import*as XY from"node:net";function ZY(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=d=>{(0,Rs.safeExecuteInTheMiddle)(()=>a(d),p=>{p&&Wn.error(p?.message)},!0)});let u=new Rs.InstrumentationNodeModuleDefinition("@firebase/firestore",e,d=>JY(d,n,r,t,i)),l=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let d of l)u.files.push(new Rs.InstrumentationNodeModuleFile(d,e,p=>JY(p,n,r,t,i),p=>e7(p,r)));return u}function JY(t,e,n,r,o){return e7(t,n),e(t,"addDoc",kxe(r,o)),e(t,"getDocs",wxe(r,o)),e(t,"setDoc",Dxe(r,o)),e(t,"deleteDoc",Lxe(r,o)),t}function e7(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Rs.isWrapped)(t[n])&&e(t,n);return t}function kxe(t,e){return function(r){return function(o,s){let i=qS(t,"addDoc",o);return e(i),VS(i,()=>r(o,s))}}}function Lxe(t,e){return function(r){return function(o){let s=qS(t,"deleteDoc",o.parent||o);return e(s),VS(s,()=>r(o))}}}function wxe(t,e){return function(r){return function(o){let s=qS(t,"getDocs",o);return e(s),VS(s,()=>r(o))}}}function Dxe(t,e){return function(r){return function(o,s,i){let a=qS(t,"setDoc",o.parent||o);return e(a),VS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function VS(t,e){return v.with(X.setSpan(v.active(),t),()=>(0,Rs.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function qS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Pe.CLIENT});return Bxe(r,n),r.setAttribute(Hu,e),r}function Uxe(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(XY.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 Bxe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[ay]:e.path,[uy]:n.name,[aa]:"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}=Uxe(s);a&&(i[hy]=a),u&&(i[gy]=u),t.setAttributes(i)}P();var Is=Q(re(),1);function t7(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,u=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(f,m)=>{(0,Is.safeExecuteInTheMiddle)(()=>l(f,m),_=>{_&&Wn.error(_?.message)},!0)}),typeof u=="function"&&(s=f=>{(0,Is.safeExecuteInTheMiddle)(()=>u(f),m=>{m&&Wn.error(m?.message)},!0)});let d=new Is.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:m})=>{d.files.push(new Is.InstrumentationNodeModuleFile(f,e,_=>Fxe(_,n,r,t,{requestHook:s,responseHook:i,errorHook:a},m),_=>n7(_,r)))}),d}function xn(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(...l){let d=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",p=t.startSpan(`firebase.function.${n}`,{kind:Pe.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{_=await i.apply(this,l)}catch(h){m=h}if(e?.responseHook?.(p,m),m&&p.recordException(m),p.end(),m)throw await e?.errorHook?.(p,m),m;return _})};return a?o.call(this,a,u):o.call(this,u)}}}function Fxe(t,e,n,r,o,s){switch(n7(t,n),s){case"function":e(t,"onRequest",xn(r,o,"http.request")),e(t,"onCall",xn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",xn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",xn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",xn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",xn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",xn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",xn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",xn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",xn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",xn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",xn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",xn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",xn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",xn(r,o,"storage.object.metadataUpdated"));break}return t}function n7(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,Is.isWrapped)(t[r])&&e(t,r);return t}var r7={},Gxe=[">=3.0.0 <5"],jxe=[">=6.0.0 <7"],$S=class extends o7.InstrumentationBase{constructor(e=r7){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...r7,...e})}init(){let e=[];return e.push(ZY(this.tracer,Gxe,this._wrap,this._unwrap,this.getConfig())),e.push(t7(this.tracer,jxe,this._wrap,this._unwrap,this.getConfig())),e}};var s7="Firebase",Hxe={firestoreSpanCreationHook:t=>{Oe(t,"auto.firebase.otel.firestore"),t.setAttribute(te,"db.query")},functions:{requestHook:t=>{Oe(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 yh(2e3))}}},i7=B(s7,()=>new $S(Hxe)),Vxe=()=>({name:s7,setupOnce(){i7()}}),a7=Vxe;function u7(){return[e8(),xq(),t5(),Nz(),F5(),Z5(),l9(),A9(),J9(),g$(),pz(),Iz(),Vz(),tY(),mY(),yY(),g5(),wY(),C5(),YY(),QY(),BY(),GY(),HY(),$Y(),S$(),a7()]}P();var zS=Q(vI(),1),c7=Q(oO(),1);de();var KN=1e6;function l7(t,e={}){t.getOptions().debug&&SO();let[n,r]=qxe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function qxe(t,e={}){let n=new c7.BasicTracerProvider({sampler:new oT(t),resource:(0,zS.defaultResource)().merge((0,zS.resourceFromAttributes)({[Ty]:"node",[iy]:"sentry",[Ey]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new rT({timeout:$xe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Br.setGlobalPropagator(new nT);let r=new EO;return v.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function $xe(t){if(t!=null){if(t>KN)return yt&&y.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${KN}`),KN;if(t<=0||Number.isNaN(t)){yt&&y.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function d7(){return pT().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(vV(),GV())}function p7(t){return[...d7(),...rt(t)?u7():[]]}function QN(t={}){return zxe(t,p7)}function zxe(t={},e){Oa(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(l7(n,{spanProcessors:t.openTelemetrySpanProcessors}),PO()),n}var Yxe="prod",m7="0.1.33",Wxe=`@tanagram/lore/${m7}`;function Ve(){return Yxe}function to(){return m7}function _7(){return Wxe}QN({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:Ve(),release:to(),sendDefaultPii:!0});Ah("service_name","lore-cli");import{realpathSync as GBe}from"node:fs";import{fileURLToPath as jBe,pathToFileURL as KJ}from"node:url";var Kxe=/\d/,Qxe=["-","_","/","."];function Jxe(t=""){if(!Kxe.test(t))return t!==t.toLowerCase()}function h7(t,e){let n=e??Qxe,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 l=Jxe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let d=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=d+a,s=l;continue}}o+=a,s=l,i=u}return r.push(o),r}function Xxe(t){return t?t[0].toUpperCase()+t.slice(1):""}function Zxe(t){return t?t[0].toLowerCase()+t.slice(1):""}function ePe(t,e){return t?(Array.isArray(t)?t:h7(t)).map(n=>Xxe(e?.normalize?n.toLowerCase():n)).join(""):""}function Jf(t,e){return Zxe(ePe(t||"",e))}function YS(t,e){return t?(Array.isArray(t)?t:h7(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function g7(t){return YS(t||"","_")}import{parseArgs as tPe}from"node:util";function XS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function JN(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 ar(t){return typeof t=="function"?t():t}var tu=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function nPe(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 b of S)i.set(g,b),a.has(b)||a.set(b,[]),a.get(b).push(g),i.set(b,g),a.has(g)||a.set(g,[]),a.get(g).push(b)}let u={};function l(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:l(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=[],m={};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);m[S]=!0;continue}f.push(E)}let _;try{_=tPe({args:f,options:Object.keys(u).length>0?u:void 0,allowPositionals:!0,strict:!1})}catch{_={values:{},positionals:f}}let h={_:[]};h._=_.positionals;for(let[g,E]of Object.entries(_.values)){let S=E;l(g)==="boolean"&&typeof E=="string"?S=E!=="false":d(g)&&typeof E=="boolean"&&(S=""),h[g]=S}for(let[g]of Object.entries(m)){h[g]=!1;let E=i.get(g);E&&(h[E]=!1);let S=a.get(g);if(S)for(let b of S)h[b]=!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 rPe=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),ZS=(t,e=39)=>n=>rPe?n:`\x1B[${t}m${n}\x1B[${e}m`,WS=ZS(1,22),no=ZS(36),QS=ZS(90),KS=ZS(4,24);function oPe(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=S7(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=Jf(a.name),l=YS(a.name);if(u!==a.name||l!==a.name){let d=XS(n.alias[a.name]||[]);u!==a.name&&!d.includes(u)&&d.push(u),l!==a.name&&!d.includes(l)&&d.push(l),d.length>0&&(n.alias[a.name]=d)}}let o=nPe(t,n),[...s]=o._,i=new Proxy(o,{get(a,u){return a[u]??a[Jf(u)]??a[YS(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 tu(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let u=i[a.name],l=a.options||[];if(u!==void 0&&l.length>0&&!l.includes(u))throw new tu(`Invalid value for argument: ${no(`--${a.name}`)} (${no(u)}). Expected one of: ${l.map(d=>no(d)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new tu(`Missing required argument: --${a.name}`,"EARG");return i}function S7(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:XS(r.alias)});return e}async function sPe(t){return Promise.all(t.map(e=>ar(e)))}async function JS(t,e){let n=await ar(t.args||{}),r=oPe(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await sPe(t.plugins??[]),i,a;try{for(let d of s)await d.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let l=await ar(t.subCommands);if(l&&Object.keys(l).length>0){let d=iPe(e.rawArgs,n),p=e.rawArgs[d];if(p){let f=await T7(l,p);if(!f)throw new tu(`Unknown command ${no(p)}`,"E_UNKNOWN_COMMAND");await JS(f,{rawArgs:e.rawArgs.slice(d+1)})}else{let f=await ar(t.default);if(f){if(t.run)throw new tu("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let m=await T7(l,f);if(!m)throw new tu(`Default sub command ${no(f)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await JS(m,{rawArgs:e.rawArgs})}else if(!t.run)throw new tu("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(l){a=l}let u=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(l){u.push(l)}for(let l of[...s].reverse())try{await l.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 T7(t,e){if(e in t)return ar(t[e]);for(let n of Object.values(t)){let r=await ar(n),o=await ar(r?.meta);if(o?.alias&&XS(o.alias).includes(e))return r}}function iPe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&aPe(r,e)&&n++;continue}return n}return-1}function aPe(t,e){let n=t.replace(/^-{1,2}/,""),r=Jf(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===Jf(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var uPe=/^no[-A-Z]/;async function e0(t,e){let n=await ar(t.meta||{}),r=S7(await ar(t.args||{})),o=await ar(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],u=[],l=[];for(let m of r)if(m.type==="positional"){let _=m.name.toUpperCase(),h=m.required!==!1&&m.default===void 0;a.push([no(_+XN(m)),E7(m,h)]),l.push(h?`<${_}>`:`[${_}]`)}else{let _=m.required===!0&&m.default===void 0,h=[...(m.alias||[]).map(g=>`-${g}`),`--${m.name}`].join(", ")+XN(m);if(i.push([no(h),E7(m,_)]),m.type==="boolean"&&(m.default===!0||m.negativeDescription)&&!uPe.test(m.name)){let g=[...(m.alias||[]).map(E=>`--no-${E}`),`--no-${m.name}`].join(", ");i.push([no(g),[m.negativeDescription,_?QS("(Required)"):""].filter(Boolean).join(" ")])}_&&l.push(`--${m.name}`+XN(m))}if(t.subCommands){let m=[],_=await ar(t.subCommands);for(let[h,g]of Object.entries(_)){let E=await ar((await ar(g))?.meta);if(E?.hidden)continue;let S=XS(E?.alias),b=[h,...S].join(", ");u.push([no(b),E?.description||""]),m.push(h,...S)}l.push(m.join("|"))}let d=[],p=n.version||o.version;d.push(QS(`${n.description} (${s+(p?` v${p}`:"")})`),"");let f=i.length>0||a.length>0;return d.push(`${KS(WS("USAGE"))} ${no(`${s}${f?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(d.push(KS(WS("ARGUMENTS")),""),d.push(JN(a," ")),d.push("")),i.length>0&&(d.push(KS(WS("OPTIONS")),""),d.push(JN(i," ")),d.push("")),u.length>0&&(d.push(KS(WS("COMMANDS")),""),d.push(JN(u," ")),d.push("",`Use ${no(`${s} <command> --help`)} for more information about a command.`)),d.filter(m=>typeof m=="string").join(`
|
|
40
40
|
`)}function XN(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${g7(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function E7(t,e){let n=e?QS("(Required)"):"",r=t.default===void 0?"":QS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{spawn as nUe}from"node:child_process";var c={};ea(c,{BRAND:()=>LPe,DIRTY:()=>nu,EMPTY_PATH:()=>pPe,INVALID:()=>J,NEVER:()=>T1e,OK:()=>dn,ParseStatus:()=>Jt,Schema:()=>ce,ZodAny:()=>Yi,ZodArray:()=>xs,ZodBigInt:()=>ou,ZodBoolean:()=>su,ZodBranded:()=>Zf,ZodCatch:()=>hu,ZodDate:()=>iu,ZodDefault:()=>_u,ZodDiscriminatedUnion:()=>r0,ZodEffects:()=>wr,ZodEnum:()=>fu,ZodError:()=>Hn,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>s0,ZodIntersection:()=>lu,ZodIssueCode:()=>x,ZodLazy:()=>du,ZodLiteral:()=>pu,ZodMap:()=>ed,ZodNaN:()=>nd,ZodNativeEnum:()=>mu,ZodNever:()=>ro,ZodNull:()=>uu,ZodNullable:()=>Ho,ZodNumber:()=>ru,ZodObject:()=>Vn,ZodOptional:()=>kr,ZodParsedType:()=>D,ZodPipeline:()=>em,ZodPromise:()=>Wi,ZodReadonly:()=>gu,ZodRecord:()=>o0,ZodSchema:()=>ce,ZodSet:()=>td,ZodString:()=>zi,ZodSymbol:()=>Xl,ZodTransformer:()=>wr,ZodTuple:()=>jo,ZodType:()=>ce,ZodUndefined:()=>au,ZodUnion:()=>cu,ZodUnknown:()=>Ns,ZodVoid:()=>Zl,addIssueToContext:()=>k,any:()=>VPe,array:()=>YPe,bigint:()=>BPe,boolean:()=>M7,coerce:()=>g1e,custom:()=>N7,date:()=>FPe,datetimeRegex:()=>O7,defaultErrorMap:()=>Os,discriminatedUnion:()=>JPe,effect:()=>c1e,enum:()=>i1e,function:()=>r1e,getErrorMap:()=>Kl,getParsedType:()=>Go,instanceof:()=>DPe,intersection:()=>XPe,isAborted:()=>t0,isAsync:()=>Ql,isDirty:()=>n0,isValid:()=>$i,late:()=>wPe,lazy:()=>o1e,literal:()=>s1e,makeIssue:()=>Xf,map:()=>t1e,nan:()=>UPe,nativeEnum:()=>a1e,never:()=>$Pe,null:()=>HPe,nullable:()=>d1e,number:()=>P7,object:()=>WPe,objectUtil:()=>ZN,oboolean:()=>h1e,onumber:()=>_1e,optional:()=>l1e,ostring:()=>m1e,pipeline:()=>f1e,preprocess:()=>p1e,promise:()=>u1e,quotelessJson:()=>cPe,record:()=>e1e,set:()=>n1e,setErrorMap:()=>dPe,strictObject:()=>KPe,string:()=>x7,symbol:()=>GPe,transformer:()=>c1e,tuple:()=>ZPe,undefined:()=>jPe,union:()=>QPe,unknown:()=>qPe,util:()=>fe,void:()=>zPe});var fe;(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})(fe||(fe={}));var ZN;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ZN||(ZN={}));var D=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Go=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var x=fe.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"]),cPe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Hn=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 l=i.path[u];u===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],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,fe.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()}};Hn.create=t=>new Hn(t);var lPe=(t,e)=>{let n;switch(t.code){case x.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,fe.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:n=`Unrecognized key(s) in object: ${fe.joinValues(t.keys,", ")}`;break;case x.invalid_union:n="Invalid input";break;case x.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${fe.joinValues(t.options)}`;break;case x.invalid_enum_value:n=`Invalid enum value. Expected ${fe.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}"`:fe.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,fe.assertNever(t)}return{message:n}},Os=lPe;var A7=Os;function dPe(t){A7=t}function Kl(){return A7}var Xf=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(l=>!!l).slice().reverse();for(let l of u)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},pPe=[];function k(t,e){let n=Kl(),r=Xf({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Os?void 0:Os].filter(o=>!!o)});t.common.issues.push(r)}var Jt=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"}),nu=t=>({status:"dirty",value:t}),dn=t=>({status:"valid",value:t}),t0=t=>t.status==="aborted",n0=t=>t.status==="dirty",$i=t=>t.status==="valid",Ql=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 Lr=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}},y7=(t,e)=>{if($i(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 Hn(t.common.issues);return this._error=n,this._error}}};function ae(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 ce=class{get description(){return this._def.description}_getType(e){return Go(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jt,ctx:{common:e.parent.common,data:e.data,parsedType:Go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ql(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Go(e)},o=this._parseSync({data:e,path:r.path,parent:r});return y7(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Go(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return $i(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=>$i(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Go(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(Ql(o)?o:Promise.resolve(o));return y7(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 wr({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 kr.create(this,this._def)}nullable(){return Ho.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xs.create(this)}promise(){return Wi.create(this,this._def)}or(e){return cu.create([this,e],this._def)}and(e){return lu.create(this,e,this._def)}transform(e){return new wr({...ae(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new _u({...ae(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new Zf({typeName:ee.ZodBranded,type:this,...ae(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new hu({...ae(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 em.create(this,e)}readonly(){return gu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},fPe=/^c[^\s-]{8,}$/i,mPe=/^[0-9a-z]+$/,_Pe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hPe=/^[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,gPe=/^[a-z0-9_-]{21}$/i,TPe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,EPe=/^[-+]?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)?)??$/,SPe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,APe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ex,yPe=/^(?:(?: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])$/,bPe=/^(?:(?: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])$/,RPe=/^(([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]))$/,IPe=/^(([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])$/,OPe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CPe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,R7="((\\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])))",NPe=new RegExp(`^${R7}$`);function I7(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 xPe(t){return new RegExp(`^${I7(t)}$`)}function O7(t){let e=`${R7}T${I7(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 PPe(t,e){return!!((e==="v4"||!e)&&yPe.test(t)||(e==="v6"||!e)&&RPe.test(t))}function MPe(t,e){if(!TPe.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 vPe(t,e){return!!((e==="v4"||!e)&&bPe.test(t)||(e==="v6"||!e)&&IPe.test(t))}var zi=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return k(s,{code:x.invalid_type,expected:D.string,received:s.parsedType}),J}let r=new Jt,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),k(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),k(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?k(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&k(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")SPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"email",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")ex||(ex=new RegExp(APe,"u")),ex.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"emoji",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")hPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"uuid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")gPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"nanoid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")fPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cuid",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")mPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cuid2",code:x.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")_Pe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(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),k(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),k(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),k(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),k(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),k(o,{code:x.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?O7(s).test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:x.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?NPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:x.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?xPe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:x.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?EPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"duration",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?PPe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"ip",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?MPe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"jwt",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?vPe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cidr",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?OPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"base64",code:x.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?CPe.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"base64url",code:x.invalid_string,message:s.message}),r.dirty()):fe.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}};zi.create=t=>new zi({checks:[],typeName:ee.ZodString,coerce:t?.coerce??!1,...ae(t)});function kPe(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 ru=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return k(s,{code:x.invalid_type,expected:D.number,received:s.parsedType}),J}let r,o=new Jt;for(let s of this._def.checks)s.kind==="int"?fe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),k(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),k(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),k(r,{code:x.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?kPe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),k(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),k(r,{code:x.not_finite,message:s.message}),o.dirty()):fe.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"&&fe.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)}};ru.create=t=>new ru({checks:[],typeName:ee.ZodNumber,coerce:t?.coerce||!1,...ae(t)});var ou=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Jt;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),k(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),k(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),k(r,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):fe.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:D.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}};ou.create=t=>new ou({checks:[],typeName:ee.ZodBigInt,coerce:t?.coerce??!1,...ae(t)});var su=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:D.boolean,received:r.parsedType}),J}return dn(e.data)}};su.create=t=>new su({typeName:ee.ZodBoolean,coerce:t?.coerce||!1,...ae(t)});var iu=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return k(s,{code:x.invalid_type,expected:D.date,received:s.parsedType}),J}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:x.invalid_date}),J}let r=new Jt,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),k(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),k(o,{code:x.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):fe.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}};iu.create=t=>new iu({checks:[],coerce:t?.coerce||!1,typeName:ee.ZodDate,...ae(t)});var Xl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:D.symbol,received:r.parsedType}),J}return dn(e.data)}};Xl.create=t=>new Xl({typeName:ee.ZodSymbol,...ae(t)});var au=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:D.undefined,received:r.parsedType}),J}return dn(e.data)}};au.create=t=>new au({typeName:ee.ZodUndefined,...ae(t)});var uu=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:D.null,received:r.parsedType}),J}return dn(e.data)}};uu.create=t=>new uu({typeName:ee.ZodNull,...ae(t)});var Yi=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return dn(e.data)}};Yi.create=t=>new Yi({typeName:ee.ZodAny,...ae(t)});var Ns=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return dn(e.data)}};Ns.create=t=>new Ns({typeName:ee.ZodUnknown,...ae(t)});var ro=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:D.never,received:n.parsedType}),J}};ro.create=t=>new ro({typeName:ee.ZodNever,...ae(t)});var Zl=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:D.void,received:r.parsedType}),J}return dn(e.data)}};Zl.create=t=>new Zl({typeName:ee.ZodVoid,...ae(t)});var xs=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return k(n,{code:x.invalid_type,expected:D.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)&&(k(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&&(k(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&&(k(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 Lr(n,i,n.path,a)))).then(i=>Jt.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Lr(n,i,n.path,a)));return Jt.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)}};xs.create=(t,e)=>new xs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ae(e)});function Jl(t){if(t instanceof Vn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=kr.create(Jl(r))}return new Vn({...t._def,shape:()=>e})}else return t instanceof xs?new xs({...t._def,type:Jl(t.element)}):t instanceof kr?kr.create(Jl(t.unwrap())):t instanceof Ho?Ho.create(Jl(t.unwrap())):t instanceof jo?jo.create(t.items.map(e=>Jl(e))):t}var Vn=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=fe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return k(l,{code:x.invalid_type,expected:D.object,received:l.parsedType}),J}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ro&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let u=[];for(let l of i){let d=s[l],p=o.data[l];u.push({key:{status:"valid",value:l},value:d._parse(new Lr(o,p,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof ro){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of a)u.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")a.length>0&&(k(o,{code:x.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of a){let p=o.data[d];u.push({key:{status:"valid",value:d},value:l._parse(new Lr(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of u){let p=await d.key,f=await d.value;l.push({key:p,value:f,alwaysSet:d.alwaysSet})}return l}).then(l=>Jt.mergeObjectSync(r,l)):Jt.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 fe.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 fe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Jl(this)}partial(e){let n={};for(let r of fe.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 fe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof kr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return C7(fe.objectKeys(this.shape))}};Vn.create=(t,e)=>new Vn({shape:()=>t,unknownKeys:"strip",catchall:ro.create(),typeName:ee.ZodObject,...ae(e)});Vn.strictCreate=(t,e)=>new Vn({shape:()=>t,unknownKeys:"strict",catchall:ro.create(),typeName:ee.ZodObject,...ae(e)});Vn.lazycreate=(t,e)=>new Vn({shape:t,unknownKeys:"strip",catchall:ro.create(),typeName:ee.ZodObject,...ae(e)});var cu=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Hn(a.ctx.common.issues));return k(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 l={...n,common:{...n.common,issues:[]},parent:null},d=u._parseSync({data:n.data,path:n.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(u=>new Hn(u));return k(n,{code:x.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}};cu.create=(t,e)=>new cu({options:t,typeName:ee.ZodUnion,...ae(e)});var Cs=t=>t instanceof du?Cs(t.schema):t instanceof wr?Cs(t.innerType()):t instanceof pu?[t.value]:t instanceof fu?t.options:t instanceof mu?fe.objectValues(t.enum):t instanceof _u?Cs(t._def.innerType):t instanceof au?[void 0]:t instanceof uu?[null]:t instanceof kr?[void 0,...Cs(t.unwrap())]:t instanceof Ho?[null,...Cs(t.unwrap())]:t instanceof Zf||t instanceof gu?Cs(t.unwrap()):t instanceof hu?Cs(t._def.innerType):[],r0=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return k(n,{code:x.invalid_type,expected:D.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}):(k(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=Cs(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,...ae(r)})}};function tx(t,e){let n=Go(t),r=Go(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=fe.objectKeys(e),s=fe.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let u=tx(t[a],e[a]);if(!u.valid)return{valid:!1};i[a]=u.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],u=tx(i,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var lu=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(t0(s)||t0(i))return J;let a=tx(s.value,i.value);return a.valid?((n0(s)||n0(i))&&n.dirty(),{status:n.value,value:a.data}):(k(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}))}};lu.create=(t,e,n)=>new lu({left:t,right:e,typeName:ee.ZodIntersection,...ae(n)});var jo=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return k(r,{code:x.invalid_type,expected:D.array,received:r.parsedType}),J;if(r.data.length<this._def.items.length)return k(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&&(k(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 Lr(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Jt.mergeArray(n,i)):Jt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};jo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jo({items:t,typeName:ee.ZodTuple,rest:null,...ae(e)})};var o0=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return k(r,{code:x.invalid_type,expected:D.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 Lr(r,a,r.path,a)),value:i._parse(new Lr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Jt.mergeObjectAsync(n,o):Jt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:ee.ZodRecord,...ae(r)}):new t({keyType:zi.create(),valueType:e,typeName:ee.ZodRecord,...ae(n)})}},ed=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return k(r,{code:x.invalid_type,expected:D.map,received:r.parsedType}),J;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,u],l)=>({key:o._parse(new Lr(r,a,r.path,[l,"key"])),value:s._parse(new Lr(r,u,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of i){let l=await u.key,d=await u.value;if(l.status==="aborted"||d.status==="aborted")return J;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let u of i){let l=u.key,d=u.value;if(l.status==="aborted"||d.status==="aborted")return J;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}}}};ed.create=(t,e,n)=>new ed({valueType:e,keyType:t,typeName:ee.ZodMap,...ae(n)});var td=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return k(r,{code:x.invalid_type,expected:D.set,received:r.parsedType}),J;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(k(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&&(k(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 l=new Set;for(let d of u){if(d.status==="aborted")return J;d.status==="dirty"&&n.dirty(),l.add(d.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((u,l)=>s._parse(new Lr(r,u,r.path,l)));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)}};td.create=(t,e)=>new td({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ae(e)});var s0=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return k(n,{code:x.invalid_type,expected:D.function,received:n.parsedType}),J;function r(a,u){return Xf({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kl(),Os].filter(l=>!!l),issueData:{code:x.invalid_arguments,argumentsError:u}})}function o(a,u){return Xf({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kl(),Os].filter(l=>!!l),issueData:{code:x.invalid_return_type,returnTypeError:u}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Wi){let a=this;return dn(async function(...u){let l=new Hn([]),d=await a._def.args.parseAsync(u,s).catch(m=>{throw l.addIssue(r(u,m)),l}),p=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(p,s).catch(m=>{throw l.addIssue(o(p,m)),l})})}else{let a=this;return dn(function(...u){let l=a._def.args.safeParse(u,s);if(!l.success)throw new Hn([r(u,l.error)]);let d=Reflect.apply(i,this,l.data),p=a._def.returns.safeParse(d,s);if(!p.success)throw new Hn([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:jo.create(e).rest(Ns.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||jo.create([]).rest(Ns.create()),returns:n||Ns.create(),typeName:ee.ZodFunction,...ae(r)})}},du=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};du.create=(t,e)=>new du({getter:t,typeName:ee.ZodLazy,...ae(e)});var pu=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return k(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}};pu.create=(t,e)=>new pu({value:t,typeName:ee.ZodLiteral,...ae(e)});function C7(t,e){return new fu({values:t,typeName:ee.ZodEnum,...ae(e)})}var fu=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return k(n,{expected:fe.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 k(n,{received:n.data,code:x.invalid_enum_value,options:r}),J}return dn(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})}};fu.create=C7;var mu=class extends ce{_parse(e){let n=fe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=fe.objectValues(n);return k(r,{expected:fe.joinValues(o),received:r.parsedType,code:x.invalid_type}),J}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=fe.objectValues(n);return k(r,{received:r.data,code:x.invalid_enum_value,options:o}),J}return dn(e.data)}get enum(){return this._def.values}};mu.create=(t,e)=>new mu({values:t,typeName:ee.ZodNativeEnum,...ae(e)});var Wi=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return k(n,{code:x.invalid_type,expected:D.promise,received:n.parsedType}),J;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return dn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Wi.create=(t,e)=>new Wi({type:t,typeName:ee.ZodPromise,...ae(e)});var wr=class extends ce{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=>{k(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"?nu(u.value):n.value==="dirty"?nu(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"?nu(a.value):n.value==="dirty"?nu(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(!$i(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=>$i(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):J);fe.assertNever(o)}};wr.create=(t,e,n)=>new wr({schema:t,typeName:ee.ZodEffects,effect:e,...ae(n)});wr.createWithPreprocess=(t,e,n)=>new wr({schema:e,effect:{type:"preprocess",transform:t},typeName:ee.ZodEffects,...ae(n)});var kr=class extends ce{_parse(e){return this._getType(e)===D.undefined?dn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};kr.create=(t,e)=>new kr({innerType:t,typeName:ee.ZodOptional,...ae(e)});var Ho=class extends ce{_parse(e){return this._getType(e)===D.null?dn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ho.create=(t,e)=>new Ho({innerType:t,typeName:ee.ZodNullable,...ae(e)});var _u=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};_u.create=(t,e)=>new _u({innerType:t,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var hu=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ql(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Hn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};hu.create=(t,e)=>new hu({innerType:t,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var nd=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:D.nan,received:r.parsedType}),J}return{status:"valid",value:e.data}}};nd.create=t=>new nd({typeName:ee.ZodNaN,...ae(t)});var LPe=Symbol("zod_brand"),Zf=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},em=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?J:s.status==="dirty"?(n.dirty(),nu(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})}},gu=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>($i(o)&&(o.value=Object.freeze(o.value)),o);return Ql(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};gu.create=(t,e)=>new gu({innerType:t,typeName:ee.ZodReadonly,...ae(e)});function b7(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function N7(t,e={},n){return t?Yi.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=b7(e,r),u=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!s){let i=b7(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Yi.create()}var wPe={object:Vn.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 DPe=(t,e={message:`Input not instance of ${t.name}`})=>N7(n=>n instanceof t,e),x7=zi.create,P7=ru.create,UPe=nd.create,BPe=ou.create,M7=su.create,FPe=iu.create,GPe=Xl.create,jPe=au.create,HPe=uu.create,VPe=Yi.create,qPe=Ns.create,$Pe=ro.create,zPe=Zl.create,YPe=xs.create,WPe=Vn.create,KPe=Vn.strictCreate,QPe=cu.create,JPe=r0.create,XPe=lu.create,ZPe=jo.create,e1e=o0.create,t1e=ed.create,n1e=td.create,r1e=s0.create,o1e=du.create,s1e=pu.create,i1e=fu.create,a1e=mu.create,u1e=Wi.create,c1e=wr.create,l1e=kr.create,d1e=Ho.create,p1e=wr.createWithPreprocess,f1e=em.create,m1e=()=>x7().optional(),_1e=()=>P7().optional(),h1e=()=>M7().optional(),g1e={string:t=>zi.create({...t,coerce:!0}),number:t=>ru.create({...t,coerce:!0}),boolean:t=>su.create({...t,coerce:!0}),bigint:t=>ou.create({...t,coerce:!0}),date:t=>iu.create({...t,coerce:!0})};var T1e=J;var E1e=t=>typeof t?.safeParse=="function";var nx=t=>typeof t?.passthrough=="function";var S1e=(t,e)=>nx(t)?nx(e)?t.merge(e):t:nx(e)?e:Object.assign({},t,e);var Xot=c.object({name:c.literal("ZodError"),issues:c.array(c.object({path:c.array(c.union([c.string(),c.number()])),message:c.string().optional(),code:c.nativeEnum(c.ZodIssueCode)}).catchall(c.any()))}),A1e=Symbol("ContractNoBody"),k7=t=>"method"in t&&"path"in t;var L7=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return k7(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:S1e(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,L7(r,e)]})),rx=Symbol("ContractPlainType"),Dr=()=>({router:(t,e)=>L7(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>rx,body:()=>rx,type:()=>rx,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>A1e}),y1e=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},b1e=(t,e=!1)=>{let n=e?R1e(t):I1e(t);return n?.length>0?"?"+n:""},R1e=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("&"):"",I1e=t=>t?Object.keys(t).flatMap(e=>ox(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",ox=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>ox(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>ox(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var sx=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 O1e=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 l={status:a.status,body:await a.json(),headers:a.headers},d=t.responses[l.status];return(s??t.validateResponseOnClient)&&E1e(d)?{...l,body:d.parse(l.body)}:l}return u?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},C1e=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},v7=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),N1e=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:u}=t,l=n.api||O1e,d=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([m,_])=>typeof _=="function"?[m,_(t)]:[m,_])),p={...d&&v7(d),...v7(a)};Object.keys(p).forEach(m=>{p[m]===void 0&&delete p[m]});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:C1e(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)})),l({...f,...i})},x1e=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:u,fetchOptions:l,cache:d,next:p,...f}=n||{},m={...e,...u};return{path:P1e(r,m.baseUrl,o,t,!!m.jsonQuery),clientArgs:m,route:t,body:s,query:r,extraInputArgs:f,fetchOptions:{...d&&{cache:d},...p&&{next:p},...l},headers:{...a,...i}}},P1e=(t,e,n,r,o)=>{let s=y1e({path:r.path,params:n}),i=b1e(t,o);return`${e}${s}${i}`},M1e=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=x1e(t,e,r),s=await N1e(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new sx(s,n)}},ix=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>k7(r)?[n,M1e(r,e)]:[n,ix(r,e)]));var ax=["free","creator","team"],w7=typeof process<"u"&&process.env?.NODE_ENV!=="production",v1e={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Share any thread from Claude Code, Codex, or Cowork. Share with friends or keep private. Share skills with your team instantly.",price:0,priceId:null,features:[{name:"Share threads from Claude Code, Codex, and Cowork"},{name:"Share with friends or keep private"},{name:"Share skills with your team instantly"}],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:w7?"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:w7?"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 D7=v1e.stripe.plans,est=Object.freeze(Object.fromEntries(D7.map(t=>[t.tier,t])));var k1e=Dr(),pn=c.object({message:c.string()}),ux=c.record(c.unknown()),Tu=c.string().regex(/^doc_[0-9A-Za-z]{22}$/),i0=c.string().regex(/^proj_[0-9A-Za-z]{22}$/),L1e=["active","archived"],a0=c.enum(L1e),U7=c.object({id:c.string().min(1),display_name:c.string().min(1)}),B7=c.object({id:i0,name:c.string().min(1)}),cx=c.object({id:Tu,title:c.string().min(1),status:a0,author:U7,project:B7.nullable(),created_at:c.string().datetime(),updated_at:c.string().datetime(),archived_at:c.string().datetime().nullable()}),w1e=c.object({type:c.literal("list"),list_type:c.literal("doc"),objects:c.array(cx)}),D1e=c.object({project_id:i0.optional(),status:a0.optional()}),U1e=c.object({title:c.string().trim().min(1).max(300).optional(),prosemirror_json:ux.optional(),project_id:i0.nullable().optional()}),B1e=c.object({id:Tu,created_at:c.string().datetime()}),F1e=c.object({title:c.string().trim().min(1).max(300).optional(),prosemirror_json:ux.optional(),project_id:i0.nullable().optional(),status:a0.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),G1e=c.object({id:Tu,updated_at:c.string().datetime()}),j1e=c.object({id:Tu,title:c.string().min(1),prosemirror_json:ux,status:a0,author:U7,project:B7.nullable(),created_at:c.string().datetime(),updated_at:c.string().datetime(),archived_at:c.string().datetime().nullable()}),F7=k1e.router({listDocs:{method:"GET",path:"/docs",headers:c.object({authorization:c.string().min(1).optional()}),query:D1e,responses:{200:w1e,401:pn,403:pn},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:c.object({authorization:c.string().min(1).optional()}),body:U1e,responses:{201:B1e,401:pn,403:pn,404:pn,422:pn},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:c.object({docId:Tu}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:j1e,401:pn,403:pn,404:pn},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:c.object({docId:Tu}),headers:c.object({authorization:c.string().min(1).optional()}),body:F1e,responses:{200:G1e,401:pn,403:pn,404:pn,422:pn},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:c.object({docId:Tu}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{204:c.object({}),401:pn,403:pn,404:pn},summary:"Hard-delete a doc and any mention references it owns"}});var H1e=Dr(),it=c.object({message:c.string()}),lx=c.record(c.unknown()),Vo=c.string().regex(/^proj_[0-9A-Za-z]{22}$/),V1e=["active","archived"],u0=c.enum(V1e),dx=c.object({id:c.string().min(1),display_name:c.string().min(1)}),G7=c.object({thread_id:c.string().min(1),title:c.string().min(1),added_at:c.string().datetime(),added_by:dx}),q1e=c.object({id:Vo,name:c.string().min(1),status:u0,author:dx,thread_count:c.number().int().nonnegative(),doc_count:c.number().int().nonnegative(),created_at:c.string().datetime(),updated_at:c.string().datetime(),archived_at:c.string().datetime().nullable()}),$1e=c.object({type:c.literal("list"),list_type:c.literal("project"),objects:c.array(q1e)}),z1e=c.object({status:u0.optional()}),Y1e=c.object({name:c.string().trim().min(1).max(200),prosemirror_json:lx.optional()}),W1e=c.object({id:Vo,created_at:c.string().datetime()}),K1e=c.object({name:c.string().trim().min(1).max(200).optional(),prosemirror_json:lx.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),Q1e=c.object({id:Vo,updated_at:c.string().datetime()}),J1e=c.object({archived:c.boolean()}),X1e=c.object({id:Vo,status:u0,archived_at:c.string().datetime().nullable()}),Z1e=c.object({id:Vo,name:c.string().min(1),prosemirror_json:lx,status:u0,author:dx,created_at:c.string().datetime(),updated_at:c.string().datetime(),archived_at:c.string().datetime().nullable(),threads:c.array(G7),docs:c.array(cx)}),eMe=c.object({thread_id:c.string().min(1).max(64)}),tMe=G7,j7=H1e.router({listProjects:{method:"GET",path:"/projects",headers:c.object({authorization:c.string().min(1).optional()}),query:z1e,responses:{200:$1e,401:it},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:c.object({authorization:c.string().min(1).optional()}),body:Y1e,responses:{201:W1e,401:it,422:it},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:c.object({projectId:Vo}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Z1e,401:it,403:it,404:it},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:c.object({projectId:Vo}),headers:c.object({authorization:c.string().min(1).optional()}),body:K1e,responses:{200:Q1e,401:it,403:it,404:it,422:it},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:c.object({projectId:Vo}),headers:c.object({authorization:c.string().min(1).optional()}),body:J1e,responses:{200:X1e,401:it,403:it,404:it},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:c.object({projectId:Vo}),headers:c.object({authorization:c.string().min(1).optional()}),body:eMe,responses:{201:tMe,401:it,403:it,404:it,409:it,422:it},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:c.object({projectId:Vo,threadId:c.string().min(1).max(64)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{204:c.object({}),401:it,403:it,404:it},summary:"Remove a thread membership from a project"}});var nMe=Dr(),c0=c.object({message:c.string()}),rMe=["thread","plan","doc","user"],l0=c.enum(rMe),oMe=["doc","project"],sMe=c.enum(oMe),iMe=c.object({kind:l0,id:c.string().min(1),title:c.string().min(1),href:c.string().min(1)}),aMe=c.object({type:c.literal("list"),list_type:c.literal("mention"),objects:c.array(iMe)}),uMe=c.object({q:c.string().trim().min(1).max(50),kinds:c.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(c.array(l0).optional())}),cMe=c.object({source_kind:sMe,source_id:c.string().min(1),source_title:c.string().min(1),source_href:c.string().min(1),target_kind:l0,target_id:c.string().min(1),created_at:c.string().datetime()}),lMe=c.object({type:c.literal("list"),list_type:c.literal("backlink"),objects:c.array(cMe)}),dMe=c.object({target_kind:l0,target_id:c.string().min(1).max(64)}),H7=nMe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:c.object({authorization:c.string().min(1).optional()}),query:uMe,responses:{200:aMe,401:c0,422:c0},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:c.object({authorization:c.string().min(1).optional()}),query:dMe,responses:{200:lMe,401:c0,403:c0},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var pMe=Dr(),fMe=c.object({type:c.literal("list"),list_type:c.literal("thread"),has_more:c.boolean(),objects:c.array(c.unknown())}),Ut=c.object({message:c.string()}),V7=c.object({thread_id:c.string().min(1),is_favorited:c.boolean(),favorited_at:c.string().datetime().nullable()}),mMe=c.object({before:c.string().min(1).max(64).optional()}),_Me=c.object({id:c.string().min(1),display_name:c.string().min(1)}),hMe=c.object({block_id:c.string().min(1),thread_id:c.string().min(1),thread_title:c.string(),thread_visibility:c.enum(["private","workspace","public"]),author:_Me,preview:c.string(),prompted_at:c.string().datetime().nullable(),favorited_at:c.string().datetime()}),gMe=c.object({type:c.literal("list"),list_type:c.literal("favorite_prompt"),has_more:c.boolean(),objects:c.array(hMe)}),q7=c.object({block_id:c.string().min(1),thread_id:c.string().min(1).nullable(),is_favorited:c.boolean(),favorited_at:c.string().datetime().nullable()}),TMe=c.object({before:c.string().min(1).max(64).optional()}),EMe=c.object({block_ids:c.array(c.string().min(1))}),$7=pMe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:c.object({id:c.string().min(1).max(64)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{201:V7,401:Ut,403:Ut,404:Ut},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:c.object({id:c.string().min(1).max(64)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:V7,401:Ut,403:Ut,404:Ut},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:c.object({authorization:c.string().min(1).optional()}),query:mMe,responses:{200:fMe,401:Ut,403:Ut},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."},addPromptFavorite:{method:"POST",path:"/thread-blocks/:id/favorite",pathParams:c.object({id:c.string().min(1).max(64)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{201:q7,401:Ut,403:Ut,404:Ut,409:Ut},summary:'Bookmark a single user prompt (a thread_blocks row with type="user") for the authenticated user. Idempotent.'},removePromptFavorite:{method:"DELETE",path:"/thread-blocks/:id/favorite",pathParams:c.object({id:c.string().min(1).max(64)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:q7,401:Ut,404:Ut},summary:"Remove a prompt bookmark for the authenticated user (no-op if absent)."},listFavoritePrompts:{method:"GET",path:"/favorites/prompts",headers:c.object({authorization:c.string().min(1).optional()}),query:TMe,responses:{200:gMe,401:Ut},summary:"List the user's favorited prompts, newest first. Prompts whose parent thread the viewer can no longer see (visibility downgraded) are filtered out at read time."},listFavoritedBlockIdsInThread:{method:"GET",path:"/threads/:id/favorited-blocks",pathParams:c.object({id:c.string().min(1).max(64)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:EMe,401:Ut,403:Ut,404:Ut},summary:"Returns the set of thread_block ids the authenticated viewer has favorited within a single thread, used to bootstrap per-prompt star state on the SessionView."}});var SMe=Dr(),z7=c.object({message:c.string()}),AMe=c.object({id:c.string().min(1),title:c.string(),href:c.string().min(1),author_display_name:c.string().nullable(),author_handle:c.string().nullable()}),yMe=c.object({name:c.string().min(1),usage_count:c.number().int().nonnegative(),href:c.string().min(1)}),bMe=c.object({id:c.string().min(1),display_name:c.string(),handle:c.string().nullable(),avatar_url:c.string().nullable(),href:c.string().min(1)}),RMe=c.object({type:c.literal("global_search"),threads:c.array(AMe),skills:c.array(yMe),people:c.array(bMe)}),IMe=c.object({q:c.string().trim().min(1).max(80)}),Y7=SMe.router({globalSearch:{method:"GET",path:"/search",headers:c.object({authorization:c.string().min(1).optional()}),query:IMe,responses:{200:RMe,401:z7,422:z7},summary:"Global navbar search. Threads and people are searched globally (subject to thread visibility); skills are scoped to the viewer workspace. Max 5 results per kind."}});var OMe=Dr(),CMe=["gmail.com","googlemail.com","hotmail.com","outlook.com","live.com","msn.com","yahoo.com","ymail.com","rocketmail.com","icloud.com","me.com","mac.com","aol.com","proton.me","protonmail.com","pm.me","tutanota.com","tuta.io","fastmail.com","hey.com","mail.com","gmx.com","gmx.net","zoho.com","zohomail.com","hushmail.com","lycos.com","inbox.com","yandex.com","yandex.ru","mail.ru","inbox.ru","bk.ru","list.ru","rambler.ru","qq.com","163.com","126.com","yeah.net","sina.com","naver.com","daum.net","hanmail.net","kakao.com","rediffmail.com","comcast.net","verizon.net","att.net","sbcglobal.net","bellsouth.net","earthlink.net","charter.net","cox.net","roadrunner.com","spectrum.net","btinternet.com","virginmedia.com","sky.com","orange.fr","wanadoo.fr","free.fr","laposte.net","web.de","t-online.de","gmx.de","libero.it","virgilio.it","alice.it","seznam.cz","centrum.cz","wp.pl","interia.pl","o2.pl","onet.pl"],Ust=new Set(CMe);var NMe=c.object({id:c.string().uuid(),role:c.enum(["user","assistant"]),content:c.string().min(1),timestamp:c.string().datetime()}),xMe=c.object({id:c.string().uuid(),title:c.string().min(1),author:c.string().min(1),authorAvatar:c.string().min(1).max(4),model:c.string().min(1),turnCount:c.number().int().nonnegative(),createdAt:c.string().datetime(),preview:c.string()}),Bst=xMe.extend({messages:c.array(NMe)}),A=c.object({message:c.string()}),PMe=/^[a-zA-Z0-9_-]{2,32}$/,tW=c.string().regex(PMe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),px=c.object({id:c.string(),first_name:c.string().min(1),last_name:c.string().min(1),display_name:c.string().min(1),stytch_id:c.string().nullable(),handle:c.string().nullable(),bio:c.string().max(280).nullable(),avatar_url:c.string().nullable(),banner_url:c.string().nullable(),share_new_threads_to_workspace:c.boolean(),experimental_features_enabled:c.boolean(),onboarded_at:c.string().nullable()}),MMe=c.object({authProviderUserId:c.string().min(1).optional(),organizationId:c.string().min(1).optional(),org_name:c.string().min(1).optional(),emailAddress:c.string().email(),name:c.string().nullable(),user:px,is_admin:c.boolean()}),vMe=c.object({workos_client_id:c.string().min(1),workos_api_origin:c.string().url()}),kMe=c.object({share_new_threads_to_workspace:c.boolean().optional(),experimental_features_enabled:c.boolean().optional(),onboarded_at:c.union([c.literal("now"),c.null()]).optional(),display_name:c.string().min(1).max(120).optional(),handle:tW.optional(),bio:c.string().max(280).nullable().optional(),avatar_storage_url:c.string().min(1).nullable().optional(),banner_storage_url:c.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),LMe=c.object({id:c.string(),display_name:c.string(),handle:c.string().nullable(),avatar_url:c.string().nullable(),visible_thread_count:c.number().int().nonnegative(),last_active_at:c.string().datetime().nullable()}),nW=c.object({id:c.string().min(1),display_name:c.string().min(1),handle:c.string().nullable(),bio:c.string().max(280).nullable(),avatar_url:c.string().nullable(),banner_url:c.string().nullable(),organization_name:c.string().min(1).nullable(),created_at:c.string().min(1),visible_thread_count:c.number().int().nonnegative(),follower_count:c.number().int().nonnegative(),following_count:c.number().int().nonnegative(),published_project_count:c.number().int().nonnegative(),is_following:c.boolean(),is_self:c.boolean()}),wMe=c.object({type:c.literal("list"),list_type:c.literal("organization_member"),objects:c.array(LMe)}),DMe=c.object({email_address:c.string().email()}),UMe=c.object({email_address:c.string().email(),invitation_id:c.string().min(1)}),BMe=c.object({organization_id:c.string().min(1),organization_name:c.string().min(1),domain:c.string().min(1),created:c.boolean()}),FMe=c.object({location:c.string().trim().min(1),contact:c.string().trim().email()}),GMe=c.object({location:c.string().min(1),contact:c.string().email(),created_at:c.string().datetime()}),jMe=c.object({first_name:c.string().min(1),last_name:c.string().min(1),display_name:c.string().min(1),stytch_id:c.string().min(1).optional()}),HMe=c.object({name:c.string().min(1),email_domains:c.array(c.string().min(1)).nonempty(),stytch_org_id:c.string().min(1)}),VMe=c.object({user:jMe,organization:HMe}),qMe=c.object({path_glob:c.string().min(1),name:c.string().min(1),description:c.string().min(1)}),$Me=c.object({repo_origin_path:c.string().min(1),building_blocks:c.array(qMe)}),rW=c.string().regex(/^th_[0-9A-Za-z]{22}$/),p0=c.string().regex(/^tb_[0-9A-Za-z]{22}$/),zMe=c.object({id:rW,author:c.object({id:c.string().min(1),display_name:c.string().min(1)}),body:c.string(),created_at:c.string().datetime(),repo_origin_path:c.string().min(1),latest_revision_id:p0,revision_count:c.number().int().positive()}),YMe=c.object({id:c.string().min(1),display_name:c.string().min(1)}),WMe=c.object({id:c.string().min(1),author_id:c.string().min(1).nullable(),author:YMe.nullable(),created_at:c.string().datetime(),deleted_at:c.string().datetime().nullable(),content:c.string().min(1)}),KMe=c.object({id:c.string().min(1),thread_block_id:c.string().min(1),created_at:c.string().datetime(),resolved_at:c.string().datetime().nullable(),comments:c.array(WMe)}),QMe=c.object({thread_block_id:p0,from_position:c.number().int().positive(),to_position:c.number().int().positive(),selected_text:c.string().min(1),content:c.string().trim().min(1)}),JMe=c.object({id:c.string().min(1)}),XMe=c.object({content:c.string().trim().min(1)}),ZMe=c.object({id:c.string().min(1)}),eve=c.object({content:c.string().trim().min(1)}),tve=c.object({id:c.string().min(1)}),nve=c.object({content:c.string().trim().min(1)}),rve=c.object({id:c.string().min(1)}),ove=c.object({resolved:c.boolean()}),sve=c.object({id:c.string().min(1),resolved_at:c.string().datetime().nullable()}),ive=c.object({resolved:c.boolean()}),ave=c.object({id:c.string().min(1),resolved_at:c.string().datetime().nullable()}),oW=c.record(c.unknown()),uve=c.object({id:p0,body:c.string(),created_at:c.string().datetime(),prosemirror_json:oW,comment_threads:c.array(KMe)}),cve=c.object({id:rW,created_at:c.string().datetime(),repo_origin_path:c.string().min(1),author:c.object({id:c.string().min(1),display_name:c.string().min(1)}),latest_revision_id:p0,revision_count:c.number().int().positive(),revisions:c.array(uve)}),lve=c.object({type:c.literal("list"),list_type:c.literal("plan"),has_more:c.boolean(),objects:c.array(zMe)}),dve=c.object({before:c.string().min(1).optional(),after:c.string().min(1).optional(),author_id:c.string().min(1).optional(),repo_origin_path:c.string().min(1).optional()}),sW=c.object({id:c.string().min(1),organization_id:c.string().min(1),created_at:c.string().min(1),repo_origin_path:c.string().min(1),path_glob:c.string().min(1),name:c.string().min(1),description:c.string().min(1)}),pve=c.array(sW),fve=c.object({type:c.literal("list"),list_type:c.literal("building_block"),has_more:c.boolean(),objects:c.array(sW)}),mve=c.object({repo_origin_path:c.string().min(1),before:c.string().min(1).optional(),after:c.string().min(1).optional()}),_ve=c.enum(["thread","building_block"]),hve=c.object({repo_origin_path:c.string().min(1),sources:c.array(_ve).nonempty()}),gve=c.object({type:c.literal("list"),list_type:c.literal("repository"),has_more:c.boolean(),objects:c.array(hve)}),qo=c.enum(["claudeCode","codex","amp","cursor","cowork","unspecified"]),Tve=c.object({uploads:c.array(c.string()),outputs:c.array(c.string())}),Eve=c.object({connected:c.boolean(),last_upload_at:c.string().nullable(),harnesses:c.array(qo)}),Sve=["transcript","plan"],Ave=c.enum(Sve),yve=c.object({md5:c.string().min(1),harness:qo,filename:c.string().min(1).optional(),repo_origin_path:c.string().min(1).optional(),harness_internal_id:c.string().min(1).optional(),file_type:Ave.optional(),remix_of_thread_id:c.string().min(1).optional(),artifact_metadata:Tve.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"}),mx=c.object({id:c.string().min(1),display_name:c.string().min(1),avatar_url:c.string().nullable()}),bve=c.object({id:c.string().min(1),display_name:c.string().min(1)}),iW=c.object({id:c.string().min(1),author_id:c.string().min(1).nullable(),author:bve.nullable(),created_at:c.string().datetime(),deleted_at:c.string().datetime().nullable(),content:c.string().min(1)}),aW=c.object({id:c.string().min(1),thread_block_id:c.string().min(1),created_at:c.string().datetime(),resolved_at:c.string().datetime().nullable()}),Rve=aW.extend({comments:c.array(iW)}),tm=c.object({id:c.string().min(1),type:c.string().min(1),index_in_thread:c.number().int().nonnegative(),isCritiqued:c.boolean(),comment_threads:c.array(Rve).optional()}).passthrough(),uW=c.object({type:c.literal("list"),list_type:c.literal("thread_block"),has_more:c.boolean(),objects:c.array(tm)}),W7=tm.extend({type:c.literal("plan"),prosemirror_json:oW,thread_file_id:c.string().min(1)}),Ive=c.union([c.literal(-1),c.literal(1)]),cW=c.union([c.literal(-1),c.literal(0),c.literal(1)]),K7=c.object({score:c.number().int(),up_count:c.number().int().nonnegative(),down_count:c.number().int().nonnegative(),viewer_vote:cW}),Ove=c.object({value:Ive}),Cve=c.object({id:c.string().min(1),display_name:c.string().min(1),avatar_url:c.string().nullable()}),Eu=c.object({id:c.string().min(1),thread_id:c.string().min(1),author_id:c.string().min(1).nullable(),author:Cve.nullable(),parent_comment_id:c.string().min(1).nullable(),content:c.string(),created_at:c.string().datetime(),updated_at:c.string().datetime(),deleted_at:c.string().datetime().nullable()}),Nve=c.object({type:c.literal("list"),list_type:c.literal("thread_comment"),objects:c.array(Eu)}),xve=c.object({content:c.string().trim().min(1).max(4e3),parent_comment_id:c.string().min(1).optional()}),Pve=Eu,Mve=c.object({content:c.string().trim().min(1).max(4e3)}),vve=Eu,kve=Eu,Fst=c.discriminatedUnion("kind",[c.object({kind:c.literal("created"),thread_id:c.string().min(1),actor_user_id:c.string().min(1),version:c.number(),comment:Eu}),c.object({kind:c.literal("updated"),thread_id:c.string().min(1),actor_user_id:c.string().min(1),version:c.number(),comment:Eu}),c.object({kind:c.literal("deleted"),thread_id:c.string().min(1),actor_user_id:c.string().min(1),version:c.number(),comment:Eu})]),Lve=c.enum(["pending","generating","ready","failed"]),wve=c.enum(["pending","generating","ready","failed"]),Dve=c.enum(["pending","placeholder","ai","user"]),lW=c.enum(["pending","generating","ready","failed"]),_x=c.enum(["pending","generating","ready","failed","disabled"]),dW=c.enum(["pending","generating","ready","failed"]),Uve=c.object({title:c.string().min(1),body:c.string().min(1),files:c.array(c.string()).optional()}),Bve=c.object({status:_x,url:c.string().nullable(),url_expires_at:c.string().nullable(),generated_at:c.string().nullable(),model:c.string().nullable()}),Fve=c.object({status:dW,steps:c.array(Uve),generated_at:c.string().nullable()}),Gve=c.object({remix_of_thread_id:c.string().nullable(),remix_count:c.number().int().nonnegative()}),jve=c.object({cover:Bve,how_to:Fve,lineage:Gve}),Hve=c.object({id:c.string().min(1),title:c.string().min(1),author:c.object({id:c.string().min(1),display_name:c.string(),handle:c.string().nullable(),avatar_url:c.string().nullable()}),cover:c.object({url:c.string(),url_expires_at:c.string()}),remix_count:c.number().int().nonnegative(),started_at:c.string(),cover_generated_at:c.string()}),Vve=c.object({type:c.literal("list"),list_type:c.literal("card_feed_item"),has_more:c.boolean(),objects:c.array(Hve)}),pW=c.enum(["asked","requested","decided","corrected","shared"]),qve=c.object({id:c.string().min(1),kind:pW,summary:c.string().min(1),block_id:c.string().min(1)}),$ve=c.object({type:c.literal("list"),list_type:c.literal("thread_decision"),status:lW,generated_at:c.string().nullable(),objects:c.array(qve)}),zve=c.object({thread_id:c.string().min(1),source_url:c.string().min(1),title:c.string().min(1),summary:c.string().nullable(),harness:qo,visibility:c.enum(["private","workspace","public"]),started_at:c.string().min(1),author:c.object({display_name:c.string().min(1),handle:c.string().nullable()}),original_user_prompt:c.string().nullable(),last_assistant_message:c.string().nullable(),decisions:c.array(c.object({kind:pW,summary:c.string().min(1)})),files_touched:c.array(c.string()),truncated:c.boolean()}),rd=c.object({id:c.string().min(1),thread_file_id:c.string().min(1),organization_id:c.string().min(1),author:mx,repo:c.string().min(1),title:c.string().min(1),started_at:c.string().min(1),blocks:uW,user_message_count:c.number().int().nonnegative(),files_touched:c.array(c.string()),skills_invoked:c.array(c.string()),harness:qo,transcript_parsing_state:c.enum(["pending","parsed","too_large_to_parse"]),visibility:c.enum(["private","workspace","public"]),has_plan:c.boolean().optional(),summary:c.string().nullable(),summary_status:Lve,summary_generated_at:c.string().nullable(),title_status:wve,title_generated_at:c.string().nullable(),title_source:Dve,decisions_status:lW,decisions_generated_at:c.string().nullable(),score:c.number().int(),up_count:c.number().int().nonnegative(),down_count:c.number().int().nonnegative(),viewer_vote:cW,comment_count:c.number().int().nonnegative(),is_favorited:c.boolean(),card:jve}),Yve=c.object({storage_url:c.string().min(1)}),Wve=c.object({storage_url:c.string(),harness:qo,thread:rd.nullable()}),Kve=c.object({status:c.literal("complete"),thread_files:c.array(Wve)}),Qve=c.object({id:c.string(),presigned_url:c.string().nullable(),presigned_url_expires_at:c.string().nullable(),storage_url:c.string(),harness:qo,expected_md5:c.string(),error:c.string().nullable(),thread:rd.nullable(),remix_parent_dropped:c.boolean().optional()}),Jve=c.object({id:c.string(),substrate:c.enum(["s3","filesystem"]),status:c.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:c.array(Qve)}),Xve=c.object({visibility:c.enum(["private","workspace","public"]).optional(),title:c.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"}),Zve=c.discriminatedUnion("visibility",[c.object({visibility:c.literal("private")}),c.object({visibility:c.literal("workspace")}),c.object({visibility:c.literal("public"),title:c.string().min(1),author_display_name:c.string().min(1),author_avatar_url:c.string().nullable(),first_user_message:c.string().nullable(),summary:c.string().nullable(),started_at:c.string().min(1),harness:qo,cover_url:c.string().nullable()})]),eke=rd,Q7=c.object({type:c.literal("list"),list_type:c.literal("thread"),has_more:c.boolean(),objects:c.array(eke)}),tke=c.enum(["recent","popular"]),nke=c.enum(["everyone","following"]),rke=rd,oke=c.object({type:c.literal("list"),list_type:c.literal("discover_thread"),has_more:c.boolean(),objects:c.array(rke)}),ske=c.object({before:c.string().min(1).optional(),after:c.string().min(1).optional(),sort:tke.optional(),scope:nke.optional(),harness:qo.optional(),search:c.string().max(200).optional()}),ike=c.object({thread_count:c.number().int().nonnegative(),author_count:c.number().int().nonnegative(),organization_count:c.number().int().nonnegative(),harness_breakdown:c.record(qo,c.number().int().nonnegative())}),ake=c.object({id:c.string(),status:c.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:c.string(),thread_count:c.number().int().nonnegative()}),uke=c.object({type:c.literal("list"),list_type:c.literal("upload_session"),objects:c.array(ake)}),cke=c.object({before:c.string().min(1).optional(),after:c.string().min(1).optional()}),lke=c.object({before:c.string().min(1).optional(),after:c.string().min(1).optional(),author_ids:c.string().min(1).optional(),created_at:c.string().min(1).optional(),filepath_prefixes:c.string().min(1).optional()}),dke=c.object({path:c.string().min(1),start_offset:c.number().int().nonnegative(),end_offset:c.number().int().positive()}),hx=c.enum(["captured","published"]),pke=c.enum(["workspace","link"]),fW=c.object({id:c.string(),display_name:c.string(),avatar_url:c.string().nullable()}),fke=c.object({name:c.string(),usage_count:c.number().int().nonnegative(),author_count:c.number().int().nonnegative(),first_used_at:c.string().nullable(),last_used_at:c.string().nullable(),usage_count_last_24h:c.number().int().nonnegative(),usage_count_last_7d:c.number().int().nonnegative(),id:c.string().nullable(),description:c.string().nullable(),source:hx.nullable(),has_content:c.boolean()}),mke=c.object({type:c.literal("list"),list_type:c.literal("skill"),objects:c.array(fke)}),_ke=c.object({id:c.string(),title:c.string(),visibility:c.enum(["private","workspace","public"]),started_at:c.string(),author:mx,skills_invoked:c.array(c.string())}),hke=c.object({id:c.string().nullable(),name:c.string(),description:c.string().nullable(),body_md:c.string().nullable(),source:hx.nullable(),visibility:pke.nullable(),share_url:c.string().nullable(),latest_version:c.number().int().nonnegative().nullable(),author:fW.nullable(),usage_count:c.number().int().nonnegative(),author_count:c.number().int().nonnegative(),first_used_at:c.string().nullable(),last_used_at:c.string().nullable(),threads:c.array(_ke)}),gke=c.object({description:c.string().nullable().optional(),body_md:c.string().min(1),display_name:c.string().nullable().optional(),published:c.boolean().optional()}),Tke=c.object({id:c.string(),name:c.string(),latest_version:c.number().int().positive(),source:hx,content_hash:c.string()}),Eke=c.object({share_url:c.string(),share_token:c.string()}),Ske=c.object({id:c.string(),name:c.string(),description:c.string().nullable(),body_md:c.string(),latest_version:c.number().int().positive(),author:fW.nullable(),shared_at:c.string()}),Ake=c.object({path:c.string().min(1),text:c.string().max(64e3)}),yke=c.enum(["text_edit","redact","delete_block"]),bke=c.object({id:c.string(),thread_block_id:c.string(),editor:c.object({id:c.string(),display_name:c.string()}),kind:yke,path:c.string().nullable(),previous_text:c.string().nullable(),new_text:c.string().nullable(),created_at:c.string()}),Rke=c.object({type:c.literal("list"),list_type:c.literal("thread_block_edit"),objects:c.array(bke)}),Ike=c.object({organization_count:c.number().int().nonnegative(),user_count:c.number().int().nonnegative(),thread_count:c.number().int().nonnegative(),thread_count_last_24h:c.number().int().nonnegative(),user_count_last_24h:c.number().int().nonnegative()}),Oke=c.object({id:c.string(),name:c.string(),email_domains:c.array(c.string()),stytch_org_id:c.string(),member_count:c.number().int().nonnegative(),thread_count:c.number().int().nonnegative(),default_thread_visibility:c.enum(["private","workspace","public"]),created_at:c.string()}),Cke=c.object({type:c.literal("list"),list_type:c.literal("admin_organization"),objects:c.array(Oke)}),mW=c.object({id:c.string(),name:c.string()}),Nke=c.object({id:c.string(),display_name:c.string(),stytch_id:c.string().nullable(),thread_count:c.number().int().nonnegative(),onboarded_at:c.string().nullable(),created_at:c.string(),organizations:c.array(mW)}),xke=c.object({q:c.string().trim().min(1).max(120).optional()}),Pke=c.object({follower_id:c.string().min(1),followee_id:c.string().min(1)}),Mke=c.object({follower_id:c.string().min(1),followee_id:c.string().min(1),is_following:c.literal(!0)}),vke=c.object({type:c.literal("list"),list_type:c.literal("admin_user"),objects:c.array(Nke)}),kke=c.object({id:c.string(),title:c.string(),started_at:c.string(),created_at:c.string(),deleted_at:c.string().nullable(),visibility:c.enum(["private","workspace","public"]),harness:qo,author:mx,organization:mW}),Lke=c.object({type:c.literal("list"),list_type:c.literal("admin_thread"),has_more:c.boolean(),objects:c.array(kke)}),wke=c.object({before:c.string().min(1).optional(),after:c.string().min(1).optional()}),J7=c.object({token:c.string().min(1),thread_id:c.string().min(1)}),Dke=c.object({visitor:c.string().min(1).max(64).optional()}),Uke=c.object({user_id:c.string(),display_name:c.string(),shares_sent:c.number().int().nonnegative(),unique_viewers:c.number().int().nonnegative(),attributed_signups:c.number().int().nonnegative()}),Bke=c.object({window_days:c.number().int().positive(),shares_sent:c.number().int().nonnegative(),unique_viewers:c.number().int().nonnegative(),attributed_signups:c.number().int().nonnegative(),active_sharers:c.number().int().nonnegative(),k_factor:c.number().nullable(),shares_sent_sparkline:c.array(c.number().int().nonnegative()),top_sharers:c.array(Uke)}),Fke=c.object({windows:c.array(Bke)}),Gke=c.object({quoted_text:c.string().min(1),comment:c.string().nullable(),type:c.enum(["comment","highlight:trapdoor"])}),jke=aW,Hke=iW.extend({comment_thread_id:c.string().min(1)}),Vke=c.object({markdown:c.string().min(1)}),qke=c.object({storage_url:c.string().min(1),thread_file_id:c.string().min(1),parsed_plan_block:W7,critiqued_plan_block:W7,annotations:c.array(Gke),comment_threads:c.array(jke),comments:c.array(Hke)}),od=c.enum(ax),_W=c.object({skills:c.boolean(),workspace_scope:c.boolean(),review:c.boolean(),shared_thread_ttl_days:c.number().int().positive().nullable()}),fx=c.object({subject_type:c.enum(["user","organization"]),subject_id:c.string().min(1),effective_plan:od,admin_override:od.nullable(),stripe_subscription_status:c.string().nullable(),cancel_at_period_end:c.boolean(),current_period_end:c.string().nullable(),seat_quantity:c.number().int().positive(),member_count:c.number().int().nonnegative().nullable(),features:_W}),$ke=c.object({effective_plan:od,features:_W,user:fx,organization:fx.nullable()}),zke=c.object({plan:c.enum(["creator","team"]),seat_quantity:c.number().int().positive().optional()}),Yke=c.object({checkout_url:c.string().min(1)}),Wke=c.object({portal_url:c.string().min(1)}),Kke=c.object({seat_quantity:c.number().int().positive()}),X7=c.object({plan:od.nullable()}),d0=c.object({subject_type:c.enum(["user","organization"]),subject_id:c.string().min(1),label:c.string().min(1),effective_plan:od,admin_override:od.nullable(),stripe_subscription_status:c.string().nullable(),seat_quantity:c.number().int().positive()}),Qke=c.object({users:c.array(d0),organizations:c.array(d0)}),Jke=c.object({id:c.string().min(1),display_name:c.string().min(1),handle:c.string().nullable(),avatar_url:c.string().nullable()}),Xke=c.object({thread_id:c.string().min(1),title:c.string().min(1),author:Jke,last_active_at:c.string().datetime(),last_block_excerpt:c.string().nullable(),last_block_kind:c.string().min(1).nullable(),is_streaming:c.boolean()}),Zke=c.object({type:c.literal("list"),list_type:c.literal("live_thread"),objects:c.array(Xke)}),eLe=c.object({thread_id:c.string().min(1)}),tLe=c.object({thread_id:c.string().min(1),last_seen_at:c.string().datetime(),started_at:c.string().datetime()}),nLe=c.object({follower_id:c.string().min(1),followee_id:c.string().min(1),is_following:c.literal(!0),follower_count:c.number().int().nonnegative()}),rLe=c.object({follower_id:c.string().min(1),followee_id:c.string().min(1),is_following:c.literal(!1),follower_count:c.number().int().nonnegative()}),hW=c.object({id:c.string().min(1),display_name:c.string().min(1),handle:c.string().nullable(),avatar_url:c.string().nullable(),bio:c.string().max(280).nullable(),is_following:c.boolean(),is_self:c.boolean()}),Z7=c.object({type:c.literal("list"),list_type:c.literal("user_follow"),objects:c.array(hW)}),oLe=c.object({date:c.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:c.number().int().nonnegative()}),sLe=c.object({window_start:c.string().datetime(),window_end:c.string().datetime(),total_contributions:c.number().int().nonnegative(),days_active:c.number().int().nonnegative(),daily_average:c.number().nonnegative(),current_streak_days:c.number().int().nonnegative(),days:c.array(oLe)}),iLe=c.object({type:c.literal("thread_created"),occurred_at:c.string().datetime(),id:c.string().min(1),thread:c.object({id:c.string().min(1),title:c.string(),visibility:c.enum(["private","workspace","public"])})}),aLe=c.object({type:c.literal("comment_posted"),occurred_at:c.string().datetime(),id:c.string().min(1),comment_excerpt:c.string(),thread:c.object({id:c.string().min(1),title:c.string(),visibility:c.enum(["private","workspace","public"])})}),uLe=c.object({type:c.literal("project_published"),occurred_at:c.string().datetime(),id:c.string().min(1),project:c.object({id:c.string().min(1),name:c.string().min(1)})}),cLe=c.object({type:c.literal("user_followed"),occurred_at:c.string().datetime(),id:c.string().min(1),followee:hW}),lLe=c.discriminatedUnion("type",[iLe,aLe,uLe,cLe]),dLe=c.object({type:c.literal("list"),list_type:c.literal("user_activity"),objects:c.array(lLe)}),pLe=c.object({id:c.string().min(1),name:c.string().min(1),excerpt:c.string(),published_at:c.string().datetime(),updated_at:c.string().datetime()}),fLe=c.object({type:c.literal("list"),list_type:c.literal("profile_published_project"),objects:c.array(pLe)}),eW=c.object({id:c.string().min(1),published_at:c.string().datetime().nullable()}),mLe=c.enum(["avatar","banner"]),gW=c.enum(["image/png","image/jpeg","image/webp","image/gif"]),_Le=c.object({kind:mLe,content_type:gW,base64_data:c.string().min(1)}),hLe=c.object({substrate:c.enum(["s3","filesystem"]),storage_url:c.string().min(1)}),gLe=c.object({content_type:gW,base64_data:c.string().min(1)}),TLe=c.object({cover_status:_x,cover_url:c.string().min(1),cover_url_expires_at:c.string().min(1),cover_generated_at:c.string().min(1)}),ELe=nW,TW=OMe.router({health:{method:"GET",path:"/health",responses:{200:c.object({status:c.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:c.object({authorization:c.string().min(1).optional(),"x-lore-referral-token":c.string().min(1).max(16).optional()}),responses:{200:MMe,401:A},summary:"Validate a WorkOS Bearer token and return member plus user fields"},getCliAuthConfig:{method:"GET",path:"/cli-auth/config",responses:{200:vMe,503:A},summary:"Return public WorkOS CLI Auth configuration for the Lore CLI"},getCliStatus:{method:"GET",path:"/users/me/cli-status",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Eve,401:A},summary:"Return whether the viewer has connected the Lore CLI (i.e., uploaded any thread under a non-unspecified harness), plus the latest upload timestamp."},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:c.object({authorization:c.string().min(1).optional()}),body:eLe,responses:{200:tLe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Zke,401:A,403:A},summary:"List members with user-block activity in the last 10 minutes. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:c.object({authorization:c.string().min(1).optional()}),query:lke,responses:{200:Q7,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:rd,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Q7,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},getThreadRemixBrief:{method:"GET",path:"/threads/:id/remix",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:zve,401:A,403:A,404:A},summary:"Fetch a portable handoff brief that lets another agent continue this thread"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),query:cke,responses:{200:uW,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:XMe,responses:{201:ZMe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1),commentThreadId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:nve,responses:{201:rve,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1),commentThreadId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:ive,responses:{200:ave,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:mke,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:c.object({name:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:hke,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},getSkillRaw:{method:"GET",path:"/skills/:name/raw",pathParams:c.object({name:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:c.string(),401:A,403:A,404:A},summary:"Raw SKILL.md body for a skill (download / install path)"},publishSkill:{method:"PUT",path:"/skills/:name",pathParams:c.object({name:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:gke,responses:{200:Tke,401:A,403:A,422:A},summary:"Publish or capture a skill body for the caller\u2019s workspace"},mintSkillShare:{method:"POST",path:"/skills/:name/share",pathParams:c.object({name:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:Eke,401:A,403:A,404:A},summary:"Mint (or rotate) a public share token for a skill"},revokeSkillShare:{method:"DELETE",path:"/skills/:name/share",pathParams:c.object({name:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{204:c.null(),401:A,403:A,404:A},summary:"Revoke an active share token for a skill"},getSharedSkill:{method:"GET",path:"/shared-skills/:token",pathParams:c.object({token:c.string().min(1)}),responses:{200:Ske,404:A},summary:"Read a shared skill by its public share token (no auth)"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:dke,responses:{200:tm,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:Ake,responses:{200:tm,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:tm,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{204:c.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:c.object({threadId:c.string().min(1),blockId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Rke,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:$ve,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:Xve,responses:{200:rd,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{204:c.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:c.object({cover_status:_x,how_to_status:dW}),401:A,403:A,404:A,429:A.extend({retry_after_seconds:c.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:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:gLe,responses:{200:TLe,401:A,403:A,404:A,413:A,422:A},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:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:Ove,responses:{200:K7,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:K7,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:c.object({threadId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Nve,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:c.object({threadId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:xve,responses:{201:Pve,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:c.object({threadId:c.string().min(1),commentId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:Mve,responses:{200:vve,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:c.object({threadId:c.string().min(1),commentId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:kve,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:c.object({id:c.string().min(1)}),responses:{200:Zve,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:c.object({authorization:c.string().min(1).optional()}),body:VMe,responses:{201:px,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:nW,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:c.object({authorization:c.string().min(1).optional()}),body:kMe,responses:{200:px,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:c.object({handle:tW}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:ELe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),query:c.object({limit:c.coerce.number().int().positive().max(100).optional()}),responses:{200:dLe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:sLe,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Z7,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Z7,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:nLe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:rLe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:fLe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:eW,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:eW,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:c.object({authorization:c.string().min(1).optional()}),body:_Le,responses:{200:hLe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:wMe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:c.object({authorization:c.string().min(1).optional()}),body:DMe,responses:{201:UMe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via WorkOS AuthKit"},ensureWorkOSOrganization:{method:"POST",path:"/organization/workos/ensure",headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{200:BMe,401:A,422:A,503:A},summary:"Create or reuse a WorkOS organization for the authenticated user\u2019s non-public email domain and add the user as a member."},listRepositories:{method:"GET",path:"/repositories",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:gve,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:c.object({authorization:c.string().min(1).optional()}),body:$Me,responses:{201:pve,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:cve,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:QMe,responses:{201:JMe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:c.object({id:c.string().min(1),threadId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:eve,responses:{201:tve,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:c.object({id:c.string().min(1),threadId:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:ove,responses:{200:sve,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:c.object({authorization:c.string().min(1).optional()}),query:dve,responses:{200:lve,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:c.object({authorization:c.string().min(1).optional()}),query:mve,responses:{200:fve,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:uke,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({thread_files:c.array(yve).nonempty()}),responses:{201:Jve,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({thread_files:c.array(Yve).nonempty()}),responses:{200:Kve,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Ike,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Cke,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",query:xke,headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:vke,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:c.object({authorization:c.string().min(1).optional()}),query:wke,responses:{200:Lke,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminForceFollow:{method:"POST",path:"/admin/connections/follow",headers:c.object({authorization:c.string().min(1).optional()}),body:Pke,responses:{200:Mke,401:A,403:A,404:A,422:A},summary:"Force follower->followee edge. Admin-only and non-destructive."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{204:c.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listCardFeed:{method:"GET",path:"/cards/feed",query:c.object({limit:c.coerce.number().int().min(1).max(48).optional()}),responses:{200:Vve},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:c.object({authorization:c.string().min(1).optional()}),query:ske,responses:{200:oke},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:ike},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:FMe,responses:{201:GMe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({}).optional(),responses:{201:J7,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:c.object({token:c.string().min(1).max(16)}),query:Dke,responses:{200:J7,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Fke,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:c.object({authorization:c.string().min(1).optional()}),body:Vke,responses:{200:qke,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:$ke,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:c.object({authorization:c.string().min(1).optional()}),body:zke,responses:{200:Yke,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:c.object({authorization:c.string().min(1).optional()}),body:c.object({subject_type:c.enum(["user","organization"]).default("user")}).optional(),responses:{200:Wke,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:c.object({authorization:c.string().min(1).optional()}),body:Kke,responses:{200:fx,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:c.object({authorization:c.string().min(1).optional()}),responses:{200:Qke,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:X7,responses:{200:d0,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:c.object({id:c.string().min(1)}),headers:c.object({authorization:c.string().min(1).optional()}),body:X7,responses:{200:d0,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:j7,docs:F7,mentions:H7,favorites:$7,search:Y7},{pathPrefix:"/api"});import om from"node:fs";import AW from"node:path";import EW from"node:os";import Ps from"node:path";function oo(){let t=Ve()==="dev"?".lore-dev":".lore";return Ps.join(EW.homedir(),t)}function nm(){return Ps.join(oo(),"log.txt")}function gx(){return Ps.join(oo(),"sync_state.json")}function SW(){return Ps.join(oo(),"upload_filters.json")}function f0(){return Ps.join(oo(),"status.json")}function Su(){return Ps.join(oo(),"install_source.json")}function m0(){return Ps.join(oo(),"skill_sync_state.json")}function Au(){return Ps.join(oo(),"bin","lore")}function rm(){let t=Ve();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function sd(){return Ps.join(EW.homedir(),"Library","LaunchAgents",`${rm()}.plist`)}function _0(){return AW.join(oo(),"token")}function sm(){let t;try{t=om.readFileSync(_0(),"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||SLe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function fn(){return sm().token}function yW(){return om.existsSync(_0())}function bW(t){let e=_0();om.mkdirSync(AW.dirname(e),{recursive:!0,mode:448}),om.writeFileSync(e,t,{mode:384})}function RW(){try{om.rmSync(_0())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function Tx(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 SLe(t,e){let n;try{n=Tx(t)}catch{return!1}return typeof n.exp!="number"?!1:e.getTime()>=n.exp*1e3}var ALe={dev:"http://localhost:4000",prod:"https://lore-api.tanagram.ai"};function yLe(t=Ve(),e=process.env.LORE_API_ORIGIN){let n=e?.trim();return n?n.replace(/\/$/,""):ALe[t]}function Xe(t={}){let e=t.token??fn();return ix(TW,{baseUrl:yLe(),baseHeaders:{"User-Agent":_7(),...e?{authorization:`Bearer ${e}`}:{}}})}import OW from"node:fs";var IW=null;function bLe(){let t=oo();IW!==t&&(OW.mkdirSync(t,{recursive:!0}),IW=t)}function RLe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function ILe(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}=${RLe(i)}`).join(" ");return o?`${r} ${o}
|
|
@@ -107,7 +107,7 @@ set -eu
|
|
|
107
107
|
cd ${JP(e)}
|
|
108
108
|
exec ${JP(n)} ${JP(t)} "$@"
|
|
109
109
|
`}function JP(t){return`'${t.replaceAll("'","'\\''")}'`}async function DQ(t){await vW({package_manager:bx(t),binary_path:t,updated_at:new Date().toISOString()})}async function UQ(){try{await W0("bootout",ZP(),sd())}catch(t){if(t1(t)||!(await FQ().catch(()=>({loaded:!0}))).loaded)return;throw t}}async function BQ(t){await W0("bootstrap",ZP(),t)}async function XP(){await W0("kickstart","-k",GQ())}async function Q2e(t){try{await XP();return}catch(e){if(!t1(e))throw e}await BQ(t),await XP()}async function FQ(){try{let t=await W0("print",GQ());return J2e(t)}catch(t){if(t1(t))return{loaded:!1,running:!1,pid:0,raw:""};throw t}}function J2e(t){let e={loaded:t.trim().length>0,running:!1,pid:0,raw:t},n;for(let r of t.split(`
|
|
110
|
-
`)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function W0(...t){try{let e=await V2e("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(tUe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function X2e(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function Z2e(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+q2e>=e.getTime()}function ZP(){return`gui/${process.getuid?.()??j2e.userInfo().uid}`}function GQ(){return`${ZP()}/${rm()}`}function eUe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(ws.delimiter)??[],...t].filter(Boolean))).join(ws.delimiter)}async function jQ(t){try{return await qn.stat(t),!0}catch{return!1}}function Y0(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function e1(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function t1(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function tUe(t){return t instanceof Error}var rUe=5*60*1e3,oUe="urn:ietf:params:oauth:grant-type:device_code",HQ=t=>new Promise(e=>setTimeout(e,t));async function VQ(t){try{return await t.json()}catch{throw new Error(`WorkOS returned an invalid JSON response: HTTP ${t.status}`)}}function qQ(t){return[t.error_description,t.error].find(e=>typeof e=="string"&&e.length>0)??"Authorization failed"}function $Q(t,e){return new URL(e,t).toString()}async function sUe({clientId:t,workosApiOrigin:e}){let n=await fetch($Q(e,"/user_management/authorize/device"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t})}),r=await VQ(n);if(!n.ok)throw new Error(qQ(r));return r}async function iUe({clientId:t,deviceCode:e,expiresIn:n,interval:r,timeoutMs:o,workosApiOrigin:s}){let i=AbortSignal.timeout(Math.min(o,n*1e3)),a=r;for(;;){let u;try{u=await fetch($Q(s,"/user_management/authenticate"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:oUe,device_code:e,client_id:t}),signal:i})}catch(p){throw p instanceof Error&&p.name==="TimeoutError"?new Error("authorization timed out"):p}let l=await VQ(u);if(u.ok)return l;let d=l;switch(d.error){case"authorization_pending":await HQ(a*1e3);break;case"slow_down":a+=1,await HQ(a*1e3);break;case"access_denied":throw new Error("Authorization denied");case"expired_token":throw new Error("Authorization expired");default:throw new Error(qQ(d))}}}async function aUe(t){let{command:e,args:n}=uUe(process.platform,t);await new Promise((r,o)=>{let s=nUe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function uUe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function cUe(t){if(sm().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function lUe(t,e){if(e==="darwin")try{let{plistPath:n,binaryPath:r}=await t();console.log(" Lore background uploads enabled."),console.log(` LaunchAgent: ${n}`),console.log(` Stable binary: ${r}
|
|
110
|
+
`)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function W0(...t){try{let e=await V2e("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(tUe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function X2e(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function Z2e(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+q2e>=e.getTime()}function ZP(){return`gui/${process.getuid?.()??j2e.userInfo().uid}`}function GQ(){return`${ZP()}/${rm()}`}function eUe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(ws.delimiter)??[],...t].filter(Boolean))).join(ws.delimiter)}async function jQ(t){try{return await qn.stat(t),!0}catch{return!1}}function Y0(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function e1(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function t1(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function tUe(t){return t instanceof Error}var rUe=5*60*1e3,oUe="urn:ietf:params:oauth:grant-type:device_code",HQ=t=>new Promise(e=>setTimeout(e,t));async function VQ(t){try{return await t.json()}catch{throw new Error(`WorkOS returned an invalid JSON response: HTTP ${t.status}`)}}function qQ(t){return[t.error_description,t.error].find(e=>typeof e=="string"&&e.length>0)??"Authorization failed"}function $Q(t,e){return new URL(e,t).toString()}async function sUe({clientId:t,workosApiOrigin:e}){let n=await fetch($Q(e,"/user_management/authorize/device"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t})}),r=await VQ(n);if(!n.ok)throw new Error(qQ(r));return r}async function iUe({clientId:t,deviceCode:e,expiresIn:n,interval:r,timeoutMs:o,workosApiOrigin:s}){let i=AbortSignal.timeout(Math.min(o,n*1e3)),a=r;for(;;){let u;try{u=await fetch($Q(s,"/user_management/authenticate"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:oUe,device_code:e,client_id:t}),signal:i})}catch(p){throw p instanceof Error&&p.name==="TimeoutError"?new Error("authorization timed out"):p}let l=await VQ(u);if(u.ok)return l;let d=l;switch(d.error){case"authorization_pending":await HQ(a*1e3);break;case"slow_down":a+=1,await HQ(a*1e3);break;case"access_denied":throw new Error("Authorization denied");case"expired_token":throw new Error("Authorization expired");default:throw new Error(qQ(d))}}}async function aUe(t){let{command:e,args:n}=uUe(process.platform,t);await new Promise((r,o)=>{let s=nUe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function uUe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function cUe(t){if(sm().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function lUe(t,e){if(e==="darwin")try{console.log(" Enabling Lore background uploads automatically (this can take about 2 minutes)..."),console.log(" Please keep this terminal open and do not cancel.");let{plistPath:n,binaryPath:r}=await t();console.log(" Lore background uploads enabled."),console.log(` LaunchAgent: ${n}`),console.log(` Stable binary: ${r}
|
|
111
111
|
`)}catch(n){ie.warn("auto_enable_failed",{error:n instanceof Error?n.message:String(n)}),console.log(` Could not enable background uploads automatically. Run 'lore enable' to retry.
|
|
112
112
|
`)}}async function dUe({client:t=Xe(),enableLaunchAgent:e=Tm,openBrowser:n=aUe,platform:r=process.platform,pollForTokens:o=iUe,requestDeviceAuthorization:s=sUe,setAccessToken:i=bW,timeoutMs:a=rUe}={}){if(await cUe(t)){console.log(`
|
|
113
113
|
Already logged in. Use 'lore logout' if you want to sign out.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanagram/lore",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"description": "Lore CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"esbuild": "^0.24.0",
|
|
22
22
|
"tsx": "^4.20.6",
|
|
23
23
|
"typescript": "^5.9.3",
|
|
24
|
-
"@lore/
|
|
25
|
-
"@lore/
|
|
24
|
+
"@lore/transcripts": "0.1.0",
|
|
25
|
+
"@lore/contracts": "0.1.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@sentry/node": "^10.47.0",
|