@linzumi/cli 1.0.245 → 1.0.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/impl-res/cloud-supervisor.mjs +11 -11
- package/dist/impl-res/index.js +260 -260
- package/dist/impl-ts/cloud-supervisor.mjs +11 -11
- package/dist/impl-ts/index.js +448 -448
- package/package.json +1 -1
|
@@ -33,14 +33,14 @@ var KE=Object.create;var tc=Object.defineProperty;var JE=Object.getOwnPropertyDe
|
|
|
33
33
|
`):e.streamInput(n).catch(r=>i.abort(r))}async function tl(e){for(let t=0;;t++)try{return await aj(e,{recursive:!0,force:!0})}catch(n){if(t>=4||!P8.has(Pt(n)??""))return;await dl((t+1)*100)}}function E8(e,t){e.waitForExit().catch(()=>{}).finally(()=>tl(t))}function R8({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore){let{queryInstance:o,transport:a,abortController:s,processEnv:d}=rm({...t},typeof e=="string",void 0,!0),u=ja(t.cwd??"."),l=t.sessionStore,p=t.loadTimeoutMs??6e4,m=t.resume;return(async()=>{if(m||(m=(await Jr(l.listSessions(_n(u)),p,`SessionStore.listSessions() timed out after ${p}ms`)).slice().sort((f,h)=>h.mtime-f.mtime)[0]?.sessionId),!!m)return nE(l,m,u,t.env,t.loadTimeoutMs)})().then(f=>{if(f){a.updateResume(m);let h={CLAUDE_CONFIG_DIR:f};if(process.platform==="win32"){let y=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";h.CLAUDE_SECURESTORAGE_CONFIG_DIR=y,d.CLAUDE_SECURESTORAGE_CONFIG_DIR=y}a.updateEnv(h),d.CLAUDE_CONFIG_DIR=f,o.addCleanupCallback(()=>E8(a,f))}o.isClosed()||a.spawn()}).catch(f=>{let h=gs(f);a.spawnAbort(h),o.setError(h)}),im(o,a,e,s),o}let{queryInstance:n,transport:i,abortController:r}=rm(t,typeof e=="string");return im(n,i,e,r),n}async function O8({options:e,initializeTimeoutMs:t=6e4}={}){let n,i=e?.resume;if((i||e?.continue)&&e?.sessionStore){let s=ja(e.cwd??".");if(!i){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let d=e.loadTimeoutMs??6e4;i=(await Jr(e.sessionStore.listSessions(_n(s)),d,`SessionStore.listSessions() timed out after ${d}ms`)).slice().sort((u,l)=>l.mtime-u.mtime)[0]?.sessionId}i&&(n=await nE(e.sessionStore,i,s,e.env,e.loadTimeoutMs))}let r,o,a;try{let s=function(){m||(m=!0,p.close())},d=rm(n&&i&&i!==e?.resume?{...e,resume:i}:e,!1,n);r=d.queryInstance;let{transport:u,abortController:l}=d;o=u;let p=d.queryInstance;if(n){let f=n;p.addCleanupCallback(()=>{a=u.waitForExit().catch(()=>{}).then(()=>tl(f))})}await Jr(p.initializationResult(),t,`Subprocess initialization did not complete within ${t}ms \u2014 check authentication and network connectivity`);let m=!1;return{query(f){if(m)throw Error("WarmQuery.query() can only be called once");m=!0;try{im(p,u,f,l)}catch(h){throw p.close(),h}return typeof f=="string"&&p.setIsSingleUserTurn(!0),p},close:s,async[Symbol.asyncDispose](){m=!0,p.close(),await a}}}catch(s){if(r?.close(),n&&!a){let d=o;a=(d?d.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>tl(n))}throw await a,s}}async function A8(e,t){return t?.sessionStore?J8(t.sessionStore,e,t):TB(e,t)}async function $8(e){return e?.sessionStore?B8(e.sessionStore,e):jB(e)}async function M8(e,t){return t?.sessionStore?W8(t.sessionStore,e,t):NB(e,t)}async function j8(e,t,n){return n?.sessionStore?H8(n.sessionStore,e,t,n.dir):LB(e,t,n)}async function N8(e,t,n){return n?.sessionStore?G8(n.sessionStore,e,t,n.dir):UB(e,t,n)}async function q8(e,t){if(!ot(e))throw new In(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let n=_n(t.dir);await t.sessionStore.delete({projectKey:n,sessionId:e});return}return FB(e,t)}async function D8(e,t){return t?.sessionStore?V8(t.sessionStore,e,t):HB(e,t)}async function L8(e,t,n){if(!ot(e))throw new In(`Invalid sessionId: ${e}`,"importSessionToStore: invalid sessionId (must be a UUID)");let i=await bl(e,n?.dir);if(!i)throw Error(`Session ${e} not found`);let r=_n(n?.dir),o=n?.batchSize&&n.batchSize>0?n.batchSize:Fm;if(await PS(i.filePath,{projectKey:r,sessionId:e},t,o),n?.includeSubagents===!1)return;let a=i.filePath.replace(/\.jsonl$/,""),s=Gt(a,"subagents");for(let d of await U8(s)){let u=YS(a,d).split(hm);u[u.length-1]=u.at(-1).replace(/\.jsonl$/,"");let l={projectKey:r,sessionId:e,subpath:u.join("/")};await PS(d,l,t,o);let p=d.replace(/\.jsonl$/,".meta.json");try{let m=An(await VS(p,"utf8"));await t.append(l,[{type:"agent_metadata",...m}])}catch(m){if(!vo(m))throw m}}}async function PS(e,t,n,i){let r=uj({input:nj(e,{encoding:"utf8"}),crlfDelay:1/0}),o=[],a=0;for await(let s of r)s&&(o.push(An(s)),a+=s.length,(o.length>=i||a>=zm)&&(await n.append(t,o),o=[],a=0));o.length>0&&await n.append(t,o)}async function U8(e){let t=[];async function n(i){let r;try{r=await oj(i,{withFileTypes:!0})}catch{return}for(let o of r){let a=Gt(i,o.name);o.isDirectory()?await n(a):o.isFile()&&o.name.endsWith(".jsonl")&&t.push(a)}}return await n(e),t}async function F8(e,t){return t?.sessionStore?Z8(t.sessionStore,e,t.dir):eK(e,t)}async function z8(e,t,n){return n?.sessionStore?Q8(n.sessionStore,e,t,n):tK(e,t,n)}function rE(e){let t=ja(e??"."),n;try{n=rj(t)}catch{n=t}return Ki(n)}function _n(e){return vs(rE(e))}function iE(e){return e.map(t=>ut(t)).join(`
|
|
34
34
|
`)+`
|
|
35
35
|
`}function ES(e,t,n){return t!==void 0&&t>0?e.slice(n,n+t):n>0?e.slice(n):e}function om(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function B8(e,t){let n=rE(t.dir),i=vs(n),r=t.offset??0,o=t.limit;if(e.listSessionSummaries){let d=await e.listSessionSummaries(i),u=e.listSessions?new Map((await e.listSessions(i)).map(f=>[f.sessionId,f])):void 0,l=[];for(let f of d){let h=u?.get(f.sessionId);if(u&&!h)continue;let y=h!==void 0&&f.mtime<h.mtime;l.push({sessionId:f.sessionId,mtime:y?h.mtime:f.mtime,info:y?void 0:Cj(f,n)})}if(u){let f=new Set(d.map(h=>h.sessionId));for(let[h,y]of u)f.has(h)||l.push({sessionId:h,mtime:y.mtime})}else Ne("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");l.sort((f,h)=>h.mtime-f.mtime);let p=ES(l,o,r),m=p.filter(f=>f.info===void 0);if(m.length>0){let f=await RS(e,m,t.dir,n),h=new Map(f.map(y=>[y.sessionId,y]));for(let y of p)y.info===void 0&&(y.info=h.get(y.sessionId)??null)}return p.flatMap(f=>f.info?[f.info]:[])}if(!e.listSessions)throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");let a=(await e.listSessions(i)).slice().sort((d,u)=>u.mtime-d.mtime),s=ES(a,o,r);return RS(e,s,t.dir,n)}async function RS(e,t,n,i){return(await Promise.allSettled(t.map(async r=>{let o=await aE(e,r.sessionId,n);if(!o)return null;let a=wl(r.sessionId,oE(o,r.mtime),i);return a?{...a,lastModified:r.mtime}:null}))).flatMap((r,o)=>{let a=t[o];return r.status==="fulfilled"?r.value?[r.value]:[]:[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function oE(e,t){let n=Buffer.from(e,"utf-8"),i=n.length,r=n.subarray(0,nr).toString("utf-8"),o=i>nr?n.subarray(i-nr).toString("utf-8"):r;return{mtime:t,size:i,head:r,tail:o}}function K8(e){let t=e.trimEnd(),n=t.slice(t.lastIndexOf(`
|
|
36
|
-
`)+1);try{let i=An(n);if(typeof i=="object"&&i!==null&&"timestamp"in i&&typeof i.timestamp=="string"){let r=Date.parse(i.timestamp);if(!Number.isNaN(r))return r}}catch{}return Date.now()}async function aE(e,t,n){let i=_n(n),r=await e.load({projectKey:i,sessionId:t});return!r||r.length===0?null:iE(r)}async function J8(e,t,n){if(!ot(t))return[];let i=_n(n.dir),r=await e.load({projectKey:i,sessionId:t});return!r||r.length===0?[]:CB(r,{limit:n.limit,offset:n.offset,includeSystemMessages:n.includeSystemMessages})}async function W8(e,t,n){if(!ot(t))return;let i=await aE(e,t,n.dir);if(!i)return;let r=oE(i,K8(i));return wl(t,r)??void 0}async function H8(e,t,n,i){if(!ot(t))throw new In(`Invalid sessionId: ${t}`,"renameSession: invalid sessionId (must be a UUID)");if(!n.trim())throw Error("title must be non-empty");let r=_n(i);await e.append({projectKey:r,sessionId:t},[{type:"custom-title",customTitle:n.trim(),sessionId:t,uuid:mm(),timestamp:new Date().toISOString()}])}async function G8(e,t,n,i){if(!ot(t))throw new In(`Invalid sessionId: ${t}`,"tagSession: invalid sessionId (must be a UUID)");if(n!==null){let o=Aa(n).trim();if(!o)throw Error("tag must be non-empty (use null to clear)");n=o}let r=_n(i);await e.append({projectKey:r,sessionId:t},[{type:"tag",tag:n??"",sessionId:t,uuid:mm(),timestamp:new Date().toISOString()}])}async function V8(e,t,n){if(!ot(t))throw new In(`Invalid sessionId: ${t}`,"forkSession: invalid sessionId (must be a UUID)");if(n.upToMessageId&&!ot(n.upToMessageId))throw new In(`Invalid upToMessageId: ${n.upToMessageId}`,"forkSession: invalid upToMessageId (must be a UUID)");let i=_n(n.dir),r=await e.load({projectKey:i,sessionId:t});if(!r||r.length===0)throw Error(`Session ${t} not found`);let{entries:o,forkedSessionId:a}=VB(r,t,n);return await e.append({projectKey:i,sessionId:a},o),{sessionId:a}}async function Z8(e,t,n){if(!ot(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let i=_n(n),r=await e.listSubkeys({projectKey:i,sessionId:t}),o=new Set;for(let a of r){if(!a.startsWith("subagents/"))continue;let s=a.split("/").at(-1);s.startsWith("agent-")&&o.add(s.slice(6))}return[...o]}async function Q8(e,t,n,i){if(!ot(t))return[];if(!n)return[];let r=_n(i.dir),o=`subagents/agent-${n}`;if(e.listSubkeys){let l=await e.listSubkeys({projectKey:r,sessionId:t}),p=`agent-${n}`,m=l.find(f=>f.startsWith("subagents/")&&f.split("/").at(-1)===p);if(!m)return[];o=m}let a=await e.load({projectKey:r,sessionId:t,subpath:o});if(!a||a.length===0)return[];let s=a.findLast(om),d=typeof s?.toolUseId=="string"?s.toolUseId:void 0,u=a.filter(l=>!om(l));return u.length===0?[]:Ex(Buffer.from(iE(u)),{limit:i.limit,offset:i.offset},d)}function OS(e,t){let n=YS(t,e),i=n.split(hm);if(i[0]===".."||QS(n)||i.length<2)return null;let r=i[0],o=i[1];if(i.length===2&&o.endsWith(".jsonl"))return{projectKey:r,sessionId:o.replace(/\.jsonl$/,"")};if(i.length>=4){let a=i.slice(2),s=a.length-1;return a[s]=a.at(-1).replace(/\.jsonl$/,""),{projectKey:r,sessionId:o,subpath:a.join("/")}}return null}var _M,vM,Np,bM,wM,kM,xM,am,z,CM,zn,IM,PM,EM,Xe,et,RM,OM,AM,AS,$M,fo,MM,sm,jM,mo,NM,qM,$S,nl,DM,MS,LM,jS,UM,rl,NS,dm,um,qS,lm,DS,LS,FM,US,zM,BM,KM,JM,WM,HM,GM,VM,ZM,QM,YM,XM,e1,t1,n1,r1,i1,o1,Md,Mv,Te,Ae,Tr,il,a1,FS,zS,jd,s1,On,d1,u1,BS,l1,ol,al,cm,sl,pm,c1,KS,p1,f1,m1,h1,g1,y1,_1,v1,b1,w1,S1,k1,x1,C1,T1,fm,I1,P1,E1,R1,JS,WS,O1,A1,$1,M1,j1,HS,N1,q1,D1,L1,U1,F1,z1,B1,K1,J1,W1,H1,G1,V1,Z1,Q1,GS,Y1,X1,ej,pj,Voe,ul,bj,wj,Sj,kj,xj,Lp,Mt,Uv,Ej,Rj,nk,Oj,Aj,Bn,$j,Dn,rk,Mj,jj,Qo,qj,Dj,Lj,Fj,zj,Bj,Fv,ri,Ln,Wj,Hj,Gj,Vj,ym,Qj,np,zv,Xj,eN,tN,ii,rN,iN,oN,aN,sN,dN,uN,cN,fN,oi,hN,Na,yN,vN,bN,wN,SN,xN,CN,TN,PN,EN,ON,Bv,$N,hs,ll,NN,qN,LN,FN,BN,JN,cl,WN,qa,GN,ZN,pl,XN,tq,rq,oq,fl,aq,vt,_o,rae,ik,Up,me,Rt,Qt,Ji,Dd,Ld,Ud,Fd,zd,Bd,Kd,Jd,Wd,uq,lq,Fp,Kv,pq,ok,fq,yr,mq,gq,Wv,Hv,Gv,vm,bq,Sq,kq,dk,Hd,xq,Cq,wm,Tq,Vv,rp,Iq,Fe,Bp,Ue,Zv,Qv,Gd,Xv,Rq,eb,zr,fk,Oq,Aq,$q,km,Mq,hk,Wt,Ht,Vr,Yo,Zr,Kp,ba,Vd,od,Zd,Jp,Qr,xt,vk,bk,xm,nb,Gq,Vq,Wp,wk,Zq,Qq,Ge,Sk,H,rb,tD,de,Qd,Ea,Yd,Xd,eu,tu,La,nu,ru,Wi,iu,ou,Tk,iD,Oi,oD,aD,Ek,an,lr,ki,Xo,ad,ea,ta,sd,na,Qn,ra,dd,ud,Dr,ld,cd,ia,ip,ob,pd,op,ap,sp,ab,sb,Gp,au,sD,dD,oa,xi,Lr,ct,$t,Jt,tr,cr,aa,ub,Vp,su,cb,lD,Yr,du,uu,Hi,lu,Ua,cu,Fa,Nt,pu,sn,pr,Ci,sa,fd,da,ua,md,la,Yn,ca,hd,gd,Ur,yd,_d,pa,dp,mb,up,lp,cp,pp,hb,gb,Zp,fu,za,_b,pD,mu,Qp,Cm,Ad,Ak,fD,mD,it,Gi,In,hD,ED,RD,OD,AD,lae,jD,Yp,qD,Hr,Ti,UD,zD,KD,WD,HD,VD,Ra,ZD,gu,Tm,YD,XD,jk,nL,iL,kr,aL,xb,Nk,dL,uL,lL,Ba,cL,mn,wa,fL,qk,Cb,mL,Tb,hL,gL,Ka,yL,_L,hl,bL,Im,SL,kL,xL,CL,TL,IL,PL,EL,RL,OL,AL,$L,ML,jL,NL,qL,DL,LL,UL,FL,zL,BL,KL,JL,We,HL,VL,Sa,Dk,Oa,ZL,gp,QL,Xp,Ib,YL,Pm,XL,eU,Lk,nU,Em,Uk,oU,aU,sU,dU,lU,gl,Fk,mU,hU,gU,_U,Rm,ka,zk,Pb,bU,Eb,Rb,Bk,kU,CU,Kk,IU,PU,Ob,EU,Jk,Om,OU,Am,AU,$U,MU,Wk,Ab,DU,LU,ef,UU,tf,FU,nf,zU,rf,$b,BU,Mb,jb,Nb,qb,KU,JU,WU,HU,GU,Br,Db,VU,yu,QU,XU,Lb,eF,tF,rF,iF,aF,dF,uF,cF,fF,mF,hF,Hk,_F,bF,wF,SF,kF,xF,CF,TF,IF,PF,EF,RF,OF,AF,$F,Fb,yp,jF,NF,qF,DF,UF,FF,zb,Bb,vd,zF,Kb,KF,Vk,JF,WF,GF,Zk,QF,Qk,ez,tz,$m,rz,iz,Mm,az,dz,uz,lz,cz,pz,Yk,mz,Jb,Wb,hz,yz,yl,vz,ys,jm,kz,Cz,Iz,ex,Ez,Rz,Az,Nm,jz,qz,Lz,tx,nx,gae,yae,Kz,qm,vu,Zz,Qz,Yz,Xz,e2,Dm,r2,a2,d2,u2,l2,_ae,c2,vae,p2,bae,f2,wae,m2,Sae,bu,w2,Cae,S2,bd,z2,B2,G2,Yb,Iae,Q2,Xb,ax,Y2,ew,X2,e4,tw,df,r4,i4,sx,o4,dx,ux,s4,d4,fa,_p,Ai,xa,rw,ma,vp,uf,f4,Pae,m4,tt,An,v4,wu,iw,cf,Ii,Su,P4,pf,bp,ff,Fm,zm,R4,mf,ow,Pi,K4,J4,Z4,nr,Y4,eB,Wa,aB,sB,dB,xu,lB,Ha,cB,pB,dw,uw,EB,KB,oK,Ax,aK,sK,dK,tse,uK,nse,fw,lK,pK,mK,gK,Oe,mw,ae,hr,W,pn,bK,Ga,wK,bf,Ot,ye,Ta,qt,hw,gw,Zi,Cu,le,hn,yw,Ie,SK,kK,xK,CK,TK,IK,PK,EK,RK,kp,OK,AK,$K,MK,jK,NK,$x,qK,Qi,Va,Za,Qa,Ya,Xa,Yi,Xi,es,wr,Un,ts,xr,Xt,eo,Xn,wf,to,or,kf,ns,rs,xf,no,ro,io,oo,Xr,Pn,fn,ar,ao,so,is,Tu,Iu,uo,rse,Z,ise,ose,ase,sse,dse,use,lse,cse,pse,fse,mse,hse,gse,yse,KK,_se,vse,bse,wse,Sse,kse,xse,Cse,Tse,Ise,Pse,Ese,Rse,Ose,Ase,$se,Mse,jse,Nse,Nx,qx,Dx,Cr,Pu,Ee,Hm,Fx,eJ,Eu,zx,Kx,Jx,Cf,Hx,Gm,ws,Qm,Ru,Ym,Ou,Xm,Tl,eh,Il,th,Qx,Yx,Xx,e0,t0,n0,r0,uJ,i0,lo,lJ,cJ,pJ,o0,fJ,mJ,hJ,gJ,yJ,s0,d0,u0,l0,c0,nh,p0,_J,f0,m0,h0,v0,b0,w0,S0,k0,x0,C0,T0,I0,at,P0,rh,ih,E0,R0,O0,A0,$0,M0,j0,N0,q0,Ss,D0,L0,U0,F0,z0,B0,K0,J0,W0,Au,H0,ve,ks,Ke,G0,V0,Z0,Q0,Y0,X0,eC,tC,nC,rC,iC,oC,aC,sC,dC,uC,lC,cC,pC,fC,hC,gC,_C,vC,ah,bC,sh,dh,wC,SC,kC,xC,CC,$u,TC,IC,PC,uh,lh,ch,EC,RC,Pl,OC,AC,$C,MC,jC,NC,ph,qC,DC,LC,UC,FC,zC,BC,KC,fh,JC,WC,HC,GC,VC,mh,vJ,wJ,kJ,CJ,IJ,EJ,OJ,AJ,$J,MJ,NJ,DJ,UJ,zJ,KJ,WJ,GJ,ZJ,YJ,e6,n6,i6,a6,d6,l6,p6,m6,g6,_6,b6,S6,x6,T6,P6,R6,A6,$6,j6,q6,L6,F6,B6,QC,YC,ss,rr,tT,Nu,ls,pW,fW,mW,c,Qh,Yh,Xh,eg,tg,JT,yW,Cs,WT,HT,GT,VT,Pe,ng,Al,Ve,rg,qu,ir,ig,og,ag,sg,dg,ug,lg,cg,pg,fg,mg,hg,gg,yg,_g,vg,ZT,$l,wo,Ml,jl,bg,QT,YT,XT,eI,tI,nI,rI,Sg,iI,ql,kg,oI,aI,sI,Cg,dI,uI,cs,lI,cI,Tg,Pg,pI,fI,hI,Eg,_I,vI,wI,Rg,SI,xI,CI,II,Ll,fH,hH,AI,kH,$I,MI,xH,Kr,Ul,mt,jI,NI,qse,CH,TH,Ag,en,Ts,IH,bt,gn,yn,wt,Fl,qI,$w,DI,PH,$g,Cd,ge,Mg,EH,Dse,Lse,jg,RH,Ng,OH,Is,po,LI,AH,$H,MH,jH,NH,qH,UI,DH,LH,FI,qg,UH,FH,Dg,zH,Ps,Es,BH,Rs,zl,KH,Uu,Lg,Ug,Fg,Use,zg,Bg,Kg,JH,zI,BI,Jg,KI,Os,So,JI,WH,Pf,HH,Ef,GH,Wg,VH,Rf,ZH,QH,YH,XH,e9,t9,n9,r9,i9,o9,Of,a9,s9,Af,Hg,Gg,Vg,d9,u9,l9,Zg,c9,p9,f9,m9,h9,WI,$f,g9,Qg,Fse,y9,Fu,_9,zse,zu,v9,HI,b9,w9,S9,k9,x9,C9,T9,Bu,I9,P9,E9,Yg,GI,R9,O9,A9,$9,M9,j9,N9,q9,D9,L9,U9,F9,z9,B9,K9,J9,W9,H9,Ku,G9,V9,Z9,Mf,X9,eG,tG,VI,nG,Bse,Kse,Jse,Wse,Hse,Gse,fe,jf,rG,Mw,iG,oG,QI,uG,lG,mG,Tp,kn,yG,Ju,Nw,EG,RG,NG,qG,DG,LG,UG,zG,Nf,KG,JG,qf,Df,Lf,nP,zw,ZG,Uf,Ff,XG,ga,Ww,iV,un,Bf,Kf,Gw,Vw,Yse,Xse,Zw,Qw,Yw,Xw,_r,Xg,Ni,gV,yV,_V,rde,SV,Pp,xV,eS,ide,Ei,uP,Hf,lP,Wu,tS,CV,mr,cP,zi,Gf,Vf,IV,nS,Kl,Jl,ude,lde,cde,ps,pde,Zf,AV,$V,MV,NV,qV,DV,LV,mP,UV,FV,BV,Qf,WV,GV,VV,QV,rS,gP,e5,t5,n5,r5,i5,o5,s5,d5,yP,l5,p5,m5,h5,vr,y5,_P,b5,iS,S5,k5,C5,I5,P5,Ep,R5,A5,M5,N5,bP,wP,SP,D5,L5,hde,U5,Rp,F5,z5,J5,V5,oS,Yf,Xf,qi,Q5,Y5,X5,aS,Hu,t3,n3,xP,CP,r3,TP,i3,o3,a3,s3,d3,_de,ey,u3,l3,vde,bde,c3,ya,f3,m3,Gu,wde,Sde,ko,Pr,h3,g3,IP,PP,y3,_3,v3,b3,w3,S3,ty,k3,em,kde,x3,C3,EP,T3,I3,Rn,ni,dS,tm,nm,RP,ny,E3,xde,R3,O3,A3,$3,M3,OP,j3,N3,q3,D3,AP,L3,uS,U3,F3,$P,z3,B3,lS,K3,J3,MP,W3,jP,H3,G3,V3,Q3,Y3,X3,eZ,Vu,Op,NP,tZ,nZ,rZ,iZ,oZ,Cde,qP,sZ,dZ,uZ,lZ,cZ,pZ,fZ,Tde,mZ,Ide,hZ,Td,Wl,cS,UP,Pde,Ede,Zu,mS,IZ,PZ,Rde,EZ,ry,iy,RZ,hS,gS,OZ,Hl,yS,er,$Z,MZ,Ode,DZ,UZ,JZ,Mp,s8,gr,XP,eE,tE,el,_8,IS,v8,b8,w8,P8,dE=VE(()=>{_M=Object.create,{getPrototypeOf:vM,defineProperty:Np,getOwnPropertyNames:bM}=Object,wM=Object.prototype.hasOwnProperty;am=(e,t,n)=>{var i=e!=null&&typeof e=="object";if(i){var r=t?kM??=new WeakMap:xM??=new WeakMap,o=r.get(e);if(o)return o}n=e!=null?_M(vM(e)):{};let a=t||!e||!e.__esModule?Np(n,"default",{value:e,enumerable:!0}):n;for(let s of bM(e))wM.call(a,s)||Np(a,s,{get:SM.bind(e,s),enumerable:!0});return i&&r.set(e,a),a},z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),CM=e=>e;zn=(e,t)=>{for(var n in t)Np(e,n,{get:t[n],enumerable:!0,configurable:!0,set:TM.bind(t,n)})},IM=yM(import.meta.url),PM=Symbol.dispose||Symbol.for("Symbol.dispose"),EM=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Xe=(e,t,n)=>{if(t!=null){if(typeof t!="object"&&typeof t!="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(n&&(i=t[EM]),i===void 0&&(i=t[PM]),typeof i!="function")throw TypeError("Object not disposable");e.push([n,i,t])}else n&&e.push([n]);return t},et=(e,t,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(a,s,d,u){return u=Error(d),u.name="SuppressedError",u.error=a,u.suppressed=s,u},r=a=>t=n?new i(a,t,"An error was suppressed during disposal"):(n=!0,a),o=a=>{for(;a=e.pop();)try{var s=a[1]&&a[1].call(a[2]);if(a[0])return Promise.resolve(s).then(o,d=>(r(d),o()))}catch(d){r(d)}if(n)throw t};return o()},RM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e._globalThis=void 0,e._globalThis=typeof globalThis=="object"?globalThis:global}),OM=z(e=>{var t=e&&e.__createBinding||(Object.create?function(i,r,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return r[o]}})}:function(i,r,o,a){a===void 0&&(a=o),i[a]=r[o]}),n=e&&e.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(RM(),e)}),AM=z(e=>{var t=e&&e.__createBinding||(Object.create?function(i,r,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return r[o]}})}:function(i,r,o,a){a===void 0&&(a=o),i[a]=r[o]}),n=e&&e.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(OM(),e)}),AS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION="1.9.0"}),$M=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isCompatible=e._makeCompatibilityCheck=void 0;var t=AS(),n=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(r){let o=new Set([r]),a=new Set,s=r.match(n);if(!s)return()=>!1;let d={major:+s[1],minor:+s[2],patch:+s[3],prerelease:s[4]};if(d.prerelease!=null)return function(p){return p===r};function u(p){return a.add(p),!1}function l(p){return o.add(p),!0}return function(p){if(o.has(p))return!0;if(a.has(p))return!1;let m=p.match(n);if(!m)return u(p);let f={major:+m[1],minor:+m[2],patch:+m[3],prerelease:m[4]};return f.prerelease!=null||d.major!==f.major?u(p):d.major===0?d.minor===f.minor&&d.patch<=f.patch?l(p):u(p):d.minor<=f.minor?l(p):u(p)}}e._makeCompatibilityCheck=i,e.isCompatible=i(t.VERSION)}),fo=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.unregisterGlobal=e.getGlobal=e.registerGlobal=void 0;var t=AM(),n=AS(),i=$M(),r=n.VERSION.split(".")[0],o=Symbol.for(`opentelemetry.js.api.${r}`),a=t._globalThis;function s(l,p,m,f=!1){var h;let y=a[o]=(h=a[o])!==null&&h!==void 0?h:{version:n.VERSION};if(!f&&y[l]){let w=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${l}`);return m.error(w.stack||w.message),!1}if(y.version!==n.VERSION){let w=Error(`@opentelemetry/api: Registration of version v${y.version} for ${l} does not match previously registered API v${n.VERSION}`);return m.error(w.stack||w.message),!1}return y[l]=p,m.debug(`@opentelemetry/api: Registered a global for ${l} v${n.VERSION}.`),!0}e.registerGlobal=s;function d(l){var p,m;let f=(p=a[o])===null||p===void 0?void 0:p.version;if(!(!f||!(0,i.isCompatible)(f)))return(m=a[o])===null||m===void 0?void 0:m[l]}e.getGlobal=d;function u(l,p){p.debug(`@opentelemetry/api: Unregistering a global for ${l} v${n.VERSION}.`);let m=a[o];m&&delete m[l]}e.unregisterGlobal=u}),MM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagComponentLogger=void 0;var t=fo();class n{constructor(o){this._namespace=o.namespace||"DiagComponentLogger"}debug(...o){return i("debug",this._namespace,o)}error(...o){return i("error",this._namespace,o)}info(...o){return i("info",this._namespace,o)}warn(...o){return i("warn",this._namespace,o)}verbose(...o){return i("verbose",this._namespace,o)}}e.DiagComponentLogger=n;function i(r,o,a){let s=(0,t.getGlobal)("diag");if(s)return a.unshift(o),s[r](...a)}}),sm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagLogLevel=void 0;var t;(function(n){n[n.NONE=0]="NONE",n[n.ERROR=30]="ERROR",n[n.WARN=50]="WARN",n[n.INFO=60]="INFO",n[n.DEBUG=70]="DEBUG",n[n.VERBOSE=80]="VERBOSE",n[n.ALL=9999]="ALL"})(t=e.DiagLogLevel||(e.DiagLogLevel={}))}),jM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLogLevelDiagLogger=void 0;var t=sm();function n(i,r){i<t.DiagLogLevel.NONE?i=t.DiagLogLevel.NONE:i>t.DiagLogLevel.ALL&&(i=t.DiagLogLevel.ALL),r=r||{};function o(a,s){let d=r[a];return typeof d=="function"&&i>=s?d.bind(r):function(){}}return{error:o("error",t.DiagLogLevel.ERROR),warn:o("warn",t.DiagLogLevel.WARN),info:o("info",t.DiagLogLevel.INFO),debug:o("debug",t.DiagLogLevel.DEBUG),verbose:o("verbose",t.DiagLogLevel.VERBOSE)}}e.createLogLevelDiagLogger=n}),mo=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagAPI=void 0;var t=MM(),n=jM(),i=sm(),r=fo(),o="diag";class a{constructor(){function d(p){return function(...m){let f=(0,r.getGlobal)("diag");if(f)return f[p](...m)}}let u=this,l=(p,m={logLevel:i.DiagLogLevel.INFO})=>{var f,h,y;if(p===u){let v=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return u.error((f=v.stack)!==null&&f!==void 0?f:v.message),!1}typeof m=="number"&&(m={logLevel:m});let w=(0,r.getGlobal)("diag"),g=(0,n.createLogLevelDiagLogger)((h=m.logLevel)!==null&&h!==void 0?h:i.DiagLogLevel.INFO,p);if(w&&!m.suppressOverrideMessage){let v=(y=Error().stack)!==null&&y!==void 0?y:"<failed to generate stacktrace>";w.warn(`Current logger will be overwritten from ${v}`),g.warn(`Current logger will overwrite one already registered from ${v}`)}return(0,r.registerGlobal)("diag",g,u,!0)};u.setLogger=l,u.disable=()=>{(0,r.unregisterGlobal)(o,u)},u.createComponentLogger=p=>new t.DiagComponentLogger(p),u.verbose=d("verbose"),u.debug=d("debug"),u.info=d("info"),u.warn=d("warn"),u.error=d("error")}static instance(){return this._instance||(this._instance=new a),this._instance}}e.DiagAPI=a}),NM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaggageImpl=void 0;class t{constructor(i){this._entries=i?new Map(i):new Map}getEntry(i){let r=this._entries.get(i);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries()).map(([i,r])=>[i,r])}setEntry(i,r){let o=new t(this._entries);return o._entries.set(i,r),o}removeEntry(i){let r=new t(this._entries);return r._entries.delete(i),r}removeEntries(...i){let r=new t(this._entries);for(let o of i)r._entries.delete(o);return r}clear(){return new t}}e.BaggageImpl=t}),qM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.baggageEntryMetadataSymbol=void 0,e.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")}),$S=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.baggageEntryMetadataFromString=e.createBaggage=void 0;var t=mo(),n=NM(),i=qM(),r=t.DiagAPI.instance();function o(s={}){return new n.BaggageImpl(new Map(Object.entries(s)))}e.createBaggage=o;function a(s){return typeof s!="string"&&(r.error(`Cannot create baggage metadata from unknown type: ${typeof s}`),s=""),{__TYPE__:i.baggageEntryMetadataSymbol,toString(){return s}}}e.baggageEntryMetadataFromString=a}),nl=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ROOT_CONTEXT=e.createContextKey=void 0;function t(i){return Symbol.for(i)}e.createContextKey=t;class n{constructor(r){let o=this;o._currentContext=r?new Map(r):new Map,o.getValue=a=>o._currentContext.get(a),o.setValue=(a,s)=>{let d=new n(o._currentContext);return d._currentContext.set(a,s),d},o.deleteValue=a=>{let s=new n(o._currentContext);return s._currentContext.delete(a),s}}}e.ROOT_CONTEXT=new n}),DM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagConsoleLogger=void 0;var t=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class n{constructor(){function r(o){return function(...a){if(console){let s=console[o];if(typeof s!="function"&&(s=console.log),typeof s=="function")return s.apply(console,a)}}}for(let o=0;o<t.length;o++)this[t[o].n]=r(t[o].c)}}e.DiagConsoleLogger=n}),MS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createNoopMeter=e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=e.NOOP_OBSERVABLE_GAUGE_METRIC=e.NOOP_OBSERVABLE_COUNTER_METRIC=e.NOOP_UP_DOWN_COUNTER_METRIC=e.NOOP_HISTOGRAM_METRIC=e.NOOP_GAUGE_METRIC=e.NOOP_COUNTER_METRIC=e.NOOP_METER=e.NoopObservableUpDownCounterMetric=e.NoopObservableGaugeMetric=e.NoopObservableCounterMetric=e.NoopObservableMetric=e.NoopHistogramMetric=e.NoopGaugeMetric=e.NoopUpDownCounterMetric=e.NoopCounterMetric=e.NoopMetric=e.NoopMeter=void 0;class t{constructor(){}createGauge(f,h){return e.NOOP_GAUGE_METRIC}createHistogram(f,h){return e.NOOP_HISTOGRAM_METRIC}createCounter(f,h){return e.NOOP_COUNTER_METRIC}createUpDownCounter(f,h){return e.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(f,h){return e.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(f,h){return e.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(f,h){return e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(f,h){}removeBatchObservableCallback(f){}}e.NoopMeter=t;class n{}e.NoopMetric=n;class i extends n{add(f,h){}}e.NoopCounterMetric=i;class r extends n{add(f,h){}}e.NoopUpDownCounterMetric=r;class o extends n{record(f,h){}}e.NoopGaugeMetric=o;class a extends n{record(f,h){}}e.NoopHistogramMetric=a;class s{addCallback(f){}removeCallback(f){}}e.NoopObservableMetric=s;class d extends s{}e.NoopObservableCounterMetric=d;class u extends s{}e.NoopObservableGaugeMetric=u;class l extends s{}e.NoopObservableUpDownCounterMetric=l,e.NOOP_METER=new t,e.NOOP_COUNTER_METRIC=new i,e.NOOP_GAUGE_METRIC=new o,e.NOOP_HISTOGRAM_METRIC=new a,e.NOOP_UP_DOWN_COUNTER_METRIC=new r,e.NOOP_OBSERVABLE_COUNTER_METRIC=new d,e.NOOP_OBSERVABLE_GAUGE_METRIC=new u,e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new l;function p(){return e.NOOP_METER}e.createNoopMeter=p}),LM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueType=void 0;var t;(function(n){n[n.INT=0]="INT",n[n.DOUBLE=1]="DOUBLE"})(t=e.ValueType||(e.ValueType={}))}),jS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultTextMapSetter=e.defaultTextMapGetter=void 0,e.defaultTextMapGetter={get(t,n){if(t!=null)return t[n]},keys(t){return t==null?[]:Object.keys(t)}},e.defaultTextMapSetter={set(t,n,i){t!=null&&(t[n]=i)}}}),UM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopContextManager=void 0;var t=nl();class n{active(){return t.ROOT_CONTEXT}with(r,o,a,...s){return o.call(a,...s)}bind(r,o){return o}enable(){return this}disable(){return this}}e.NoopContextManager=n}),rl=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContextAPI=void 0;var t=UM(),n=fo(),i=mo(),r="context",o=new t.NoopContextManager;class a{constructor(){}static getInstance(){return this._instance||(this._instance=new a),this._instance}setGlobalContextManager(d){return(0,n.registerGlobal)(r,d,i.DiagAPI.instance())}active(){return this._getContextManager().active()}with(d,u,l,...p){return this._getContextManager().with(d,u,l,...p)}bind(d,u){return this._getContextManager().bind(d,u)}_getContextManager(){return(0,n.getGlobal)(r)||o}disable(){this._getContextManager().disable(),(0,n.unregisterGlobal)(r,i.DiagAPI.instance())}}e.ContextAPI=a}),NS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceFlags=void 0;var t;(function(n){n[n.NONE=0]="NONE",n[n.SAMPLED=1]="SAMPLED"})(t=e.TraceFlags||(e.TraceFlags={}))}),dm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=void 0;var t=NS();e.INVALID_SPANID="0000000000000000",e.INVALID_TRACEID="00000000000000000000000000000000",e.INVALID_SPAN_CONTEXT={traceId:e.INVALID_TRACEID,spanId:e.INVALID_SPANID,traceFlags:t.TraceFlags.NONE}}),um=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NonRecordingSpan=void 0;var t=dm();class n{constructor(r=t.INVALID_SPAN_CONTEXT){this._spanContext=r}spanContext(){return this._spanContext}setAttribute(r,o){return this}setAttributes(r){return this}addEvent(r,o){return this}addLink(r){return this}addLinks(r){return this}setStatus(r){return this}updateName(r){return this}end(r){}isRecording(){return!1}recordException(r,o){}}e.NonRecordingSpan=n}),qS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSpanContext=e.setSpanContext=e.deleteSpan=e.setSpan=e.getActiveSpan=e.getSpan=void 0;var t=nl(),n=um(),i=rl(),r=(0,t.createContextKey)("OpenTelemetry Context Key SPAN");function o(p){return p.getValue(r)||void 0}e.getSpan=o;function a(){return o(i.ContextAPI.getInstance().active())}e.getActiveSpan=a;function s(p,m){return p.setValue(r,m)}e.setSpan=s;function d(p){return p.deleteValue(r)}e.deleteSpan=d;function u(p,m){return s(p,new n.NonRecordingSpan(m))}e.setSpanContext=u;function l(p){var m;return(m=o(p))===null||m===void 0?void 0:m.spanContext()}e.getSpanContext=l}),lm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wrapSpanContext=e.isSpanContextValid=e.isValidSpanId=e.isValidTraceId=void 0;var t=dm(),n=um(),i=/^([0-9a-f]{32})$/i,r=/^[0-9a-f]{16}$/i;function o(u){return i.test(u)&&u!==t.INVALID_TRACEID}e.isValidTraceId=o;function a(u){return r.test(u)&&u!==t.INVALID_SPANID}e.isValidSpanId=a;function s(u){return o(u.traceId)&&a(u.spanId)}e.isSpanContextValid=s;function d(u){return new n.NonRecordingSpan(u)}e.wrapSpanContext=d}),DS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTracer=void 0;var t=rl(),n=qS(),i=um(),r=lm(),o=t.ContextAPI.getInstance();class a{startSpan(u,l,p=o.active()){if(l?.root)return new i.NonRecordingSpan;let m=p&&(0,n.getSpanContext)(p);return s(m)&&(0,r.isSpanContextValid)(m)?new i.NonRecordingSpan(m):new i.NonRecordingSpan}startActiveSpan(u,l,p,m){let f,h,y;if(arguments.length<2)return;arguments.length===2?y=l:arguments.length===3?(f=l,y=p):(f=l,h=p,y=m);let w=h??o.active(),g=this.startSpan(u,f,w),v=(0,n.setSpan)(w,g);return o.with(v,y,void 0,g)}}e.NoopTracer=a;function s(d){return typeof d=="object"&&typeof d.spanId=="string"&&typeof d.traceId=="string"&&typeof d.traceFlags=="number"}}),LS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyTracer=void 0;var t=DS(),n=new t.NoopTracer;class i{constructor(o,a,s,d){this._provider=o,this.name=a,this.version=s,this.options=d}startSpan(o,a,s){return this._getTracer().startSpan(o,a,s)}startActiveSpan(o,a,s,d){let u=this._getTracer();return Reflect.apply(u.startActiveSpan,u,arguments)}_getTracer(){if(this._delegate)return this._delegate;let o=this._provider.getDelegateTracer(this.name,this.version,this.options);return o?(this._delegate=o,this._delegate):n}}e.ProxyTracer=i}),FM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTracerProvider=void 0;var t=DS();class n{getTracer(r,o,a){return new t.NoopTracer}}e.NoopTracerProvider=n}),US=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyTracerProvider=void 0;var t=LS(),n=FM(),i=new n.NoopTracerProvider;class r{getTracer(a,s,d){var u;return(u=this.getDelegateTracer(a,s,d))!==null&&u!==void 0?u:new t.ProxyTracer(this,a,s,d)}getDelegate(){var a;return(a=this._delegate)!==null&&a!==void 0?a:i}setDelegate(a){this._delegate=a}getDelegateTracer(a,s,d){var u;return(u=this._delegate)===null||u===void 0?void 0:u.getTracer(a,s,d)}}e.ProxyTracerProvider=r}),zM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SamplingDecision=void 0;var t;(function(n){n[n.NOT_RECORD=0]="NOT_RECORD",n[n.RECORD=1]="RECORD",n[n.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(t=e.SamplingDecision||(e.SamplingDecision={}))}),BM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SpanKind=void 0;var t;(function(n){n[n.INTERNAL=0]="INTERNAL",n[n.SERVER=1]="SERVER",n[n.CLIENT=2]="CLIENT",n[n.PRODUCER=3]="PRODUCER",n[n.CONSUMER=4]="CONSUMER"})(t=e.SpanKind||(e.SpanKind={}))}),KM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SpanStatusCode=void 0;var t;(function(n){n[n.UNSET=0]="UNSET",n[n.OK=1]="OK",n[n.ERROR=2]="ERROR"})(t=e.SpanStatusCode||(e.SpanStatusCode={}))}),JM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateValue=e.validateKey=void 0;var t="[_0-9a-z-*/]",n=`[a-z]${t}{0,255}`,i=`[a-z0-9]${t}{0,240}@[a-z]${t}{0,13}`,r=new RegExp(`^(?:${n}|${i})$`),o=/^[ -~]{0,255}[!-~]$/,a=/,|=/;function s(u){return r.test(u)}e.validateKey=s;function d(u){return o.test(u)&&!a.test(u)}e.validateValue=d}),WM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceStateImpl=void 0;var t=JM(),n=32,i=512,r=",",o="=";class a{constructor(d){this._internalState=new Map,d&&this._parse(d)}set(d,u){let l=this._clone();return l._internalState.has(d)&&l._internalState.delete(d),l._internalState.set(d,u),l}unset(d){let u=this._clone();return u._internalState.delete(d),u}get(d){return this._internalState.get(d)}serialize(){return this._keys().reduce((d,u)=>(d.push(u+o+this.get(u)),d),[]).join(r)}_parse(d){d.length>i||(this._internalState=d.split(r).reverse().reduce((u,l)=>{let p=l.trim(),m=p.indexOf(o);if(m!==-1){let f=p.slice(0,m),h=p.slice(m+1,l.length);(0,t.validateKey)(f)&&(0,t.validateValue)(h)&&u.set(f,h)}return u},new Map),this._internalState.size>n&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,n))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let d=new a;return d._internalState=new Map(this._internalState),d}}e.TraceStateImpl=a}),HM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createTraceState=void 0;var t=WM();function n(i){return new t.TraceStateImpl(i)}e.createTraceState=n}),GM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.context=void 0;var t=rl();e.context=t.ContextAPI.getInstance()}),VM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.diag=void 0;var t=mo();e.diag=t.DiagAPI.instance()}),ZM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NOOP_METER_PROVIDER=e.NoopMeterProvider=void 0;var t=MS();class n{getMeter(r,o,a){return t.NOOP_METER}}e.NoopMeterProvider=n,e.NOOP_METER_PROVIDER=new n}),QM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MetricsAPI=void 0;var t=ZM(),n=fo(),i=mo(),r="metrics";class o{constructor(){}static getInstance(){return this._instance||(this._instance=new o),this._instance}setGlobalMeterProvider(s){return(0,n.registerGlobal)(r,s,i.DiagAPI.instance())}getMeterProvider(){return(0,n.getGlobal)(r)||t.NOOP_METER_PROVIDER}getMeter(s,d,u){return this.getMeterProvider().getMeter(s,d,u)}disable(){(0,n.unregisterGlobal)(r,i.DiagAPI.instance())}}e.MetricsAPI=o}),YM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.metrics=void 0;var t=QM();e.metrics=t.MetricsAPI.getInstance()}),XM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTextMapPropagator=void 0;class t{inject(i,r){}extract(i,r){return i}fields(){return[]}}e.NoopTextMapPropagator=t}),e1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.deleteBaggage=e.setBaggage=e.getActiveBaggage=e.getBaggage=void 0;var t=rl(),n=nl(),i=(0,n.createContextKey)("OpenTelemetry Baggage Key");function r(d){return d.getValue(i)||void 0}e.getBaggage=r;function o(){return r(t.ContextAPI.getInstance().active())}e.getActiveBaggage=o;function a(d,u){return d.setValue(i,u)}e.setBaggage=a;function s(d){return d.deleteValue(i)}e.deleteBaggage=s}),t1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PropagationAPI=void 0;var t=fo(),n=XM(),i=jS(),r=e1(),o=$S(),a=mo(),s="propagation",d=new n.NoopTextMapPropagator;class u{constructor(){this.createBaggage=o.createBaggage,this.getBaggage=r.getBaggage,this.getActiveBaggage=r.getActiveBaggage,this.setBaggage=r.setBaggage,this.deleteBaggage=r.deleteBaggage}static getInstance(){return this._instance||(this._instance=new u),this._instance}setGlobalPropagator(p){return(0,t.registerGlobal)(s,p,a.DiagAPI.instance())}inject(p,m,f=i.defaultTextMapSetter){return this._getGlobalPropagator().inject(p,m,f)}extract(p,m,f=i.defaultTextMapGetter){return this._getGlobalPropagator().extract(p,m,f)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,t.unregisterGlobal)(s,a.DiagAPI.instance())}_getGlobalPropagator(){return(0,t.getGlobal)(s)||d}}e.PropagationAPI=u}),n1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.propagation=void 0;var t=t1();e.propagation=t.PropagationAPI.getInstance()}),r1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceAPI=void 0;var t=fo(),n=US(),i=lm(),r=qS(),o=mo(),a="trace";class s{constructor(){this._proxyTracerProvider=new n.ProxyTracerProvider,this.wrapSpanContext=i.wrapSpanContext,this.isSpanContextValid=i.isSpanContextValid,this.deleteSpan=r.deleteSpan,this.getSpan=r.getSpan,this.getActiveSpan=r.getActiveSpan,this.getSpanContext=r.getSpanContext,this.setSpan=r.setSpan,this.setSpanContext=r.setSpanContext}static getInstance(){return this._instance||(this._instance=new s),this._instance}setGlobalTracerProvider(u){let l=(0,t.registerGlobal)(a,this._proxyTracerProvider,o.DiagAPI.instance());return l&&this._proxyTracerProvider.setDelegate(u),l}getTracerProvider(){return(0,t.getGlobal)(a)||this._proxyTracerProvider}getTracer(u,l){return this.getTracerProvider().getTracer(u,l)}disable(){(0,t.unregisterGlobal)(a,o.DiagAPI.instance()),this._proxyTracerProvider=new n.ProxyTracerProvider}}e.TraceAPI=s}),i1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.trace=void 0;var t=r1();e.trace=t.TraceAPI.getInstance()}),o1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.trace=e.propagation=e.metrics=e.diag=e.context=e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=e.isValidSpanId=e.isValidTraceId=e.isSpanContextValid=e.createTraceState=e.TraceFlags=e.SpanStatusCode=e.SpanKind=e.SamplingDecision=e.ProxyTracerProvider=e.ProxyTracer=e.defaultTextMapSetter=e.defaultTextMapGetter=e.ValueType=e.createNoopMeter=e.DiagLogLevel=e.DiagConsoleLogger=e.ROOT_CONTEXT=e.createContextKey=e.baggageEntryMetadataFromString=void 0;var t=$S();Object.defineProperty(e,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return t.baggageEntryMetadataFromString}});var n=nl();Object.defineProperty(e,"createContextKey",{enumerable:!0,get:function(){return n.createContextKey}}),Object.defineProperty(e,"ROOT_CONTEXT",{enumerable:!0,get:function(){return n.ROOT_CONTEXT}});var i=DM();Object.defineProperty(e,"DiagConsoleLogger",{enumerable:!0,get:function(){return i.DiagConsoleLogger}});var r=sm();Object.defineProperty(e,"DiagLogLevel",{enumerable:!0,get:function(){return r.DiagLogLevel}});var o=MS();Object.defineProperty(e,"createNoopMeter",{enumerable:!0,get:function(){return o.createNoopMeter}});var a=LM();Object.defineProperty(e,"ValueType",{enumerable:!0,get:function(){return a.ValueType}});var s=jS();Object.defineProperty(e,"defaultTextMapGetter",{enumerable:!0,get:function(){return s.defaultTextMapGetter}}),Object.defineProperty(e,"defaultTextMapSetter",{enumerable:!0,get:function(){return s.defaultTextMapSetter}});var d=LS();Object.defineProperty(e,"ProxyTracer",{enumerable:!0,get:function(){return d.ProxyTracer}});var u=US();Object.defineProperty(e,"ProxyTracerProvider",{enumerable:!0,get:function(){return u.ProxyTracerProvider}});var l=zM();Object.defineProperty(e,"SamplingDecision",{enumerable:!0,get:function(){return l.SamplingDecision}});var p=BM();Object.defineProperty(e,"SpanKind",{enumerable:!0,get:function(){return p.SpanKind}});var m=KM();Object.defineProperty(e,"SpanStatusCode",{enumerable:!0,get:function(){return m.SpanStatusCode}});var f=NS();Object.defineProperty(e,"TraceFlags",{enumerable:!0,get:function(){return f.TraceFlags}});var h=HM();Object.defineProperty(e,"createTraceState",{enumerable:!0,get:function(){return h.createTraceState}});var y=lm();Object.defineProperty(e,"isSpanContextValid",{enumerable:!0,get:function(){return y.isSpanContextValid}}),Object.defineProperty(e,"isValidTraceId",{enumerable:!0,get:function(){return y.isValidTraceId}}),Object.defineProperty(e,"isValidSpanId",{enumerable:!0,get:function(){return y.isValidSpanId}});var w=dm();Object.defineProperty(e,"INVALID_SPANID",{enumerable:!0,get:function(){return w.INVALID_SPANID}}),Object.defineProperty(e,"INVALID_TRACEID",{enumerable:!0,get:function(){return w.INVALID_TRACEID}}),Object.defineProperty(e,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return w.INVALID_SPAN_CONTEXT}});var g=GM();Object.defineProperty(e,"context",{enumerable:!0,get:function(){return g.context}});var v=VM();Object.defineProperty(e,"diag",{enumerable:!0,get:function(){return v.diag}});var b=YM();Object.defineProperty(e,"metrics",{enumerable:!0,get:function(){return b.metrics}});var S=n1();Object.defineProperty(e,"propagation",{enumerable:!0,get:function(){return S.propagation}});var T=i1();Object.defineProperty(e,"trace",{enumerable:!0,get:function(){return T.trace}}),e.default={context:g.context,diag:v.diag,metrics:b.metrics,propagation:S.propagation,trace:T.trace}}),Md=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(v){if(super(),!e.IDENTIFIER.test(v))throw Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class i extends t{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((b,S)=>`${b}${S}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((b,S)=>(S instanceof n&&(b[S.str]=(b[S.str]||0)+1),b),{})}}e._Code=i,e.nil=new i("");function r(g,...v){let b=[g[0]],S=0;for(;S<v.length;)s(b,v[S]),b.push(g[++S]);return new i(b)}e._=r;var o=new i("+");function a(g,...v){let b=[f(g[0])],S=0;for(;S<v.length;)b.push(o),s(b,v[S]),b.push(o,f(g[++S]));return d(b),new i(b)}e.str=a;function s(g,v){v instanceof i?g.push(...v._items):v instanceof n?g.push(v):g.push(p(v))}e.addCodeArg=s;function d(g){let v=1;for(;v<g.length-1;){if(g[v]===o){let b=u(g[v-1],g[v+1]);if(b!==void 0){g.splice(v-1,3,b);continue}g[v++]="+"}v++}}function u(g,v){if(v==='""')return g;if(g==='""')return v;if(typeof g=="string")return v instanceof n||g[g.length-1]!=='"'?void 0:typeof v!="string"?`${g.slice(0,-1)}${v}"`:v[0]==='"'?g.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(g instanceof n))return`"${g}${v.slice(1)}`}function l(g,v){return v.emptyStr()?g:g.emptyStr()?v:a`${g}${v}`}e.strConcat=l;function p(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:f(Array.isArray(g)?g.join(","):g)}function m(g){return new i(f(g))}e.stringify=m;function f(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=f;function h(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new i(`.${g}`):r`[${g}]`}e.getProperty=h;function y(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new i(`${g}`);throw Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=y;function w(g){return new i(g.toString())}e.regexpCode=w}),Mv=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Md();class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var i;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(i||(e.UsedValueState=i={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class r{constructor({prefixes:u,parent:l}={}){this._names={},this._prefixes=u,this._parent=l}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){let l=this._names[u]||this._nameGroup(u);return`${u}${l.index++}`}_nameGroup(u){var l,p;if(!((p=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||p===void 0)&&p.has(u)||this._prefixes&&!this._prefixes.has(u))throw Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=r;class o extends t.Name{constructor(u,l){super(l),this.prefix=u}setValue(u,{property:l,itemIndex:p}){this.value=u,this.scopePath=t._`.${new t.Name(l)}[${p}]`}}e.ValueScopeName=o;var a=t._`\n`;class s extends r{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?a:t.nil}}get(){return this._scope}name(u){return new o(u,this._newName(u))}value(u,l){var p;if(l.ref===void 0)throw Error("CodeGen: ref must be passed in value");let m=this.toName(u),{prefix:f}=m,h=(p=l.key)!==null&&p!==void 0?p:l.ref,y=this._values[f];if(y){let v=y.get(h);if(v)return v}else y=this._values[f]=new Map;y.set(h,m);let w=this._scope[f]||(this._scope[f]=[]),g=w.length;return w[g]=l.ref,m.setValue(l,{property:f,itemIndex:g}),m}getValue(u,l){let p=this._values[u];if(p)return p.get(l)}scopeRefs(u,l=this._values){return this._reduceValues(l,p=>{if(p.scopePath===void 0)throw Error(`CodeGen: name "${p}" has no value`);return t._`${u}${p.scopePath}`})}scopeCode(u=this._values,l,p){return this._reduceValues(u,m=>{if(m.value===void 0)throw Error(`CodeGen: name "${m}" has no value`);return m.value.code},l,p)}_reduceValues(u,l,p={},m){let f=t.nil;for(let h in u){let y=u[h];if(!y)continue;let w=p[h]=p[h]||new Map;y.forEach(g=>{if(w.has(g))return;w.set(g,i.Started);let v=l(g);if(v){let b=this.opts.es5?e.varKinds.var:e.varKinds.const;f=t._`${f}${b} ${g} = ${v};${this.opts._n}`}else if(v=m?.(g))f=t._`${f}${v}${this.opts._n}`;else throw new n(g);w.set(g,i.Completed)})}return f}}e.ValueScope=s}),Te=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=Md(),n=Mv(),i=Md();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return i.Name}});var r=Mv();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(x,E){return this}}class a extends o{constructor(x,E,O){super(),this.varKind=x,this.name=E,this.rhs=O}render({es5:x,_n:E}){let O=x?n.varKinds.var:this.varKind,ne=this.rhs===void 0?"":` = ${this.rhs}`;return`${O} ${this.name}${ne};`+E}optimizeNames(x,E){if(x[this.name.str])return this.rhs&&(this.rhs=F(this.rhs,x,E)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class s extends o{constructor(x,E,O){super(),this.lhs=x,this.rhs=E,this.sideEffects=O}render({_n:x}){return`${this.lhs} = ${this.rhs};`+x}optimizeNames(x,E){if(!(this.lhs instanceof t.Name&&!x[this.lhs.str]&&!this.sideEffects))return this.rhs=F(this.rhs,x,E),this}get names(){let x=this.lhs instanceof t.Name?{}:{...this.lhs.names};return A(x,this.rhs)}}class d extends s{constructor(x,E,O,ne){super(x,O,ne),this.op=E}render({_n:x}){return`${this.lhs} ${this.op}= ${this.rhs};`+x}}class u extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`${this.label}:`+x}}class l extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`break${this.label?` ${this.label}`:""};`+x}}class p extends o{constructor(x){super(),this.error=x}render({_n:x}){return`throw ${this.error};`+x}get names(){return this.error.names}}class m extends o{constructor(x){super(),this.code=x}render({_n:x}){return`${this.code};`+x}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(x,E){return this.code=F(this.code,x,E),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends o{constructor(x=[]){super(),this.nodes=x}render(x){return this.nodes.reduce((E,O)=>E+O.render(x),"")}optimizeNodes(){let{nodes:x}=this,E=x.length;for(;E--;){let O=x[E].optimizeNodes();Array.isArray(O)?x.splice(E,1,...O):O?x[E]=O:x.splice(E,1)}return x.length>0?this:void 0}optimizeNames(x,E){let{nodes:O}=this,ne=O.length;for(;ne--;){let X=O[ne];X.optimizeNames(x,E)||(se(x,X.names),O.splice(ne,1))}return O.length>0?this:void 0}get names(){return this.nodes.reduce((x,E)=>M(x,E.names),{})}}class h extends f{render(x){return"{"+x._n+super.render(x)+"}"+x._n}}class y extends f{}class w extends h{}w.kind="else";class g extends h{constructor(x,E){super(E),this.condition=x}render(x){let E=`if(${this.condition})`+super.render(x);return this.else&&(E+="else "+this.else.render(x)),E}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!0)return this.nodes;let E=this.else;if(E){let O=E.optimizeNodes();E=this.else=Array.isArray(O)?new w(O):O}if(E)return x===!1?E instanceof g?E:E.nodes:this.nodes.length?this:new g(he(x),E instanceof g?[E]:E.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,E){var O;if(this.else=(O=this.else)===null||O===void 0?void 0:O.optimizeNames(x,E),!!(super.optimizeNames(x,E)||this.else))return this.condition=F(this.condition,x,E),this}get names(){let x=super.names;return A(x,this.condition),this.else&&M(x,this.else.names),x}}g.kind="if";class v extends h{}v.kind="for";class b extends v{constructor(x){super(),this.iteration=x}render(x){return`for(${this.iteration})`+super.render(x)}optimizeNames(x,E){if(super.optimizeNames(x,E))return this.iteration=F(this.iteration,x,E),this}get names(){return M(super.names,this.iteration.names)}}class S extends v{constructor(x,E,O,ne){super(),this.varKind=x,this.name=E,this.from=O,this.to=ne}render(x){let E=x.es5?n.varKinds.var:this.varKind,{name:O,from:ne,to:X}=this;return`for(${E} ${O}=${ne}; ${O}<${X}; ${O}++)`+super.render(x)}get names(){let x=A(super.names,this.from);return A(x,this.to)}}class T extends v{constructor(x,E,O,ne){super(),this.loop=x,this.varKind=E,this.name=O,this.iterable=ne}render(x){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(x)}optimizeNames(x,E){if(super.optimizeNames(x,E))return this.iterable=F(this.iterable,x,E),this}get names(){return M(super.names,this.iterable.names)}}class C extends h{constructor(x,E,O){super(),this.name=x,this.args=E,this.async=O}render(x){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(x)}}C.kind="func";class _ extends f{render(x){return"return "+super.render(x)}}_.kind="return";class k extends h{render(x){let E="try"+super.render(x);return this.catch&&(E+=this.catch.render(x)),this.finally&&(E+=this.finally.render(x)),E}optimizeNodes(){var x,E;return super.optimizeNodes(),(x=this.catch)===null||x===void 0||x.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(x,E){var O,ne;return super.optimizeNames(x,E),(O=this.catch)===null||O===void 0||O.optimizeNames(x,E),(ne=this.finally)===null||ne===void 0||ne.optimizeNames(x,E),this}get names(){let x=super.names;return this.catch&&M(x,this.catch.names),this.finally&&M(x,this.finally.names),x}}class I extends h{constructor(x){super(),this.error=x}render(x){return`catch(${this.error})`+super.render(x)}}I.kind="catch";class P extends h{render(x){return"finally"+super.render(x)}}P.kind="finally";class R{constructor(x,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?`
|
|
36
|
+
`)+1);try{let i=An(n);if(typeof i=="object"&&i!==null&&"timestamp"in i&&typeof i.timestamp=="string"){let r=Date.parse(i.timestamp);if(!Number.isNaN(r))return r}}catch{}return Date.now()}async function aE(e,t,n){let i=_n(n),r=await e.load({projectKey:i,sessionId:t});return!r||r.length===0?null:iE(r)}async function J8(e,t,n){if(!ot(t))return[];let i=_n(n.dir),r=await e.load({projectKey:i,sessionId:t});return!r||r.length===0?[]:CB(r,{limit:n.limit,offset:n.offset,includeSystemMessages:n.includeSystemMessages})}async function W8(e,t,n){if(!ot(t))return;let i=await aE(e,t,n.dir);if(!i)return;let r=oE(i,K8(i));return wl(t,r)??void 0}async function H8(e,t,n,i){if(!ot(t))throw new In(`Invalid sessionId: ${t}`,"renameSession: invalid sessionId (must be a UUID)");if(!n.trim())throw Error("title must be non-empty");let r=_n(i);await e.append({projectKey:r,sessionId:t},[{type:"custom-title",customTitle:n.trim(),sessionId:t,uuid:mm(),timestamp:new Date().toISOString()}])}async function G8(e,t,n,i){if(!ot(t))throw new In(`Invalid sessionId: ${t}`,"tagSession: invalid sessionId (must be a UUID)");if(n!==null){let o=Aa(n).trim();if(!o)throw Error("tag must be non-empty (use null to clear)");n=o}let r=_n(i);await e.append({projectKey:r,sessionId:t},[{type:"tag",tag:n??"",sessionId:t,uuid:mm(),timestamp:new Date().toISOString()}])}async function V8(e,t,n){if(!ot(t))throw new In(`Invalid sessionId: ${t}`,"forkSession: invalid sessionId (must be a UUID)");if(n.upToMessageId&&!ot(n.upToMessageId))throw new In(`Invalid upToMessageId: ${n.upToMessageId}`,"forkSession: invalid upToMessageId (must be a UUID)");let i=_n(n.dir),r=await e.load({projectKey:i,sessionId:t});if(!r||r.length===0)throw Error(`Session ${t} not found`);let{entries:o,forkedSessionId:a}=VB(r,t,n);return await e.append({projectKey:i,sessionId:a},o),{sessionId:a}}async function Z8(e,t,n){if(!ot(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let i=_n(n),r=await e.listSubkeys({projectKey:i,sessionId:t}),o=new Set;for(let a of r){if(!a.startsWith("subagents/"))continue;let s=a.split("/").at(-1);s.startsWith("agent-")&&o.add(s.slice(6))}return[...o]}async function Q8(e,t,n,i){if(!ot(t))return[];if(!n)return[];let r=_n(i.dir),o=`subagents/agent-${n}`;if(e.listSubkeys){let l=await e.listSubkeys({projectKey:r,sessionId:t}),p=`agent-${n}`,m=l.find(f=>f.startsWith("subagents/")&&f.split("/").at(-1)===p);if(!m)return[];o=m}let a=await e.load({projectKey:r,sessionId:t,subpath:o});if(!a||a.length===0)return[];let s=a.findLast(om),d=typeof s?.toolUseId=="string"?s.toolUseId:void 0,u=a.filter(l=>!om(l));return u.length===0?[]:Ex(Buffer.from(iE(u)),{limit:i.limit,offset:i.offset},d)}function OS(e,t){let n=YS(t,e),i=n.split(hm);if(i[0]===".."||QS(n)||i.length<2)return null;let r=i[0],o=i[1];if(i.length===2&&o.endsWith(".jsonl"))return{projectKey:r,sessionId:o.replace(/\.jsonl$/,"")};if(i.length>=4){let a=i.slice(2),s=a.length-1;return a[s]=a.at(-1).replace(/\.jsonl$/,""),{projectKey:r,sessionId:o,subpath:a.join("/")}}return null}var _M,vM,Np,bM,wM,kM,xM,am,z,CM,zn,IM,PM,EM,Xe,et,RM,OM,AM,AS,$M,fo,MM,sm,jM,mo,NM,qM,$S,nl,DM,MS,LM,jS,UM,rl,NS,dm,um,qS,lm,DS,LS,FM,US,zM,BM,KM,JM,WM,HM,GM,VM,ZM,QM,YM,XM,e1,t1,n1,r1,i1,o1,Md,Mv,Te,Ae,Tr,il,a1,FS,zS,jd,s1,On,d1,u1,BS,l1,ol,al,cm,sl,pm,c1,KS,p1,f1,m1,h1,g1,y1,_1,v1,b1,w1,S1,k1,x1,C1,T1,fm,I1,P1,E1,R1,JS,WS,O1,A1,$1,M1,j1,HS,N1,q1,D1,L1,U1,F1,z1,B1,K1,J1,W1,H1,G1,V1,Z1,Q1,GS,Y1,X1,ej,pj,Zoe,ul,bj,wj,Sj,kj,xj,Lp,Mt,Uv,Ej,Rj,nk,Oj,Aj,Bn,$j,Dn,rk,Mj,jj,Qo,qj,Dj,Lj,Fj,zj,Bj,Fv,ri,Ln,Wj,Hj,Gj,Vj,ym,Qj,np,zv,Xj,eN,tN,ii,rN,iN,oN,aN,sN,dN,uN,cN,fN,oi,hN,Na,yN,vN,bN,wN,SN,xN,CN,TN,PN,EN,ON,Bv,$N,hs,ll,NN,qN,LN,FN,BN,JN,cl,WN,qa,GN,ZN,pl,XN,tq,rq,oq,fl,aq,vt,_o,iae,ik,Up,me,Rt,Qt,Ji,Dd,Ld,Ud,Fd,zd,Bd,Kd,Jd,Wd,uq,lq,Fp,Kv,pq,ok,fq,yr,mq,gq,Wv,Hv,Gv,vm,bq,Sq,kq,dk,Hd,xq,Cq,wm,Tq,Vv,rp,Iq,Fe,Bp,Ue,Zv,Qv,Gd,Xv,Rq,eb,zr,fk,Oq,Aq,$q,km,Mq,hk,Wt,Ht,Vr,Yo,Zr,Kp,ba,Vd,od,Zd,Jp,Qr,xt,vk,bk,xm,nb,Gq,Vq,Wp,wk,Zq,Qq,Ge,Sk,H,rb,tD,de,Qd,Ea,Yd,Xd,eu,tu,La,nu,ru,Wi,iu,ou,Tk,iD,Oi,oD,aD,Ek,an,lr,ki,Xo,ad,ea,ta,sd,na,Qn,ra,dd,ud,Dr,ld,cd,ia,ip,ob,pd,op,ap,sp,ab,sb,Gp,au,sD,dD,oa,xi,Lr,ct,$t,Jt,tr,cr,aa,ub,Vp,su,cb,lD,Yr,du,uu,Hi,lu,Ua,cu,Fa,Nt,pu,sn,pr,Ci,sa,fd,da,ua,md,la,Yn,ca,hd,gd,Ur,yd,_d,pa,dp,mb,up,lp,cp,pp,hb,gb,Zp,fu,za,_b,pD,mu,Qp,Cm,Ad,Ak,fD,mD,it,Gi,In,hD,ED,RD,OD,AD,cae,jD,Yp,qD,Hr,Ti,UD,zD,KD,WD,HD,VD,Ra,ZD,gu,Tm,YD,XD,jk,nL,iL,kr,aL,xb,Nk,dL,uL,lL,Ba,cL,mn,wa,fL,qk,Cb,mL,Tb,hL,gL,Ka,yL,_L,hl,bL,Im,SL,kL,xL,CL,TL,IL,PL,EL,RL,OL,AL,$L,ML,jL,NL,qL,DL,LL,UL,FL,zL,BL,KL,JL,We,HL,VL,Sa,Dk,Oa,ZL,gp,QL,Xp,Ib,YL,Pm,XL,eU,Lk,nU,Em,Uk,oU,aU,sU,dU,lU,gl,Fk,mU,hU,gU,_U,Rm,ka,zk,Pb,bU,Eb,Rb,Bk,kU,CU,Kk,IU,PU,Ob,EU,Jk,Om,OU,Am,AU,$U,MU,Wk,Ab,DU,LU,ef,UU,tf,FU,nf,zU,rf,$b,BU,Mb,jb,Nb,qb,KU,JU,WU,HU,GU,Br,Db,VU,yu,QU,XU,Lb,eF,tF,rF,iF,aF,dF,uF,cF,fF,mF,hF,Hk,_F,bF,wF,SF,kF,xF,CF,TF,IF,PF,EF,RF,OF,AF,$F,Fb,yp,jF,NF,qF,DF,UF,FF,zb,Bb,vd,zF,Kb,KF,Vk,JF,WF,GF,Zk,QF,Qk,ez,tz,$m,rz,iz,Mm,az,dz,uz,lz,cz,pz,Yk,mz,Jb,Wb,hz,yz,yl,vz,ys,jm,kz,Cz,Iz,ex,Ez,Rz,Az,Nm,jz,qz,Lz,tx,nx,yae,_ae,Kz,qm,vu,Zz,Qz,Yz,Xz,e2,Dm,r2,a2,d2,u2,l2,vae,c2,bae,p2,wae,f2,Sae,m2,kae,bu,w2,Tae,S2,bd,z2,B2,G2,Yb,Pae,Q2,Xb,ax,Y2,ew,X2,e4,tw,df,r4,i4,sx,o4,dx,ux,s4,d4,fa,_p,Ai,xa,rw,ma,vp,uf,f4,Eae,m4,tt,An,v4,wu,iw,cf,Ii,Su,P4,pf,bp,ff,Fm,zm,R4,mf,ow,Pi,K4,J4,Z4,nr,Y4,eB,Wa,aB,sB,dB,xu,lB,Ha,cB,pB,dw,uw,EB,KB,oK,Ax,aK,sK,dK,nse,uK,rse,fw,lK,pK,mK,gK,Oe,mw,ae,hr,W,pn,bK,Ga,wK,bf,Ot,ye,Ta,qt,hw,gw,Zi,Cu,le,hn,yw,Ie,SK,kK,xK,CK,TK,IK,PK,EK,RK,kp,OK,AK,$K,MK,jK,NK,$x,qK,Qi,Va,Za,Qa,Ya,Xa,Yi,Xi,es,wr,Un,ts,xr,Xt,eo,Xn,wf,to,or,kf,ns,rs,xf,no,ro,io,oo,Xr,Pn,fn,ar,ao,so,is,Tu,Iu,uo,ise,Z,ose,ase,sse,dse,use,lse,cse,pse,fse,mse,hse,gse,yse,_se,KK,vse,bse,wse,Sse,kse,xse,Cse,Tse,Ise,Pse,Ese,Rse,Ose,Ase,$se,Mse,jse,Nse,qse,Nx,qx,Dx,Cr,Pu,Ee,Hm,Fx,eJ,Eu,zx,Kx,Jx,Cf,Hx,Gm,ws,Qm,Ru,Ym,Ou,Xm,Tl,eh,Il,th,Qx,Yx,Xx,e0,t0,n0,r0,uJ,i0,lo,lJ,cJ,pJ,o0,fJ,mJ,hJ,gJ,yJ,s0,d0,u0,l0,c0,nh,p0,_J,f0,m0,h0,v0,b0,w0,S0,k0,x0,C0,T0,I0,at,P0,rh,ih,E0,R0,O0,A0,$0,M0,j0,N0,q0,Ss,D0,L0,U0,F0,z0,B0,K0,J0,W0,Au,H0,ve,ks,Ke,G0,V0,Z0,Q0,Y0,X0,eC,tC,nC,rC,iC,oC,aC,sC,dC,uC,lC,cC,pC,fC,hC,gC,_C,vC,ah,bC,sh,dh,wC,SC,kC,xC,CC,$u,TC,IC,PC,uh,lh,ch,EC,RC,Pl,OC,AC,$C,MC,jC,NC,ph,qC,DC,LC,UC,FC,zC,BC,KC,fh,JC,WC,HC,GC,VC,mh,vJ,wJ,kJ,CJ,IJ,EJ,OJ,AJ,$J,MJ,NJ,DJ,UJ,zJ,KJ,WJ,GJ,ZJ,YJ,e6,n6,i6,a6,d6,l6,p6,m6,g6,_6,b6,S6,x6,T6,P6,R6,A6,$6,j6,q6,L6,F6,B6,QC,YC,ss,rr,tT,Nu,ls,pW,fW,mW,c,Qh,Yh,Xh,eg,tg,JT,yW,Cs,WT,HT,GT,VT,Pe,ng,Al,Ve,rg,qu,ir,ig,og,ag,sg,dg,ug,lg,cg,pg,fg,mg,hg,gg,yg,_g,vg,ZT,$l,wo,Ml,jl,bg,QT,YT,XT,eI,tI,nI,rI,Sg,iI,ql,kg,oI,aI,sI,Cg,dI,uI,cs,lI,cI,Tg,Pg,pI,fI,hI,Eg,_I,vI,wI,Rg,SI,xI,CI,II,Ll,fH,hH,AI,kH,$I,MI,xH,Kr,Ul,mt,jI,NI,Dse,CH,TH,Ag,en,Ts,IH,bt,gn,yn,wt,Fl,qI,$w,DI,PH,$g,Cd,ge,Mg,EH,Lse,Use,jg,RH,Ng,OH,Is,po,LI,AH,$H,MH,jH,NH,qH,UI,DH,LH,FI,qg,UH,FH,Dg,zH,Ps,Es,BH,Rs,zl,KH,Uu,Lg,Ug,Fg,Fse,zg,Bg,Kg,JH,zI,BI,Jg,KI,Os,So,JI,WH,Pf,HH,Ef,GH,Wg,VH,Rf,ZH,QH,YH,XH,e9,t9,n9,r9,i9,o9,Of,a9,s9,Af,Hg,Gg,Vg,d9,u9,l9,Zg,c9,p9,f9,m9,h9,WI,$f,g9,Qg,zse,y9,Fu,_9,Bse,zu,v9,HI,b9,w9,S9,k9,x9,C9,T9,Bu,I9,P9,E9,Yg,GI,R9,O9,A9,$9,M9,j9,N9,q9,D9,L9,U9,F9,z9,B9,K9,J9,W9,H9,Ku,G9,V9,Z9,Mf,X9,eG,tG,VI,nG,Kse,Jse,Wse,Hse,Gse,Vse,fe,jf,rG,Mw,iG,oG,QI,uG,lG,mG,Tp,kn,yG,Ju,Nw,EG,RG,NG,qG,DG,LG,UG,zG,Nf,KG,JG,qf,Df,Lf,nP,zw,ZG,Uf,Ff,XG,ga,Ww,iV,un,Bf,Kf,Gw,Vw,Xse,ede,Zw,Qw,Yw,Xw,_r,Xg,Ni,gV,yV,_V,ide,SV,Pp,xV,eS,ode,Ei,uP,Hf,lP,Wu,tS,CV,mr,cP,zi,Gf,Vf,IV,nS,Kl,Jl,lde,cde,pde,ps,fde,Zf,AV,$V,MV,NV,qV,DV,LV,mP,UV,FV,BV,Qf,WV,GV,VV,QV,rS,gP,e5,t5,n5,r5,i5,o5,s5,d5,yP,l5,p5,m5,h5,vr,y5,_P,b5,iS,S5,k5,C5,I5,P5,Ep,R5,A5,M5,N5,bP,wP,SP,D5,L5,gde,U5,Rp,F5,z5,J5,V5,oS,Yf,Xf,qi,Q5,Y5,X5,aS,Hu,t3,n3,xP,CP,r3,TP,i3,o3,a3,s3,d3,vde,ey,u3,l3,bde,wde,c3,ya,f3,m3,Gu,Sde,kde,ko,Pr,h3,g3,IP,PP,y3,_3,v3,b3,w3,S3,ty,k3,em,xde,x3,C3,EP,T3,I3,Rn,ni,dS,tm,nm,RP,ny,E3,Cde,R3,O3,A3,$3,M3,OP,j3,N3,q3,D3,AP,L3,uS,U3,F3,$P,z3,B3,lS,K3,J3,MP,W3,jP,H3,G3,V3,Q3,Y3,X3,eZ,Vu,Op,NP,tZ,nZ,rZ,iZ,oZ,Tde,qP,sZ,dZ,uZ,lZ,cZ,pZ,fZ,Ide,mZ,Pde,hZ,Td,Wl,cS,UP,Ede,Rde,Zu,mS,IZ,PZ,Ode,EZ,ry,iy,RZ,hS,gS,OZ,Hl,yS,er,$Z,MZ,Ade,DZ,UZ,JZ,Mp,s8,gr,XP,eE,tE,el,_8,IS,v8,b8,w8,P8,dE=VE(()=>{_M=Object.create,{getPrototypeOf:vM,defineProperty:Np,getOwnPropertyNames:bM}=Object,wM=Object.prototype.hasOwnProperty;am=(e,t,n)=>{var i=e!=null&&typeof e=="object";if(i){var r=t?kM??=new WeakMap:xM??=new WeakMap,o=r.get(e);if(o)return o}n=e!=null?_M(vM(e)):{};let a=t||!e||!e.__esModule?Np(n,"default",{value:e,enumerable:!0}):n;for(let s of bM(e))wM.call(a,s)||Np(a,s,{get:SM.bind(e,s),enumerable:!0});return i&&r.set(e,a),a},z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),CM=e=>e;zn=(e,t)=>{for(var n in t)Np(e,n,{get:t[n],enumerable:!0,configurable:!0,set:TM.bind(t,n)})},IM=yM(import.meta.url),PM=Symbol.dispose||Symbol.for("Symbol.dispose"),EM=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Xe=(e,t,n)=>{if(t!=null){if(typeof t!="object"&&typeof t!="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(n&&(i=t[EM]),i===void 0&&(i=t[PM]),typeof i!="function")throw TypeError("Object not disposable");e.push([n,i,t])}else n&&e.push([n]);return t},et=(e,t,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(a,s,d,u){return u=Error(d),u.name="SuppressedError",u.error=a,u.suppressed=s,u},r=a=>t=n?new i(a,t,"An error was suppressed during disposal"):(n=!0,a),o=a=>{for(;a=e.pop();)try{var s=a[1]&&a[1].call(a[2]);if(a[0])return Promise.resolve(s).then(o,d=>(r(d),o()))}catch(d){r(d)}if(n)throw t};return o()},RM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e._globalThis=void 0,e._globalThis=typeof globalThis=="object"?globalThis:global}),OM=z(e=>{var t=e&&e.__createBinding||(Object.create?function(i,r,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return r[o]}})}:function(i,r,o,a){a===void 0&&(a=o),i[a]=r[o]}),n=e&&e.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(RM(),e)}),AM=z(e=>{var t=e&&e.__createBinding||(Object.create?function(i,r,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return r[o]}})}:function(i,r,o,a){a===void 0&&(a=o),i[a]=r[o]}),n=e&&e.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(OM(),e)}),AS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION="1.9.0"}),$M=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isCompatible=e._makeCompatibilityCheck=void 0;var t=AS(),n=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(r){let o=new Set([r]),a=new Set,s=r.match(n);if(!s)return()=>!1;let d={major:+s[1],minor:+s[2],patch:+s[3],prerelease:s[4]};if(d.prerelease!=null)return function(p){return p===r};function u(p){return a.add(p),!1}function l(p){return o.add(p),!0}return function(p){if(o.has(p))return!0;if(a.has(p))return!1;let m=p.match(n);if(!m)return u(p);let f={major:+m[1],minor:+m[2],patch:+m[3],prerelease:m[4]};return f.prerelease!=null||d.major!==f.major?u(p):d.major===0?d.minor===f.minor&&d.patch<=f.patch?l(p):u(p):d.minor<=f.minor?l(p):u(p)}}e._makeCompatibilityCheck=i,e.isCompatible=i(t.VERSION)}),fo=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.unregisterGlobal=e.getGlobal=e.registerGlobal=void 0;var t=AM(),n=AS(),i=$M(),r=n.VERSION.split(".")[0],o=Symbol.for(`opentelemetry.js.api.${r}`),a=t._globalThis;function s(l,p,m,f=!1){var h;let y=a[o]=(h=a[o])!==null&&h!==void 0?h:{version:n.VERSION};if(!f&&y[l]){let w=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${l}`);return m.error(w.stack||w.message),!1}if(y.version!==n.VERSION){let w=Error(`@opentelemetry/api: Registration of version v${y.version} for ${l} does not match previously registered API v${n.VERSION}`);return m.error(w.stack||w.message),!1}return y[l]=p,m.debug(`@opentelemetry/api: Registered a global for ${l} v${n.VERSION}.`),!0}e.registerGlobal=s;function d(l){var p,m;let f=(p=a[o])===null||p===void 0?void 0:p.version;if(!(!f||!(0,i.isCompatible)(f)))return(m=a[o])===null||m===void 0?void 0:m[l]}e.getGlobal=d;function u(l,p){p.debug(`@opentelemetry/api: Unregistering a global for ${l} v${n.VERSION}.`);let m=a[o];m&&delete m[l]}e.unregisterGlobal=u}),MM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagComponentLogger=void 0;var t=fo();class n{constructor(o){this._namespace=o.namespace||"DiagComponentLogger"}debug(...o){return i("debug",this._namespace,o)}error(...o){return i("error",this._namespace,o)}info(...o){return i("info",this._namespace,o)}warn(...o){return i("warn",this._namespace,o)}verbose(...o){return i("verbose",this._namespace,o)}}e.DiagComponentLogger=n;function i(r,o,a){let s=(0,t.getGlobal)("diag");if(s)return a.unshift(o),s[r](...a)}}),sm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagLogLevel=void 0;var t;(function(n){n[n.NONE=0]="NONE",n[n.ERROR=30]="ERROR",n[n.WARN=50]="WARN",n[n.INFO=60]="INFO",n[n.DEBUG=70]="DEBUG",n[n.VERBOSE=80]="VERBOSE",n[n.ALL=9999]="ALL"})(t=e.DiagLogLevel||(e.DiagLogLevel={}))}),jM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLogLevelDiagLogger=void 0;var t=sm();function n(i,r){i<t.DiagLogLevel.NONE?i=t.DiagLogLevel.NONE:i>t.DiagLogLevel.ALL&&(i=t.DiagLogLevel.ALL),r=r||{};function o(a,s){let d=r[a];return typeof d=="function"&&i>=s?d.bind(r):function(){}}return{error:o("error",t.DiagLogLevel.ERROR),warn:o("warn",t.DiagLogLevel.WARN),info:o("info",t.DiagLogLevel.INFO),debug:o("debug",t.DiagLogLevel.DEBUG),verbose:o("verbose",t.DiagLogLevel.VERBOSE)}}e.createLogLevelDiagLogger=n}),mo=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagAPI=void 0;var t=MM(),n=jM(),i=sm(),r=fo(),o="diag";class a{constructor(){function d(p){return function(...m){let f=(0,r.getGlobal)("diag");if(f)return f[p](...m)}}let u=this,l=(p,m={logLevel:i.DiagLogLevel.INFO})=>{var f,h,y;if(p===u){let v=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return u.error((f=v.stack)!==null&&f!==void 0?f:v.message),!1}typeof m=="number"&&(m={logLevel:m});let w=(0,r.getGlobal)("diag"),g=(0,n.createLogLevelDiagLogger)((h=m.logLevel)!==null&&h!==void 0?h:i.DiagLogLevel.INFO,p);if(w&&!m.suppressOverrideMessage){let v=(y=Error().stack)!==null&&y!==void 0?y:"<failed to generate stacktrace>";w.warn(`Current logger will be overwritten from ${v}`),g.warn(`Current logger will overwrite one already registered from ${v}`)}return(0,r.registerGlobal)("diag",g,u,!0)};u.setLogger=l,u.disable=()=>{(0,r.unregisterGlobal)(o,u)},u.createComponentLogger=p=>new t.DiagComponentLogger(p),u.verbose=d("verbose"),u.debug=d("debug"),u.info=d("info"),u.warn=d("warn"),u.error=d("error")}static instance(){return this._instance||(this._instance=new a),this._instance}}e.DiagAPI=a}),NM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaggageImpl=void 0;class t{constructor(i){this._entries=i?new Map(i):new Map}getEntry(i){let r=this._entries.get(i);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries()).map(([i,r])=>[i,r])}setEntry(i,r){let o=new t(this._entries);return o._entries.set(i,r),o}removeEntry(i){let r=new t(this._entries);return r._entries.delete(i),r}removeEntries(...i){let r=new t(this._entries);for(let o of i)r._entries.delete(o);return r}clear(){return new t}}e.BaggageImpl=t}),qM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.baggageEntryMetadataSymbol=void 0,e.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")}),$S=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.baggageEntryMetadataFromString=e.createBaggage=void 0;var t=mo(),n=NM(),i=qM(),r=t.DiagAPI.instance();function o(s={}){return new n.BaggageImpl(new Map(Object.entries(s)))}e.createBaggage=o;function a(s){return typeof s!="string"&&(r.error(`Cannot create baggage metadata from unknown type: ${typeof s}`),s=""),{__TYPE__:i.baggageEntryMetadataSymbol,toString(){return s}}}e.baggageEntryMetadataFromString=a}),nl=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ROOT_CONTEXT=e.createContextKey=void 0;function t(i){return Symbol.for(i)}e.createContextKey=t;class n{constructor(r){let o=this;o._currentContext=r?new Map(r):new Map,o.getValue=a=>o._currentContext.get(a),o.setValue=(a,s)=>{let d=new n(o._currentContext);return d._currentContext.set(a,s),d},o.deleteValue=a=>{let s=new n(o._currentContext);return s._currentContext.delete(a),s}}}e.ROOT_CONTEXT=new n}),DM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagConsoleLogger=void 0;var t=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class n{constructor(){function r(o){return function(...a){if(console){let s=console[o];if(typeof s!="function"&&(s=console.log),typeof s=="function")return s.apply(console,a)}}}for(let o=0;o<t.length;o++)this[t[o].n]=r(t[o].c)}}e.DiagConsoleLogger=n}),MS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createNoopMeter=e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=e.NOOP_OBSERVABLE_GAUGE_METRIC=e.NOOP_OBSERVABLE_COUNTER_METRIC=e.NOOP_UP_DOWN_COUNTER_METRIC=e.NOOP_HISTOGRAM_METRIC=e.NOOP_GAUGE_METRIC=e.NOOP_COUNTER_METRIC=e.NOOP_METER=e.NoopObservableUpDownCounterMetric=e.NoopObservableGaugeMetric=e.NoopObservableCounterMetric=e.NoopObservableMetric=e.NoopHistogramMetric=e.NoopGaugeMetric=e.NoopUpDownCounterMetric=e.NoopCounterMetric=e.NoopMetric=e.NoopMeter=void 0;class t{constructor(){}createGauge(f,h){return e.NOOP_GAUGE_METRIC}createHistogram(f,h){return e.NOOP_HISTOGRAM_METRIC}createCounter(f,h){return e.NOOP_COUNTER_METRIC}createUpDownCounter(f,h){return e.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(f,h){return e.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(f,h){return e.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(f,h){return e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(f,h){}removeBatchObservableCallback(f){}}e.NoopMeter=t;class n{}e.NoopMetric=n;class i extends n{add(f,h){}}e.NoopCounterMetric=i;class r extends n{add(f,h){}}e.NoopUpDownCounterMetric=r;class o extends n{record(f,h){}}e.NoopGaugeMetric=o;class a extends n{record(f,h){}}e.NoopHistogramMetric=a;class s{addCallback(f){}removeCallback(f){}}e.NoopObservableMetric=s;class d extends s{}e.NoopObservableCounterMetric=d;class u extends s{}e.NoopObservableGaugeMetric=u;class l extends s{}e.NoopObservableUpDownCounterMetric=l,e.NOOP_METER=new t,e.NOOP_COUNTER_METRIC=new i,e.NOOP_GAUGE_METRIC=new o,e.NOOP_HISTOGRAM_METRIC=new a,e.NOOP_UP_DOWN_COUNTER_METRIC=new r,e.NOOP_OBSERVABLE_COUNTER_METRIC=new d,e.NOOP_OBSERVABLE_GAUGE_METRIC=new u,e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new l;function p(){return e.NOOP_METER}e.createNoopMeter=p}),LM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueType=void 0;var t;(function(n){n[n.INT=0]="INT",n[n.DOUBLE=1]="DOUBLE"})(t=e.ValueType||(e.ValueType={}))}),jS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultTextMapSetter=e.defaultTextMapGetter=void 0,e.defaultTextMapGetter={get(t,n){if(t!=null)return t[n]},keys(t){return t==null?[]:Object.keys(t)}},e.defaultTextMapSetter={set(t,n,i){t!=null&&(t[n]=i)}}}),UM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopContextManager=void 0;var t=nl();class n{active(){return t.ROOT_CONTEXT}with(r,o,a,...s){return o.call(a,...s)}bind(r,o){return o}enable(){return this}disable(){return this}}e.NoopContextManager=n}),rl=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContextAPI=void 0;var t=UM(),n=fo(),i=mo(),r="context",o=new t.NoopContextManager;class a{constructor(){}static getInstance(){return this._instance||(this._instance=new a),this._instance}setGlobalContextManager(d){return(0,n.registerGlobal)(r,d,i.DiagAPI.instance())}active(){return this._getContextManager().active()}with(d,u,l,...p){return this._getContextManager().with(d,u,l,...p)}bind(d,u){return this._getContextManager().bind(d,u)}_getContextManager(){return(0,n.getGlobal)(r)||o}disable(){this._getContextManager().disable(),(0,n.unregisterGlobal)(r,i.DiagAPI.instance())}}e.ContextAPI=a}),NS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceFlags=void 0;var t;(function(n){n[n.NONE=0]="NONE",n[n.SAMPLED=1]="SAMPLED"})(t=e.TraceFlags||(e.TraceFlags={}))}),dm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=void 0;var t=NS();e.INVALID_SPANID="0000000000000000",e.INVALID_TRACEID="00000000000000000000000000000000",e.INVALID_SPAN_CONTEXT={traceId:e.INVALID_TRACEID,spanId:e.INVALID_SPANID,traceFlags:t.TraceFlags.NONE}}),um=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NonRecordingSpan=void 0;var t=dm();class n{constructor(r=t.INVALID_SPAN_CONTEXT){this._spanContext=r}spanContext(){return this._spanContext}setAttribute(r,o){return this}setAttributes(r){return this}addEvent(r,o){return this}addLink(r){return this}addLinks(r){return this}setStatus(r){return this}updateName(r){return this}end(r){}isRecording(){return!1}recordException(r,o){}}e.NonRecordingSpan=n}),qS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSpanContext=e.setSpanContext=e.deleteSpan=e.setSpan=e.getActiveSpan=e.getSpan=void 0;var t=nl(),n=um(),i=rl(),r=(0,t.createContextKey)("OpenTelemetry Context Key SPAN");function o(p){return p.getValue(r)||void 0}e.getSpan=o;function a(){return o(i.ContextAPI.getInstance().active())}e.getActiveSpan=a;function s(p,m){return p.setValue(r,m)}e.setSpan=s;function d(p){return p.deleteValue(r)}e.deleteSpan=d;function u(p,m){return s(p,new n.NonRecordingSpan(m))}e.setSpanContext=u;function l(p){var m;return(m=o(p))===null||m===void 0?void 0:m.spanContext()}e.getSpanContext=l}),lm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wrapSpanContext=e.isSpanContextValid=e.isValidSpanId=e.isValidTraceId=void 0;var t=dm(),n=um(),i=/^([0-9a-f]{32})$/i,r=/^[0-9a-f]{16}$/i;function o(u){return i.test(u)&&u!==t.INVALID_TRACEID}e.isValidTraceId=o;function a(u){return r.test(u)&&u!==t.INVALID_SPANID}e.isValidSpanId=a;function s(u){return o(u.traceId)&&a(u.spanId)}e.isSpanContextValid=s;function d(u){return new n.NonRecordingSpan(u)}e.wrapSpanContext=d}),DS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTracer=void 0;var t=rl(),n=qS(),i=um(),r=lm(),o=t.ContextAPI.getInstance();class a{startSpan(u,l,p=o.active()){if(l?.root)return new i.NonRecordingSpan;let m=p&&(0,n.getSpanContext)(p);return s(m)&&(0,r.isSpanContextValid)(m)?new i.NonRecordingSpan(m):new i.NonRecordingSpan}startActiveSpan(u,l,p,m){let f,h,y;if(arguments.length<2)return;arguments.length===2?y=l:arguments.length===3?(f=l,y=p):(f=l,h=p,y=m);let w=h??o.active(),g=this.startSpan(u,f,w),v=(0,n.setSpan)(w,g);return o.with(v,y,void 0,g)}}e.NoopTracer=a;function s(d){return typeof d=="object"&&typeof d.spanId=="string"&&typeof d.traceId=="string"&&typeof d.traceFlags=="number"}}),LS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyTracer=void 0;var t=DS(),n=new t.NoopTracer;class i{constructor(o,a,s,d){this._provider=o,this.name=a,this.version=s,this.options=d}startSpan(o,a,s){return this._getTracer().startSpan(o,a,s)}startActiveSpan(o,a,s,d){let u=this._getTracer();return Reflect.apply(u.startActiveSpan,u,arguments)}_getTracer(){if(this._delegate)return this._delegate;let o=this._provider.getDelegateTracer(this.name,this.version,this.options);return o?(this._delegate=o,this._delegate):n}}e.ProxyTracer=i}),FM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTracerProvider=void 0;var t=DS();class n{getTracer(r,o,a){return new t.NoopTracer}}e.NoopTracerProvider=n}),US=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyTracerProvider=void 0;var t=LS(),n=FM(),i=new n.NoopTracerProvider;class r{getTracer(a,s,d){var u;return(u=this.getDelegateTracer(a,s,d))!==null&&u!==void 0?u:new t.ProxyTracer(this,a,s,d)}getDelegate(){var a;return(a=this._delegate)!==null&&a!==void 0?a:i}setDelegate(a){this._delegate=a}getDelegateTracer(a,s,d){var u;return(u=this._delegate)===null||u===void 0?void 0:u.getTracer(a,s,d)}}e.ProxyTracerProvider=r}),zM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SamplingDecision=void 0;var t;(function(n){n[n.NOT_RECORD=0]="NOT_RECORD",n[n.RECORD=1]="RECORD",n[n.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(t=e.SamplingDecision||(e.SamplingDecision={}))}),BM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SpanKind=void 0;var t;(function(n){n[n.INTERNAL=0]="INTERNAL",n[n.SERVER=1]="SERVER",n[n.CLIENT=2]="CLIENT",n[n.PRODUCER=3]="PRODUCER",n[n.CONSUMER=4]="CONSUMER"})(t=e.SpanKind||(e.SpanKind={}))}),KM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SpanStatusCode=void 0;var t;(function(n){n[n.UNSET=0]="UNSET",n[n.OK=1]="OK",n[n.ERROR=2]="ERROR"})(t=e.SpanStatusCode||(e.SpanStatusCode={}))}),JM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateValue=e.validateKey=void 0;var t="[_0-9a-z-*/]",n=`[a-z]${t}{0,255}`,i=`[a-z0-9]${t}{0,240}@[a-z]${t}{0,13}`,r=new RegExp(`^(?:${n}|${i})$`),o=/^[ -~]{0,255}[!-~]$/,a=/,|=/;function s(u){return r.test(u)}e.validateKey=s;function d(u){return o.test(u)&&!a.test(u)}e.validateValue=d}),WM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceStateImpl=void 0;var t=JM(),n=32,i=512,r=",",o="=";class a{constructor(d){this._internalState=new Map,d&&this._parse(d)}set(d,u){let l=this._clone();return l._internalState.has(d)&&l._internalState.delete(d),l._internalState.set(d,u),l}unset(d){let u=this._clone();return u._internalState.delete(d),u}get(d){return this._internalState.get(d)}serialize(){return this._keys().reduce((d,u)=>(d.push(u+o+this.get(u)),d),[]).join(r)}_parse(d){d.length>i||(this._internalState=d.split(r).reverse().reduce((u,l)=>{let p=l.trim(),m=p.indexOf(o);if(m!==-1){let f=p.slice(0,m),h=p.slice(m+1,l.length);(0,t.validateKey)(f)&&(0,t.validateValue)(h)&&u.set(f,h)}return u},new Map),this._internalState.size>n&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,n))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let d=new a;return d._internalState=new Map(this._internalState),d}}e.TraceStateImpl=a}),HM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createTraceState=void 0;var t=WM();function n(i){return new t.TraceStateImpl(i)}e.createTraceState=n}),GM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.context=void 0;var t=rl();e.context=t.ContextAPI.getInstance()}),VM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.diag=void 0;var t=mo();e.diag=t.DiagAPI.instance()}),ZM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NOOP_METER_PROVIDER=e.NoopMeterProvider=void 0;var t=MS();class n{getMeter(r,o,a){return t.NOOP_METER}}e.NoopMeterProvider=n,e.NOOP_METER_PROVIDER=new n}),QM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MetricsAPI=void 0;var t=ZM(),n=fo(),i=mo(),r="metrics";class o{constructor(){}static getInstance(){return this._instance||(this._instance=new o),this._instance}setGlobalMeterProvider(s){return(0,n.registerGlobal)(r,s,i.DiagAPI.instance())}getMeterProvider(){return(0,n.getGlobal)(r)||t.NOOP_METER_PROVIDER}getMeter(s,d,u){return this.getMeterProvider().getMeter(s,d,u)}disable(){(0,n.unregisterGlobal)(r,i.DiagAPI.instance())}}e.MetricsAPI=o}),YM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.metrics=void 0;var t=QM();e.metrics=t.MetricsAPI.getInstance()}),XM=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTextMapPropagator=void 0;class t{inject(i,r){}extract(i,r){return i}fields(){return[]}}e.NoopTextMapPropagator=t}),e1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.deleteBaggage=e.setBaggage=e.getActiveBaggage=e.getBaggage=void 0;var t=rl(),n=nl(),i=(0,n.createContextKey)("OpenTelemetry Baggage Key");function r(d){return d.getValue(i)||void 0}e.getBaggage=r;function o(){return r(t.ContextAPI.getInstance().active())}e.getActiveBaggage=o;function a(d,u){return d.setValue(i,u)}e.setBaggage=a;function s(d){return d.deleteValue(i)}e.deleteBaggage=s}),t1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PropagationAPI=void 0;var t=fo(),n=XM(),i=jS(),r=e1(),o=$S(),a=mo(),s="propagation",d=new n.NoopTextMapPropagator;class u{constructor(){this.createBaggage=o.createBaggage,this.getBaggage=r.getBaggage,this.getActiveBaggage=r.getActiveBaggage,this.setBaggage=r.setBaggage,this.deleteBaggage=r.deleteBaggage}static getInstance(){return this._instance||(this._instance=new u),this._instance}setGlobalPropagator(p){return(0,t.registerGlobal)(s,p,a.DiagAPI.instance())}inject(p,m,f=i.defaultTextMapSetter){return this._getGlobalPropagator().inject(p,m,f)}extract(p,m,f=i.defaultTextMapGetter){return this._getGlobalPropagator().extract(p,m,f)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,t.unregisterGlobal)(s,a.DiagAPI.instance())}_getGlobalPropagator(){return(0,t.getGlobal)(s)||d}}e.PropagationAPI=u}),n1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.propagation=void 0;var t=t1();e.propagation=t.PropagationAPI.getInstance()}),r1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceAPI=void 0;var t=fo(),n=US(),i=lm(),r=qS(),o=mo(),a="trace";class s{constructor(){this._proxyTracerProvider=new n.ProxyTracerProvider,this.wrapSpanContext=i.wrapSpanContext,this.isSpanContextValid=i.isSpanContextValid,this.deleteSpan=r.deleteSpan,this.getSpan=r.getSpan,this.getActiveSpan=r.getActiveSpan,this.getSpanContext=r.getSpanContext,this.setSpan=r.setSpan,this.setSpanContext=r.setSpanContext}static getInstance(){return this._instance||(this._instance=new s),this._instance}setGlobalTracerProvider(u){let l=(0,t.registerGlobal)(a,this._proxyTracerProvider,o.DiagAPI.instance());return l&&this._proxyTracerProvider.setDelegate(u),l}getTracerProvider(){return(0,t.getGlobal)(a)||this._proxyTracerProvider}getTracer(u,l){return this.getTracerProvider().getTracer(u,l)}disable(){(0,t.unregisterGlobal)(a,o.DiagAPI.instance()),this._proxyTracerProvider=new n.ProxyTracerProvider}}e.TraceAPI=s}),i1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.trace=void 0;var t=r1();e.trace=t.TraceAPI.getInstance()}),o1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.trace=e.propagation=e.metrics=e.diag=e.context=e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=e.isValidSpanId=e.isValidTraceId=e.isSpanContextValid=e.createTraceState=e.TraceFlags=e.SpanStatusCode=e.SpanKind=e.SamplingDecision=e.ProxyTracerProvider=e.ProxyTracer=e.defaultTextMapSetter=e.defaultTextMapGetter=e.ValueType=e.createNoopMeter=e.DiagLogLevel=e.DiagConsoleLogger=e.ROOT_CONTEXT=e.createContextKey=e.baggageEntryMetadataFromString=void 0;var t=$S();Object.defineProperty(e,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return t.baggageEntryMetadataFromString}});var n=nl();Object.defineProperty(e,"createContextKey",{enumerable:!0,get:function(){return n.createContextKey}}),Object.defineProperty(e,"ROOT_CONTEXT",{enumerable:!0,get:function(){return n.ROOT_CONTEXT}});var i=DM();Object.defineProperty(e,"DiagConsoleLogger",{enumerable:!0,get:function(){return i.DiagConsoleLogger}});var r=sm();Object.defineProperty(e,"DiagLogLevel",{enumerable:!0,get:function(){return r.DiagLogLevel}});var o=MS();Object.defineProperty(e,"createNoopMeter",{enumerable:!0,get:function(){return o.createNoopMeter}});var a=LM();Object.defineProperty(e,"ValueType",{enumerable:!0,get:function(){return a.ValueType}});var s=jS();Object.defineProperty(e,"defaultTextMapGetter",{enumerable:!0,get:function(){return s.defaultTextMapGetter}}),Object.defineProperty(e,"defaultTextMapSetter",{enumerable:!0,get:function(){return s.defaultTextMapSetter}});var d=LS();Object.defineProperty(e,"ProxyTracer",{enumerable:!0,get:function(){return d.ProxyTracer}});var u=US();Object.defineProperty(e,"ProxyTracerProvider",{enumerable:!0,get:function(){return u.ProxyTracerProvider}});var l=zM();Object.defineProperty(e,"SamplingDecision",{enumerable:!0,get:function(){return l.SamplingDecision}});var p=BM();Object.defineProperty(e,"SpanKind",{enumerable:!0,get:function(){return p.SpanKind}});var m=KM();Object.defineProperty(e,"SpanStatusCode",{enumerable:!0,get:function(){return m.SpanStatusCode}});var f=NS();Object.defineProperty(e,"TraceFlags",{enumerable:!0,get:function(){return f.TraceFlags}});var h=HM();Object.defineProperty(e,"createTraceState",{enumerable:!0,get:function(){return h.createTraceState}});var y=lm();Object.defineProperty(e,"isSpanContextValid",{enumerable:!0,get:function(){return y.isSpanContextValid}}),Object.defineProperty(e,"isValidTraceId",{enumerable:!0,get:function(){return y.isValidTraceId}}),Object.defineProperty(e,"isValidSpanId",{enumerable:!0,get:function(){return y.isValidSpanId}});var w=dm();Object.defineProperty(e,"INVALID_SPANID",{enumerable:!0,get:function(){return w.INVALID_SPANID}}),Object.defineProperty(e,"INVALID_TRACEID",{enumerable:!0,get:function(){return w.INVALID_TRACEID}}),Object.defineProperty(e,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return w.INVALID_SPAN_CONTEXT}});var g=GM();Object.defineProperty(e,"context",{enumerable:!0,get:function(){return g.context}});var v=VM();Object.defineProperty(e,"diag",{enumerable:!0,get:function(){return v.diag}});var b=YM();Object.defineProperty(e,"metrics",{enumerable:!0,get:function(){return b.metrics}});var S=n1();Object.defineProperty(e,"propagation",{enumerable:!0,get:function(){return S.propagation}});var T=i1();Object.defineProperty(e,"trace",{enumerable:!0,get:function(){return T.trace}}),e.default={context:g.context,diag:v.diag,metrics:b.metrics,propagation:S.propagation,trace:T.trace}}),Md=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(v){if(super(),!e.IDENTIFIER.test(v))throw Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class i extends t{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((b,S)=>`${b}${S}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((b,S)=>(S instanceof n&&(b[S.str]=(b[S.str]||0)+1),b),{})}}e._Code=i,e.nil=new i("");function r(g,...v){let b=[g[0]],S=0;for(;S<v.length;)s(b,v[S]),b.push(g[++S]);return new i(b)}e._=r;var o=new i("+");function a(g,...v){let b=[f(g[0])],S=0;for(;S<v.length;)b.push(o),s(b,v[S]),b.push(o,f(g[++S]));return d(b),new i(b)}e.str=a;function s(g,v){v instanceof i?g.push(...v._items):v instanceof n?g.push(v):g.push(p(v))}e.addCodeArg=s;function d(g){let v=1;for(;v<g.length-1;){if(g[v]===o){let b=u(g[v-1],g[v+1]);if(b!==void 0){g.splice(v-1,3,b);continue}g[v++]="+"}v++}}function u(g,v){if(v==='""')return g;if(g==='""')return v;if(typeof g=="string")return v instanceof n||g[g.length-1]!=='"'?void 0:typeof v!="string"?`${g.slice(0,-1)}${v}"`:v[0]==='"'?g.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(g instanceof n))return`"${g}${v.slice(1)}`}function l(g,v){return v.emptyStr()?g:g.emptyStr()?v:a`${g}${v}`}e.strConcat=l;function p(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:f(Array.isArray(g)?g.join(","):g)}function m(g){return new i(f(g))}e.stringify=m;function f(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=f;function h(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new i(`.${g}`):r`[${g}]`}e.getProperty=h;function y(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new i(`${g}`);throw Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=y;function w(g){return new i(g.toString())}e.regexpCode=w}),Mv=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Md();class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var i;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(i||(e.UsedValueState=i={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class r{constructor({prefixes:u,parent:l}={}){this._names={},this._prefixes=u,this._parent=l}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){let l=this._names[u]||this._nameGroup(u);return`${u}${l.index++}`}_nameGroup(u){var l,p;if(!((p=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||p===void 0)&&p.has(u)||this._prefixes&&!this._prefixes.has(u))throw Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=r;class o extends t.Name{constructor(u,l){super(l),this.prefix=u}setValue(u,{property:l,itemIndex:p}){this.value=u,this.scopePath=t._`.${new t.Name(l)}[${p}]`}}e.ValueScopeName=o;var a=t._`\n`;class s extends r{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?a:t.nil}}get(){return this._scope}name(u){return new o(u,this._newName(u))}value(u,l){var p;if(l.ref===void 0)throw Error("CodeGen: ref must be passed in value");let m=this.toName(u),{prefix:f}=m,h=(p=l.key)!==null&&p!==void 0?p:l.ref,y=this._values[f];if(y){let v=y.get(h);if(v)return v}else y=this._values[f]=new Map;y.set(h,m);let w=this._scope[f]||(this._scope[f]=[]),g=w.length;return w[g]=l.ref,m.setValue(l,{property:f,itemIndex:g}),m}getValue(u,l){let p=this._values[u];if(p)return p.get(l)}scopeRefs(u,l=this._values){return this._reduceValues(l,p=>{if(p.scopePath===void 0)throw Error(`CodeGen: name "${p}" has no value`);return t._`${u}${p.scopePath}`})}scopeCode(u=this._values,l,p){return this._reduceValues(u,m=>{if(m.value===void 0)throw Error(`CodeGen: name "${m}" has no value`);return m.value.code},l,p)}_reduceValues(u,l,p={},m){let f=t.nil;for(let h in u){let y=u[h];if(!y)continue;let w=p[h]=p[h]||new Map;y.forEach(g=>{if(w.has(g))return;w.set(g,i.Started);let v=l(g);if(v){let b=this.opts.es5?e.varKinds.var:e.varKinds.const;f=t._`${f}${b} ${g} = ${v};${this.opts._n}`}else if(v=m?.(g))f=t._`${f}${v}${this.opts._n}`;else throw new n(g);w.set(g,i.Completed)})}return f}}e.ValueScope=s}),Te=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=Md(),n=Mv(),i=Md();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return i.Name}});var r=Mv();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(x,E){return this}}class a extends o{constructor(x,E,O){super(),this.varKind=x,this.name=E,this.rhs=O}render({es5:x,_n:E}){let O=x?n.varKinds.var:this.varKind,ne=this.rhs===void 0?"":` = ${this.rhs}`;return`${O} ${this.name}${ne};`+E}optimizeNames(x,E){if(x[this.name.str])return this.rhs&&(this.rhs=F(this.rhs,x,E)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class s extends o{constructor(x,E,O){super(),this.lhs=x,this.rhs=E,this.sideEffects=O}render({_n:x}){return`${this.lhs} = ${this.rhs};`+x}optimizeNames(x,E){if(!(this.lhs instanceof t.Name&&!x[this.lhs.str]&&!this.sideEffects))return this.rhs=F(this.rhs,x,E),this}get names(){let x=this.lhs instanceof t.Name?{}:{...this.lhs.names};return A(x,this.rhs)}}class d extends s{constructor(x,E,O,ne){super(x,O,ne),this.op=E}render({_n:x}){return`${this.lhs} ${this.op}= ${this.rhs};`+x}}class u extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`${this.label}:`+x}}class l extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`break${this.label?` ${this.label}`:""};`+x}}class p extends o{constructor(x){super(),this.error=x}render({_n:x}){return`throw ${this.error};`+x}get names(){return this.error.names}}class m extends o{constructor(x){super(),this.code=x}render({_n:x}){return`${this.code};`+x}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(x,E){return this.code=F(this.code,x,E),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends o{constructor(x=[]){super(),this.nodes=x}render(x){return this.nodes.reduce((E,O)=>E+O.render(x),"")}optimizeNodes(){let{nodes:x}=this,E=x.length;for(;E--;){let O=x[E].optimizeNodes();Array.isArray(O)?x.splice(E,1,...O):O?x[E]=O:x.splice(E,1)}return x.length>0?this:void 0}optimizeNames(x,E){let{nodes:O}=this,ne=O.length;for(;ne--;){let X=O[ne];X.optimizeNames(x,E)||(se(x,X.names),O.splice(ne,1))}return O.length>0?this:void 0}get names(){return this.nodes.reduce((x,E)=>M(x,E.names),{})}}class h extends f{render(x){return"{"+x._n+super.render(x)+"}"+x._n}}class y extends f{}class w extends h{}w.kind="else";class g extends h{constructor(x,E){super(E),this.condition=x}render(x){let E=`if(${this.condition})`+super.render(x);return this.else&&(E+="else "+this.else.render(x)),E}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!0)return this.nodes;let E=this.else;if(E){let O=E.optimizeNodes();E=this.else=Array.isArray(O)?new w(O):O}if(E)return x===!1?E instanceof g?E:E.nodes:this.nodes.length?this:new g(he(x),E instanceof g?[E]:E.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,E){var O;if(this.else=(O=this.else)===null||O===void 0?void 0:O.optimizeNames(x,E),!!(super.optimizeNames(x,E)||this.else))return this.condition=F(this.condition,x,E),this}get names(){let x=super.names;return A(x,this.condition),this.else&&M(x,this.else.names),x}}g.kind="if";class v extends h{}v.kind="for";class b extends v{constructor(x){super(),this.iteration=x}render(x){return`for(${this.iteration})`+super.render(x)}optimizeNames(x,E){if(super.optimizeNames(x,E))return this.iteration=F(this.iteration,x,E),this}get names(){return M(super.names,this.iteration.names)}}class S extends v{constructor(x,E,O,ne){super(),this.varKind=x,this.name=E,this.from=O,this.to=ne}render(x){let E=x.es5?n.varKinds.var:this.varKind,{name:O,from:ne,to:X}=this;return`for(${E} ${O}=${ne}; ${O}<${X}; ${O}++)`+super.render(x)}get names(){let x=A(super.names,this.from);return A(x,this.to)}}class T extends v{constructor(x,E,O,ne){super(),this.loop=x,this.varKind=E,this.name=O,this.iterable=ne}render(x){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(x)}optimizeNames(x,E){if(super.optimizeNames(x,E))return this.iterable=F(this.iterable,x,E),this}get names(){return M(super.names,this.iterable.names)}}class C extends h{constructor(x,E,O){super(),this.name=x,this.args=E,this.async=O}render(x){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(x)}}C.kind="func";class _ extends f{render(x){return"return "+super.render(x)}}_.kind="return";class k extends h{render(x){let E="try"+super.render(x);return this.catch&&(E+=this.catch.render(x)),this.finally&&(E+=this.finally.render(x)),E}optimizeNodes(){var x,E;return super.optimizeNodes(),(x=this.catch)===null||x===void 0||x.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(x,E){var O,ne;return super.optimizeNames(x,E),(O=this.catch)===null||O===void 0||O.optimizeNames(x,E),(ne=this.finally)===null||ne===void 0||ne.optimizeNames(x,E),this}get names(){let x=super.names;return this.catch&&M(x,this.catch.names),this.finally&&M(x,this.finally.names),x}}class I extends h{constructor(x){super(),this.error=x}render(x){return`catch(${this.error})`+super.render(x)}}I.kind="catch";class P extends h{render(x){return"finally"+super.render(x)}}P.kind="finally";class R{constructor(x,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?`
|
|
37
37
|
`:""},this._extScope=x,this._scope=new n.Scope({parent:x}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(x){return this._scope.name(x)}scopeName(x){return this._extScope.name(x)}scopeValue(x,E){let O=this._extScope.value(x,E);return(this._values[O.prefix]||(this._values[O.prefix]=new Set)).add(O),O}getScopeValue(x,E){return this._extScope.getValue(x,E)}scopeRefs(x){return this._extScope.scopeRefs(x,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(x,E,O,ne){let X=this._scope.toName(E);return O!==void 0&&ne&&(this._constants[X.str]=O),this._leafNode(new a(x,X,O)),X}const(x,E,O){return this._def(n.varKinds.const,x,E,O)}let(x,E,O){return this._def(n.varKinds.let,x,E,O)}var(x,E,O){return this._def(n.varKinds.var,x,E,O)}assign(x,E,O){return this._leafNode(new s(x,E,O))}add(x,E){return this._leafNode(new d(x,e.operators.ADD,E))}code(x){return typeof x=="function"?x():x!==t.nil&&this._leafNode(new m(x)),this}object(...x){let E=["{"];for(let[O,ne]of x)E.length>1&&E.push(","),E.push(O),(O!==ne||this.opts.es5)&&(E.push(":"),(0,t.addCodeArg)(E,ne));return E.push("}"),new t._Code(E)}if(x,E,O){if(this._blockNode(new g(x)),E&&O)this.code(E).else().code(O).endIf();else if(E)this.code(E).endIf();else if(O)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(x){return this._elseNode(new g(x))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(g,w)}_for(x,E){return this._blockNode(x),E&&this.code(E).endFor(),this}for(x,E){return this._for(new b(x),E)}forRange(x,E,O,ne,X=this.opts.es5?n.varKinds.var:n.varKinds.let){let we=this._scope.toName(x);return this._for(new S(X,we,E,O),()=>ne(we))}forOf(x,E,O,ne=n.varKinds.const){let X=this._scope.toName(x);if(this.opts.es5){let we=E instanceof t.Name?E:this.var("_arr",E);return this.forRange("_i",0,t._`${we}.length`,Se=>{this.var(X,t._`${we}[${Se}]`),O(X)})}return this._for(new T("of",ne,X,E),()=>O(X))}forIn(x,E,O,ne=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(x,t._`Object.keys(${E})`,O);let X=this._scope.toName(x);return this._for(new T("in",ne,X,E),()=>O(X))}endFor(){return this._endBlockNode(v)}label(x){return this._leafNode(new u(x))}break(x){return this._leafNode(new l(x))}return(x){let E=new _;if(this._blockNode(E),this.code(x),E.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(x,E,O){if(!E&&!O)throw Error('CodeGen: "try" without "catch" and "finally"');let ne=new k;if(this._blockNode(ne),this.code(x),E){let X=this.name("e");this._currNode=ne.catch=new I(X),E(X)}return O&&(this._currNode=ne.finally=new P,this.code(O)),this._endBlockNode(I,P)}throw(x){return this._leafNode(new p(x))}block(x,E){return this._blockStarts.push(this._nodes.length),x&&this.code(x).endBlock(E),this}endBlock(x){let E=this._blockStarts.pop();if(E===void 0)throw Error("CodeGen: not in self-balancing block");let O=this._nodes.length-E;if(O<0||x!==void 0&&O!==x)throw Error(`CodeGen: wrong number of nodes: ${O} vs ${x} expected`);return this._nodes.length=E,this}func(x,E=t.nil,O,ne){return this._blockNode(new C(x,E,O)),ne&&this.code(ne).endFunc(),this}endFunc(){return this._endBlockNode(C)}optimize(x=1){for(;x-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(x){return this._currNode.nodes.push(x),this}_blockNode(x){this._currNode.nodes.push(x),this._nodes.push(x)}_endBlockNode(x,E){let O=this._currNode;if(O instanceof x||E&&O instanceof E)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${E?`${x.kind}/${E.kind}`:x.kind}"`)}_elseNode(x){let E=this._currNode;if(!(E instanceof g))throw Error('CodeGen: "else" without "if"');return this._currNode=E.else=x,this}get _root(){return this._nodes[0]}get _currNode(){let x=this._nodes;return x[x.length-1]}set _currNode(x){let E=this._nodes;E[E.length-1]=x}}e.CodeGen=R;function M(L,x){for(let E in x)L[E]=(L[E]||0)+(x[E]||0);return L}function A(L,x){return x instanceof t._CodeOrName?M(L,x.names):L}function F(L,x,E){if(L instanceof t.Name)return O(L);if(!ne(L))return L;return new t._Code(L._items.reduce((X,we)=>(we instanceof t.Name&&(we=O(we)),we instanceof t._Code?X.push(...we._items):X.push(we),X),[]));function O(X){let we=E[X.str];return we===void 0||x[X.str]!==1?X:(delete x[X.str],we)}function ne(X){return X instanceof t._Code&&X._items.some(we=>we instanceof t.Name&&x[we.str]===1&&E[we.str]!==void 0)}}function se(L,x){for(let E in x)L[E]=(L[E]||0)-(x[E]||0)}function he(L){return typeof L=="boolean"||typeof L=="number"||L===null?!L:t._`!${B(L)}`}e.not=he;var ee=$(e.operators.AND);function $e(...L){return L.reduce(ee)}e.and=$e;var be=$(e.operators.OR);function G(...L){return L.reduce(be)}e.or=G;function $(L){return(x,E)=>x===t.nil?E:E===t.nil?x:t._`${B(x)} ${L} ${B(E)}`}function B(L){return L instanceof t.Name?L:t._`(${L})`}}),Ae=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Te(),n=Md();function i(C){let _={};for(let k of C)_[k]=!0;return _}e.toHash=i;function r(C,_){return typeof _=="boolean"?_:Object.keys(_).length===0?!0:(o(C,_),!a(_,C.self.RULES.all))}e.alwaysValidSchema=r;function o(C,_=C.schema){let{opts:k,self:I}=C;if(!k.strictSchema||typeof _=="boolean")return;let P=I.RULES.keywords;for(let R in _)P[R]||T(C,`unknown keyword: "${R}"`)}e.checkUnknownRules=o;function a(C,_){if(typeof C=="boolean")return!C;for(let k in C)if(_[k])return!0;return!1}e.schemaHasRules=a;function s(C,_){if(typeof C=="boolean")return!C;for(let k in C)if(k!=="$ref"&&_.all[k])return!0;return!1}e.schemaHasRulesButRef=s;function d({topSchemaRef:C,schemaPath:_},k,I,P){if(!P){if(typeof k=="number"||typeof k=="boolean")return k;if(typeof k=="string")return t._`${k}`}return t._`${C}${_}${(0,t.getProperty)(I)}`}e.schemaRefOrVal=d;function u(C){return m(decodeURIComponent(C))}e.unescapeFragment=u;function l(C){return encodeURIComponent(p(C))}e.escapeFragment=l;function p(C){return typeof C=="number"?`${C}`:C.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=p;function m(C){return C.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=m;function f(C,_){if(Array.isArray(C))for(let k of C)_(k);else _(C)}e.eachItem=f;function h({mergeNames:C,mergeToName:_,mergeValues:k,resultToName:I}){return(P,R,M,A)=>{let F=M===void 0?R:M instanceof t.Name?(R instanceof t.Name?C(P,R,M):_(P,R,M),M):R instanceof t.Name?(_(P,M,R),R):k(R,M);return A===t.Name&&!(F instanceof t.Name)?I(P,F):F}}e.mergeEvaluated={props:h({mergeNames:(C,_,k)=>C.if(t._`${k} !== true && ${_} !== undefined`,()=>{C.if(t._`${_} === true`,()=>C.assign(k,!0),()=>C.assign(k,t._`${k} || {}`).code(t._`Object.assign(${k}, ${_})`))}),mergeToName:(C,_,k)=>C.if(t._`${k} !== true`,()=>{_===!0?C.assign(k,!0):(C.assign(k,t._`${k} || {}`),w(C,k,_))}),mergeValues:(C,_)=>C===!0?!0:{...C,..._},resultToName:y}),items:h({mergeNames:(C,_,k)=>C.if(t._`${k} !== true && ${_} !== undefined`,()=>C.assign(k,t._`${_} === true ? true : ${k} > ${_} ? ${k} : ${_}`)),mergeToName:(C,_,k)=>C.if(t._`${k} !== true`,()=>C.assign(k,_===!0?!0:t._`${k} > ${_} ? ${k} : ${_}`)),mergeValues:(C,_)=>C===!0?!0:Math.max(C,_),resultToName:(C,_)=>C.var("items",_)})};function y(C,_){if(_===!0)return C.var("props",!0);let k=C.var("props",t._`{}`);return _!==void 0&&w(C,k,_),k}e.evaluatedPropsToName=y;function w(C,_,k){Object.keys(k).forEach(I=>C.assign(t._`${_}${(0,t.getProperty)(I)}`,!0))}e.setEvaluated=w;var g={};function v(C,_){return C.scopeValue("func",{ref:_,code:g[_.code]||(g[_.code]=new n._Code(_.code))})}e.useFunc=v;var b;(function(C){C[C.Num=0]="Num",C[C.Str=1]="Str"})(b||(e.Type=b={}));function S(C,_,k){if(C instanceof t.Name){let I=_===b.Num;return k?I?t._`"[" + ${C} + "]"`:t._`"['" + ${C} + "']"`:I?t._`"/" + ${C}`:t._`"/" + ${C}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return k?(0,t.getProperty)(C).toString():"/"+p(C)}e.getErrorPath=S;function T(C,_,k=C.opts.strictSchema){if(k){if(_=`strict mode: ${_}`,k===!0)throw Error(_);C.self.logger.warn(_)}}e.checkStrictMode=T}),Tr=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=n}),il=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Te(),n=Ae(),i=Tr();e.keywordError={message:({keyword:w})=>t.str`must pass "${w}" keyword validation`},e.keyword$DataError={message:({keyword:w,schemaType:g})=>g?t.str`"${w}" keyword must be ${g} ($data)`:t.str`"${w}" keyword is invalid ($data)`};function r(w,g=e.keywordError,v,b){let{it:S}=w,{gen:T,compositeRule:C,allErrors:_}=S,k=p(w,g,v);b??(C||_)?d(T,k):u(S,t._`[${k}]`)}e.reportError=r;function o(w,g=e.keywordError,v){let{it:b}=w,{gen:S,compositeRule:T,allErrors:C}=b,_=p(w,g,v);d(S,_),!(T||C)&&u(b,i.default.vErrors)}e.reportExtraError=o;function a(w,g){w.assign(i.default.errors,g),w.if(t._`${i.default.vErrors} !== null`,()=>w.if(g,()=>w.assign(t._`${i.default.vErrors}.length`,g),()=>w.assign(i.default.vErrors,null)))}e.resetErrorsCount=a;function s({gen:w,keyword:g,schemaValue:v,data:b,errsCount:S,it:T}){if(S===void 0)throw Error("ajv implementation error");let C=w.name("err");w.forRange("i",S,i.default.errors,_=>{w.const(C,t._`${i.default.vErrors}[${_}]`),w.if(t._`${C}.instancePath === undefined`,()=>w.assign(t._`${C}.instancePath`,(0,t.strConcat)(i.default.instancePath,T.errorPath))),w.assign(t._`${C}.schemaPath`,t.str`${T.errSchemaPath}/${g}`),T.opts.verbose&&(w.assign(t._`${C}.schema`,v),w.assign(t._`${C}.data`,b))})}e.extendErrors=s;function d(w,g){let v=w.const("err",g);w.if(t._`${i.default.vErrors} === null`,()=>w.assign(i.default.vErrors,t._`[${v}]`),t._`${i.default.vErrors}.push(${v})`),w.code(t._`${i.default.errors}++`)}function u(w,g){let{gen:v,validateName:b,schemaEnv:S}=w;S.$async?v.throw(t._`new ${w.ValidationError}(${g})`):(v.assign(t._`${b}.errors`,g),v.return(!1))}var l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function p(w,g,v){let{createErrors:b}=w.it;return b===!1?t._`{}`:m(w,g,v)}function m(w,g,v={}){let{gen:b,it:S}=w,T=[f(S,v),h(w,v)];return y(w,g,T),b.object(...T)}function f({errorPath:w},{instancePath:g}){let v=g?t.str`${w}${(0,n.getErrorPath)(g,n.Type.Str)}`:w;return[i.default.instancePath,(0,t.strConcat)(i.default.instancePath,v)]}function h({keyword:w,it:{errSchemaPath:g}},{schemaPath:v,parentSchema:b}){let S=b?g:t.str`${g}/${w}`;return v&&(S=t.str`${S}${(0,n.getErrorPath)(v,n.Type.Str)}`),[l.schemaPath,S]}function y(w,{params:g,message:v},b){let{keyword:S,data:T,schemaValue:C,it:_}=w,{opts:k,propertyName:I,topSchemaRef:P,schemaPath:R}=_;b.push([l.keyword,S],[l.params,typeof g=="function"?g(w):g||t._`{}`]),k.messages&&b.push([l.message,typeof v=="function"?v(w):v]),k.verbose&&b.push([l.schema,C],[l.parentSchema,t._`${P}${R}`],[i.default.data,T]),I&&b.push([l.propertyName,I])}}),a1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=il(),n=Te(),i=Tr(),r={message:"boolean schema is false"};function o(d){let{gen:u,schema:l,validateName:p}=d;l===!1?s(d,!1):typeof l=="object"&&l.$async===!0?u.return(i.default.data):(u.assign(n._`${p}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=o;function a(d,u){let{gen:l,schema:p}=d;p===!1?(l.var(u,!1),s(d)):l.var(u,!0)}e.boolOrEmptySchema=a;function s(d,u){let{gen:l,data:p}=d,m={gen:l,keyword:"false schema",data:p,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:d};(0,t.reportError)(m,r,void 0,u)}}),FS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=["string","number","integer","boolean","null","object","array"],n=new Set(t);function i(o){return typeof o=="string"&&n.has(o)}e.isJSONType=i;function r(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r}),zS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:r,self:o},a){let s=o.RULES.types[a];return s&&s!==!0&&n(r,s)}e.schemaHasRulesForType=t;function n(r,o){return o.rules.some(a=>i(r,a))}e.shouldUseGroup=n;function i(r,o){var a;return r[o.keyword]!==void 0||((a=o.definition.implements)===null||a===void 0?void 0:a.some(s=>r[s]!==void 0))}e.shouldUseRule=i}),jd=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=FS(),n=zS(),i=il(),r=Te(),o=Ae(),a;(function(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(a||(e.DataType=a={}));function s(b){let S=d(b.type);if(S.includes("null")){if(b.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!S.length&&b.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');b.nullable===!0&&S.push("null")}return S}e.getSchemaTypes=s;function d(b){let S=Array.isArray(b)?b:b?[b]:[];if(S.every(t.isJSONType))return S;throw Error("type must be JSONType or JSONType[]: "+S.join(","))}e.getJSONTypes=d;function u(b,S){let{gen:T,data:C,opts:_}=b,k=p(S,_.coerceTypes),I=S.length>0&&!(k.length===0&&S.length===1&&(0,n.schemaHasRulesForType)(b,S[0]));if(I){let P=y(S,C,_.strictNumbers,a.Wrong);T.if(P,()=>{k.length?m(b,S,k):g(b)})}return I}e.coerceAndCheckDataType=u;var l=new Set(["string","number","integer","boolean","null"]);function p(b,S){return S?b.filter(T=>l.has(T)||S==="array"&&T==="array"):[]}function m(b,S,T){let{gen:C,data:_,opts:k}=b,I=C.let("dataType",r._`typeof ${_}`),P=C.let("coerced",r._`undefined`);k.coerceTypes==="array"&&C.if(r._`${I} == 'object' && Array.isArray(${_}) && ${_}.length == 1`,()=>C.assign(_,r._`${_}[0]`).assign(I,r._`typeof ${_}`).if(y(S,_,k.strictNumbers),()=>C.assign(P,_))),C.if(r._`${P} !== undefined`);for(let M of T)(l.has(M)||M==="array"&&k.coerceTypes==="array")&&R(M);C.else(),g(b),C.endIf(),C.if(r._`${P} !== undefined`,()=>{C.assign(_,P),f(b,P)});function R(M){switch(M){case"string":C.elseIf(r._`${I} == "number" || ${I} == "boolean"`).assign(P,r._`"" + ${_}`).elseIf(r._`${_} === null`).assign(P,r._`""`);return;case"number":C.elseIf(r._`${I} == "boolean" || ${_} === null
|
|
38
38
|
|| (${I} == "string" && ${_} && ${_} == +${_})`).assign(P,r._`+${_}`);return;case"integer":C.elseIf(r._`${I} === "boolean" || ${_} === null
|
|
39
39
|
|| (${I} === "string" && ${_} && ${_} == +${_} && !(${_} % 1))`).assign(P,r._`+${_}`);return;case"boolean":C.elseIf(r._`${_} === "false" || ${_} === 0 || ${_} === null`).assign(P,!1).elseIf(r._`${_} === "true" || ${_} === 1`).assign(P,!0);return;case"null":C.elseIf(r._`${_} === "" || ${_} === 0 || ${_} === false`),C.assign(P,null);return;case"array":C.elseIf(r._`${I} === "string" || ${I} === "number"
|
|
40
40
|
|| ${I} === "boolean" || ${_} === null`).assign(P,r._`[${_}]`)}}}function f({gen:b,parentData:S,parentDataProperty:T},C){b.if(r._`${S} !== undefined`,()=>b.assign(r._`${S}[${T}]`,C))}function h(b,S,T,C=a.Correct){let _=C===a.Correct?r.operators.EQ:r.operators.NEQ,k;switch(b){case"null":return r._`${S} ${_} null`;case"array":k=r._`Array.isArray(${S})`;break;case"object":k=r._`${S} && typeof ${S} == "object" && !Array.isArray(${S})`;break;case"integer":k=I(r._`!(${S} % 1) && !isNaN(${S})`);break;case"number":k=I();break;default:return r._`typeof ${S} ${_} ${b}`}return C===a.Correct?k:(0,r.not)(k);function I(P=r.nil){return(0,r.and)(r._`typeof ${S} == "number"`,P,T?r._`isFinite(${S})`:r.nil)}}e.checkDataType=h;function y(b,S,T,C){if(b.length===1)return h(b[0],S,T,C);let _,k=(0,o.toHash)(b);if(k.array&&k.object){let I=r._`typeof ${S} != "object"`;_=k.null?I:r._`!${S} || ${I}`,delete k.null,delete k.array,delete k.object}else _=r.nil;k.number&&delete k.integer;for(let I in k)_=(0,r.and)(_,h(I,S,T,C));return _}e.checkDataTypes=y;var w={message:({schema:b})=>`must be ${b}`,params:({schema:b,schemaValue:S})=>typeof b=="string"?r._`{type: ${b}}`:r._`{type: ${S}}`};function g(b){let S=v(b);(0,i.reportError)(S,w)}e.reportTypeError=g;function v(b){let{gen:S,data:T,schema:C}=b,_=(0,o.schemaRefOrVal)(b,C,"type");return{gen:S,keyword:"type",data:T,schema:C.type,schemaCode:_,schemaValue:_,parentSchema:C,params:{},it:b}}}),s1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=Te(),n=Ae();function i(o,a){let{properties:s,items:d}=o.schema;if(a==="object"&&s)for(let u in s)r(o,u,s[u].default);else a==="array"&&Array.isArray(d)&&d.forEach((u,l)=>r(o,l,u.default))}e.assignDefaults=i;function r(o,a,s){let{gen:d,compositeRule:u,data:l,opts:p}=o;if(s===void 0)return;let m=t._`${l}${(0,t.getProperty)(a)}`;if(u){(0,n.checkStrictMode)(o,`default is ignored for: ${m}`);return}let f=t._`${m} === undefined`;p.useDefaults==="empty"&&(f=t._`${f} || ${m} === null || ${m} === ""`),d.if(f,t._`${m} = ${(0,t.stringify)(s)}`)}}),On=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=Te(),n=Ae(),i=Tr(),r=Ae();function o(b,S){let{gen:T,data:C,it:_}=b;T.if(p(T,C,S,_.opts.ownProperties),()=>{b.setParams({missingProperty:t._`${S}`},!0),b.error()})}e.checkReportMissingProp=o;function a({gen:b,data:S,it:{opts:T}},C,_){return(0,t.or)(...C.map(k=>(0,t.and)(p(b,S,k,T.ownProperties),t._`${_} = ${k}`)))}e.checkMissingProp=a;function s(b,S){b.setParams({missingProperty:S},!0),b.error()}e.reportMissingProp=s;function d(b){return b.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=d;function u(b,S,T){return t._`${d(b)}.call(${S}, ${T})`}e.isOwnProperty=u;function l(b,S,T,C){let _=t._`${S}${(0,t.getProperty)(T)} !== undefined`;return C?t._`${_} && ${u(b,S,T)}`:_}e.propertyInData=l;function p(b,S,T,C){let _=t._`${S}${(0,t.getProperty)(T)} === undefined`;return C?(0,t.or)(_,(0,t.not)(u(b,S,T))):_}e.noPropertyInData=p;function m(b){return b?Object.keys(b).filter(S=>S!=="__proto__"):[]}e.allSchemaProperties=m;function f(b,S){return m(S).filter(T=>!(0,n.alwaysValidSchema)(b,S[T]))}e.schemaProperties=f;function h({schemaCode:b,data:S,it:{gen:T,topSchemaRef:C,schemaPath:_,errorPath:k},it:I},P,R,M){let A=M?t._`${b}, ${S}, ${C}${_}`:S,F=[[i.default.instancePath,(0,t.strConcat)(i.default.instancePath,k)],[i.default.parentData,I.parentData],[i.default.parentDataProperty,I.parentDataProperty],[i.default.rootData,i.default.rootData]];I.opts.dynamicRef&&F.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let se=t._`${A}, ${T.object(...F)}`;return R!==t.nil?t._`${P}.call(${R}, ${se})`:t._`${P}(${se})`}e.callValidateCode=h;var y=t._`new RegExp`;function w({gen:b,it:{opts:S}},T){let C=S.unicodeRegExp?"u":"",{regExp:_}=S.code,k=_(T,C);return b.scopeValue("pattern",{key:k.toString(),ref:k,code:t._`${_.code==="new RegExp"?y:(0,r.useFunc)(b,_)}(${T}, ${C})`})}e.usePattern=w;function g(b){let{gen:S,data:T,keyword:C,it:_}=b,k=S.name("valid");if(_.allErrors){let P=S.let("valid",!0);return I(()=>S.assign(P,!1)),P}return S.var(k,!0),I(()=>S.break()),k;function I(P){let R=S.const("len",t._`${T}.length`);S.forRange("i",0,R,M=>{b.subschema({keyword:C,dataProp:M,dataPropType:n.Type.Num},k),S.if((0,t.not)(k),P)})}}e.validateArray=g;function v(b){let{gen:S,schema:T,keyword:C,it:_}=b;if(!Array.isArray(T))throw Error("ajv implementation error");if(T.some(P=>(0,n.alwaysValidSchema)(_,P))&&!_.opts.unevaluated)return;let k=S.let("valid",!1),I=S.name("_valid");S.block(()=>T.forEach((P,R)=>{let M=b.subschema({keyword:C,schemaProp:R,compositeRule:!0},I);S.assign(k,t._`${k} || ${I}`),!b.mergeValidEvaluated(M,I)&&S.if((0,t.not)(k))})),b.result(k,()=>b.reset(),()=>b.error(!0))}e.validateUnion=v}),d1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=Te(),n=Tr(),i=On(),r=il();function o(f,h){let{gen:y,keyword:w,schema:g,parentSchema:v,it:b}=f,S=h.macro.call(b.self,g,v,b),T=l(y,w,S);b.opts.validateSchema!==!1&&b.self.validateSchema(S,!0);let C=y.name("valid");f.subschema({schema:S,schemaPath:t.nil,errSchemaPath:`${b.errSchemaPath}/${w}`,topSchemaRef:T,compositeRule:!0},C),f.pass(C,()=>f.error(!0))}e.macroKeywordCode=o;function a(f,h){var y;let{gen:w,keyword:g,schema:v,parentSchema:b,$data:S,it:T}=f;u(T,h);let C=!S&&h.compile?h.compile.call(T.self,v,b,T):h.validate,_=l(w,g,C),k=w.let("valid");f.block$data(k,I),f.ok((y=h.valid)!==null&&y!==void 0?y:k);function I(){if(h.errors===!1)M(),h.modifying&&s(f),A(()=>f.error());else{let F=h.async?P():R();h.modifying&&s(f),A(()=>d(f,F))}}function P(){let F=w.let("ruleErrs",null);return w.try(()=>M(t._`await `),se=>w.assign(k,!1).if(t._`${se} instanceof ${T.ValidationError}`,()=>w.assign(F,t._`${se}.errors`),()=>w.throw(se))),F}function R(){let F=t._`${_}.errors`;return w.assign(F,null),M(t.nil),F}function M(F=h.async?t._`await `:t.nil){let se=T.opts.passContext?n.default.this:n.default.self,he=!("compile"in h&&!S||h.schema===!1);w.assign(k,t._`${F}${(0,i.callValidateCode)(f,_,se,he)}`,h.modifying)}function A(F){var se;w.if((0,t.not)((se=h.valid)!==null&&se!==void 0?se:k),F)}}e.funcKeywordCode=a;function s(f){let{gen:h,data:y,it:w}=f;h.if(w.parentData,()=>h.assign(y,t._`${w.parentData}[${w.parentDataProperty}]`))}function d(f,h){let{gen:y}=f;y.if(t._`Array.isArray(${h})`,()=>{y.assign(n.default.vErrors,t._`${n.default.vErrors} === null ? ${h} : ${n.default.vErrors}.concat(${h})`).assign(n.default.errors,t._`${n.default.vErrors}.length`),(0,r.extendErrors)(f)},()=>f.error())}function u({schemaEnv:f},h){if(h.async&&!f.$async)throw Error("async keyword in sync schema")}function l(f,h,y){if(y===void 0)throw Error(`keyword "${h}" failed to compile`);return f.scopeValue("keyword",typeof y=="function"?{ref:y}:{ref:y,code:(0,t.stringify)(y)})}function p(f,h,y=!1){return!h.length||h.some(w=>w==="array"?Array.isArray(f):w==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==w||y&&typeof f>"u")}e.validSchemaType=p;function m({schema:f,opts:h,self:y,errSchemaPath:w},g,v){if(Array.isArray(g.keyword)?!g.keyword.includes(v):g.keyword!==v)throw Error("ajv implementation error");let b=g.dependencies;if(b?.some(S=>!Object.prototype.hasOwnProperty.call(f,S)))throw Error(`parent schema must have dependencies of ${v}: ${b.join(",")}`);if(g.validateSchema&&!g.validateSchema(f[v])){let S=`keyword "${v}" value is invalid at path "${w}": `+y.errorsText(g.validateSchema.errors);if(h.validateSchema==="log")y.logger.error(S);else throw Error(S)}}e.validateKeywordUsage=m}),u1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=Te(),n=Ae();function i(a,{keyword:s,schemaProp:d,schema:u,schemaPath:l,errSchemaPath:p,topSchemaRef:m}){if(s!==void 0&&u!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){let f=a.schema[s];return d===void 0?{schema:f,schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(s)}`,errSchemaPath:`${a.errSchemaPath}/${s}`}:{schema:f[d],schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(s)}${(0,t.getProperty)(d)}`,errSchemaPath:`${a.errSchemaPath}/${s}/${(0,n.escapeFragment)(d)}`}}if(u!==void 0){if(l===void 0||p===void 0||m===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:m,errSchemaPath:p}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=i;function r(a,s,{dataProp:d,dataPropType:u,data:l,dataTypes:p,propertyName:m}){if(l!==void 0&&d!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:f}=s;if(d!==void 0){let{errorPath:y,dataPathArr:w,opts:g}=s,v=f.let("data",t._`${s.data}${(0,t.getProperty)(d)}`,!0);h(v),a.errorPath=t.str`${y}${(0,n.getErrorPath)(d,u,g.jsPropertySyntax)}`,a.parentDataProperty=t._`${d}`,a.dataPathArr=[...w,a.parentDataProperty]}if(l!==void 0){let y=l instanceof t.Name?l:f.let("data",l,!0);h(y),m!==void 0&&(a.propertyName=m)}p&&(a.dataTypes=p);function h(y){a.data=y,a.dataLevel=s.dataLevel+1,a.dataTypes=[],s.definedProperties=new Set,a.parentData=s.data,a.dataNames=[...s.dataNames,y]}}e.extendSubschemaData=r;function o(a,{jtdDiscriminator:s,jtdMetadata:d,compositeRule:u,createErrors:l,allErrors:p}){u!==void 0&&(a.compositeRule=u),l!==void 0&&(a.createErrors=l),p!==void 0&&(a.allErrors=p),a.jtdDiscriminator=s,a.jtdMetadata=d}e.extendSubschemaMode=o}),BS=z((e,t)=>{t.exports=function n(i,r){if(i===r)return!0;if(i&&r&&typeof i=="object"&&typeof r=="object"){if(i.constructor!==r.constructor)return!1;var o,a,s;if(Array.isArray(i)){if(o=i.length,o!=r.length)return!1;for(a=o;a--!==0;)if(!n(i[a],r[a]))return!1;return!0}if(i.constructor===RegExp)return i.source===r.source&&i.flags===r.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===r.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===r.toString();if(s=Object.keys(i),o=s.length,o!==Object.keys(r).length)return!1;for(a=o;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=o;a--!==0;){var d=s[a];if(!n(i[d],r[d]))return!1}return!0}return i!==i&&r!==r}}),l1=z((e,t)=>{var n=t.exports=function(o,a,s){typeof a=="function"&&(s=a,a={}),s=a.cb||s;var d=typeof s=="function"?s:s.pre||function(){},u=s.post||function(){};i(a,d,u,o,"",o)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function i(o,a,s,d,u,l,p,m,f,h){if(d&&typeof d=="object"&&!Array.isArray(d)){a(d,u,l,p,m,f,h);for(var y in d){var w=d[y];if(Array.isArray(w)){if(y in n.arrayKeywords)for(var g=0;g<w.length;g++)i(o,a,s,w[g],u+"/"+y+"/"+g,l,u,y,d,g)}else if(y in n.propsKeywords){if(w&&typeof w=="object")for(var v in w)i(o,a,s,w[v],u+"/"+y+"/"+r(v),l,u,y,d,v)}else(y in n.keywords||o.allKeys&&!(y in n.skipKeywords))&&i(o,a,s,w,u+"/"+y,l,u,y,d)}s(d,u,l,p,m,f,h)}}function r(o){return o.replace(/~/g,"~0").replace(/\//g,"~1")}}),ol=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Ae(),n=BS(),i=l1(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(w,g=!0){return typeof w=="boolean"?!0:g===!0?!s(w):g?d(w)<=g:!1}e.inlineRef=o;var a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(w){for(let g in w){if(a.has(g))return!0;let v=w[g];if(Array.isArray(v)&&v.some(s)||typeof v=="object"&&s(v))return!0}return!1}function d(w){let g=0;for(let v in w){if(v==="$ref")return 1/0;if(g++,!r.has(v)&&(typeof w[v]=="object"&&(0,t.eachItem)(w[v],b=>g+=d(b)),g===1/0))return 1/0}return g}function u(w,g="",v){v!==!1&&(g=m(g));let b=w.parse(g);return l(w,b)}e.getFullPath=u;function l(w,g){return w.serialize(g).split("#")[0]+"#"}e._getFullPath=l;var p=/#\/?$/;function m(w){return w?w.replace(p,""):""}e.normalizeId=m;function f(w,g,v){return v=m(v),w.resolve(g,v)}e.resolveUrl=f;var h=/^[a-z_][-a-z0-9._]*$/i;function y(w,g){if(typeof w=="boolean")return{};let{schemaId:v,uriResolver:b}=this.opts,S=m(w[v]||g),T={"":S},C=u(b,S,!1),_={},k=new Set;return i(w,{allKeys:!0},(R,M,A,F)=>{if(F===void 0)return;let se=C+M,he=T[F];typeof R[v]=="string"&&(he=ee.call(this,R[v])),$e.call(this,R.$anchor),$e.call(this,R.$dynamicAnchor),T[M]=he;function ee(be){let G=this.opts.uriResolver.resolve;if(be=m(he?G(he,be):be),k.has(be))throw P(be);k.add(be);let $=this.refs[be];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?I(R,$.schema,be):be!==m(se)&&(be[0]==="#"?(I(R,_[be],be),_[be]=R):this.refs[be]=se),be}function $e(be){if(typeof be=="string"){if(!h.test(be))throw Error(`invalid anchor "${be}"`);ee.call(this,`#${be}`)}}}),_;function I(R,M,A){if(M!==void 0&&!n(R,M))throw P(A)}function P(R){return Error(`reference "${R}" resolves to more than one schema`)}}e.getSchemaRefs=y}),al=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=a1(),n=jd(),i=zS(),r=jd(),o=s1(),a=d1(),s=u1(),d=Te(),u=Tr(),l=ol(),p=Ae(),m=il();function f(j){if(C(j)&&(k(j),T(j))){g(j);return}h(j,()=>(0,t.topBoolOrEmptySchema)(j))}e.validateFunctionCode=f;function h({gen:j,validateName:D,schema:K,schemaEnv:Y,opts:ue},xe){ue.code.es5?j.func(D,d._`${u.default.data}, ${u.default.valCxt}`,Y.$async,()=>{j.code(d._`"use strict"; ${b(K,ue)}`),w(j,ue),j.code(xe)}):j.func(D,d._`${u.default.data}, ${y(ue)}`,Y.$async,()=>j.code(b(K,ue)).code(xe))}function y(j){return d._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${j.dynamicRef?d._`, ${u.default.dynamicAnchors}={}`:d.nil}}={}`}function w(j,D){j.if(u.default.valCxt,()=>{j.var(u.default.instancePath,d._`${u.default.valCxt}.${u.default.instancePath}`),j.var(u.default.parentData,d._`${u.default.valCxt}.${u.default.parentData}`),j.var(u.default.parentDataProperty,d._`${u.default.valCxt}.${u.default.parentDataProperty}`),j.var(u.default.rootData,d._`${u.default.valCxt}.${u.default.rootData}`),D.dynamicRef&&j.var(u.default.dynamicAnchors,d._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{j.var(u.default.instancePath,d._`""`),j.var(u.default.parentData,d._`undefined`),j.var(u.default.parentDataProperty,d._`undefined`),j.var(u.default.rootData,u.default.data),D.dynamicRef&&j.var(u.default.dynamicAnchors,d._`{}`)})}function g(j){let{schema:D,opts:K,gen:Y}=j;h(j,()=>{K.$comment&&D.$comment&&F(j),R(j),Y.let(u.default.vErrors,null),Y.let(u.default.errors,0),K.unevaluated&&v(j),I(j),se(j)})}function v(j){let{gen:D,validateName:K}=j;j.evaluated=D.const("evaluated",d._`${K}.evaluated`),D.if(d._`${j.evaluated}.dynamicProps`,()=>D.assign(d._`${j.evaluated}.props`,d._`undefined`)),D.if(d._`${j.evaluated}.dynamicItems`,()=>D.assign(d._`${j.evaluated}.items`,d._`undefined`))}function b(j,D){let K=typeof j=="object"&&j[D.schemaId];return K&&(D.code.source||D.code.process)?d._`/*# sourceURL=${K} */`:d.nil}function S(j,D){if(C(j)&&(k(j),T(j))){_(j,D);return}(0,t.boolOrEmptySchema)(j,D)}function T({schema:j,self:D}){if(typeof j=="boolean")return!j;for(let K in j)if(D.RULES.all[K])return!0;return!1}function C(j){return typeof j.schema!="boolean"}function _(j,D){let{schema:K,gen:Y,opts:ue}=j;ue.$comment&&K.$comment&&F(j),M(j),A(j);let xe=Y.const("_errs",u.default.errors);I(j,xe),Y.var(D,d._`${xe} === ${u.default.errors}`)}function k(j){(0,p.checkUnknownRules)(j),P(j)}function I(j,D){if(j.opts.jtd)return ee(j,[],!1,D);let K=(0,n.getSchemaTypes)(j.schema),Y=(0,n.coerceAndCheckDataType)(j,K);ee(j,K,!Y,D)}function P(j){let{schema:D,errSchemaPath:K,opts:Y,self:ue}=j;D.$ref&&Y.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(D,ue.RULES)&&ue.logger.warn(`$ref: keywords ignored in schema at path "${K}"`)}function R(j){let{schema:D,opts:K}=j;D.default!==void 0&&K.useDefaults&&K.strictSchema&&(0,p.checkStrictMode)(j,"default is ignored in the schema root")}function M(j){let D=j.schema[j.opts.schemaId];D&&(j.baseId=(0,l.resolveUrl)(j.opts.uriResolver,j.baseId,D))}function A(j){if(j.schema.$async&&!j.schemaEnv.$async)throw Error("async schema in sync schema")}function F({gen:j,schemaEnv:D,schema:K,errSchemaPath:Y,opts:ue}){let xe=K.$comment;if(ue.$comment===!0)j.code(d._`${u.default.self}.logger.log(${xe})`);else if(typeof ue.$comment=="function"){let lt=d.str`${Y}/$comment`,Ft=j.scopeValue("root",{ref:D.root});j.code(d._`${u.default.self}.opts.$comment(${xe}, ${lt}, ${Ft}.schema)`)}}function se(j){let{gen:D,schemaEnv:K,validateName:Y,ValidationError:ue,opts:xe}=j;K.$async?D.if(d._`${u.default.errors} === 0`,()=>D.return(u.default.data),()=>D.throw(d._`new ${ue}(${u.default.vErrors})`)):(D.assign(d._`${Y}.errors`,u.default.vErrors),xe.unevaluated&&he(j),D.return(d._`${u.default.errors} === 0`))}function he({gen:j,evaluated:D,props:K,items:Y}){K instanceof d.Name&&j.assign(d._`${D}.props`,K),Y instanceof d.Name&&j.assign(d._`${D}.items`,Y)}function ee(j,D,K,Y){let{gen:ue,schema:xe,data:lt,allErrors:Ft,opts:St,self:yt}=j,{RULES:st}=yt;if(xe.$ref&&(St.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(xe,st))){ue.block(()=>X(j,"$ref",st.all.$ref.definition));return}St.jtd||be(j,D),ue.block(()=>{for(let Ct of st.rules)Wn(Ct);Wn(st.post)});function Wn(Ct){(0,i.shouldUseGroup)(xe,Ct)&&(Ct.type?(ue.if((0,r.checkDataType)(Ct.type,lt,St.strictNumbers)),$e(j,Ct),D.length===1&&D[0]===Ct.type&&K&&(ue.else(),(0,r.reportTypeError)(j)),ue.endIf()):$e(j,Ct),Ft||ue.if(d._`${u.default.errors} === ${Y||0}`))}}function $e(j,D){let{gen:K,schema:Y,opts:{useDefaults:ue}}=j;ue&&(0,o.assignDefaults)(j,D.type),K.block(()=>{for(let xe of D.rules)(0,i.shouldUseRule)(Y,xe)&&X(j,xe.keyword,xe.definition,D.type)})}function be(j,D){j.schemaEnv.meta||!j.opts.strictTypes||(G(j,D),!j.opts.allowUnionTypes&&$(j,D),B(j,j.dataTypes))}function G(j,D){if(D.length){if(!j.dataTypes.length){j.dataTypes=D;return}D.forEach(K=>{x(j.dataTypes,K)||O(j,`type "${K}" not allowed by context "${j.dataTypes.join(",")}"`)}),E(j,D)}}function $(j,D){D.length>1&&!(D.length===2&&D.includes("null"))&&O(j,"use allowUnionTypes to allow union type keyword")}function B(j,D){let K=j.self.RULES.all;for(let Y in K){let ue=K[Y];if(typeof ue=="object"&&(0,i.shouldUseRule)(j.schema,ue)){let{type:xe}=ue.definition;xe.length&&!xe.some(lt=>L(D,lt))&&O(j,`missing type "${xe.join(",")}" for keyword "${Y}"`)}}}function L(j,D){return j.includes(D)||D==="number"&&j.includes("integer")}function x(j,D){return j.includes(D)||D==="integer"&&j.includes("number")}function E(j,D){let K=[];for(let Y of j.dataTypes)x(D,Y)?K.push(Y):D.includes("integer")&&Y==="number"&&K.push("integer");j.dataTypes=K}function O(j,D){let K=j.schemaEnv.baseId+j.errSchemaPath;D+=` at "${K}" (strictTypes)`,(0,p.checkStrictMode)(j,D,j.opts.strictTypes)}class ne{constructor(D,K,Y){if((0,a.validateKeywordUsage)(D,K,Y),this.gen=D.gen,this.allErrors=D.allErrors,this.keyword=Y,this.data=D.data,this.schema=D.schema[Y],this.$data=K.$data&&D.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(D,this.schema,Y,this.$data),this.schemaType=K.schemaType,this.parentSchema=D.schema,this.params={},this.it=D,this.def=K,this.$data)this.schemaCode=D.gen.const("vSchema",Je(this.$data,D));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,K.schemaType,K.allowUndefined))throw Error(`${Y} value must be ${JSON.stringify(K.schemaType)}`);("code"in K?K.trackErrors:K.errors!==!1)&&(this.errsCount=D.gen.const("_errs",u.default.errors))}result(D,K,Y){this.failResult((0,d.not)(D),K,Y)}failResult(D,K,Y){this.gen.if(D),Y?Y():this.error(),K?(this.gen.else(),K(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(D,K){this.failResult((0,d.not)(D),void 0,K)}fail(D){if(D===void 0){this.error(),!this.allErrors&&this.gen.if(!1);return}this.gen.if(D),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(D){if(!this.$data)return this.fail(D);let{schemaCode:K}=this;this.fail(d._`${K} !== undefined && (${(0,d.or)(this.invalid$data(),D)})`)}error(D,K,Y){if(K){this.setParams(K),this._error(D,Y),this.setParams({});return}this._error(D,Y)}_error(D,K){(D?m.reportExtraError:m.reportError)(this,this.def.error,K)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(D){this.allErrors||this.gen.if(D)}setParams(D,K){K?Object.assign(this.params,D):this.params=D}block$data(D,K,Y=d.nil){this.gen.block(()=>{this.check$data(D,Y),K()})}check$data(D=d.nil,K=d.nil){if(!this.$data)return;let{gen:Y,schemaCode:ue,schemaType:xe,def:lt}=this;Y.if((0,d.or)(d._`${ue} === undefined`,K)),D!==d.nil&&Y.assign(D,!0),(xe.length||lt.validateSchema)&&(Y.elseIf(this.invalid$data()),this.$dataError(),D!==d.nil&&Y.assign(D,!1)),Y.else()}invalid$data(){let{gen:D,schemaCode:K,schemaType:Y,def:ue,it:xe}=this;return(0,d.or)(lt(),Ft());function lt(){if(Y.length){if(!(K instanceof d.Name))throw Error("ajv implementation error");let St=Array.isArray(Y)?Y:[Y];return d._`${(0,r.checkDataTypes)(St,K,xe.opts.strictNumbers,r.DataType.Wrong)}`}return d.nil}function Ft(){if(ue.validateSchema){let St=D.scopeValue("validate$data",{ref:ue.validateSchema});return d._`!${St}(${K})`}return d.nil}}subschema(D,K){let Y=(0,s.getSubschema)(this.it,D);(0,s.extendSubschemaData)(Y,this.it,D),(0,s.extendSubschemaMode)(Y,D);let ue={...this.it,...Y,items:void 0,props:void 0};return S(ue,K),ue}mergeEvaluated(D,K){let{it:Y,gen:ue}=this;Y.opts.unevaluated&&(Y.props!==!0&&D.props!==void 0&&(Y.props=p.mergeEvaluated.props(ue,D.props,Y.props,K)),Y.items!==!0&&D.items!==void 0&&(Y.items=p.mergeEvaluated.items(ue,D.items,Y.items,K)))}mergeValidEvaluated(D,K){let{it:Y,gen:ue}=this;if(Y.opts.unevaluated&&(Y.props!==!0||Y.items!==!0))return ue.if(K,()=>this.mergeEvaluated(D,d.Name)),!0}}e.KeywordCxt=ne;function X(j,D,K,Y){let ue=new ne(j,K,D);"code"in K?K.code(ue,Y):ue.$data&&K.validate?(0,a.funcKeywordCode)(ue,K):"macro"in K?(0,a.macroKeywordCode)(ue,K):(K.compile||K.validate)&&(0,a.funcKeywordCode)(ue,K)}var we=/^\/(?:[^~]|~0|~1)*$/,Se=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Je(j,{dataLevel:D,dataNames:K,dataPathArr:Y}){let ue,xe;if(j==="")return u.default.rootData;if(j[0]==="/"){if(!we.test(j))throw Error(`Invalid JSON-pointer: ${j}`);ue=j,xe=u.default.rootData}else{let yt=Se.exec(j);if(!yt)throw Error(`Invalid JSON-pointer: ${j}`);let st=+yt[1];if(ue=yt[2],ue==="#"){if(st>=D)throw Error(St("property/index",st));return Y[D-st]}if(st>D)throw Error(St("data",st));if(xe=K[D-st],!ue)return xe}let lt=xe,Ft=ue.split("/");for(let yt of Ft)yt&&(xe=d._`${xe}${(0,d.getProperty)((0,p.unescapeJsonPointer)(yt))}`,lt=d._`${lt} && ${xe}`);return lt;function St(yt,st){return`Cannot access ${yt} ${st} levels up, current level is ${D}`}}e.getData=Je}),cm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});class t extends Error{constructor(i){super("validation failed"),this.errors=i,this.ajv=this.validation=!0}}e.default=t}),sl=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ol();class n extends Error{constructor(r,o,a,s){super(s||`can't resolve reference ${a} from id ${o}`),this.missingRef=(0,t.resolveUrl)(r,o,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(r,this.missingRef))}}e.default=n}),pm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=Te(),n=cm(),i=Tr(),r=ol(),o=Ae(),a=al();class s{constructor(v){var b;this.refs={},this.dynamicAnchors={};let S;typeof v.schema=="object"&&(S=v.schema),this.schema=v.schema,this.schemaId=v.schemaId,this.root=v.root||this,this.baseId=(b=v.baseId)!==null&&b!==void 0?b:(0,r.normalizeId)(S?.[v.schemaId||"$id"]),this.schemaPath=v.schemaPath,this.localRefs=v.localRefs,this.meta=v.meta,this.$async=S?.$async,this.refs={}}}e.SchemaEnv=s;function d(g){let v=p.call(this,g);if(v)return v;let b=(0,r.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:S,lines:T}=this.opts.code,{ownProperties:C}=this.opts,_=new t.CodeGen(this.scope,{es5:S,lines:T,ownProperties:C}),k;g.$async&&(k=_.scopeValue("Error",{ref:n.default,code:t._`require("ajv/dist/runtime/validation_error").default`}));let I=_.scopeName("validate");g.validateName=I;let P={gen:_,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:_.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:I,ValidationError:k,schema:g.schema,schemaEnv:g,rootId:b,baseId:g.baseId||b,schemaPath:t.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},R;try{this._compilations.add(g),(0,a.validateFunctionCode)(P),_.optimize(this.opts.code.optimize);let M=_.toString();R=`${_.scopeRefs(i.default.scope)}return ${M}`,this.opts.code.process&&(R=this.opts.code.process(R,g));let A=Function(`${i.default.self}`,`${i.default.scope}`,R)(this,this.scope.get());if(this.scope.value(I,{ref:A}),A.errors=null,A.schema=g.schema,A.schemaEnv=g,g.$async&&(A.$async=!0),this.opts.code.source===!0&&(A.source={validateName:I,validateCode:M,scopeValues:_._values}),this.opts.unevaluated){let{props:F,items:se}=P;A.evaluated={props:F instanceof t.Name?void 0:F,items:se instanceof t.Name?void 0:se,dynamicProps:F instanceof t.Name,dynamicItems:se instanceof t.Name},A.source&&(A.source.evaluated=(0,t.stringify)(A.evaluated))}return g.validate=A,g}catch(M){throw delete g.validate,delete g.validateName,R&&this.logger.error("Error compiling schema, function code:",R),M}finally{this._compilations.delete(g)}}e.compileSchema=d;function u(g,v,b){var S;b=(0,r.resolveUrl)(this.opts.uriResolver,v,b);let T=g.refs[b];if(T)return T;let C=f.call(this,g,b);if(C===void 0){let _=(S=g.localRefs)===null||S===void 0?void 0:S[b],{schemaId:k}=this.opts;_&&(C=new s({schema:_,schemaId:k,root:g,baseId:v}))}if(C!==void 0)return g.refs[b]=l.call(this,C)}e.resolveRef=u;function l(g){return(0,r.inlineRef)(g.schema,this.opts.inlineRefs)?g.schema:g.validate?g:d.call(this,g)}function p(g){for(let v of this._compilations)if(m(v,g))return v}e.getCompilingSchema=p;function m(g,v){return g.schema===v.schema&&g.root===v.root&&g.baseId===v.baseId}function f(g,v){let b;for(;typeof(b=this.refs[v])=="string";)v=b;return b||this.schemas[v]||h.call(this,g,v)}function h(g,v){let b=this.opts.uriResolver.parse(v),S=(0,r._getFullPath)(this.opts.uriResolver,b),T=(0,r.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&S===T)return w.call(this,b,g);let C=(0,r.normalizeId)(S),_=this.refs[C]||this.schemas[C];if(typeof _=="string"){let k=h.call(this,g,_);return typeof k?.schema!="object"?void 0:w.call(this,b,k)}if(typeof _?.schema=="object"){if(_.validate||d.call(this,_),C===(0,r.normalizeId)(v)){let{schema:k}=_,{schemaId:I}=this.opts,P=k[I];return P&&(T=(0,r.resolveUrl)(this.opts.uriResolver,T,P)),new s({schema:k,schemaId:I,root:g,baseId:T})}return w.call(this,b,_)}}e.resolveSchema=h;var y=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function w(g,{baseId:v,schema:b,root:S}){var T;if(((T=g.fragment)===null||T===void 0?void 0:T[0])!=="/")return;for(let k of g.fragment.slice(1).split("/")){if(typeof b=="boolean")return;let I=b[(0,o.unescapeFragment)(k)];if(I===void 0)return;b=I;let P=typeof b=="object"&&b[this.opts.schemaId];!y.has(k)&&P&&(v=(0,r.resolveUrl)(this.opts.uriResolver,v,P))}let C;if(typeof b!="boolean"&&b.$ref&&!(0,o.schemaHasRulesButRef)(b,this.RULES)){let k=(0,r.resolveUrl)(this.opts.uriResolver,v,b.$ref);C=h.call(this,S,k)}let{schemaId:_}=this.opts;if(C=C||new s({schema:b,schemaId:_,root:S,baseId:v}),C.schema!==C.root.schema)return C}}),c1=z((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),KS=z((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),r=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(_){let k="",I=0,P=0;for(P=0;P<_.length;P++)if(I=_[P].charCodeAt(0),I!==48){if(!(I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102))return"";k+=_[P];break}for(P+=1;P<_.length;P++){if(I=_[P].charCodeAt(0),!(I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102))return"";k+=_[P]}return k}var d=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function u(_){return _.length=0,!0}function l(_,k,I){if(_.length){let P=s(_);if(P!=="")k.push(P);else return I.error=!0,!1;_.length=0}return!0}function p(_){let k=0,I={error:!1,address:"",zone:""},P=[],R=[],M=!1,A=!1,F=l;for(let se=0;se<_.length;se++){let he=_[se];if(!(he==="["||he==="]"))if(he===":"){if(M===!0&&(A=!0),!F(R,P,I))break;if(++k>7){I.error=!0;break}se>0&&_[se-1]===":"&&(M=!0),P.push(":");continue}else if(he==="%"){if(!F(R,P,I))break;F=u}else{R.push(he);continue}}return R.length&&(F===u?I.zone=R.join(""):A?P.push(R.join("")):P.push(s(R))),I.address=P.join(""),I}function m(_){if(f(_,":")<2)return{host:_,isIPV6:!1};let k=p(_);if(k.error)return{host:_,isIPV6:!1};{let{address:I,address:P}=k;return k.zone&&(I+="%"+k.zone,P+="%25"+k.zone),{host:I,isIPV6:!0,escapedHost:P}}}function f(_,k){let I=0;for(let P=0;P<_.length;P++)_[P]===k&&I++;return I}function h(_){let k=_,I=[],P=-1,R=0;for(;R=k.length;){if(R===1){if(k===".")break;if(k==="/"){I.push("/");break}else{I.push(k);break}}else if(R===2){if(k[0]==="."){if(k[1]===".")break;if(k[1]==="/"){k=k.slice(2);continue}}else if(k[0]==="/"&&(k[1]==="."||k[1]==="/")){I.push("/");break}}else if(R===3&&k==="/.."){I.length!==0&&I.pop(),I.push("/");break}if(k[0]==="."){if(k[1]==="."){if(k[2]==="/"){k=k.slice(3);continue}}else if(k[1]==="/"){k=k.slice(2);continue}}else if(k[0]==="/"&&k[1]==="."){if(k[2]==="/"){k=k.slice(2);continue}else if(k[2]==="."&&k[3]==="/"){k=k.slice(3),I.length!==0&&I.pop();continue}}if((P=k.indexOf("/",1))===-1){I.push(k);break}else I.push(k.slice(0,P)),k=k.slice(P)}return I.join("")}var y={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},w=/[@/?#:]/g,g=/[@/?#]/g;function v(_,k){let I=k?g:w;return I.lastIndex=0,_.replace(I,P=>y[P])}function b(_,k=!1){if(_.indexOf("%")===-1)return _;let I="";for(let P=0;P<_.length;P++){if(_[P]==="%"&&P+2<_.length){let R=_.slice(P+1,P+3);if(r(R)){let M=R.toUpperCase(),A=String.fromCharCode(parseInt(M,16));k&&o(A)?I+=A:I+="%"+M,P+=2;continue}}I+=_[P]}return I}function S(_){let k="";for(let I=0;I<_.length;I++){if(_[I]==="%"&&I+2<_.length){let P=_.slice(I+1,I+3);if(r(P)){let R=P.toUpperCase(),M=String.fromCharCode(parseInt(R,16));M!=="."&&o(M)?k+=M:k+="%"+R,I+=2;continue}}a(_[I])?k+=_[I]:k+=escape(_[I])}return k}function T(_){let k="";for(let I=0;I<_.length;I++){if(_[I]==="%"&&I+2<_.length){let P=_.slice(I+1,I+3);if(r(P)){k+="%"+P.toUpperCase(),I+=2;continue}}k+=escape(_[I])}return k}function C(_){let k=[];if(_.userinfo!==void 0&&(k.push(_.userinfo),k.push("@")),_.host!==void 0){let I=unescape(_.host);if(!i(I)){let P=m(I);P.isIPV6===!0?I=`[${P.escapedHost}]`:I=v(I,!1)}k.push(I)}return(typeof _.port=="number"||typeof _.port=="string")&&(k.push(":"),k.push(String(_.port))),k.length?k.join(""):void 0}t.exports={nonSimpleDomain:d,recomposeAuthority:C,reescapeHostDelimiters:v,normalizePercentEncoding:b,normalizePathEncoding:S,escapePreservingEscapes:T,removeDotSegments:h,isIPv4:i,isUUID:n,normalizeIPv6:m,stringArrayToHexStripped:s}}),p1=z((e,t)=>{var{isUUID:n}=KS(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function o(_){return r.indexOf(_)!==-1}function a(_){return _.secure===!0?!0:_.secure===!1?!1:_.scheme?_.scheme.length===3&&(_.scheme[0]==="w"||_.scheme[0]==="W")&&(_.scheme[1]==="s"||_.scheme[1]==="S")&&(_.scheme[2]==="s"||_.scheme[2]==="S"):!1}function s(_){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_}function d(_){let k=String(_.scheme).toLowerCase()==="https";return(_.port===(k?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}function u(_){return _.secure=a(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_}function l(_){if((_.port===(a(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){let[k,I]=_.resourceName.split("?");_.path=k&&k!=="/"?k:void 0,_.query=I,_.resourceName=void 0}return _.fragment=void 0,_}function p(_,k){if(!_.path)return _.error="URN can not be parsed",_;let I=_.path.match(i);if(I){let P=k.scheme||_.scheme||"urn";_.nid=I[1].toLowerCase(),_.nss=I[2];let R=`${P}:${k.nid||_.nid}`,M=C(R);_.path=void 0,M&&(_=M.parse(_,k))}else _.error=_.error||"URN can not be parsed.";return _}function m(_,k){if(_.nid===void 0)throw Error("URN without nid cannot be serialized");let I=k.scheme||_.scheme||"urn",P=_.nid.toLowerCase(),R=`${I}:${k.nid||P}`,M=C(R);M&&(_=M.serialize(_,k));let A=_,F=_.nss;return A.path=`${P||k.nid}:${F}`,k.skipEscape=!0,A}function f(_,k){let I=_;return I.uuid=I.nss,I.nss=void 0,!k.tolerant&&(!I.uuid||!n(I.uuid))&&(I.error=I.error||"UUID is not valid."),I}function h(_){let k=_;return k.nss=(_.uuid||"").toLowerCase(),k}var y={scheme:"http",domainHost:!0,parse:s,serialize:d},w={scheme:"https",domainHost:y.domainHost,parse:s,serialize:d},g={scheme:"ws",domainHost:!0,parse:u,serialize:l},v={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},b={scheme:"urn",parse:p,serialize:m,skipNormalize:!0},S={scheme:"urn:uuid",parse:f,serialize:h,skipNormalize:!0},T={http:y,https:w,ws:g,wss:v,urn:b,"urn:uuid":S};Object.setPrototypeOf(T,null);function C(_){return _&&(T[_]||T[_.toLowerCase()])||void 0}t.exports={wsIsSecure:a,SCHEMES:T,isValidSchemeName:o,getSchemeHandler:C}}),f1=z((e,t)=>{var{normalizeIPv6:n,removeDotSegments:i,recomposeAuthority:r,normalizePercentEncoding:o,normalizePathEncoding:a,escapePreservingEscapes:s,reescapeHostDelimiters:d,isIPv4:u,nonSimpleDomain:l}=KS(),{SCHEMES:p,getSchemeHandler:m}=p1();function f(P,R){return typeof P=="string"?P=C(P,R):typeof P=="object"&&(P=T(g(P,R),R)),P}function h(P,R,M){let A=M?Object.assign({scheme:"null"},M):{scheme:"null"},F=y(T(P,A),T(R,A),A,!0);return A.skipEscape=!0,g(F,A)}function y(P,R,M,A){let F={};return A||(P=T(g(P,M),M),R=T(g(R,M),M)),M=M||{},!M.tolerant&&R.scheme?(F.scheme=R.scheme,F.userinfo=R.userinfo,F.host=R.host,F.port=R.port,F.path=i(R.path||""),F.query=R.query):(R.userinfo!==void 0||R.host!==void 0||R.port!==void 0?(F.userinfo=R.userinfo,F.host=R.host,F.port=R.port,F.path=i(R.path||""),F.query=R.query):(R.path?(R.path[0]==="/"?F.path=i(R.path):((P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)&&!P.path?F.path="/"+R.path:P.path?F.path=P.path.slice(0,P.path.lastIndexOf("/")+1)+R.path:F.path=R.path,F.path=i(F.path)),F.query=R.query):(F.path=P.path,R.query!==void 0?F.query=R.query:F.query=P.query),F.userinfo=P.userinfo,F.host=P.host,F.port=P.port),F.scheme=P.scheme),F.fragment=R.fragment,F}function w(P,R,M){let A=k(P,M),F=k(R,M);return A!==void 0&&F!==void 0&&A.toLowerCase()===F.toLowerCase()}function g(P,R){let M={host:P.host,scheme:P.scheme,userinfo:P.userinfo,port:P.port,path:P.path,query:P.query,nid:P.nid,nss:P.nss,uuid:P.uuid,fragment:P.fragment,reference:P.reference,resourceName:P.resourceName,secure:P.secure,error:""},A=Object.assign({},R),F=[],se=m(A.scheme||M.scheme);se&&se.serialize&&se.serialize(M,A),M.path!==void 0&&(A.skipEscape?M.path=o(M.path):(M.path=s(M.path),M.scheme!==void 0&&(M.path=M.path.split("%3A").join(":")))),A.reference!=="suffix"&&M.scheme&&F.push(M.scheme,":");let he=r(M);if(he!==void 0&&(A.reference!=="suffix"&&F.push("//"),F.push(he),M.path&&M.path[0]!=="/"&&F.push("/")),M.path!==void 0){let ee=M.path;!A.absolutePath&&(!se||!se.absolutePath)&&(ee=i(ee)),he===void 0&&ee[0]==="/"&&ee[1]==="/"&&(ee="/%2F"+ee.slice(2)),F.push(ee)}return M.query!==void 0&&F.push("?",M.query),M.fragment!==void 0&&F.push("#",M.fragment),F.join("")}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function b(P,R){if(R[2]!==void 0&&P.path&&P.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof P.port=="number"&&(P.port<0||P.port>65535))return"URI port is malformed."}function S(P,R){let M=Object.assign({},R),A={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},F=!1,se=!1;M.reference==="suffix"&&(M.scheme?P=M.scheme+":"+P:P="//"+P);let he=P.match(v);if(he){A.scheme=he[1],A.userinfo=he[3],A.host=he[4],A.port=parseInt(he[5],10),A.path=he[6]||"",A.query=he[7],A.fragment=he[8],isNaN(A.port)&&(A.port=he[5]);let ee=b(A,he);if(ee!==void 0&&(A.error=A.error||ee,F=!0),A.host)if(u(A.host)===!1){let be=n(A.host);A.host=be.host.toLowerCase(),se=be.isIPV6}else se=!0;A.scheme===void 0&&A.userinfo===void 0&&A.host===void 0&&A.port===void 0&&A.query===void 0&&!A.path?A.reference="same-document":A.scheme===void 0?A.reference="relative":A.fragment===void 0?A.reference="absolute":A.reference="uri",M.reference&&M.reference!=="suffix"&&M.reference!==A.reference&&(A.error=A.error||"URI is not a "+M.reference+" reference.");let $e=m(M.scheme||A.scheme);if(!M.unicodeSupport&&(!$e||!$e.unicodeSupport)&&A.host&&(M.domainHost||$e&&$e.domainHost)&&se===!1&&l(A.host))try{A.host=URL.domainToASCII(A.host.toLowerCase())}catch(be){A.error=A.error||"Host's domain name can not be converted to ASCII: "+be}if((!$e||$e&&!$e.skipNormalize)&&(P.indexOf("%")!==-1&&(A.scheme!==void 0&&(A.scheme=unescape(A.scheme)),A.host!==void 0&&(A.host=d(unescape(A.host),se))),A.path&&(A.path=a(A.path)),A.fragment))try{A.fragment=encodeURI(decodeURIComponent(A.fragment))}catch{A.error=A.error||"URI malformed"}$e&&$e.parse&&$e.parse(A,M)}else A.error=A.error||"URI can not be parsed.";return{parsed:A,malformedAuthorityOrPort:F}}function T(P,R){return S(P,R).parsed}function C(P,R){return _(P,R).normalized}function _(P,R){let{parsed:M,malformedAuthorityOrPort:A}=S(P,R);return{normalized:A?P:g(M,R),malformedAuthorityOrPort:A}}function k(P,R){if(typeof P=="string"){let{normalized:M,malformedAuthorityOrPort:A}=_(P,R);return A?void 0:M}if(typeof P=="object")return g(P,R)}var I={SCHEMES:p,normalize:f,resolve:h,resolveComponent:y,equal:w,serialize:g,parse:T};t.exports=I,t.exports.default=I,t.exports.fastUri=I}),m1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=f1();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),h1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=al();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Te();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});var i=cm(),r=sl(),o=FS(),a=pm(),s=Te(),d=ol(),u=jd(),l=Ae(),p=c1(),m=m1(),f=(G,$)=>new RegExp(G,$);f.code="new RegExp";var h=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),w={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function b(G){var $,B,L,x,E,O,ne,X,we,Se,Je,j,D,K,Y,ue,xe,lt,Ft,St,yt,st,Wn,Ct,Io;let Er=G.strict,fi=($=G.code)===null||$===void 0?void 0:$.optimize,Ms=fi===!0||fi===void 0?1:fi||0,js=(L=(B=G.code)===null||B===void 0?void 0:B.regExp)!==null&&L!==void 0?L:f,Po=(x=G.uriResolver)!==null&&x!==void 0?x:m.default;return{strictSchema:(O=(E=G.strictSchema)!==null&&E!==void 0?E:Er)!==null&&O!==void 0?O:!0,strictNumbers:(X=(ne=G.strictNumbers)!==null&&ne!==void 0?ne:Er)!==null&&X!==void 0?X:!0,strictTypes:(Se=(we=G.strictTypes)!==null&&we!==void 0?we:Er)!==null&&Se!==void 0?Se:"log",strictTuples:(j=(Je=G.strictTuples)!==null&&Je!==void 0?Je:Er)!==null&&j!==void 0?j:"log",strictRequired:(K=(D=G.strictRequired)!==null&&D!==void 0?D:Er)!==null&&K!==void 0?K:!1,code:G.code?{...G.code,optimize:Ms,regExp:js}:{optimize:Ms,regExp:js},loopRequired:(Y=G.loopRequired)!==null&&Y!==void 0?Y:v,loopEnum:(ue=G.loopEnum)!==null&&ue!==void 0?ue:v,meta:(xe=G.meta)!==null&&xe!==void 0?xe:!0,messages:(lt=G.messages)!==null&<!==void 0?lt:!0,inlineRefs:(Ft=G.inlineRefs)!==null&&Ft!==void 0?Ft:!0,schemaId:(St=G.schemaId)!==null&&St!==void 0?St:"$id",addUsedSchema:(yt=G.addUsedSchema)!==null&&yt!==void 0?yt:!0,validateSchema:(st=G.validateSchema)!==null&&st!==void 0?st:!0,validateFormats:(Wn=G.validateFormats)!==null&&Wn!==void 0?Wn:!0,unicodeRegExp:(Ct=G.unicodeRegExp)!==null&&Ct!==void 0?Ct:!0,int32range:(Io=G.int32range)!==null&&Io!==void 0?Io:!0,uriResolver:Po}}class S{constructor($={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...b($)};let{es5:B,lines:L}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:y,es5:B,lines:L}),this.logger=M($.logger);let x=$.validateFormats;$.validateFormats=!1,this.RULES=(0,o.getRules)(),T.call(this,w,$,"NOT SUPPORTED"),T.call(this,g,$,"DEPRECATED","warn"),this._metaOpts=P.call(this),$.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords&&I.call(this,$.keywords),typeof $.meta=="object"&&this.addMetaSchema($.meta),_.call(this),$.validateFormats=x}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:$,meta:B,schemaId:L}=this.opts,x=p;L==="id"&&(x={...p},x.id=x.$id,delete x.$id),B&&$&&this.addMetaSchema(x,x[L],!1)}defaultMeta(){let{meta:$,schemaId:B}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[B]||$:void 0}validate($,B){let L;if(typeof $=="string"){if(L=this.getSchema($),!L)throw Error(`no schema with key or ref "${$}"`)}else L=this.compile($);let x=L(B);return"$async"in L||(this.errors=L.errors),x}compile($,B){let L=this._addSchema($,B);return L.validate||this._compileSchemaEnv(L)}compileAsync($,B){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:L}=this.opts;return x.call(this,$,B);async function x(Se,Je){await E.call(this,Se.$schema);let j=this._addSchema(Se,Je);return j.validate||O.call(this,j)}async function E(Se){Se&&!this.getSchema(Se)&&await x.call(this,{$ref:Se},!0)}async function O(Se){try{return this._compileSchemaEnv(Se)}catch(Je){if(!(Je instanceof r.default))throw Je;return ne.call(this,Je),await X.call(this,Je.missingSchema),O.call(this,Se)}}function ne({missingSchema:Se,missingRef:Je}){if(this.refs[Se])throw Error(`AnySchema ${Se} is loaded but ${Je} cannot be resolved`)}async function X(Se){let Je=await we.call(this,Se);this.refs[Se]||await E.call(this,Je.$schema),this.refs[Se]||this.addSchema(Je,Se,B)}async function we(Se){let Je=this._loading[Se];if(Je)return Je;try{return await(this._loading[Se]=L(Se))}finally{delete this._loading[Se]}}}addSchema($,B,L,x=this.opts.validateSchema){if(Array.isArray($)){for(let O of $)this.addSchema(O,void 0,L,x);return this}let E;if(typeof $=="object"){let{schemaId:O}=this.opts;if(E=$[O],E!==void 0&&typeof E!="string")throw Error(`schema ${O} must be string`)}return B=(0,d.normalizeId)(B||E),this._checkUnique(B),this.schemas[B]=this._addSchema($,L,B,x,!0),this}addMetaSchema($,B,L=this.opts.validateSchema){return this.addSchema($,B,!0,L),this}validateSchema($,B){if(typeof $=="boolean")return!0;let L;if(L=$.$schema,L!==void 0&&typeof L!="string")throw Error("$schema must be a string");if(L=L||this.opts.defaultMeta||this.defaultMeta(),!L)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let x=this.validate(L,$);if(!x&&B){let E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw Error(E)}return x}getSchema($){let B;for(;typeof(B=C.call(this,$))=="string";)$=B;if(B===void 0){let{schemaId:L}=this.opts,x=new a.SchemaEnv({schema:{},schemaId:L});if(B=a.resolveSchema.call(this,x,$),!B)return;this.refs[$]=B}return B.validate||this._compileSchemaEnv(B)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let B=C.call(this,$);return typeof B=="object"&&this._cache.delete(B.schema),delete this.schemas[$],delete this.refs[$],this}case"object":{let B=$;this._cache.delete(B);let L=$[this.opts.schemaId];return L&&(L=(0,d.normalizeId)(L),delete this.schemas[L],delete this.refs[L]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(let B of $)this.addKeyword(B);return this}addKeyword($,B){let L;if(typeof $=="string")L=$,typeof B=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),B.keyword=L);else if(typeof $=="object"&&B===void 0){if(B=$,L=B.keyword,Array.isArray(L)&&!L.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(F.call(this,L,B),!B)return(0,l.eachItem)(L,E=>se.call(this,E)),this;ee.call(this,B);let x={...B,type:(0,u.getJSONTypes)(B.type),schemaType:(0,u.getJSONTypes)(B.schemaType)};return(0,l.eachItem)(L,x.type.length===0?E=>se.call(this,E,x):E=>x.type.forEach(O=>se.call(this,E,x,O))),this}getKeyword($){let B=this.RULES.all[$];return typeof B=="object"?B.definition:!!B}removeKeyword($){let{RULES:B}=this;delete B.keywords[$],delete B.all[$];for(let L of B.rules){let x=L.rules.findIndex(E=>E.keyword===$);x>=0&&L.rules.splice(x,1)}return this}addFormat($,B){return typeof B=="string"&&(B=new RegExp(B)),this.formats[$]=B,this}errorsText($=this.errors,{separator:B=", ",dataVar:L="data"}={}){return!$||$.length===0?"No errors":$.map(x=>`${L}${x.instancePath} ${x.message}`).reduce((x,E)=>x+B+E)}$dataMetaSchema($,B){let L=this.RULES.all;$=JSON.parse(JSON.stringify($));for(let x of B){let E=x.split("/").slice(1),O=$;for(let ne of E)O=O[ne];for(let ne in L){let X=L[ne];if(typeof X!="object")continue;let{$data:we}=X.definition,Se=O[ne];we&&Se&&(O[ne]=be(Se))}}return $}_removeAllSchemas($,B){for(let L in $){let x=$[L];(!B||B.test(L))&&(typeof x=="string"?delete $[L]:x&&!x.meta&&(this._cache.delete(x.schema),delete $[L]))}}_addSchema($,B,L,x=this.opts.validateSchema,E=this.opts.addUsedSchema){let O,{schemaId:ne}=this.opts;if(typeof $=="object")O=$[ne];else{if(this.opts.jtd)throw Error("schema must be object");if(typeof $!="boolean")throw Error("schema must be object or boolean")}let X=this._cache.get($);if(X!==void 0)return X;L=(0,d.normalizeId)(O||L);let we=d.getSchemaRefs.call(this,$,L);return X=new a.SchemaEnv({schema:$,schemaId:ne,meta:B,baseId:L,localRefs:we}),this._cache.set(X.schema,X),E&&!L.startsWith("#")&&(L&&this._checkUnique(L),this.refs[L]=X),x&&this.validateSchema($,!0),X}_checkUnique($){if(this.schemas[$]||this.refs[$])throw Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta?this._compileMetaSchema($):a.compileSchema.call(this,$),!$.validate)throw Error("ajv implementation error");return $.validate}_compileMetaSchema($){let B=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,$)}finally{this.opts=B}}}S.ValidationError=i.default,S.MissingRefError=r.default,e.default=S;function T(G,$,B,L="error"){for(let x in G){let E=x;E in $&&this.logger[L](`${B}: option ${x}. ${G[E]}`)}}function C(G){return G=(0,d.normalizeId)(G),this.schemas[G]||this.refs[G]}function _(){let G=this.opts.schemas;if(G)if(Array.isArray(G))this.addSchema(G);else for(let $ in G)this.addSchema(G[$],$)}function k(){for(let G in this.opts.formats){let $=this.opts.formats[G];$&&this.addFormat(G,$)}}function I(G){if(Array.isArray(G)){this.addVocabulary(G);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let $ in G){let B=G[$];B.keyword||(B.keyword=$),this.addKeyword(B)}}function P(){let G={...this.opts};for(let $ of h)delete G[$];return G}var R={log(){},warn(){},error(){}};function M(G){if(G===!1)return R;if(G===void 0)return console;if(G.log&&G.warn&&G.error)return G;throw Error("logger must implement log, warn and error methods")}var A=/^[a-z_$][a-z0-9_$:-]*$/i;function F(G,$){let{RULES:B}=this;if((0,l.eachItem)(G,L=>{if(B.keywords[L])throw Error(`Keyword ${L} is already defined`);if(!A.test(L))throw Error(`Keyword ${L} has invalid name`)}),!!$&&$.$data&&!("code"in $||"validate"in $))throw Error('$data keyword must have "code" or "validate" function')}function se(G,$,B){var L;let x=$?.post;if(B&&x)throw Error('keyword with "post" flag cannot have "type"');let{RULES:E}=this,O=x?E.post:E.rules.find(({type:X})=>X===B);if(O||(O={type:B,rules:[]},E.rules.push(O)),E.keywords[G]=!0,!$)return;let ne={keyword:G,definition:{...$,type:(0,u.getJSONTypes)($.type),schemaType:(0,u.getJSONTypes)($.schemaType)}};$.before?he.call(this,O,ne,$.before):O.rules.push(ne),E.all[G]=ne,(L=$.implements)===null||L===void 0||L.forEach(X=>this.addKeyword(X))}function he(G,$,B){let L=G.rules.findIndex(x=>x.keyword===B);L>=0?G.rules.splice(L,0,$):(G.rules.push($),this.logger.warn(`rule ${B} is not defined`))}function ee(G){let{metaSchema:$}=G;$!==void 0&&(G.$data&&this.opts.$data&&($=be($)),G.validateSchema=this.compile($,!0))}var $e={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function be(G){return{anyOf:[G,$e]}}}),g1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),y1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=sl(),n=On(),i=Te(),r=Tr(),o=pm(),a=Ae(),s={keyword:"$ref",schemaType:"string",code(l){let{gen:p,schema:m,it:f}=l,{baseId:h,schemaEnv:y,validateName:w,opts:g,self:v}=f,{root:b}=y;if((m==="#"||m==="#/")&&h===b.baseId)return T();let S=o.resolveRef.call(v,b,h,m);if(S===void 0)throw new t.default(f.opts.uriResolver,h,m);if(S instanceof o.SchemaEnv)return C(S);return _(S);function T(){if(y===b)return u(l,w,y,y.$async);let k=p.scopeValue("root",{ref:b});return u(l,i._`${k}.validate`,b,b.$async)}function C(k){let I=d(l,k);u(l,I,k,k.$async)}function _(k){let I=p.scopeValue("schema",g.code.source===!0?{ref:k,code:(0,i.stringify)(k)}:{ref:k}),P=p.name("valid"),R=l.subschema({schema:k,dataTypes:[],schemaPath:i.nil,topSchemaRef:I,errSchemaPath:m},P);l.mergeEvaluated(R),l.ok(P)}}};function d(l,p){let{gen:m}=l;return p.validate?m.scopeValue("validate",{ref:p.validate}):i._`${m.scopeValue("wrapper",{ref:p})}.validate`}e.getValidate=d;function u(l,p,m,f){let{gen:h,it:y}=l,{allErrors:w,schemaEnv:g,opts:v}=y,b=v.passContext?r.default.this:i.nil;f?S():T();function S(){if(!g.$async)throw Error("async schema referenced by sync schema");let k=h.let("valid");h.try(()=>{h.code(i._`await ${(0,n.callValidateCode)(l,p,b)}`),_(p),!w&&h.assign(k,!0)},I=>{h.if(i._`!(${I} instanceof ${y.ValidationError})`,()=>h.throw(I)),C(I),!w&&h.assign(k,!1)}),l.ok(k)}function T(){l.result((0,n.callValidateCode)(l,p,b),()=>_(p),()=>C(p))}function C(k){let I=i._`${k}.errors`;h.assign(r.default.vErrors,i._`${r.default.vErrors} === null ? ${I} : ${r.default.vErrors}.concat(${I})`),h.assign(r.default.errors,i._`${r.default.vErrors}.length`)}function _(k){var I;if(!y.opts.unevaluated)return;let P=(I=m?.validate)===null||I===void 0?void 0:I.evaluated;if(y.props!==!0)if(P&&!P.dynamicProps)P.props!==void 0&&(y.props=a.mergeEvaluated.props(h,P.props,y.props));else{let R=h.var("props",i._`${k}.evaluated.props`);y.props=a.mergeEvaluated.props(h,R,y.props,i.Name)}if(y.items!==!0)if(P&&!P.dynamicItems)P.items!==void 0&&(y.items=a.mergeEvaluated.items(h,P.items,y.items));else{let R=h.var("items",i._`${k}.evaluated.items`);y.items=a.mergeEvaluated.items(h,R,y.items,i.Name)}}}e.callRef=u,e.default=s}),_1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=g1(),n=y1(),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,n.default];e.default=i}),v1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=t.operators,i={maximum:{okStr:"<=",ok:n.LTE,fail:n.GT},minimum:{okStr:">=",ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},r={message:({keyword:a,schemaCode:s})=>t.str`must be ${i[a].okStr} ${s}`,params:({keyword:a,schemaCode:s})=>t._`{comparison: ${i[a].okStr}, limit: ${s}}`},o={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:r,code(a){let{keyword:s,data:d,schemaCode:u}=a;a.fail$data(t._`${d} ${i[s].fail} ${u} || isNaN(${d})`)}};e.default=o}),b1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n={message:({schemaCode:r})=>t.str`must be multiple of ${r}`,params:({schemaCode:r})=>t._`{multipleOf: ${r}}`},i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:n,code(r){let{gen:o,data:a,schemaCode:s,it:d}=r,u=d.opts.multipleOfPrecision,l=o.let("res"),p=u?t._`Math.abs(Math.round(${l}) - ${l}) > 1e-${u}`:t._`${l} !== parseInt(${l})`;r.fail$data(t._`(${s} === 0 || (${l} = ${a}/${s}, ${p}))`)}};e.default=i}),w1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(n){let i=n.length,r=0,o=0,a;for(;o<i;)r++,a=n.charCodeAt(o++),a>=55296&&a<=56319&&o<i&&(a=n.charCodeAt(o),(a&64512)===56320&&o++);return r}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),S1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i=w1(),r={message({keyword:a,schemaCode:s}){let d=a==="maxLength"?"more":"fewer";return t.str`must NOT have ${d} than ${s} characters`},params:({schemaCode:a})=>t._`{limit: ${a}}`},o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:r,code(a){let{keyword:s,data:d,schemaCode:u,it:l}=a,p=s==="maxLength"?t.operators.GT:t.operators.LT,m=l.opts.unicode===!1?t._`${d}.length`:t._`${(0,n.useFunc)(a.gen,i.default)}(${d})`;a.fail$data(t._`${m} ${p} ${u}`)}};e.default=o}),k1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n=Ae(),i=Te(),r={message:({schemaCode:a})=>i.str`must match pattern "${a}"`,params:({schemaCode:a})=>i._`{pattern: ${a}}`},o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:r,code(a){let{gen:s,data:d,$data:u,schema:l,schemaCode:p,it:m}=a,f=m.opts.unicodeRegExp?"u":"";if(u){let{regExp:h}=m.opts.code,y=h.code==="new RegExp"?i._`new RegExp`:(0,n.useFunc)(s,h),w=s.let("valid");s.try(()=>s.assign(w,i._`${y}(${p}, ${f}).test(${d})`),()=>s.assign(w,!1)),a.fail$data(i._`!${w}`)}else{let h=(0,t.usePattern)(a,l);a.fail$data(i._`!${h}.test(${d})`)}}};e.default=o}),x1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n={message({keyword:r,schemaCode:o}){let a=r==="maxProperties"?"more":"fewer";return t.str`must NOT have ${a} than ${o} properties`},params:({schemaCode:r})=>t._`{limit: ${r}}`},i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:n,code(r){let{keyword:o,data:a,schemaCode:s}=r,d=o==="maxProperties"?t.operators.GT:t.operators.LT;r.fail$data(t._`Object.keys(${a}).length ${d} ${s}`)}};e.default=i}),C1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n=Te(),i=Ae(),r={message:({params:{missingProperty:a}})=>n.str`must have required property '${a}'`,params:({params:{missingProperty:a}})=>n._`{missingProperty: ${a}}`},o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:r,code(a){let{gen:s,schema:d,schemaCode:u,data:l,$data:p,it:m}=a,{opts:f}=m;if(!p&&d.length===0)return;let h=d.length>=f.loopRequired;if(m.allErrors?y():w(),f.strictRequired){let b=a.parentSchema.properties,{definedProperties:S}=a.it;for(let T of d)if(b?.[T]===void 0&&!S.has(T)){let C=m.schemaEnv.baseId+m.errSchemaPath,_=`required property "${T}" is not defined at "${C}" (strictRequired)`;(0,i.checkStrictMode)(m,_,m.opts.strictRequired)}}function y(){if(h||p)a.block$data(n.nil,g);else for(let b of d)(0,t.checkReportMissingProp)(a,b)}function w(){let b=s.let("missing");if(h||p){let S=s.let("valid",!0);a.block$data(S,()=>v(b,S)),a.ok(S)}else s.if((0,t.checkMissingProp)(a,d,b)),(0,t.reportMissingProp)(a,b),s.else()}function g(){s.forOf("prop",u,b=>{a.setParams({missingProperty:b}),s.if((0,t.noPropertyInData)(s,l,b,f.ownProperties),()=>a.error())})}function v(b,S){a.setParams({missingProperty:b}),s.forOf(b,u,()=>{s.assign(S,(0,t.propertyInData)(s,l,b,f.ownProperties)),s.if((0,n.not)(S),()=>{a.error(),s.break()})},n.nil)}}};e.default=o}),T1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n={message({keyword:r,schemaCode:o}){let a=r==="maxItems"?"more":"fewer";return t.str`must NOT have ${a} than ${o} items`},params:({schemaCode:r})=>t._`{limit: ${r}}`},i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:n,code(r){let{keyword:o,data:a,schemaCode:s}=r,d=o==="maxItems"?t.operators.GT:t.operators.LT;r.fail$data(t._`${a}.length ${d} ${s}`)}};e.default=i}),fm=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=BS();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),I1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=jd(),n=Te(),i=Ae(),r=fm(),o={message:({params:{i:s,j:d}})=>n.str`must NOT have duplicate items (items ## ${d} and ${s} are identical)`,params:({params:{i:s,j:d}})=>n._`{i: ${s}, j: ${d}}`},a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:o,code(s){let{gen:d,data:u,$data:l,schema:p,parentSchema:m,schemaCode:f,it:h}=s;if(!l&&!p)return;let y=d.let("valid"),w=m.items?(0,t.getSchemaTypes)(m.items):[];s.block$data(y,g,n._`${f} === false`),s.ok(y);function g(){let T=d.let("i",n._`${u}.length`),C=d.let("j");s.setParams({i:T,j:C}),d.assign(y,!0),d.if(n._`${T} > 1`,()=>(v()?b:S)(T,C))}function v(){return w.length>0&&!w.some(T=>T==="object"||T==="array")}function b(T,C){let _=d.name("item"),k=(0,t.checkDataTypes)(w,_,h.opts.strictNumbers,t.DataType.Wrong),I=d.const("indices",n._`{}`);d.for(n._`;${T}--;`,()=>{d.let(_,n._`${u}[${T}]`),d.if(k,n._`continue`),w.length>1&&d.if(n._`typeof ${_} == "string"`,n._`${_} += "_"`),d.if(n._`typeof ${I}[${_}] == "number"`,()=>{d.assign(C,n._`${I}[${_}]`),s.error(),d.assign(y,!1).break()}).code(n._`${I}[${_}] = ${T}`)})}function S(T,C){let _=(0,i.useFunc)(d,r.default),k=d.name("outer");d.label(k).for(n._`;${T}--;`,()=>d.for(n._`${C} = ${T}; ${C}--;`,()=>d.if(n._`${_}(${u}[${T}], ${u}[${C}])`,()=>{s.error(),d.assign(y,!1).break(k)})))}}};e.default=a}),P1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i=fm(),r={message:"must be equal to constant",params:({schemaCode:a})=>t._`{allowedValue: ${a}}`},o={keyword:"const",$data:!0,error:r,code(a){let{gen:s,data:d,$data:u,schemaCode:l,schema:p}=a;u||p&&typeof p=="object"?a.fail$data(t._`!${(0,n.useFunc)(s,i.default)}(${d}, ${l})`):a.fail(t._`${p} !== ${d}`)}};e.default=o}),E1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i=fm(),r={message:"must be equal to one of the allowed values",params:({schemaCode:a})=>t._`{allowedValues: ${a}}`},o={keyword:"enum",schemaType:"array",$data:!0,error:r,code(a){let{gen:s,data:d,$data:u,schema:l,schemaCode:p,it:m}=a;if(!u&&l.length===0)throw Error("enum must have non-empty array");let f=l.length>=m.opts.loopEnum,h,y=()=>h??(h=(0,n.useFunc)(s,i.default)),w;if(f||u)w=s.let("valid"),a.block$data(w,g);else{if(!Array.isArray(l))throw Error("ajv implementation error");let b=s.const("vSchema",p);w=(0,t.or)(...l.map((S,T)=>v(b,T)))}a.pass(w);function g(){s.assign(w,!1),s.forOf("v",p,b=>s.if(t._`${y()}(${d}, ${b})`,()=>s.assign(w,!0).break()))}function v(b,S){let T=l[S];return typeof T=="object"&&T!==null?t._`${y()}(${d}, ${b}[${S}])`:t._`${d} === ${T}`}}};e.default=o}),R1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=v1(),n=b1(),i=S1(),r=k1(),o=x1(),a=C1(),s=T1(),d=I1(),u=P1(),l=E1(),p=[t.default,n.default,i.default,r.default,o.default,a.default,s.default,d.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=p}),JS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=Te(),n=Ae(),i={message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:i,code(a){let{parentSchema:s,it:d}=a,{items:u}=s;if(!Array.isArray(u)){(0,n.checkStrictMode)(d,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(a,u)}};function o(a,s){let{gen:d,schema:u,data:l,keyword:p,it:m}=a;m.items=!0;let f=d.const("len",t._`${l}.length`);if(u===!1)a.setParams({len:s.length}),a.pass(t._`${f} <= ${s.length}`);else if(typeof u=="object"&&!(0,n.alwaysValidSchema)(m,u)){let y=d.var("valid",t._`${f} <= ${s.length}`);d.if((0,t.not)(y),()=>h(y)),a.ok(y)}function h(y){d.forRange("i",s.length,f,w=>{a.subschema({keyword:p,dataProp:w,dataPropType:n.Type.Num},y),!m.allErrors&&d.if((0,t.not)(y),()=>d.break())})}}e.validateAdditionalItems=o,e.default=r}),WS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=Te(),n=Ae(),i=On(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){let{schema:s,it:d}=a;if(Array.isArray(s))return o(a,"additionalItems",s);d.items=!0,!(0,n.alwaysValidSchema)(d,s)&&a.ok((0,i.validateArray)(a))}};function o(a,s,d=a.schema){let{gen:u,parentSchema:l,data:p,keyword:m,it:f}=a;w(l),f.opts.unevaluated&&d.length&&f.items!==!0&&(f.items=n.mergeEvaluated.items(u,d.length,f.items));let h=u.name("valid"),y=u.const("len",t._`${p}.length`);d.forEach((g,v)=>{(0,n.alwaysValidSchema)(f,g)||(u.if(t._`${y} > ${v}`,()=>a.subschema({keyword:m,schemaProp:v,dataProp:v},h)),a.ok(h))});function w(g){let{opts:v,errSchemaPath:b}=f,S=d.length,T=S===g.minItems&&(S===g.maxItems||g[s]===!1);if(v.strictTuples&&!T){let C=`"${m}" is ${S}-tuple, but minItems or maxItems/${s} are not specified or different at path "${b}"`;(0,n.checkStrictMode)(f,C,v.strictTuples)}}}e.validateTuple=o,e.default=r}),O1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=WS(),n={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:i=>(0,t.validateTuple)(i,"items")};e.default=n}),A1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i=On(),r=JS(),o={message:({params:{len:s}})=>t.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>t._`{limit: ${s}}`},a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:o,code(s){let{schema:d,parentSchema:u,it:l}=s,{prefixItems:p}=u;l.items=!0,!(0,n.alwaysValidSchema)(l,d)&&(p?(0,r.validateAdditionalItems)(s,p):s.ok((0,i.validateArray)(s)))}};e.default=a}),$1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:({params:{min:o,max:a}})=>a===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${a} valid item(s)`,params:({params:{min:o,max:a}})=>a===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${a}}`},r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:i,code(o){let{gen:a,schema:s,parentSchema:d,data:u,it:l}=o,p,m,{minContains:f,maxContains:h}=d;l.opts.next?(p=f===void 0?1:f,m=h):p=1;let y=a.const("len",t._`${u}.length`);if(o.setParams({min:p,max:m}),m===void 0&&p===0){(0,n.checkStrictMode)(l,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(m!==void 0&&p>m){(0,n.checkStrictMode)(l,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,n.alwaysValidSchema)(l,s)){let S=t._`${y} >= ${p}`;m!==void 0&&(S=t._`${S} && ${y} <= ${m}`),o.pass(S);return}l.items=!0;let w=a.name("valid");m===void 0&&p===1?v(w,()=>a.if(w,()=>a.break())):p===0?(a.let(w,!0),m!==void 0&&a.if(t._`${u}.length > 0`,g)):(a.let(w,!1),g()),o.result(w,()=>o.reset());function g(){let S=a.name("_valid"),T=a.let("count",0);v(S,()=>a.if(S,()=>b(T)))}function v(S,T){a.forRange("i",0,y,C=>{o.subschema({keyword:"contains",dataProp:C,dataPropType:n.Type.Num,compositeRule:!0},S),T()})}function b(S){a.code(t._`${S}++`),m===void 0?a.if(t._`${S} >= ${p}`,()=>a.assign(w,!0).break()):(a.if(t._`${S} > ${m}`,()=>a.assign(w,!1).break()),p===1?a.assign(w,!0):a.if(t._`${S} >= ${p}`,()=>a.assign(w,!0)))}}};e.default=r}),M1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=Te(),n=Ae(),i=On();e.error={message:({params:{property:d,depsCount:u,deps:l}})=>{let p=u===1?"property":"properties";return t.str`must have ${p} ${l} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:l,missingProperty:p}})=>t._`{property: ${d},
|
|
41
41
|
missingProperty: ${p},
|
|
42
42
|
depsCount: ${u},
|
|
43
|
-
deps: ${l}}`};var r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){let[u,l]=o(d);a(d,u),s(d,l)}};function o({schema:d}){let u={},l={};for(let p in d){if(p==="__proto__")continue;let m=Array.isArray(d[p])?u:l;m[p]=d[p]}return[u,l]}function a(d,u=d.schema){let{gen:l,data:p,it:m}=d;if(Object.keys(u).length===0)return;let f=l.let("missing");for(let h in u){let y=u[h];if(y.length===0)continue;let w=(0,i.propertyInData)(l,p,h,m.opts.ownProperties);d.setParams({property:h,depsCount:y.length,deps:y.join(", ")}),m.allErrors?l.if(w,()=>{for(let g of y)(0,i.checkReportMissingProp)(d,g)}):(l.if(t._`${w} && (${(0,i.checkMissingProp)(d,y,f)})`),(0,i.reportMissingProp)(d,f),l.else())}}e.validatePropertyDeps=a;function s(d,u=d.schema){let{gen:l,data:p,keyword:m,it:f}=d,h=l.name("valid");for(let y in u)(0,n.alwaysValidSchema)(f,u[y])||(l.if((0,i.propertyInData)(l,p,y,f.opts.ownProperties),()=>{let w=d.subschema({keyword:m,schemaProp:y},h);d.mergeValidEvaluated(w,h)},()=>l.var(h,!0)),d.ok(h))}e.validateSchemaDeps=s,e.default=r}),j1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i,code(o){let{gen:a,schema:s,data:d,it:u}=o;if((0,n.alwaysValidSchema)(u,s))return;let l=a.name("valid");a.forIn("key",d,p=>{o.setParams({propertyName:p}),o.subschema({keyword:"propertyNames",data:p,dataTypes:["string"],propertyName:p,compositeRule:!0},l),a.if((0,t.not)(l),()=>{o.error(!0),!u.allErrors&&a.break()})}),o.ok(l)}};e.default=r}),HS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n=Te(),i=Tr(),r=Ae(),o={message:"must NOT have additional properties",params:({params:s})=>n._`{additionalProperty: ${s.additionalProperty}}`},a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:o,code(s){let{gen:d,schema:u,parentSchema:l,data:p,errsCount:m,it:f}=s;if(!m)throw Error("ajv implementation error");let{allErrors:h,opts:y}=f;if(f.props=!0,y.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(f,u))return;let w=(0,t.allSchemaProperties)(l.properties),g=(0,t.allSchemaProperties)(l.patternProperties);v(),s.ok(n._`${m} === ${i.default.errors}`);function v(){d.forIn("key",p,_=>{!w.length&&!g.length?T(_):d.if(b(_),()=>T(_))})}function b(_){let k;if(w.length>8){let I=(0,r.schemaRefOrVal)(f,l.properties,"properties");k=(0,t.isOwnProperty)(d,I,_)}else w.length?k=(0,n.or)(...w.map(I=>n._`${_} === ${I}`)):k=n.nil;return g.length&&(k=(0,n.or)(k,...g.map(I=>n._`${(0,t.usePattern)(s,I)}.test(${_})`))),(0,n.not)(k)}function S(_){d.code(n._`delete ${p}[${_}]`)}function T(_){if(y.removeAdditional==="all"||y.removeAdditional&&u===!1){S(_);return}if(u===!1){s.setParams({additionalProperty:_}),s.error(),!h&&d.break();return}if(typeof u=="object"&&!(0,r.alwaysValidSchema)(f,u)){let k=d.name("valid");y.removeAdditional==="failing"?(C(_,k,!1),d.if((0,n.not)(k),()=>{s.reset(),S(_)})):(C(_,k),!h&&d.if((0,n.not)(k),()=>d.break()))}}function C(_,k,I){let P={keyword:"additionalProperties",dataProp:_,dataPropType:r.Type.Str};I===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(P,k)}}};e.default=a}),N1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=al(),n=On(),i=Ae(),r=HS(),o={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:s,schema:d,parentSchema:u,data:l,it:p}=a;p.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&r.default.code(new t.KeywordCxt(p,r.default,"additionalProperties"));let m=(0,n.allSchemaProperties)(d);for(let g of m)p.definedProperties.add(g);p.opts.unevaluated&&m.length&&p.props!==!0&&(p.props=i.mergeEvaluated.props(s,(0,i.toHash)(m),p.props));let f=m.filter(g=>!(0,i.alwaysValidSchema)(p,d[g]));if(f.length===0)return;let h=s.name("valid");for(let g of f)y(g)?w(g):(s.if((0,n.propertyInData)(s,l,g,p.opts.ownProperties)),w(g),!p.allErrors&&s.else().var(h,!0),s.endIf()),a.it.definedProperties.add(g),a.ok(h);function y(g){return p.opts.useDefaults&&!p.compositeRule&&d[g].default!==void 0}function w(g){a.subschema({keyword:"properties",schemaProp:g,dataProp:g},h)}}};e.default=o}),q1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n=Te(),i=Ae(),r=Ae(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:s,schema:d,data:u,parentSchema:l,it:p}=a,{opts:m}=p,f=(0,t.allSchemaProperties)(d),h=f.filter(T=>(0,i.alwaysValidSchema)(p,d[T]));if(f.length===0||h.length===f.length&&(!p.opts.unevaluated||p.props===!0))return;let y=m.strictSchema&&!m.allowMatchingProperties&&l.properties,w=s.name("valid");p.props!==!0&&!(p.props instanceof n.Name)&&(p.props=(0,r.evaluatedPropsToName)(s,p.props));let{props:g}=p;v();function v(){for(let T of f)y&&b(T),p.allErrors?S(T):(s.var(w,!0),S(T),s.if(w))}function b(T){for(let C in y)new RegExp(T).test(C)&&(0,i.checkStrictMode)(p,`property ${C} matches pattern ${T} (use allowMatchingProperties)`)}function S(T){s.forIn("key",u,C=>{s.if(n._`${(0,t.usePattern)(a,T)}.test(${C})`,()=>{let _=h.includes(T);_||a.subschema({keyword:"patternProperties",schemaProp:T,dataProp:C,dataPropType:r.Type.Str},w),p.opts.unevaluated&&g!==!0?s.assign(n._`${g}[${C}]`,!0):!_&&!p.allErrors&&s.if((0,n.not)(w),()=>s.break())})})}}};e.default=o}),D1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ae(),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(i){let{gen:r,schema:o,it:a}=i;if((0,t.alwaysValidSchema)(a,o)){i.fail();return}let s=r.name("valid");i.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),i.failResult(s,()=>i.reset(),()=>i.error())},error:{message:"must NOT be valid"}};e.default=n}),L1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t.validateUnion,error:{message:"must match a schema in anyOf"}};e.default=n}),U1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:i,code(o){let{gen:a,schema:s,parentSchema:d,it:u}=o;if(!Array.isArray(s))throw Error("ajv implementation error");if(u.opts.discriminator&&d.discriminator)return;let l=s,p=a.let("valid",!1),m=a.let("passing",null),f=a.name("_valid");o.setParams({passing:m}),a.block(h),o.result(p,()=>o.reset(),()=>o.error(!0));function h(){l.forEach((y,w)=>{let g;(0,n.alwaysValidSchema)(u,y)?a.var(f,!0):g=o.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},f),w>0&&a.if(t._`${f} && ${p}`).assign(p,!1).assign(m,t._`[${m}, ${w}]`).else(),a.if(f,()=>{a.assign(p,!0),a.assign(m,w),g&&o.mergeEvaluated(g,t.Name)})})}}};e.default=r}),F1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ae(),n={keyword:"allOf",schemaType:"array",code(i){let{gen:r,schema:o,it:a}=i;if(!Array.isArray(o))throw Error("ajv implementation error");let s=r.name("valid");o.forEach((d,u)=>{if((0,t.alwaysValidSchema)(a,d))return;let l=i.subschema({keyword:"allOf",schemaProp:u},s);i.ok(s),i.mergeEvaluated(l)})}};e.default=n}),z1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:({params:a})=>t.str`must match "${a.ifClause}" schema`,params:({params:a})=>t._`{failingKeyword: ${a.ifClause}}`},r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:i,code(a){let{gen:s,parentSchema:d,it:u}=a;d.then===void 0&&d.else===void 0&&(0,n.checkStrictMode)(u,'"if" without "then" and "else" is ignored');let l=o(u,"then"),p=o(u,"else");if(!l&&!p)return;let m=s.let("valid",!0),f=s.name("_valid");if(h(),a.reset(),l&&p){let w=s.let("ifClause");a.setParams({ifClause:w}),s.if(f,y("then",w),y("else",w))}else l?s.if(f,y("then")):s.if((0,t.not)(f),y("else"));a.pass(m,()=>a.error(!0));function h(){let w=a.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);a.mergeEvaluated(w)}function y(w,g){return()=>{let v=a.subschema({keyword:w},f);s.assign(m,f),a.mergeValidEvaluated(v,m),g?s.assign(g,t._`${w}`):a.setParams({ifClause:w})}}}};function o(a,s){let d=a.schema[s];return d!==void 0&&!(0,n.alwaysValidSchema)(a,d)}e.default=r}),B1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ae(),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:i,parentSchema:r,it:o}){r.if===void 0&&(0,t.checkStrictMode)(o,`"${i}" without "if" is ignored`)}};e.default=n}),K1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=JS(),n=O1(),i=WS(),r=A1(),o=$1(),a=M1(),s=j1(),d=HS(),u=N1(),l=q1(),p=D1(),m=L1(),f=U1(),h=F1(),y=z1(),w=B1();function g(v=!1){let b=[p.default,m.default,f.default,h.default,y.default,w.default,s.default,d.default,a.default,u.default,l.default];return v?b.push(n.default,r.default):b.push(t.default,i.default),b.push(o.default),b}e.default=g}),J1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n={message:({schemaCode:r})=>t.str`must match format "${r}"`,params:({schemaCode:r})=>t._`{format: ${r}}`},i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:n,code(r,o){let{gen:a,data:s,$data:d,schema:u,schemaCode:l,it:p}=r,{opts:m,errSchemaPath:f,schemaEnv:h,self:y}=p;if(!m.validateFormats)return;d?w():g();function w(){let v=a.scopeValue("formats",{ref:y.formats,code:m.code.formats}),b=a.const("fDef",t._`${v}[${l}]`),S=a.let("fType"),T=a.let("format");a.if(t._`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>a.assign(S,t._`${b}.type || "string"`).assign(T,t._`${b}.validate`),()=>a.assign(S,t._`"string"`).assign(T,b)),r.fail$data((0,t.or)(C(),_()));function C(){return m.strictSchema===!1?t.nil:t._`${l} && !${T}`}function _(){let k=h.$async?t._`(${b}.async ? await ${T}(${s}) : ${T}(${s}))`:t._`${T}(${s})`,I=t._`(typeof ${T} == "function" ? ${k} : ${T}.test(${s}))`;return t._`${T} && ${T} !== true && ${S} === ${o} && !${I}`}}function g(){let v=y.formats[u];if(!v){C();return}if(v===!0)return;let[b,S,T]=_(v);b===o&&r.pass(k());function C(){if(m.strictSchema===!1){y.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${u}" ignored in schema at path "${f}"`}}function _(I){let P=I instanceof RegExp?(0,t.regexpCode)(I):m.code.formats?t._`${m.code.formats}${(0,t.getProperty)(u)}`:void 0,R=a.scopeValue("formats",{key:u,ref:I,code:P});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,t._`${R}.validate`]:["string",I,R]}function k(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!h.$async)throw Error("async format in sync schema");return t._`await ${T}(${s})`}return typeof S=="function"?t._`${T}(${s})`:t._`${T}.test(${s})`}}}};e.default=i}),W1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=J1(),n=[t.default];e.default=n}),H1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),G1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_1(),n=R1(),i=K1(),r=W1(),o=H1(),a=[t.default,n.default,(0,i.default)(),r.default,o.metadataVocabulary,o.contentVocabulary];e.default=a}),V1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(n){n.Tag="tag",n.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Z1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=V1(),i=pm(),r=sl(),o=Ae(),a={message:({params:{discrError:d,tagName:u}})=>d===n.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:d,tag:u,tagName:l}})=>t._`{error: ${d}, tag: ${l}, tagValue: ${u}}`},s={keyword:"discriminator",type:"object",schemaType:"object",error:a,code(d){let{gen:u,data:l,schema:p,parentSchema:m,it:f}=d,{oneOf:h}=m;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let y=p.propertyName;if(typeof y!="string")throw Error("discriminator: requires propertyName");if(p.mapping)throw Error("discriminator: mapping is not supported");if(!h)throw Error("discriminator: requires oneOf keyword");let w=u.let("valid",!1),g=u.const("tag",t._`${l}${(0,t.getProperty)(y)}`);u.if(t._`typeof ${g} == "string"`,()=>v(),()=>d.error(!1,{discrError:n.DiscrError.Tag,tag:g,tagName:y})),d.ok(w);function v(){let T=S();u.if(!1);for(let C in T)u.elseIf(t._`${g} === ${C}`),u.assign(w,b(T[C]));u.else(),d.error(!1,{discrError:n.DiscrError.Mapping,tag:g,tagName:y}),u.endIf()}function b(T){let C=u.name("valid"),_=d.subschema({keyword:"oneOf",schemaProp:T},C);return d.mergeEvaluated(_,t.Name),C}function S(){var T;let C={},_=I(m),k=!0;for(let M=0;M<h.length;M++){let A=h[M];if(A?.$ref&&!(0,o.schemaHasRulesButRef)(A,f.self.RULES)){let se=A.$ref;if(A=i.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,se),A instanceof i.SchemaEnv&&(A=A.schema),A===void 0)throw new r.default(f.opts.uriResolver,f.baseId,se)}let F=(T=A?.properties)===null||T===void 0?void 0:T[y];if(typeof F!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${y}"`);k=k&&(_||I(A)),P(F,M)}if(!k)throw Error(`discriminator: "${y}" must be required`);return C;function I({required:M}){return Array.isArray(M)&&M.includes(y)}function P(M,A){if(M.const)R(M.const,A);else if(M.enum)for(let F of M.enum)R(F,A);else throw Error(`discriminator: "properties/${y}" must have "const" or "enum"`)}function R(M,A){if(typeof M!="string"||M in C)throw Error(`discriminator: "${y}" values must be unique strings`);C[M]=A}}}};e.default=s}),Q1=z((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),GS=z((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=h1(),i=G1(),r=Z1(),o=Q1(),a=["/properties"],s="http://json-schema.org/draft-07/schema";class d extends n.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let h=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(h,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}e.Ajv=d,t.exports=e=d,t.exports.Ajv=d,Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var u=al();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=Te();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var p=cm();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=sl();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),Y1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(R,M){return{validate:R,compare:M}}e.fullFormats={date:t(o,a),time:t(d(!0),u),"date-time":t(m(!0),f),"iso-time":t(d(),l),"iso-date-time":t(m(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:P,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:b,int32:{type:"number",validate:C},int64:{type:"number",validate:_},float:{type:"number",validate:k},double:{type:"number",validate:k},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(R){return R%4===0&&(R%100!==0||R%400===0)}var i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(R){let M=i.exec(R);if(!M)return!1;let A=+M[1],F=+M[2],se=+M[3];return F>=1&&F<=12&&se>=1&&se<=(F===2&&n(A)?29:r[F])}function a(R,M){if(R&&M)return R>M?1:R<M?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function d(R){return function(M){let A=s.exec(M);if(!A)return!1;let F=+A[1],se=+A[2],he=+A[3],ee=A[4],$e=A[5]==="-"?-1:1,be=+(A[6]||0),G=+(A[7]||0);if(be>23||G>59||R&&!ee)return!1;if(F<=23&&se<=59&&he<60)return!0;let $=se-G*$e,B=F-be*$e-($<0?1:0);return(B===23||B===-1)&&($===59||$===-1)&&he<61}}function u(R,M){if(!(R&&M))return;let A=new Date("2020-01-01T"+R).valueOf(),F=new Date("2020-01-01T"+M).valueOf();if(A&&F)return A-F}function l(R,M){if(!(R&&M))return;let A=s.exec(R),F=s.exec(M);if(A&&F)return R=A[1]+A[2]+A[3],M=F[1]+F[2]+F[3],R>M?1:R<M?-1:0}var p=/t|\s/i;function m(R){let M=d(R);return function(A){let F=A.split(p);return F.length===2&&o(F[0])&&M(F[1])}}function f(R,M){if(!(R&&M))return;let A=new Date(R).valueOf(),F=new Date(M).valueOf();if(A&&F)return A-F}function h(R,M){if(!(R&&M))return;let[A,F]=R.split(p),[se,he]=M.split(p),ee=a(A,se);if(ee!==void 0)return ee||u(F,he)}var y=/\/|:/,w=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function g(R){return y.test(R)&&w.test(R)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function b(R){return v.lastIndex=0,v.test(R)}var S=-2147483648,T=2147483647;function C(R){return Number.isInteger(R)&&R<=T&&R>=S}function _(R){return Number.isInteger(R)}function k(){return!0}var I=/[^\\]\\Z/;function P(R){if(I.test(R))return!1;try{return new RegExp(R),!0}catch{return!1}}}),X1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=GS(),n=Te(),i=n.operators,r={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:s,schemaCode:d})=>n.str`should be ${r[s].okStr} ${d}`,params:({keyword:s,schemaCode:d})=>n._`{comparison: ${r[s].okStr}, limit: ${d}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:o,code(s){let{gen:d,data:u,schemaCode:l,keyword:p,it:m}=s,{opts:f,self:h}=m;if(!f.validateFormats)return;let y=new t.KeywordCxt(m,h.RULES.all.format.definition,"format");y.$data?w():g();function w(){let b=d.scopeValue("formats",{ref:h.formats,code:f.code.formats}),S=d.const("fmt",n._`${b}[${y.schemaCode}]`);s.fail$data((0,n.or)(n._`typeof ${S} != "object"`,n._`${S} instanceof RegExp`,n._`typeof ${S}.compare != "function"`,v(S)))}function g(){let b=y.schema,S=h.formats[b];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw Error(`"${p}": format "${b}" does not define "compare" function`);let T=d.scopeValue("formats",{key:b,ref:S,code:f.code.formats?n._`${f.code.formats}${(0,n.getProperty)(b)}`:void 0});s.fail$data(v(T))}function v(b){return n._`${b}.compare(${u}, ${l}) ${r[p].fail} 0`}},dependencies:["format"]};var a=s=>(s.addKeyword(e.formatLimitDefinition),s);e.default=a}),ej=z((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=Y1(),i=X1(),r=Te(),o=new r.Name("fullFormats"),a=new r.Name("fastFormats"),s=(u,l={keywords:!0})=>{if(Array.isArray(l))return d(u,l,n.fullFormats,o),u;let[p,m]=l.mode==="fast"?[n.fastFormats,a]:[n.fullFormats,o],f=l.formats||n.formatNames;return d(u,f,p,m),l.keywords&&(0,i.default)(u),u};s.get=(u,l="full")=>{let p=(l==="fast"?n.fastFormats:n.fullFormats)[u];if(!p)throw Error(`Unknown format "${u}"`);return p};function d(u,l,p,m){var f,h;(f=(h=u.opts.code).formats)!==null&&f!==void 0||(h.formats=r._`require("ajv-formats/dist/formats").${m}`);for(let y of l)u.addFormat(y,p[y])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),pj=50;Voe=new FinalizationRegistry(({parentSignalRef:e,handler:t})=>{e.deref()?.removeEventListener("abort",t)});ul=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged","MessageDisplay"],bj=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],wj="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__",Sj=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,kj=/<command-name>(.*?)<\/command-name>/;xj={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};Lp=class{store=new Map;mtimes=new Map;summaries=new Map;lastMtime=0;keyToString(t){let n=[t.projectKey,t.sessionId];return t.subpath&&n.push(t.subpath),n.join("/")}async append(t,n){let i=this.keyToString(t),r=this.store.get(i)??[];r.push(...n),this.store.set(i,r);let o=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=o,this.mtimes.set(i,o),t.subpath===void 0){let a=`${t.projectKey}/${t.sessionId}`,s=ek(this.summaries.get(a),t,n,{mtime:o});this.summaries.set(a,s)}}async load(t){let n=this.keyToString(t);return this.store.get(n)??null}async listSessions(t){let n=[],i=t+"/";for(let[r]of this.store)if(r.startsWith(i)){let o=r.slice(i.length);o.includes("/")||n.push({sessionId:o,mtime:this.mtimes.get(r)??0})}return n}async listSessionSummaries(t){let n=[],i=t+"/";for(let[r,o]of this.summaries)r.startsWith(i)&&n.push(o);return n}async delete(t){let n=this.keyToString(t);if(this.store.delete(n),this.mtimes.delete(n),t.subpath===void 0){this.summaries.delete(`${t.projectKey}/${t.sessionId}`);let i=`${t.projectKey}/${t.sessionId}/`;for(let r of this.store.keys())r.startsWith(i)&&(this.store.delete(r),this.mtimes.delete(r))}}async listSubkeys(t){let n=`${t.projectKey}/${t.sessionId}/`,i=[];for(let r of this.store.keys())r.startsWith(n)&&i.push(r.slice(n.length));return i}getEntries(t){return this.store.get(this.keyToString(t))??[]}get size(){let t=0;for(let n of this.store.keys()){let i=n.indexOf("/");i!==-1&&!n.slice(i+1).includes("/")&&t++}return t}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}},Mt=class extends Error{};Uv=globalThis.process?.getBuiltinModule?.("async_hooks"),Ej=Uv?e=>Uv.AsyncResource.bind(e):e=>e;Rj=typeof global=="object"&&global&&global.Object===Object&&global,nk=Rj,Oj=typeof self=="object"&&self&&self.Object===Object&&self,Aj=nk||Oj||Function("return this")(),Bn=Aj,$j=Bn.Symbol,Dn=$j,rk=Object.prototype,Mj=rk.hasOwnProperty,jj=rk.toString,Qo=Dn?Dn.toStringTag:void 0;qj=Nj,Dj=Object.prototype,Lj=Dj.toString;Fj=Uj,zj="[object Null]",Bj="[object Undefined]",Fv=Dn?Dn.toStringTag:void 0;ri=Kj;Ln=Jj,Wj="[object AsyncFunction]",Hj="[object Function]",Gj="[object GeneratorFunction]",Vj="[object Proxy]";ym=Zj,Qj=Bn["__core-js_shared__"],np=Qj,zv=(function(){var e=/[^.]+$/.exec(np&&np.keys&&np.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();Xj=Yj,eN=Function.prototype,tN=eN.toString;ii=nN,rN=/[\\^$.*+?()[\]{}|]/g,iN=/^\[object .+?Constructor\]$/,oN=Function.prototype,aN=Object.prototype,sN=oN.toString,dN=aN.hasOwnProperty,uN=RegExp("^"+sN.call(dN).replace(rN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");cN=lN;fN=pN;oi=mN,hN=oi(Object,"create"),Na=hN;yN=gN;vN=_N,bN="__lodash_hash_undefined__",wN=Object.prototype,SN=wN.hasOwnProperty;xN=kN,CN=Object.prototype,TN=CN.hasOwnProperty;PN=IN,EN="__lodash_hash_undefined__";ON=RN;ho.prototype.clear=yN;ho.prototype.delete=vN;ho.prototype.get=xN;ho.prototype.has=PN;ho.prototype.set=ON;Bv=ho;$N=AN;hs=MN;ll=jN,NN=Array.prototype,qN=NN.splice;LN=DN;FN=UN;BN=zN;JN=KN;go.prototype.clear=$N;go.prototype.delete=LN;go.prototype.get=FN;go.prototype.has=BN;go.prototype.set=JN;cl=go,WN=oi(Bn,"Map"),qa=WN;GN=HN;ZN=VN;pl=QN;XN=YN;tq=eq;rq=nq;oq=iq;yo.prototype.clear=GN;yo.prototype.delete=XN;yo.prototype.get=tq;yo.prototype.has=rq;yo.prototype.set=oq;fl=yo,aq="Expected a function";_m.Cache=fl;vt=_m,_o=vt(()=>(process.env.CLAUDE_CONFIG_DIR??dq(sq(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR),rae=vt(()=>kt(process.env.CLAUDE_CODE_SUPERVISED));ik=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return ik=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^n()&15>>+i/4).toString(16))};Up=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},me=class extends Error{},Rt=class e extends me{constructor(t,n,i,r,o){super(`${e.makeMessage(t,n,i)}`),this.status=t,this.headers=r,this.requestID=r?.get("request-id"),this.error=n,this.type=o??null}static makeMessage(t,n,i){let r=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):i;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,n,i,r){if(!t||!r)return new Ji({message:i,cause:Up(n)});let o=n,a=o?.error?.type;return t===400?new Ld(t,o,i,r,a):t===401?new Ud(t,o,i,r,a):t===403?new Fd(t,o,i,r,a):t===404?new zd(t,o,i,r,a):t===409?new Bd(t,o,i,r,a):t===422?new Kd(t,o,i,r,a):t===429?new Jd(t,o,i,r,a):t>=500?new Wd(t,o,i,r,a):new e(t,o,i,r,a)}},Qt=class extends Rt{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}},Ji=class extends Rt{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}},Dd=class extends Ji{constructor({message:t}={}){super({message:t??"Request timed out."})}},Ld=class extends Rt{},Ud=class extends Rt{},Fd=class extends Rt{},zd=class extends Rt{},Bd=class extends Rt{},Kd=class extends Rt{},Jd=class extends Rt{},Wd=class extends Rt{},uq=/^[a-z][a-z0-9+.-]*:/i,lq=e=>uq.test(e),Fp=e=>(Fp=Array.isArray,Fp(e)),Kv=Fp;pq=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new me(`${e} must be an integer`);if(t<0)throw new me(`${e} must be a positive integer`);return t},ok=e=>{try{return JSON.parse(e)}catch{return}},fq=e=>new Promise(t=>setTimeout(t,e)),yr="0.94.0",mq=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";gq=()=>{let e=hq();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":Hv(Deno.build.os),"X-Stainless-Arch":Wv(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":Hv(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Wv(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=yq();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};Wv=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",Hv=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),vm=()=>Gv??(Gv=gq());bq=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});Sq="urn:ietf:params:oauth:grant-type:jwt-bearer",kq="refresh_token",dk="/v1/oauth/token",Hd="oauth-2025-04-20",xq="oidc-federation-2026-04-01",Cq=120,wm=30,Tq=5,Vv=1048576;rp=2e3,Iq=new Set(["error","error_description","error_uri"]);Fe=class extends me{constructor(t,n=null,i=null,r=null){super(t),this.statusCode=n,this.body=i,this.requestId=r}};Bp=class{constructor(t,n){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=t,this.onAdvisoryRefreshError=n}async getToken(){let t=this.nextForce;this.nextForce=!1;let n=this.cached;if(t||n==null)return(await this.refresh(t)).token;if(n.expiresAt==null)return n.token;let i=n.expiresAt-Wr();return i>Cq?n.token:i>wm?(this.backgroundRefresh(),n.token):(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(t=!1){return this.pendingRefresh&&!t?this.pendingRefresh:this.doRefresh(t)}backgroundRefresh(){this.pendingRefresh||Wr()-this.lastAdvisoryError<Tq||this.doRefresh().catch(t=>{this.lastAdvisoryError=Wr(),this.onAdvisoryRefreshError?.(t)})}doRefresh(t=!1){return this.pendingRefresh=this.provider(t?{forceRefresh:!0}:void 0).then(n=>(this.cached=n,this.pendingRefresh=null,n),n=>{throw this.pendingRefresh=null,n}),this.pendingRefresh}},Ue=e=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0};Gd={off:0,error:200,warn:300,info:400,debug:500},Xv=(e,t,n)=>{if(e){if(cq(Gd,e))return e;gt(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Gd))}`)}};Rq={error:va,warn:va,info:va,debug:va},eb=new WeakMap;zr=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),fk="1.0",Oq=/^[A-Za-z0-9_.-]+$/;Aq=async e=>{var t,n;let i=await km();if(i===null)return null;let r=e??await hk();if(r===null)return null;mk(r);let o=await import("node:fs"),a=(await import("node:path")).join(i,"configs",`${r}.json`),s;try{s=await o.promises.readFile(a,"utf-8")}catch(l){if(l?.code!=="ENOENT")throw Error(`failed to read config file ${a}: ${l}`);s=null}if(s===null){let l=Ue("ANTHROPIC_ORGANIZATION_ID"),p=Ue("ANTHROPIC_IDENTITY_TOKEN_FILE"),m=Ue("ANTHROPIC_FEDERATION_RULE_ID");return m&&l?{fromFile:!1,config:{organization_id:l,workspace_id:Ue("ANTHROPIC_WORKSPACE_ID"),base_url:Ue("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:m,service_account_id:Ue("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:p?{source:"file",path:p}:void 0,scope:Ue("ANTHROPIC_SCOPE")}}}:null}let d;try{d=JSON.parse(s)}catch(l){throw Error(`failed to parse config file ${a}: ${l}`)}if(!d.authentication)throw Error(`config file ${a} is missing "authentication"`);let u=d.authentication.type;if(u!=="oidc_federation"&&u!=="user_oauth")throw Error(`authentication.type "${u}" is not a known authentication type`);if(d.organization_id??(d.organization_id=Ue("ANTHROPIC_ORGANIZATION_ID")),d.workspace_id??(d.workspace_id=Ue("ANTHROPIC_WORKSPACE_ID")),d.base_url??(d.base_url=Ue("ANTHROPIC_BASE_URL")),(t=d.authentication).scope??(t.scope=Ue("ANTHROPIC_SCOPE")),d.authentication.type==="oidc_federation"){if(!d.authentication.identity_token){let l=Ue("ANTHROPIC_IDENTITY_TOKEN_FILE");l&&(d.authentication.identity_token={source:"file",path:l})}d.authentication.federation_rule_id||(d.authentication.federation_rule_id=Ue("ANTHROPIC_FEDERATION_RULE_ID")??""),(n=d.authentication).service_account_id??(n.service_account_id=Ue("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:d,fromFile:!0}},$q=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await km();if(!n)return null;let i=t??await hk();return i?(mk(i),(await import("node:path")).join(n,"credentials",`${i}.json`)):null},km=async()=>{if(!Mq())return null;let e=await import("node:path"),t=Ue("ANTHROPIC_CONFIG_DIR");if(t)return t;if(vm()["X-Stainless-OS"]==="Windows"){let r=Ue("APPDATA");if(r)return e.join(r,"Anthropic");let o=Ue("USERPROFILE");return o?e.join(o,"AppData","Roaming","Anthropic"):null}let n=Ue("XDG_CONFIG_HOME");if(n)return e.join(n,"anthropic");let i=Ue("HOME");return i?e.join(i,".config","anthropic"):null},Mq=()=>{let e=vm()["X-Stainless-Runtime"];return e==="node"||e==="deno"},hk=async()=>{let e=await km();if(!e)return null;let t=Ue("ANTHROPIC_PROFILE");if(t)return t;let n=await import("node:fs"),i=(await import("node:path")).join(e,"active_config");try{return(await n.promises.readFile(i,"utf-8")).trim()||"default"}catch(r){if(r?.code!=="ENOENT")throw Error(`failed to read ${i}: ${r}`);return"default"}};Vr=class{constructor(){Wt.set(this,void 0),Ht.set(this,void 0),ie(this,Wt,new Uint8Array,"f"),ie(this,Ht,null,"f")}decode(t){if(t==null)return[];let n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?Sm(t):t;ie(this,Wt,Eq([q(this,Wt,"f"),n]),"f");let i=[],r;for(;(r=zq(q(this,Wt,"f"),q(this,Ht,"f")))!=null;){if(r.carriage&&q(this,Ht,"f")==null){ie(this,Ht,r.index,"f");continue}if(q(this,Ht,"f")!=null&&(r.index!==q(this,Ht,"f")+1||r.carriage)){i.push(Yv(q(this,Wt,"f").subarray(0,q(this,Ht,"f")-1))),ie(this,Wt,q(this,Wt,"f").subarray(q(this,Ht,"f")),"f"),ie(this,Ht,null,"f");continue}let o=q(this,Ht,"f")!==null?r.preceding-1:r.preceding,a=Yv(q(this,Wt,"f").subarray(0,o));i.push(a),ie(this,Wt,q(this,Wt,"f").subarray(r.index),"f"),ie(this,Ht,null,"f")}return i}flush(){return q(this,Wt,"f").length?this.decode(`
|
|
43
|
+
deps: ${l}}`};var r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){let[u,l]=o(d);a(d,u),s(d,l)}};function o({schema:d}){let u={},l={};for(let p in d){if(p==="__proto__")continue;let m=Array.isArray(d[p])?u:l;m[p]=d[p]}return[u,l]}function a(d,u=d.schema){let{gen:l,data:p,it:m}=d;if(Object.keys(u).length===0)return;let f=l.let("missing");for(let h in u){let y=u[h];if(y.length===0)continue;let w=(0,i.propertyInData)(l,p,h,m.opts.ownProperties);d.setParams({property:h,depsCount:y.length,deps:y.join(", ")}),m.allErrors?l.if(w,()=>{for(let g of y)(0,i.checkReportMissingProp)(d,g)}):(l.if(t._`${w} && (${(0,i.checkMissingProp)(d,y,f)})`),(0,i.reportMissingProp)(d,f),l.else())}}e.validatePropertyDeps=a;function s(d,u=d.schema){let{gen:l,data:p,keyword:m,it:f}=d,h=l.name("valid");for(let y in u)(0,n.alwaysValidSchema)(f,u[y])||(l.if((0,i.propertyInData)(l,p,y,f.opts.ownProperties),()=>{let w=d.subschema({keyword:m,schemaProp:y},h);d.mergeValidEvaluated(w,h)},()=>l.var(h,!0)),d.ok(h))}e.validateSchemaDeps=s,e.default=r}),j1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i,code(o){let{gen:a,schema:s,data:d,it:u}=o;if((0,n.alwaysValidSchema)(u,s))return;let l=a.name("valid");a.forIn("key",d,p=>{o.setParams({propertyName:p}),o.subschema({keyword:"propertyNames",data:p,dataTypes:["string"],propertyName:p,compositeRule:!0},l),a.if((0,t.not)(l),()=>{o.error(!0),!u.allErrors&&a.break()})}),o.ok(l)}};e.default=r}),HS=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n=Te(),i=Tr(),r=Ae(),o={message:"must NOT have additional properties",params:({params:s})=>n._`{additionalProperty: ${s.additionalProperty}}`},a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:o,code(s){let{gen:d,schema:u,parentSchema:l,data:p,errsCount:m,it:f}=s;if(!m)throw Error("ajv implementation error");let{allErrors:h,opts:y}=f;if(f.props=!0,y.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(f,u))return;let w=(0,t.allSchemaProperties)(l.properties),g=(0,t.allSchemaProperties)(l.patternProperties);v(),s.ok(n._`${m} === ${i.default.errors}`);function v(){d.forIn("key",p,_=>{!w.length&&!g.length?T(_):d.if(b(_),()=>T(_))})}function b(_){let k;if(w.length>8){let I=(0,r.schemaRefOrVal)(f,l.properties,"properties");k=(0,t.isOwnProperty)(d,I,_)}else w.length?k=(0,n.or)(...w.map(I=>n._`${_} === ${I}`)):k=n.nil;return g.length&&(k=(0,n.or)(k,...g.map(I=>n._`${(0,t.usePattern)(s,I)}.test(${_})`))),(0,n.not)(k)}function S(_){d.code(n._`delete ${p}[${_}]`)}function T(_){if(y.removeAdditional==="all"||y.removeAdditional&&u===!1){S(_);return}if(u===!1){s.setParams({additionalProperty:_}),s.error(),!h&&d.break();return}if(typeof u=="object"&&!(0,r.alwaysValidSchema)(f,u)){let k=d.name("valid");y.removeAdditional==="failing"?(C(_,k,!1),d.if((0,n.not)(k),()=>{s.reset(),S(_)})):(C(_,k),!h&&d.if((0,n.not)(k),()=>d.break()))}}function C(_,k,I){let P={keyword:"additionalProperties",dataProp:_,dataPropType:r.Type.Str};I===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(P,k)}}};e.default=a}),N1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=al(),n=On(),i=Ae(),r=HS(),o={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:s,schema:d,parentSchema:u,data:l,it:p}=a;p.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&r.default.code(new t.KeywordCxt(p,r.default,"additionalProperties"));let m=(0,n.allSchemaProperties)(d);for(let g of m)p.definedProperties.add(g);p.opts.unevaluated&&m.length&&p.props!==!0&&(p.props=i.mergeEvaluated.props(s,(0,i.toHash)(m),p.props));let f=m.filter(g=>!(0,i.alwaysValidSchema)(p,d[g]));if(f.length===0)return;let h=s.name("valid");for(let g of f)y(g)?w(g):(s.if((0,n.propertyInData)(s,l,g,p.opts.ownProperties)),w(g),!p.allErrors&&s.else().var(h,!0),s.endIf()),a.it.definedProperties.add(g),a.ok(h);function y(g){return p.opts.useDefaults&&!p.compositeRule&&d[g].default!==void 0}function w(g){a.subschema({keyword:"properties",schemaProp:g,dataProp:g},h)}}};e.default=o}),q1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n=Te(),i=Ae(),r=Ae(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:s,schema:d,data:u,parentSchema:l,it:p}=a,{opts:m}=p,f=(0,t.allSchemaProperties)(d),h=f.filter(T=>(0,i.alwaysValidSchema)(p,d[T]));if(f.length===0||h.length===f.length&&(!p.opts.unevaluated||p.props===!0))return;let y=m.strictSchema&&!m.allowMatchingProperties&&l.properties,w=s.name("valid");p.props!==!0&&!(p.props instanceof n.Name)&&(p.props=(0,r.evaluatedPropsToName)(s,p.props));let{props:g}=p;v();function v(){for(let T of f)y&&b(T),p.allErrors?S(T):(s.var(w,!0),S(T),s.if(w))}function b(T){for(let C in y)new RegExp(T).test(C)&&(0,i.checkStrictMode)(p,`property ${C} matches pattern ${T} (use allowMatchingProperties)`)}function S(T){s.forIn("key",u,C=>{s.if(n._`${(0,t.usePattern)(a,T)}.test(${C})`,()=>{let _=h.includes(T);_||a.subschema({keyword:"patternProperties",schemaProp:T,dataProp:C,dataPropType:r.Type.Str},w),p.opts.unevaluated&&g!==!0?s.assign(n._`${g}[${C}]`,!0):!_&&!p.allErrors&&s.if((0,n.not)(w),()=>s.break())})})}}};e.default=o}),D1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ae(),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(i){let{gen:r,schema:o,it:a}=i;if((0,t.alwaysValidSchema)(a,o)){i.fail();return}let s=r.name("valid");i.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),i.failResult(s,()=>i.reset(),()=>i.error())},error:{message:"must NOT be valid"}};e.default=n}),L1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=On(),n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t.validateUnion,error:{message:"must match a schema in anyOf"}};e.default=n}),U1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:i,code(o){let{gen:a,schema:s,parentSchema:d,it:u}=o;if(!Array.isArray(s))throw Error("ajv implementation error");if(u.opts.discriminator&&d.discriminator)return;let l=s,p=a.let("valid",!1),m=a.let("passing",null),f=a.name("_valid");o.setParams({passing:m}),a.block(h),o.result(p,()=>o.reset(),()=>o.error(!0));function h(){l.forEach((y,w)=>{let g;(0,n.alwaysValidSchema)(u,y)?a.var(f,!0):g=o.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},f),w>0&&a.if(t._`${f} && ${p}`).assign(p,!1).assign(m,t._`[${m}, ${w}]`).else(),a.if(f,()=>{a.assign(p,!0),a.assign(m,w),g&&o.mergeEvaluated(g,t.Name)})})}}};e.default=r}),F1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ae(),n={keyword:"allOf",schemaType:"array",code(i){let{gen:r,schema:o,it:a}=i;if(!Array.isArray(o))throw Error("ajv implementation error");let s=r.name("valid");o.forEach((d,u)=>{if((0,t.alwaysValidSchema)(a,d))return;let l=i.subschema({keyword:"allOf",schemaProp:u},s);i.ok(s),i.mergeEvaluated(l)})}};e.default=n}),z1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=Ae(),i={message:({params:a})=>t.str`must match "${a.ifClause}" schema`,params:({params:a})=>t._`{failingKeyword: ${a.ifClause}}`},r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:i,code(a){let{gen:s,parentSchema:d,it:u}=a;d.then===void 0&&d.else===void 0&&(0,n.checkStrictMode)(u,'"if" without "then" and "else" is ignored');let l=o(u,"then"),p=o(u,"else");if(!l&&!p)return;let m=s.let("valid",!0),f=s.name("_valid");if(h(),a.reset(),l&&p){let w=s.let("ifClause");a.setParams({ifClause:w}),s.if(f,y("then",w),y("else",w))}else l?s.if(f,y("then")):s.if((0,t.not)(f),y("else"));a.pass(m,()=>a.error(!0));function h(){let w=a.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);a.mergeEvaluated(w)}function y(w,g){return()=>{let v=a.subschema({keyword:w},f);s.assign(m,f),a.mergeValidEvaluated(v,m),g?s.assign(g,t._`${w}`):a.setParams({ifClause:w})}}}};function o(a,s){let d=a.schema[s];return d!==void 0&&!(0,n.alwaysValidSchema)(a,d)}e.default=r}),B1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ae(),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:i,parentSchema:r,it:o}){r.if===void 0&&(0,t.checkStrictMode)(o,`"${i}" without "if" is ignored`)}};e.default=n}),K1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=JS(),n=O1(),i=WS(),r=A1(),o=$1(),a=M1(),s=j1(),d=HS(),u=N1(),l=q1(),p=D1(),m=L1(),f=U1(),h=F1(),y=z1(),w=B1();function g(v=!1){let b=[p.default,m.default,f.default,h.default,y.default,w.default,s.default,d.default,a.default,u.default,l.default];return v?b.push(n.default,r.default):b.push(t.default,i.default),b.push(o.default),b}e.default=g}),J1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n={message:({schemaCode:r})=>t.str`must match format "${r}"`,params:({schemaCode:r})=>t._`{format: ${r}}`},i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:n,code(r,o){let{gen:a,data:s,$data:d,schema:u,schemaCode:l,it:p}=r,{opts:m,errSchemaPath:f,schemaEnv:h,self:y}=p;if(!m.validateFormats)return;d?w():g();function w(){let v=a.scopeValue("formats",{ref:y.formats,code:m.code.formats}),b=a.const("fDef",t._`${v}[${l}]`),S=a.let("fType"),T=a.let("format");a.if(t._`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>a.assign(S,t._`${b}.type || "string"`).assign(T,t._`${b}.validate`),()=>a.assign(S,t._`"string"`).assign(T,b)),r.fail$data((0,t.or)(C(),_()));function C(){return m.strictSchema===!1?t.nil:t._`${l} && !${T}`}function _(){let k=h.$async?t._`(${b}.async ? await ${T}(${s}) : ${T}(${s}))`:t._`${T}(${s})`,I=t._`(typeof ${T} == "function" ? ${k} : ${T}.test(${s}))`;return t._`${T} && ${T} !== true && ${S} === ${o} && !${I}`}}function g(){let v=y.formats[u];if(!v){C();return}if(v===!0)return;let[b,S,T]=_(v);b===o&&r.pass(k());function C(){if(m.strictSchema===!1){y.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${u}" ignored in schema at path "${f}"`}}function _(I){let P=I instanceof RegExp?(0,t.regexpCode)(I):m.code.formats?t._`${m.code.formats}${(0,t.getProperty)(u)}`:void 0,R=a.scopeValue("formats",{key:u,ref:I,code:P});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,t._`${R}.validate`]:["string",I,R]}function k(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!h.$async)throw Error("async format in sync schema");return t._`await ${T}(${s})`}return typeof S=="function"?t._`${T}(${s})`:t._`${T}.test(${s})`}}}};e.default=i}),W1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=J1(),n=[t.default];e.default=n}),H1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),G1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_1(),n=R1(),i=K1(),r=W1(),o=H1(),a=[t.default,n.default,(0,i.default)(),r.default,o.metadataVocabulary,o.contentVocabulary];e.default=a}),V1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(n){n.Tag="tag",n.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Z1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Te(),n=V1(),i=pm(),r=sl(),o=Ae(),a={message:({params:{discrError:d,tagName:u}})=>d===n.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:d,tag:u,tagName:l}})=>t._`{error: ${d}, tag: ${l}, tagValue: ${u}}`},s={keyword:"discriminator",type:"object",schemaType:"object",error:a,code(d){let{gen:u,data:l,schema:p,parentSchema:m,it:f}=d,{oneOf:h}=m;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let y=p.propertyName;if(typeof y!="string")throw Error("discriminator: requires propertyName");if(p.mapping)throw Error("discriminator: mapping is not supported");if(!h)throw Error("discriminator: requires oneOf keyword");let w=u.let("valid",!1),g=u.const("tag",t._`${l}${(0,t.getProperty)(y)}`);u.if(t._`typeof ${g} == "string"`,()=>v(),()=>d.error(!1,{discrError:n.DiscrError.Tag,tag:g,tagName:y})),d.ok(w);function v(){let T=S();u.if(!1);for(let C in T)u.elseIf(t._`${g} === ${C}`),u.assign(w,b(T[C]));u.else(),d.error(!1,{discrError:n.DiscrError.Mapping,tag:g,tagName:y}),u.endIf()}function b(T){let C=u.name("valid"),_=d.subschema({keyword:"oneOf",schemaProp:T},C);return d.mergeEvaluated(_,t.Name),C}function S(){var T;let C={},_=I(m),k=!0;for(let M=0;M<h.length;M++){let A=h[M];if(A?.$ref&&!(0,o.schemaHasRulesButRef)(A,f.self.RULES)){let se=A.$ref;if(A=i.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,se),A instanceof i.SchemaEnv&&(A=A.schema),A===void 0)throw new r.default(f.opts.uriResolver,f.baseId,se)}let F=(T=A?.properties)===null||T===void 0?void 0:T[y];if(typeof F!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${y}"`);k=k&&(_||I(A)),P(F,M)}if(!k)throw Error(`discriminator: "${y}" must be required`);return C;function I({required:M}){return Array.isArray(M)&&M.includes(y)}function P(M,A){if(M.const)R(M.const,A);else if(M.enum)for(let F of M.enum)R(F,A);else throw Error(`discriminator: "properties/${y}" must have "const" or "enum"`)}function R(M,A){if(typeof M!="string"||M in C)throw Error(`discriminator: "${y}" values must be unique strings`);C[M]=A}}}};e.default=s}),Q1=z((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),GS=z((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=h1(),i=G1(),r=Z1(),o=Q1(),a=["/properties"],s="http://json-schema.org/draft-07/schema";class d extends n.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let h=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(h,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}e.Ajv=d,t.exports=e=d,t.exports.Ajv=d,Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var u=al();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=Te();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var p=cm();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=sl();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),Y1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(R,M){return{validate:R,compare:M}}e.fullFormats={date:t(o,a),time:t(d(!0),u),"date-time":t(m(!0),f),"iso-time":t(d(),l),"iso-date-time":t(m(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:P,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:b,int32:{type:"number",validate:C},int64:{type:"number",validate:_},float:{type:"number",validate:k},double:{type:"number",validate:k},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(R){return R%4===0&&(R%100!==0||R%400===0)}var i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(R){let M=i.exec(R);if(!M)return!1;let A=+M[1],F=+M[2],se=+M[3];return F>=1&&F<=12&&se>=1&&se<=(F===2&&n(A)?29:r[F])}function a(R,M){if(R&&M)return R>M?1:R<M?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function d(R){return function(M){let A=s.exec(M);if(!A)return!1;let F=+A[1],se=+A[2],he=+A[3],ee=A[4],$e=A[5]==="-"?-1:1,be=+(A[6]||0),G=+(A[7]||0);if(be>23||G>59||R&&!ee)return!1;if(F<=23&&se<=59&&he<60)return!0;let $=se-G*$e,B=F-be*$e-($<0?1:0);return(B===23||B===-1)&&($===59||$===-1)&&he<61}}function u(R,M){if(!(R&&M))return;let A=new Date("2020-01-01T"+R).valueOf(),F=new Date("2020-01-01T"+M).valueOf();if(A&&F)return A-F}function l(R,M){if(!(R&&M))return;let A=s.exec(R),F=s.exec(M);if(A&&F)return R=A[1]+A[2]+A[3],M=F[1]+F[2]+F[3],R>M?1:R<M?-1:0}var p=/t|\s/i;function m(R){let M=d(R);return function(A){let F=A.split(p);return F.length===2&&o(F[0])&&M(F[1])}}function f(R,M){if(!(R&&M))return;let A=new Date(R).valueOf(),F=new Date(M).valueOf();if(A&&F)return A-F}function h(R,M){if(!(R&&M))return;let[A,F]=R.split(p),[se,he]=M.split(p),ee=a(A,se);if(ee!==void 0)return ee||u(F,he)}var y=/\/|:/,w=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function g(R){return y.test(R)&&w.test(R)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function b(R){return v.lastIndex=0,v.test(R)}var S=-2147483648,T=2147483647;function C(R){return Number.isInteger(R)&&R<=T&&R>=S}function _(R){return Number.isInteger(R)}function k(){return!0}var I=/[^\\]\\Z/;function P(R){if(I.test(R))return!1;try{return new RegExp(R),!0}catch{return!1}}}),X1=z(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=GS(),n=Te(),i=n.operators,r={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:s,schemaCode:d})=>n.str`should be ${r[s].okStr} ${d}`,params:({keyword:s,schemaCode:d})=>n._`{comparison: ${r[s].okStr}, limit: ${d}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:o,code(s){let{gen:d,data:u,schemaCode:l,keyword:p,it:m}=s,{opts:f,self:h}=m;if(!f.validateFormats)return;let y=new t.KeywordCxt(m,h.RULES.all.format.definition,"format");y.$data?w():g();function w(){let b=d.scopeValue("formats",{ref:h.formats,code:f.code.formats}),S=d.const("fmt",n._`${b}[${y.schemaCode}]`);s.fail$data((0,n.or)(n._`typeof ${S} != "object"`,n._`${S} instanceof RegExp`,n._`typeof ${S}.compare != "function"`,v(S)))}function g(){let b=y.schema,S=h.formats[b];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw Error(`"${p}": format "${b}" does not define "compare" function`);let T=d.scopeValue("formats",{key:b,ref:S,code:f.code.formats?n._`${f.code.formats}${(0,n.getProperty)(b)}`:void 0});s.fail$data(v(T))}function v(b){return n._`${b}.compare(${u}, ${l}) ${r[p].fail} 0`}},dependencies:["format"]};var a=s=>(s.addKeyword(e.formatLimitDefinition),s);e.default=a}),ej=z((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=Y1(),i=X1(),r=Te(),o=new r.Name("fullFormats"),a=new r.Name("fastFormats"),s=(u,l={keywords:!0})=>{if(Array.isArray(l))return d(u,l,n.fullFormats,o),u;let[p,m]=l.mode==="fast"?[n.fastFormats,a]:[n.fullFormats,o],f=l.formats||n.formatNames;return d(u,f,p,m),l.keywords&&(0,i.default)(u),u};s.get=(u,l="full")=>{let p=(l==="fast"?n.fastFormats:n.fullFormats)[u];if(!p)throw Error(`Unknown format "${u}"`);return p};function d(u,l,p,m){var f,h;(f=(h=u.opts.code).formats)!==null&&f!==void 0||(h.formats=r._`require("ajv-formats/dist/formats").${m}`);for(let y of l)u.addFormat(y,p[y])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),pj=50;Zoe=new FinalizationRegistry(({parentSignalRef:e,handler:t})=>{e.deref()?.removeEventListener("abort",t)});ul=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged","MessageDisplay"],bj=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],wj="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__",Sj=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,kj=/<command-name>(.*?)<\/command-name>/;xj={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};Lp=class{store=new Map;mtimes=new Map;summaries=new Map;lastMtime=0;keyToString(t){let n=[t.projectKey,t.sessionId];return t.subpath&&n.push(t.subpath),n.join("/")}async append(t,n){let i=this.keyToString(t),r=this.store.get(i)??[];r.push(...n),this.store.set(i,r);let o=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=o,this.mtimes.set(i,o),t.subpath===void 0){let a=`${t.projectKey}/${t.sessionId}`,s=ek(this.summaries.get(a),t,n,{mtime:o});this.summaries.set(a,s)}}async load(t){let n=this.keyToString(t);return this.store.get(n)??null}async listSessions(t){let n=[],i=t+"/";for(let[r]of this.store)if(r.startsWith(i)){let o=r.slice(i.length);o.includes("/")||n.push({sessionId:o,mtime:this.mtimes.get(r)??0})}return n}async listSessionSummaries(t){let n=[],i=t+"/";for(let[r,o]of this.summaries)r.startsWith(i)&&n.push(o);return n}async delete(t){let n=this.keyToString(t);if(this.store.delete(n),this.mtimes.delete(n),t.subpath===void 0){this.summaries.delete(`${t.projectKey}/${t.sessionId}`);let i=`${t.projectKey}/${t.sessionId}/`;for(let r of this.store.keys())r.startsWith(i)&&(this.store.delete(r),this.mtimes.delete(r))}}async listSubkeys(t){let n=`${t.projectKey}/${t.sessionId}/`,i=[];for(let r of this.store.keys())r.startsWith(n)&&i.push(r.slice(n.length));return i}getEntries(t){return this.store.get(this.keyToString(t))??[]}get size(){let t=0;for(let n of this.store.keys()){let i=n.indexOf("/");i!==-1&&!n.slice(i+1).includes("/")&&t++}return t}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}},Mt=class extends Error{};Uv=globalThis.process?.getBuiltinModule?.("async_hooks"),Ej=Uv?e=>Uv.AsyncResource.bind(e):e=>e;Rj=typeof global=="object"&&global&&global.Object===Object&&global,nk=Rj,Oj=typeof self=="object"&&self&&self.Object===Object&&self,Aj=nk||Oj||Function("return this")(),Bn=Aj,$j=Bn.Symbol,Dn=$j,rk=Object.prototype,Mj=rk.hasOwnProperty,jj=rk.toString,Qo=Dn?Dn.toStringTag:void 0;qj=Nj,Dj=Object.prototype,Lj=Dj.toString;Fj=Uj,zj="[object Null]",Bj="[object Undefined]",Fv=Dn?Dn.toStringTag:void 0;ri=Kj;Ln=Jj,Wj="[object AsyncFunction]",Hj="[object Function]",Gj="[object GeneratorFunction]",Vj="[object Proxy]";ym=Zj,Qj=Bn["__core-js_shared__"],np=Qj,zv=(function(){var e=/[^.]+$/.exec(np&&np.keys&&np.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();Xj=Yj,eN=Function.prototype,tN=eN.toString;ii=nN,rN=/[\\^$.*+?()[\]{}|]/g,iN=/^\[object .+?Constructor\]$/,oN=Function.prototype,aN=Object.prototype,sN=oN.toString,dN=aN.hasOwnProperty,uN=RegExp("^"+sN.call(dN).replace(rN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");cN=lN;fN=pN;oi=mN,hN=oi(Object,"create"),Na=hN;yN=gN;vN=_N,bN="__lodash_hash_undefined__",wN=Object.prototype,SN=wN.hasOwnProperty;xN=kN,CN=Object.prototype,TN=CN.hasOwnProperty;PN=IN,EN="__lodash_hash_undefined__";ON=RN;ho.prototype.clear=yN;ho.prototype.delete=vN;ho.prototype.get=xN;ho.prototype.has=PN;ho.prototype.set=ON;Bv=ho;$N=AN;hs=MN;ll=jN,NN=Array.prototype,qN=NN.splice;LN=DN;FN=UN;BN=zN;JN=KN;go.prototype.clear=$N;go.prototype.delete=LN;go.prototype.get=FN;go.prototype.has=BN;go.prototype.set=JN;cl=go,WN=oi(Bn,"Map"),qa=WN;GN=HN;ZN=VN;pl=QN;XN=YN;tq=eq;rq=nq;oq=iq;yo.prototype.clear=GN;yo.prototype.delete=XN;yo.prototype.get=tq;yo.prototype.has=rq;yo.prototype.set=oq;fl=yo,aq="Expected a function";_m.Cache=fl;vt=_m,_o=vt(()=>(process.env.CLAUDE_CONFIG_DIR??dq(sq(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR),iae=vt(()=>kt(process.env.CLAUDE_CODE_SUPERVISED));ik=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return ik=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^n()&15>>+i/4).toString(16))};Up=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},me=class extends Error{},Rt=class e extends me{constructor(t,n,i,r,o){super(`${e.makeMessage(t,n,i)}`),this.status=t,this.headers=r,this.requestID=r?.get("request-id"),this.error=n,this.type=o??null}static makeMessage(t,n,i){let r=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):i;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,n,i,r){if(!t||!r)return new Ji({message:i,cause:Up(n)});let o=n,a=o?.error?.type;return t===400?new Ld(t,o,i,r,a):t===401?new Ud(t,o,i,r,a):t===403?new Fd(t,o,i,r,a):t===404?new zd(t,o,i,r,a):t===409?new Bd(t,o,i,r,a):t===422?new Kd(t,o,i,r,a):t===429?new Jd(t,o,i,r,a):t>=500?new Wd(t,o,i,r,a):new e(t,o,i,r,a)}},Qt=class extends Rt{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}},Ji=class extends Rt{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}},Dd=class extends Ji{constructor({message:t}={}){super({message:t??"Request timed out."})}},Ld=class extends Rt{},Ud=class extends Rt{},Fd=class extends Rt{},zd=class extends Rt{},Bd=class extends Rt{},Kd=class extends Rt{},Jd=class extends Rt{},Wd=class extends Rt{},uq=/^[a-z][a-z0-9+.-]*:/i,lq=e=>uq.test(e),Fp=e=>(Fp=Array.isArray,Fp(e)),Kv=Fp;pq=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new me(`${e} must be an integer`);if(t<0)throw new me(`${e} must be a positive integer`);return t},ok=e=>{try{return JSON.parse(e)}catch{return}},fq=e=>new Promise(t=>setTimeout(t,e)),yr="0.94.0",mq=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";gq=()=>{let e=hq();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":Hv(Deno.build.os),"X-Stainless-Arch":Wv(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":Hv(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Wv(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=yq();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};Wv=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",Hv=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),vm=()=>Gv??(Gv=gq());bq=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});Sq="urn:ietf:params:oauth:grant-type:jwt-bearer",kq="refresh_token",dk="/v1/oauth/token",Hd="oauth-2025-04-20",xq="oidc-federation-2026-04-01",Cq=120,wm=30,Tq=5,Vv=1048576;rp=2e3,Iq=new Set(["error","error_description","error_uri"]);Fe=class extends me{constructor(t,n=null,i=null,r=null){super(t),this.statusCode=n,this.body=i,this.requestId=r}};Bp=class{constructor(t,n){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=t,this.onAdvisoryRefreshError=n}async getToken(){let t=this.nextForce;this.nextForce=!1;let n=this.cached;if(t||n==null)return(await this.refresh(t)).token;if(n.expiresAt==null)return n.token;let i=n.expiresAt-Wr();return i>Cq?n.token:i>wm?(this.backgroundRefresh(),n.token):(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(t=!1){return this.pendingRefresh&&!t?this.pendingRefresh:this.doRefresh(t)}backgroundRefresh(){this.pendingRefresh||Wr()-this.lastAdvisoryError<Tq||this.doRefresh().catch(t=>{this.lastAdvisoryError=Wr(),this.onAdvisoryRefreshError?.(t)})}doRefresh(t=!1){return this.pendingRefresh=this.provider(t?{forceRefresh:!0}:void 0).then(n=>(this.cached=n,this.pendingRefresh=null,n),n=>{throw this.pendingRefresh=null,n}),this.pendingRefresh}},Ue=e=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0};Gd={off:0,error:200,warn:300,info:400,debug:500},Xv=(e,t,n)=>{if(e){if(cq(Gd,e))return e;gt(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Gd))}`)}};Rq={error:va,warn:va,info:va,debug:va},eb=new WeakMap;zr=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),fk="1.0",Oq=/^[A-Za-z0-9_.-]+$/;Aq=async e=>{var t,n;let i=await km();if(i===null)return null;let r=e??await hk();if(r===null)return null;mk(r);let o=await import("node:fs"),a=(await import("node:path")).join(i,"configs",`${r}.json`),s;try{s=await o.promises.readFile(a,"utf-8")}catch(l){if(l?.code!=="ENOENT")throw Error(`failed to read config file ${a}: ${l}`);s=null}if(s===null){let l=Ue("ANTHROPIC_ORGANIZATION_ID"),p=Ue("ANTHROPIC_IDENTITY_TOKEN_FILE"),m=Ue("ANTHROPIC_FEDERATION_RULE_ID");return m&&l?{fromFile:!1,config:{organization_id:l,workspace_id:Ue("ANTHROPIC_WORKSPACE_ID"),base_url:Ue("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:m,service_account_id:Ue("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:p?{source:"file",path:p}:void 0,scope:Ue("ANTHROPIC_SCOPE")}}}:null}let d;try{d=JSON.parse(s)}catch(l){throw Error(`failed to parse config file ${a}: ${l}`)}if(!d.authentication)throw Error(`config file ${a} is missing "authentication"`);let u=d.authentication.type;if(u!=="oidc_federation"&&u!=="user_oauth")throw Error(`authentication.type "${u}" is not a known authentication type`);if(d.organization_id??(d.organization_id=Ue("ANTHROPIC_ORGANIZATION_ID")),d.workspace_id??(d.workspace_id=Ue("ANTHROPIC_WORKSPACE_ID")),d.base_url??(d.base_url=Ue("ANTHROPIC_BASE_URL")),(t=d.authentication).scope??(t.scope=Ue("ANTHROPIC_SCOPE")),d.authentication.type==="oidc_federation"){if(!d.authentication.identity_token){let l=Ue("ANTHROPIC_IDENTITY_TOKEN_FILE");l&&(d.authentication.identity_token={source:"file",path:l})}d.authentication.federation_rule_id||(d.authentication.federation_rule_id=Ue("ANTHROPIC_FEDERATION_RULE_ID")??""),(n=d.authentication).service_account_id??(n.service_account_id=Ue("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:d,fromFile:!0}},$q=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await km();if(!n)return null;let i=t??await hk();return i?(mk(i),(await import("node:path")).join(n,"credentials",`${i}.json`)):null},km=async()=>{if(!Mq())return null;let e=await import("node:path"),t=Ue("ANTHROPIC_CONFIG_DIR");if(t)return t;if(vm()["X-Stainless-OS"]==="Windows"){let r=Ue("APPDATA");if(r)return e.join(r,"Anthropic");let o=Ue("USERPROFILE");return o?e.join(o,"AppData","Roaming","Anthropic"):null}let n=Ue("XDG_CONFIG_HOME");if(n)return e.join(n,"anthropic");let i=Ue("HOME");return i?e.join(i,".config","anthropic"):null},Mq=()=>{let e=vm()["X-Stainless-Runtime"];return e==="node"||e==="deno"},hk=async()=>{let e=await km();if(!e)return null;let t=Ue("ANTHROPIC_PROFILE");if(t)return t;let n=await import("node:fs"),i=(await import("node:path")).join(e,"active_config");try{return(await n.promises.readFile(i,"utf-8")).trim()||"default"}catch(r){if(r?.code!=="ENOENT")throw Error(`failed to read ${i}: ${r}`);return"default"}};Vr=class{constructor(){Wt.set(this,void 0),Ht.set(this,void 0),ie(this,Wt,new Uint8Array,"f"),ie(this,Ht,null,"f")}decode(t){if(t==null)return[];let n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?Sm(t):t;ie(this,Wt,Eq([q(this,Wt,"f"),n]),"f");let i=[],r;for(;(r=zq(q(this,Wt,"f"),q(this,Ht,"f")))!=null;){if(r.carriage&&q(this,Ht,"f")==null){ie(this,Ht,r.index,"f");continue}if(q(this,Ht,"f")!=null&&(r.index!==q(this,Ht,"f")+1||r.carriage)){i.push(Yv(q(this,Wt,"f").subarray(0,q(this,Ht,"f")-1))),ie(this,Wt,q(this,Wt,"f").subarray(q(this,Ht,"f")),"f"),ie(this,Ht,null,"f");continue}let o=q(this,Ht,"f")!==null?r.preceding-1:r.preceding,a=Yv(q(this,Wt,"f").subarray(0,o));i.push(a),ie(this,Wt,q(this,Wt,"f").subarray(r.index),"f"),ie(this,Ht,null,"f")}return i}flush(){return q(this,Wt,"f").length?this.decode(`
|
|
44
44
|
`):[]}};Wt=new WeakMap,Ht=new WeakMap;Vr.NEWLINE_CHARS=new Set([`
|
|
45
45
|
`,"\r"]);Vr.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Zr=class e{constructor(t,n,i){this.iterator=t,Yo.set(this,void 0),this.controller=n,ie(this,Yo,i,"f")}static fromSSEResponse(t,n,i){let r=!1,o=i?gt(i):console;async function*a(){if(r)throw new me("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let s=!1;try{for await(let d of Kq(t,n)){if(d.event==="completion")try{yield JSON.parse(d.data)}catch(u){throw o.error("Could not parse message into JSON:",d.data),o.error("From chunk:",d.raw),u}if(d.event==="message_start"||d.event==="message_delta"||d.event==="message_stop"||d.event==="content_block_start"||d.event==="content_block_delta"||d.event==="content_block_stop"||d.event==="message"||d.event==="user.message"||d.event==="user.interrupt"||d.event==="user.tool_confirmation"||d.event==="user.custom_tool_result"||d.event==="agent.message"||d.event==="agent.thinking"||d.event==="agent.tool_use"||d.event==="agent.tool_result"||d.event==="agent.mcp_tool_use"||d.event==="agent.mcp_tool_result"||d.event==="agent.custom_tool_use"||d.event==="agent.thread_context_compacted"||d.event==="session.status_running"||d.event==="session.status_idle"||d.event==="session.status_rescheduled"||d.event==="session.status_terminated"||d.event==="session.error"||d.event==="session.deleted"||d.event==="span.model_request_start"||d.event==="span.model_request_end")try{yield JSON.parse(d.data)}catch(u){throw o.error("Could not parse message into JSON:",d.data),o.error("From chunk:",d.raw),u}if(d.event!=="ping"&&d.event==="error"){let u=ok(d.data)??d.data,l=u?.error?.type;throw new Rt(void 0,u,void 0,t.headers,l)}}s=!0}catch(d){if(Da(d))return;throw d}finally{s||n.abort()}}return new e(a,n,i)}static fromReadableStream(t,n,i){let r=!1;async function*o(){let s=new Vr,d=bm(t);for await(let u of d)for(let l of s.decode(u))yield l;for(let u of s.flush())yield u}async function*a(){if(r)throw new me("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let s=!1;try{for await(let d of o())s||d&&(yield JSON.parse(d));s=!0}catch(d){if(Da(d))return;throw d}finally{s||n.abort()}}return new e(a,n,i)}[(Yo=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],i=this.iterator(),r=o=>({next:()=>{if(o.length===0){let a=i.next();t.push(a),n.push(a)}return o.shift()}});return[new e(()=>r(t),this.controller,q(this,Yo,"f")),new e(()=>r(n),this.controller,q(this,Yo,"f"))]}toReadableStream(){let t=this,n;return ak({async start(){n=t[Symbol.asyncIterator]()},async pull(i){try{let{value:r,done:o}=await n.next();if(o)return i.close();let a=Sm(JSON.stringify(r)+`
|
|
46
46
|
`);i.enqueue(a)}catch(r){i.error(r)}},async cancel(){await n.return?.()}})}};Kp=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
@@ -80,12 +80,12 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
80
80
|
|
|
81
81
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
82
82
|
`);this.baseURL=o.baseURL,this._baseURLIsExplicit=r.__baseURLIsExplicit??!!t,this.timeout=o.timeout??Cm.DEFAULT_TIMEOUT,this.logger=o.logger??console;let a="warn";this.logLevel=a,this.logLevel=Xv(o.logLevel,"ClientOptions.logLevel",this)??Xv(Ue("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??_q(),ie(this,Ad,bq,"f");let s=Ue("ANTHROPIC_CUSTOM_HEADERS");if(s){let u={};for(let l of s.split(`
|
|
83
|
-
`)){let p=l.indexOf(":");p>=0&&(u[l.substring(0,p).trim()]=l.substring(p+1).trim())}o.defaultHeaders={...u,...o.defaultHeaders}}let d=r.__auth;if(delete o.__auth,delete o.__baseURLIsExplicit,this._options=o,this.apiKey=typeof n=="string"?n:null,this.authToken=i,d)this._authState=d,!this._baseURLIsExplicit&&d.baseURL&&(this.baseURL=d.baseURL);else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let u=o.credentials??null;if(u)this._authState.provider=u,this._authState.tokenCache=this._makeTokenCache(u);else if(o.config!=null){let l=gk(o.config,this._credentialResolverOptions());this._authState.provider=l.provider,this._authState.tokenCache=this._makeTokenCache(l.provider),this._authState.extraHeaders=l.extraHeaders,this._applyCredentialBaseURL(l.baseURL)}else o.profile!=null?this._authState.resolution=this._resolveDefaultCredentials(o.profile):this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(t){if(!t)return;let n=t.replace(/\/+$/,"");this._authState.baseURL=n,!this._baseURLIsExplicit&&(this.baseURL=n)}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:t=>{gt(this).debug("credential cache write failed (best-effort)",t)},onSafetyWarning:t=>{gt(this).warn(t)}}}_makeTokenCache(t){return new Bp(t,n=>{gt(this).debug("advisory token refresh failed; serving cached token",n)})}withOptions(t){let n="credentials"in t||"config"in t||"profile"in t,i="apiKey"in t||"authToken"in t||n,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...n?{credentials:void 0,config:void 0,profile:void 0}:{},...t,__auth:i?void 0:this._authState,__baseURLIsExplicit:"baseURL"in t?!0:this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(t){try{let n=await Dq(this._credentialResolverOptions(),t);if(n)this._authState.provider=n.provider,this._authState.tokenCache=this._makeTokenCache(n.provider),this._authState.extraHeaders=n.extraHeaders,this._applyCredentialBaseURL(n.baseURL);else if(t!=null)throw new me(`Profile "${t}" could not be resolved (no <config_dir>/configs/${t}.json found).`)}catch(n){this._authState.error=n}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:n}){if(!(t.get("x-api-key")||t.get("authorization"))){if(this._authState.error)throw this._authState.error;if(!(this._authState.tokenCache||this._authState.resolution)&&!(this.apiKey&&t.get("x-api-key"))&&!n.has("x-api-key")&&!(this.authToken&&t.get("authorization"))&&!n.has("authorization"))throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}}_authFlags(t){let n=this._requestAuthFlags.get(t);return n||(n={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(t,n)),n}async authHeaders(t){if(this._authState.resolution&&await this._authState.resolution,!this._authState.error){if(this._authState.tokenCache&&this.apiKey==null){let n=await this._authState.tokenCache.getToken();return this._authFlags(t).usedTokenCache=!0,H([{Authorization:`Bearer ${n}`}])}return H([await this.apiKeyAuth(t),await this.bearerAuth(t)])}}async apiKeyAuth(t){if(this.apiKey!=null)return H([{"X-Api-Key":this.apiKey}])}async bearerAuth(t){if(this.authToken!=null)return H([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(t){return wq(t)}getUserAgent(){return`${this.constructor.name}/JS ${yr}`}defaultIdempotencyKey(){return`stainless-node-retry-${ik()}`}makeStatusError(t,n,i,r){return Rt.generate(t,n,i,r)}buildURL(t,n,i){let r=!q(this,Qp,"m",Ak).call(this)&&i||this.baseURL,o=lq(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),a=this.defaultQuery(),s=Object.fromEntries(o.searchParams);return(!Jv(a)||!Jv(s))&&(n={...s,...a,...n}),typeof n=="object"&&n&&!Array.isArray(n)&&(o.search=this.stringifyQuery(n)),o.toString()}_calculateNonstreamingTimeout(t){if(3600*t/128e3>600)throw new me("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 6e5}async prepareOptions(t){}async prepareRequest(t,{url:n,options:i}){if(this._authState.tokenCache&&this.apiKey==null){let r=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(let[o,a]of Object.entries(this._authState.extraHeaders))r.has(o)||r.set(o,a);r.get("anthropic-beta")?.split(",").map(o=>o.trim())?.includes(Hd)||r.append("anthropic-beta",Hd),t.headers=r}}get(t,n){return this.methodRequest("get",t,n)}post(t,n){return this.methodRequest("post",t,n)}patch(t,n){return this.methodRequest("patch",t,n)}put(t,n){return this.methodRequest("put",t,n)}delete(t,n){return this.methodRequest("delete",t,n)}methodRequest(t,n,i){return this.request(Promise.resolve(i).then(r=>({method:t,path:n,...r})))}request(t,n=null){return new Vd(this,this.makeRequest(t,n,void 0))}async makeRequest(t,n,i){let r=await t,o=r.maxRetries??this.maxRetries;n==null&&(n=o,this._requestAuthFlags.delete(r)),await this.prepareOptions(r);let{req:a,url:s,timeout:d}=await this.buildRequest(r,{retryCount:o-n});await this.prepareRequest(a,{url:s,options:r});let u="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),l=i===void 0?"":`, retryOf: ${i}`,p=Date.now();if(gt(this).debug(`[${u}] sending request`,zr({retryOfRequestLogID:i,method:r.method,url:s,options:r,headers:a.headers})),r.signal?.aborted)throw new Qt;let m=new AbortController,f=await this.fetchWithTimeout(s,a,d,m).catch(Up),h=Date.now();if(f instanceof globalThis.Error){let g=`retrying, ${n} attempts remaining`;if(r.signal?.aborted)throw new Qt;let v=Da(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):""));if(n)return gt(this).info(`[${u}] connection ${v?"timed out":"failed"} - ${g}`),gt(this).debug(`[${u}] connection ${v?"timed out":"failed"} (${g})`,zr({retryOfRequestLogID:i,url:s,durationMs:h-p,message:f.message})),this.retryRequest(r,n,i??u);throw gt(this).info(`[${u}] connection ${v?"timed out":"failed"} - error; no more retries left`),gt(this).debug(`[${u}] connection ${v?"timed out":"failed"} (error; no more retries left)`,zr({retryOfRequestLogID:i,url:s,durationMs:h-p,message:f.message})),v?new Dd:new Ji({cause:f})}let y=[...f.headers.entries()].filter(([g])=>g==="request-id").map(([g,v])=>", "+g+": "+JSON.stringify(v)).join(""),w=`[${u}${l}${y}] ${a.method} ${s} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${h-p}ms`;if(!f.ok){let g=await this.shouldRetry(f,r);if(n&&g){let C=`retrying, ${n} attempts remaining`;return await vq(f.body),gt(this).info(`${w} - ${C}`),gt(this).debug(`[${u}] response error (${C})`,zr({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:h-p})),this.retryRequest(r,n,i??u,f.headers)}let v=g?"error; no more retries left":"error; not retryable";gt(this).info(`${w} - ${v}`);let b=await f.text().catch(C=>Up(C).message),S=ok(b),T=S?void 0:b;throw gt(this).debug(`[${u}] response error (${v})`,zr({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,message:T,durationMs:Date.now()-p})),this.makeStatusError(f.status,S,T,f.headers)}return gt(this).info(w),gt(this).debug(`[${u}] response start`,zr({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:h-p})),{response:f,options:r,controller:m,requestLogID:u,retryOfRequestLogID:i,startTime:p}}getAPIList(t,n,i){return this.requestAPIList(n,i&&"then"in i?i.then(r=>({method:"get",path:t,...r})):{method:"get",path:t,...i})}requestAPIList(t,n){let i=this.makeRequest(n,null,void 0);return new Jp(this,i,t)}async fetchWithTimeout(t,n,i,r){let{signal:o,method:a,...s}=n||{},d=this._makeAbort(r);o&&o.addEventListener("abort",d,{once:!0});let u=setTimeout(d,i),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,p={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(p.method=a.toUpperCase());try{return await this.fetch.call(void 0,t,p)}finally{clearTimeout(u)}}async shouldRetry(t,n){let i=this._authFlags(n);if(t.status===401&&this._authState.tokenCache&&i.usedTokenCache&&!i.didRefreshFor401)return i.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,n,i,r){let o,a=r?.get("retry-after-ms");if(a){let d=parseFloat(a);Number.isNaN(d)||(o=d)}let s=r?.get("retry-after");if(s&&!o){let d=parseFloat(s);Number.isNaN(d)?o=Date.parse(s)-Date.now():o=d*1e3}if(o===void 0){let d=t.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(n,d)}return await fq(o),this.makeRequest(t,n-1,i)}calculateDefaultRetryTimeoutMillis(t,n){let i=n-t,r=Math.min(.5*Math.pow(2,i),8),o=1-Math.random()*.25;return r*o*1e3}calculateNonstreamingTimeout(t,n){if(36e5*t/128e3>6e5||n!=null&&t>n)throw new me("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(t,{retryCount:n=0}={}){let i={...t},{method:r,path:o,query:a,defaultBaseURL:s}=i;this._authState.resolution&&await this._authState.resolution,!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL&&(this.baseURL=this._authState.baseURL);let d=this.buildURL(o,a,s);"timeout"in i&&pq("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:i}),p=await this.buildHeaders({options:t,method:r,bodyHeaders:u,retryCount:n});return{req:{method:r,headers:p,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...i.fetchOptions??{}},url:d,timeout:i.timeout}}async buildHeaders({options:t,method:n,bodyHeaders:i,retryCount:r}){let o={};this.idempotencyHeader&&n!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=t.idempotencyKey);let a=H([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{},...vm(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(t),this._options.defaultHeaders,i,t.headers]);return this.validateHeaders(a),a.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:n}}){if(!t)return{bodyHeaders:void 0,body:void 0};let i=H([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&i.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:sk(t)}:typeof t=="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:q(this,Ad,"f").call(this,{body:t,headers:i})}};Cm=it,Ad=new WeakMap,Qp=new WeakSet,Ak=function(){return this.baseURL!=="https://api.anthropic.com"};it.Anthropic=Cm;it.HUMAN_PROMPT=fD;it.AI_PROMPT=mD;it.DEFAULT_TIMEOUT=6e5;it.AnthropicError=me;it.APIError=Rt;it.APIConnectionError=Ji;it.APIConnectionTimeoutError=Dd;it.APIUserAbortError=Qt;it.NotFoundError=zd;it.ConflictError=Bd;it.RateLimitError=Jd;it.BadRequestError=Ld;it.AuthenticationError=Ud;it.InternalServerError=Wd;it.PermissionDeniedError=Fd;it.UnprocessableEntityError=Kd;it.toFile=Yq;Gi=class extends it{constructor(){super(...arguments),this.completions=new pu(this),this.messages=new za(this),this.models=new mu(this),this.beta=new Nt(this)}};Gi.Completions=pu;Gi.Messages=za;Gi.Models=mu;Gi.Beta=Nt;In=class extends Error{telemetryMessage;constructor(t,n){super(t),this.name="TelemetrySafeError",this.telemetryMessage=n??t}},hD=(e,t)=>e!==null&&typeof e=="object"&&!("telemetryMessage"in e)?Object.assign(e,{telemetryMessage:t}):e;ED=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),RD=new Set(["EPERM","EBUSY","EACCES"]),OD=4,AD=50,lae=new Int32Array(new SharedArrayBuffer(4));jD=new Set(["ENOSPC","EIO","EDQUOT","EFBIG"]);Yp=class{read(t){return Sb(t,"utf8")}readBytes(t){return Sb(t)}write(t,n,i){return fp(t,n,{encoding:"utf8",mode:i})}async mkdir(t){try{await wD(t,{recursive:!0})}catch(n){if(Pt(n)!=="EEXIST")throw n}}atomicWrite(t,n,i){return ND(t,n,i)}delete(t){return kD(t)}list(t){return wb(t)}append(t,n,i){return vD(t,n,{encoding:"utf8",mode:i})}writeExclusive(t,n,i){return fp(t,n,{encoding:"utf8",flag:"wx",mode:i})}writeBytes(t,n){return fp(t,n)}copy(t,n){return bD(t,n)}async stat(t){return{mtimeMs:(await SD(t)).mtimeMs}}async listEntries(t){return(await wb(t,{withFileTypes:!0})).map(n=>({name:n.name,isDirectory:n.isDirectory(),isFile:n.isFile()}))}async readRange(t,n,i){hp("readRange","offset",n),hp("readRange","length",i);let r=await bb(t,"r");try{return await kb(r,n,i)}finally{await r.close()}}async readTail(t,n){hp("readTail","maxBytes",n);let i=await bb(t,"r");try{let{size:r}=await i.stat(),o=Math.min(n,r);return await kb(i,r-o,o)}finally{await i.close()}}};qD=new _D;Ti=null;UD=LD;zD=FD;KD=BD;WD=JD,HD=200;VD=GD;bo.prototype.clear=UD;bo.prototype.delete=zD;bo.prototype.get=KD;bo.prototype.has=WD;bo.prototype.set=VD;Ra=bo,ZD=(function(){try{var e=oi(Object,"defineProperty");return e({},"",{}),e}catch{}})(),gu=ZD;Tm=QD,YD=Object.prototype,XD=YD.hasOwnProperty;jk=eL;nL=tL;iL=rL;kr=oL,aL="[object Arguments]";xb=sL,Nk=Object.prototype,dL=Nk.hasOwnProperty,uL=Nk.propertyIsEnumerable,lL=xb((function(){return arguments})())?xb:function(e){return kr(e)&&dL.call(e,"callee")&&!uL.call(e,"callee")},Ba=lL,cL=Array.isArray,mn=cL,wa={};zn(wa,{default:()=>Ka});fL=pL,qk=typeof wa=="object"&&wa&&!wa.nodeType&&wa,Cb=qk&&typeof wd=="object"&&wd&&!wd.nodeType&&wd,mL=Cb&&Cb.exports===qk,Tb=mL?Bn.Buffer:void 0,hL=Tb?Tb.isBuffer:void 0,gL=hL||fL,Ka=gL,yL=9007199254740991,_L=/^(?:0|[1-9]\d*)$/;hl=vL,bL=9007199254740991;Im=wL,SL="[object Arguments]",kL="[object Array]",xL="[object Boolean]",CL="[object Date]",TL="[object Error]",IL="[object Function]",PL="[object Map]",EL="[object Number]",RL="[object Object]",OL="[object RegExp]",AL="[object Set]",$L="[object String]",ML="[object WeakMap]",jL="[object ArrayBuffer]",NL="[object DataView]",qL="[object Float32Array]",DL="[object Float64Array]",LL="[object Int8Array]",UL="[object Int16Array]",FL="[object Int32Array]",zL="[object Uint8Array]",BL="[object Uint8ClampedArray]",KL="[object Uint16Array]",JL="[object Uint32Array]",We={};We[qL]=We[DL]=We[LL]=We[UL]=We[FL]=We[zL]=We[BL]=We[KL]=We[JL]=!0;We[SL]=We[kL]=We[jL]=We[xL]=We[NL]=We[CL]=We[TL]=We[IL]=We[PL]=We[EL]=We[RL]=We[OL]=We[AL]=We[$L]=We[ML]=!1;HL=WL;VL=GL,Sa={};zn(Sa,{default:()=>Xp});Dk=typeof Sa=="object"&&Sa&&!Sa.nodeType&&Sa,Oa=Dk&&typeof Ed=="object"&&Ed&&!Ed.nodeType&&Ed,ZL=Oa&&Oa.exports===Dk,gp=ZL&&nk.process,QL=(function(){try{var e=Oa&&Oa.require&&Oa.require("util").types;return e||gp&&gp.binding&&gp.binding("util")}catch{}})(),Xp=QL,Ib=Xp&&Xp.isTypedArray,YL=Ib?VL(Ib):HL,Pm=YL,XL=Object.prototype,eU=XL.hasOwnProperty;Lk=tU,nU=Object.prototype;Em=rU;Uk=iU,oU=Uk(Object.keys,Object),aU=oU,sU=Object.prototype,dU=sU.hasOwnProperty;lU=uU;gl=cU;Fk=pU;mU=fU,hU=Object.prototype,gU=hU.hasOwnProperty;_U=yU;Rm=vU,ka={};zn(ka,{default:()=>Bk});zk=typeof ka=="object"&&ka&&!ka.nodeType&&ka,Pb=zk&&typeof Od=="object"&&Od&&!Od.nodeType&&Od,bU=Pb&&Pb.exports===zk,Eb=bU?Bn.Buffer:void 0,Rb=Eb?Eb.allocUnsafe:void 0;Bk=wU;kU=SU;CU=xU;Kk=TU,IU=Object.prototype,PU=IU.propertyIsEnumerable,Ob=Object.getOwnPropertySymbols,EU=Ob?function(e){return e==null?[]:(e=Object(e),CU(Ob(e),function(t){return PU.call(e,t)}))}:Kk,Jk=EU;Om=RU,OU=Uk(Object.getPrototypeOf,Object),Am=OU,AU=Object.getOwnPropertySymbols,$U=AU?function(e){for(var t=[];e;)Om(t,Jk(e)),e=Am(e);return t}:Kk,MU=$U;Wk=jU;Ab=NU;DU=qU,LU=oi(Bn,"DataView"),ef=LU,UU=oi(Bn,"Promise"),tf=UU,FU=oi(Bn,"Set"),nf=FU,zU=oi(Bn,"WeakMap"),rf=zU,$b="[object Map]",BU="[object Object]",Mb="[object Promise]",jb="[object Set]",Nb="[object WeakMap]",qb="[object DataView]",KU=ii(ef),JU=ii(qa),WU=ii(tf),HU=ii(nf),GU=ii(rf),Br=ri;(ef&&Br(new ef(new ArrayBuffer(1)))!=qb||qa&&Br(new qa)!=$b||tf&&Br(tf.resolve())!=Mb||nf&&Br(new nf)!=jb||rf&&Br(new rf)!=Nb)&&(Br=function(e){var t=ri(e),n=t==BU?e.constructor:void 0,i=n?ii(n):"";if(i)switch(i){case KU:return qb;case JU:return $b;case WU:return Mb;case HU:return jb;case GU:return Nb}return t});Db=Br,VU=Bn.Uint8Array,yu=VU;QU=ZU;XU=YU,Lb=Object.create,eF=(function(){function e(){}return function(t){if(!Ln(t))return{};if(Lb)return Lb(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})(),tF=eF;rF=nF,iF="__lodash_hash_undefined__";aF=oF;dF=sF;_u.prototype.add=_u.prototype.push=aF;_u.prototype.has=dF;uF=_u;cF=lF;fF=pF,mF=1,hF=2;Hk=gF;_F=yF;bF=vF,wF=1,SF=2,kF="[object Boolean]",xF="[object Date]",CF="[object Error]",TF="[object Map]",IF="[object Number]",PF="[object RegExp]",EF="[object Set]",RF="[object String]",OF="[object Symbol]",AF="[object ArrayBuffer]",$F="[object DataView]",Fb=Dn?Dn.prototype:void 0,yp=Fb?Fb.valueOf:void 0;jF=MF,NF=1,qF=Object.prototype,DF=qF.hasOwnProperty;UF=LF,FF=1,zb="[object Arguments]",Bb="[object Array]",vd="[object Object]",zF=Object.prototype,Kb=zF.hasOwnProperty;KF=BF;Vk=Gk,JF=1,WF=2;GF=HF;Zk=VF;QF=ZF;Qk=YF;ez=XF,tz="[object Symbol]";$m=nz,rz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iz=/^\w*$/;Mm=oz,az=500;dz=sz,uz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lz=/\\(\\)?/g,cz=dz(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(uz,function(n,i,r,o){t.push(r?o.replace(lz,"$1"):i||n)}),t}),pz=cz;Yk=fz,mz=1/0,Jb=Dn?Dn.prototype:void 0,Wb=Jb?Jb.toString:void 0;hz=Xk;yz=gz;yl=_z,vz=1/0;ys=bz;jm=wz;kz=Sz;Cz=xz;Iz=Tz;ex=Pz,Ez=1,Rz=2;Az=Oz;Nm=$z;jz=Mz;qz=Nz;Lz=Dz;tx=Uz,nx="[\\w-]{1,63}",gae=new RegExp(`^${nx}$`),yae=new RegExp(`^a(?:${nx}-)?[0-9a-f]{16}$`);Kz="3ab19d7e-9f35-45c2-926e-75e271cc60b3";qm=null;vu=new Map;Dm=new Map;a2={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};d2=s2(),u2=()=>{};l2=ms(),_ae=l2.subscribe;c2=ms(),vae=c2.subscribe,p2=ms(),bae=p2.subscribe,f2=ms(),wae=f2.subscribe,m2=ms(),Sae=m2.subscribe;bu=class{#r=new Set;register(t){let n=b2(t);this.#r.add(n);let i=()=>{this.#r.delete(n)};return Object.assign(i,{[Symbol.dispose]:i})}async drain(){let t=Array.from(this.#r);this.#r.clear(),await Promise.all(t.map(async n=>n()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#r.size}},w2=new bu;Cae=new bu,S2=vt(e=>{if(!e||e.trim()==="")return null;let t=e.split(",").map(o=>o.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(o=>o.startsWith("!")),i=t.some(o=>!o.startsWith("!"));if(n&&i)return null;let r=t.map(o=>o.replace(/^!/,"").toLowerCase());return{include:n?[]:r,exclude:n?r:[],isExclusive:n}});bd="\u2192";z2={cwd(){return process.cwd()},existsSync(e){let t=[];try{let r=Xe(t,tt`fs.existsSync(${e})`,0);return _e.existsSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},async stat(e){return D2(e)},async lstat(e){return R2(e)},async readdir(e){return A2(e,{withFileTypes:!0})},async unlink(e){return U2(e)},async rmdir(e){return N2(e)},async rm(e,t){return q2(e,t)},async mkdir(e,t){try{await O2(e,{recursive:!0,...t})}catch(n){if(Pt(n)!=="EEXIST")throw n}},async readFile(e,t){return Qb(e,{encoding:t.encoding})},async rename(e,t){return j2(e,t)},async realpath(e){return Ki(await M2(e))},async readlink(e){return $2(e)},async copyFile(e,t){return P2(e,t)},async appendFile(e,t,n){if(n?.mode!==void 0)try{let i=await Zb(e,"ax",n.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(Pt(i)!=="EEXIST")throw i}return T2(e,t)},async symlink(e,t,n){return L2(e,t,n)},async link(e,t){return E2(e,t)},async chmod(e,t){return I2(e,t)},statSync(e){let t=[];try{let r=Xe(t,tt`fs.statSync(${e})`,0);return _e.statSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},lstatSync(e){let t=[];try{let r=Xe(t,tt`fs.lstatSync(${e})`,0);return _e.lstatSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},readFileSync(e,t){let n=[];try{let o=Xe(n,tt`fs.readFileSync(${e})`,0);return _e.readFileSync(e,{encoding:t.encoding})}catch(o){var i=o,r=1}finally{et(n,i,r)}},readFileBytesSync(e){let t=[];try{let r=Xe(t,tt`fs.readFileBytesSync(${e})`,0);return _e.readFileSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},readSync(e,t){let n=[];try{let o=Xe(n,tt`fs.readSync(${e}, ${t.length} bytes)`,0),a;try{a=_e.openSync(e,"r");let s=Buffer.alloc(t.length),d=_e.readSync(a,s,0,t.length,0);return{buffer:s,bytesRead:d}}finally{a&&_e.closeSync(a)}}catch(o){var i=o,r=1}finally{et(n,i,r)}},appendFileSync(e,t,n){let i=[];try{let a=Xe(i,tt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(n?.mode!==void 0)try{let s=_e.openSync(e,"ax",n.mode);try{_e.appendFileSync(s,t)}finally{_e.closeSync(s)}return}catch(s){if(Pt(s)!=="EEXIST")throw s}_e.appendFileSync(e,t)}catch(a){var r=a,o=1}finally{et(i,r,o)}},copyFileSync(e,t){let n=[];try{let o=Xe(n,tt`fs.copyFileSync(${e} ${bd} ${t})`,0);_e.copyFileSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},unlinkSync(e){let t=[];try{let r=Xe(t,tt`fs.unlinkSync(${e})`,0);_e.unlinkSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},renameSync(e,t){let n=[];try{let o=Xe(n,tt`fs.renameSync(${e} ${bd} ${t})`,0);_e.renameSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},linkSync(e,t){let n=[];try{let o=Xe(n,tt`fs.linkSync(${e} ${bd} ${t})`,0);_e.linkSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},symlinkSync(e,t,n){let i=[];try{let a=Xe(i,tt`fs.symlinkSync(${e} ${bd} ${t})`,0);_e.symlinkSync(e,t,n)}catch(a){var r=a,o=1}finally{et(i,r,o)}},readlinkSync(e){let t=[];try{let r=Xe(t,tt`fs.readlinkSync(${e})`,0);return _e.readlinkSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},realpathSync(e){let t=[];try{let r=Xe(t,tt`fs.realpathSync(${e})`,0);return Ki(_e.realpathSync(e))}catch(r){var n=r,i=1}finally{et(t,n,i)}},mkdirSync(e,t){let n=[];try{let o=Xe(n,tt`fs.mkdirSync(${e})`,0),a={recursive:!0};t?.mode!==void 0&&(a.mode=t.mode);try{_e.mkdirSync(e,a)}catch(s){if(Pt(s)!=="EEXIST")throw s}}catch(o){var i=o,r=1}finally{et(n,i,r)}},readdirSync(e){let t=[];try{let r=Xe(t,tt`fs.readdirSync(${e})`,0);return _e.readdirSync(e,{withFileTypes:!0})}catch(r){var n=r,i=1}finally{et(t,n,i)}},readdirStringSync(e){let t=[];try{let r=Xe(t,tt`fs.readdirStringSync(${e})`,0);return _e.readdirSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},isDirEmptySync(e){let t=[];try{let r=Xe(t,tt`fs.isDirEmptySync(${e})`,0);return this.readdirSync(e).length===0}catch(r){var n=r,i=1}finally{et(t,n,i)}},rmdirSync(e){let t=[];try{let r=Xe(t,tt`fs.rmdirSync(${e})`,0);_e.rmdirSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},rmSync(e,t){let n=[];try{let o=Xe(n,tt`fs.rmSync(${e})`,0);_e.rmSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},createWriteStream(e){return _e.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return Qb(e);let n=await Zb(e,"r");try{let{size:i}=await n.stat(),r=Math.min(i,t),o=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:s}=await n.read(o,a,r-a,a);if(s===0)break;a+=s}return a<r?o.subarray(0,a):o}finally{await n.close()}}},B2=z2;G2=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,Yb=typeof String.prototype.isWellFormed=="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,Iae=typeof String.prototype.toWellFormed=="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;Q2=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,Xb="[^\\s,;&}\\])]+",ax="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",Y2=`[^\\s-]{0,4}${ax}['"\`]?`,ew=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${Xb})|${Y2}|${Xb}`,X2=["sk","ant","api"].join("-"),e4=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${Q2.source})[\\w.-]*["']?\\s*[=:]\\s*(${ew})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${ew})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${X2}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:ax,flags:"i",confidence:"high"}],tw=null;df={verbose:0,debug:1,info:2,warn:3,error:4},r4=vt(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(df,e)?e:"debug"}),i4=!1;sx=vt(()=>{let e=_l();return i4||kt(process.env.DEBUG)||kt(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||dx()||e.some(t=>t.startsWith("--debug="))||ux()!==null}),o4=vt(()=>{let e=_l().find(n=>n.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return S2(t)}),dx=vt(()=>{let e=_l();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),ux=vt(()=>{let e=_l();for(let t=0;t<e.length;t++){let n=e[t];if(n.startsWith("--debug-file="))return nw(n.substring(13));if(n==="--debug-file"&&t+1<e.length)return nw(e[t+1])}return null});s4=!1,d4=10485760,fa=null,_p=Promise.resolve(),Ai=[],xa=null,rw=null,ma=-1,vp=!1,uf=null;f4=vt(async()=>{try{let e=lf(),t=sf(e),n=Um(t,"latest");await af(n).catch(()=>{}),await y2(e,n)}catch{}}),Pae=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),m4={[Symbol.dispose](){}};tt=h4;An=(e,t)=>{let n=[];try{let o=Xe(n,tt`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}};v4=2e3,wu=new Set,iw=!1;cf=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;forwardedAbort=Dp();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(t){this.options=t,this.abortController=t.abortController||Dp(),t.deferSpawn?(this.spawnPromise=new Promise((n,i)=>{this.spawnResolve=n,this.spawnReject=i}),this.spawnPromise.catch(()=>{})):this.initialize()}spawn(){try{this.initialize()}catch(n){throw this.spawnAbort(gs(n)),n}let t=this.pendingWrites;this.pendingWrites=[],this.spawnResolve&&(this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0);for(let n of t)this.write(n);this.pendingEndInput&&(this.pendingEndInput=!1,this.processStdin?.end())}spawnAbort(t){this.spawnReject&&(this.spawnReject(t),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[])}updateEnv(t){this.options.env?Object.assign(this.options.env,t):this.options.env={...t}}updateResume(t){this.options.resume=t}getDefaultExecutable(){return tk()?"bun":"node"}spawnLocalProcess(t){let{command:n,args:i,cwd:r,env:o,signal:a}=t,s=kt(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",d=yj(n,i,{cwd:r,stdio:["pipe","pipe",s],signal:a,env:o,windowsHide:!0});return(kt(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)&&d.stderr.on("data",u=>{let l=u.toString();dn(l),this.options.stderr&&this.options.stderr(l)}),{stdin:d.stdin,stdout:d.stdout,get killed(){return d.killed},get exitCode(){return d.exitCode},kill:d.kill.bind(d),on:d.on.bind(d),once:d.once.bind(d),off:d.off.bind(d)}}initialize(){try{let{additionalDirectories:t=[],agent:n,betas:i,cwd:r,executable:o=this.getDefaultExecutable(),executableArgs:a=[],extraArgs:s={},pathToClaudeCodeExecutable:d,env:u={...process.env},thinkingConfig:l,maxTurns:p,maxBudgetUsd:m,taskBudget:f,model:h,fallbackModel:y,jsonSchema:w,permissionMode:g,allowDangerouslySkipPermissions:v,permissionPromptToolName:b,continueConversation:S,resume:T,settingSources:C,skills:_,disallowedTools:k=[],tools:I,mcpServers:P,strictMcpConfig:R,canUseTool:M,includePartialMessages:A,plugins:F,sandbox:se}=this.options,{allowedTools:he=[]}=this.options;if(_!==void 0){let x=_==="all"?["Skill"]:_.map(O=>`Skill(${O})`),E=new Set(he);he=[...he,...x.filter(O=>!E.has(O))]}let ee=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(l){switch(l.type){case"enabled":l.budgetTokens===void 0?ee.push("--thinking","adaptive"):ee.push("--max-thinking-tokens",l.budgetTokens.toString());break;case"disabled":ee.push("--thinking","disabled");break;case"adaptive":ee.push("--thinking","adaptive");break}l.type!=="disabled"&&l.display&&ee.push("--thinking-display",l.display)}if(this.options.effort&&ee.push("--effort",this.options.effort),p&&ee.push("--max-turns",p.toString()),m!==void 0&&ee.push("--max-budget-usd",m.toString()),f&&ee.push("--task-budget",f.total.toString()),h&&ee.push("--model",h),n&&ee.push("--agent",n),i&&i.length>0&&ee.push("--betas",i.join(",")),w&&ee.push("--json-schema",ut(w)),this.options.debugFile?ee.push("--debug-file",this.options.debugFile):this.options.debug&&ee.push("--debug"),!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let x=DD();x&&ee.push("--debug-file",x)}if(M){if(b)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");ee.push("--permission-prompt-tool","stdio")}else b&&ee.push("--permission-prompt-tool",b);if(S&&ee.push("--continue"),T&&ee.push("--resume",T),this.options.channels&&this.options.channels.length>0&&ee.push("--channels",...this.options.channels),he.length>0&&ee.push("--allowedTools",he.join(",")),k.length>0&&ee.push("--disallowedTools",k.join(",")),I!==void 0&&(Array.isArray(I)?I.length===0?ee.push("--tools",""):ee.push("--tools",I.join(",")):ee.push("--tools","default")),P&&Object.keys(P).length>0&&ee.push("--mcp-config",ut({mcpServers:P})),C!==void 0&&ee.push(`--setting-sources=${C.join(",")}`),R&&ee.push("--strict-mcp-config"),g&&ee.push("--permission-mode",g),v&&ee.push("--allow-dangerously-skip-permissions"),y){if(h&&y===h)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");ee.push("--fallback-model",y)}this.options.includeHookEvents&&ee.push("--include-hook-events"),A&&ee.push("--include-partial-messages"),this.options.sessionMirror&&ee.push("--session-mirror");for(let x of t)ee.push("--add-dir",x);if(F&&F.length>0)for(let x of F)if(x.type==="local")ee.push(x.skipMcpDiscovery?"--plugin-dir-no-mcp":"--plugin-dir",x.path);else throw Error(`Unsupported plugin type: ${x.type}`);this.options.forkSession&&ee.push("--fork-session"),this.options.resumeSessionAt&&ee.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&ee.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&ee.push("--no-session-persistence"),this.options.managedSettings&&ee.push("--managed-settings",this.options.managedSettings);let $e={...s??{}};this.options.settings&&($e.settings=this.options.settings);let be=_4($e,se);for(let[x,E]of Object.entries(be))E===null?ee.push(`--${x}`):ee.push(`--${x}`,E);u.CLAUDE_CODE_ENTRYPOINT||(u.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete u.NODE_OPTIONS,kt(u.DEBUG_CLAUDE_AGENT_SDK)?u.DEBUG="1":delete u.DEBUG;let G=S4(d),$=G?d:o,B=G?[...a,...ee]:[...a,d,...ee],L={command:$,args:B,cwd:r,env:u,signal:this.forwardedAbort.signal};this.options.spawnClaudeCodeProcess?(dn(`Spawning Claude Code (custom): ${$} ${B.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(L)):(dn(`Spawning Claude Code: ${$} ${B.join(" ")}`),this.process=this.spawnLocalProcess(L)),this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,w4(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted&&this.close(),this.process.on("error",x=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Mt("Claude Code process aborted by user");else if(gD(x)){let E=k4(d,G);this.exitError=ReferenceError(E),dn(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${x.message}`),dn(this.exitError.message)}),this.process.on("exit",(x,E)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Mt("Claude Code process aborted by user");else{let O=this.getProcessExitError(x,E);O&&(this.exitError=O,dn(O.message))}}),this.ready=!this.abortController.signal.aborted}catch(t){throw this.ready=!1,t}}getProcessExitError(t,n){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);if(n)return Error(`Claude Code process terminated by signal ${n}`)}write(t){if(this.abortController.signal.aborted)throw new Mt("Operation aborted");if(this.spawnResolve){this.pendingWrites.push(t);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){dn("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);dn(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{this.processStdin.write(t)||dn("[ProcessTransport] Write buffer full, data queued")}catch(n){throw this.ready=!1,Error(`Failed to write to process stdin: ${$d(n)}`)}}[Symbol.dispose](){this.close()}close(){this.spawnAbort(this.abortController.signal.aborted?new Mt("Claude Code process aborted by user"):Error("Query closed before spawn")),this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:i}of this.exitListeners)this.process?.off("exit",i);this.exitListeners=[];let t=()=>{this.abortController.signal.aborted&&this.forwardedAbort.abort(this.abortController.signal.reason)},n=this.process;n&&!n.killed&&n.exitCode===null?(setTimeout((i,r)=>{if(i.exitCode!==null){r();return}if(process.platform==="win32"){setTimeout((o,a)=>{o.exitCode===null&&o.kill("SIGKILL"),a()},5e3,i,r).unref();return}i.kill("SIGTERM"),setTimeout(o=>{o.exitCode===null&&o.kill("SIGKILL")},5e3,i).unref(),r()},v4,n,t).unref(),n.once("exit",()=>wu.delete(n))):n&&(wu.delete(n),t()),this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise&&(await this.spawnPromise,this.spawnPromise=void 0),!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let t=vj({input:this.processStdout}),n=this.process?(()=>{let i=this.process,r=()=>t.close();return i.on("error",r),()=>i.off("error",r)})():void 0;this.exitError&&t.close();try{for await(let i of t)if(i.trim()){let r;try{r=An(i)}catch{dn(`Non-JSON stdout: ${i}`);continue}yield r}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(i){throw i}finally{n?.(),t.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let n=(i,r)=>{let o=this.getProcessExitError(i,r);t(o)};return this.process.on("exit",n),this.exitListeners.push({callback:t,handler:n}),()=>{this.process&&this.process.off("exit",n);let i=this.exitListeners.findIndex(r=>r.handler===n);i!==-1&&this.exitListeners.splice(i,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((t,n)=>{let i=(o,a)=>{if(this.abortController.signal.aborted){n(new Mt("Operation aborted"));return}let s=this.getProcessExitError(o,a);s?n(s):t()};this.process.once("exit",i);let r=o=>{this.process.off("exit",i),n(o)};this.process.once("error",r),this.process.once("exit",()=>{this.process.off("error",r)})})}};Ii="@anthropic-ai/claude-agent-sdk";Su=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((t,n)=>{this.readResolve=t,this.readReject=n})}enqueue(t){if(this.readResolve){let n=this.readResolve;this.readResolve=void 0,this.readReject=void 0,n({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let n=this.readReject;this.readResolve=void 0,this.readReject=void 0,n(t)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}};P4=I4();pf=class{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},bp=Symbol("suppressControlResponse"),ff=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new Su;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(t){this.isSingleUserTurn=t}setTranscriptMirrorBatcher(t){this.transcriptMirrorBatcher=t}reportMirrorError(t,n){let i={type:"system",subtype:"mirror_error",error:n,key:t,uuid:of(),session_id:t.sessionId};this.inputStream.enqueue(i)}addCleanupCallback(t){this.cleanupPerformed?t():this.cleanupCallbacks.push(t)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(t,n,i,r,o,a=new Map,s,d,u,l,p,m){this.transport=t,this.isSingleUserTurn=n,this.canUseTool=i,this.hooks=r,this.abortController=o,this.jsonSchema=s,this.initConfig=d,this.onElicitation=u,this.getOAuthToken=l,this.getHostAuthToken=p,this.onUserDialog=m;for(let[f,h]of a)this.connectSdkMcpServer(f,h);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}async stopTask(t){await this.request({subtype:"stop_task",task_id:t})}async backgroundTasks(t){return(await this.request({subtype:"background_tasks",tool_use_id:t})).response.backgrounded??!0}close(){this.cleanup()}cleanup(t){return this.cleanupPromise?this.cleanupPromise:(this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(t),this.cleanupPromise)}async performCleanup(t){for(let n of this.cleanupCallbacks)try{n()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let i of this.cancelControllers.values())i.abort();this.cancelControllers.clear(),this.transport.close();let n=t??Error("Query closed before response received");for(let{reject:i}of this.pendingControlResponses.values())i(n);this.pendingControlResponses.clear();for(let{reject:i}of this.pendingMcpResponses.values())i(n);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let i of this.sdkMcpTransports.values())i.close().catch(()=>{});this.sdkMcpTransports.clear(),t?this.inputStream.error(t):this.inputStream.done()}catch{}if(this.transport.waitForExit){let n=new AbortController;try{await Promise.race([this.transport.waitForExit(),dl(2e3,n.signal)])}catch{}finally{n.abort()}}}next(...[t]){return this.sdkMessages.next(t)}async return(t){return await this.cleanup(),this.sdkMessages.return(t)}async throw(t){return await this.cleanup(),this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let n=this.pendingControlResponses.get(t.response.request_id);n&&n.handler(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else{if(t.type==="keep_alive")continue;if(t.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(t.filePath,t.entries);continue}}if(t.type==="system"&&(t.subtype==="post_turn_summary"||t.subtype==="task_summary")){this.inputStream.enqueue(t);continue}if(t.type==="active_goal"){this.inputStream.enqueue(t);continue}t.type==="result"?(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.lastErrorResultText=t.is_error?t.subtype==="success"?t.result:t.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(Ne("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())):t.type==="system"&&t.subtype==="session_state_changed"||(this.lastErrorResultText=void 0),this.inputStream.enqueue(t)}this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(t){if(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.lastErrorResultText!==void 0&&!(t instanceof Mt)){let n=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Ne(`[Query.readMessages] Replacing exit error with result text. Original: ${$d(t)}`),this.inputStream.error(n),this.cleanup(n);return}this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){if(this.cancelControllers.has(t.request_id)){Ne(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${t.request_id} (${t.request.subtype}) \u2014 skipping`);return}let n=new AbortController;this.cancelControllers.set(t.request_id,n);try{let i=await this.processControlRequest(t,n.signal);if(this.cleanupPerformed||i===bp)return;let r={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:i}};await Promise.resolve(this.transport.write(ut(r)+`
|
|
83
|
+
`)){let p=l.indexOf(":");p>=0&&(u[l.substring(0,p).trim()]=l.substring(p+1).trim())}o.defaultHeaders={...u,...o.defaultHeaders}}let d=r.__auth;if(delete o.__auth,delete o.__baseURLIsExplicit,this._options=o,this.apiKey=typeof n=="string"?n:null,this.authToken=i,d)this._authState=d,!this._baseURLIsExplicit&&d.baseURL&&(this.baseURL=d.baseURL);else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let u=o.credentials??null;if(u)this._authState.provider=u,this._authState.tokenCache=this._makeTokenCache(u);else if(o.config!=null){let l=gk(o.config,this._credentialResolverOptions());this._authState.provider=l.provider,this._authState.tokenCache=this._makeTokenCache(l.provider),this._authState.extraHeaders=l.extraHeaders,this._applyCredentialBaseURL(l.baseURL)}else o.profile!=null?this._authState.resolution=this._resolveDefaultCredentials(o.profile):this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(t){if(!t)return;let n=t.replace(/\/+$/,"");this._authState.baseURL=n,!this._baseURLIsExplicit&&(this.baseURL=n)}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:t=>{gt(this).debug("credential cache write failed (best-effort)",t)},onSafetyWarning:t=>{gt(this).warn(t)}}}_makeTokenCache(t){return new Bp(t,n=>{gt(this).debug("advisory token refresh failed; serving cached token",n)})}withOptions(t){let n="credentials"in t||"config"in t||"profile"in t,i="apiKey"in t||"authToken"in t||n,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...n?{credentials:void 0,config:void 0,profile:void 0}:{},...t,__auth:i?void 0:this._authState,__baseURLIsExplicit:"baseURL"in t?!0:this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(t){try{let n=await Dq(this._credentialResolverOptions(),t);if(n)this._authState.provider=n.provider,this._authState.tokenCache=this._makeTokenCache(n.provider),this._authState.extraHeaders=n.extraHeaders,this._applyCredentialBaseURL(n.baseURL);else if(t!=null)throw new me(`Profile "${t}" could not be resolved (no <config_dir>/configs/${t}.json found).`)}catch(n){this._authState.error=n}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:n}){if(!(t.get("x-api-key")||t.get("authorization"))){if(this._authState.error)throw this._authState.error;if(!(this._authState.tokenCache||this._authState.resolution)&&!(this.apiKey&&t.get("x-api-key"))&&!n.has("x-api-key")&&!(this.authToken&&t.get("authorization"))&&!n.has("authorization"))throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}}_authFlags(t){let n=this._requestAuthFlags.get(t);return n||(n={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(t,n)),n}async authHeaders(t){if(this._authState.resolution&&await this._authState.resolution,!this._authState.error){if(this._authState.tokenCache&&this.apiKey==null){let n=await this._authState.tokenCache.getToken();return this._authFlags(t).usedTokenCache=!0,H([{Authorization:`Bearer ${n}`}])}return H([await this.apiKeyAuth(t),await this.bearerAuth(t)])}}async apiKeyAuth(t){if(this.apiKey!=null)return H([{"X-Api-Key":this.apiKey}])}async bearerAuth(t){if(this.authToken!=null)return H([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(t){return wq(t)}getUserAgent(){return`${this.constructor.name}/JS ${yr}`}defaultIdempotencyKey(){return`stainless-node-retry-${ik()}`}makeStatusError(t,n,i,r){return Rt.generate(t,n,i,r)}buildURL(t,n,i){let r=!q(this,Qp,"m",Ak).call(this)&&i||this.baseURL,o=lq(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),a=this.defaultQuery(),s=Object.fromEntries(o.searchParams);return(!Jv(a)||!Jv(s))&&(n={...s,...a,...n}),typeof n=="object"&&n&&!Array.isArray(n)&&(o.search=this.stringifyQuery(n)),o.toString()}_calculateNonstreamingTimeout(t){if(3600*t/128e3>600)throw new me("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 6e5}async prepareOptions(t){}async prepareRequest(t,{url:n,options:i}){if(this._authState.tokenCache&&this.apiKey==null){let r=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(let[o,a]of Object.entries(this._authState.extraHeaders))r.has(o)||r.set(o,a);r.get("anthropic-beta")?.split(",").map(o=>o.trim())?.includes(Hd)||r.append("anthropic-beta",Hd),t.headers=r}}get(t,n){return this.methodRequest("get",t,n)}post(t,n){return this.methodRequest("post",t,n)}patch(t,n){return this.methodRequest("patch",t,n)}put(t,n){return this.methodRequest("put",t,n)}delete(t,n){return this.methodRequest("delete",t,n)}methodRequest(t,n,i){return this.request(Promise.resolve(i).then(r=>({method:t,path:n,...r})))}request(t,n=null){return new Vd(this,this.makeRequest(t,n,void 0))}async makeRequest(t,n,i){let r=await t,o=r.maxRetries??this.maxRetries;n==null&&(n=o,this._requestAuthFlags.delete(r)),await this.prepareOptions(r);let{req:a,url:s,timeout:d}=await this.buildRequest(r,{retryCount:o-n});await this.prepareRequest(a,{url:s,options:r});let u="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),l=i===void 0?"":`, retryOf: ${i}`,p=Date.now();if(gt(this).debug(`[${u}] sending request`,zr({retryOfRequestLogID:i,method:r.method,url:s,options:r,headers:a.headers})),r.signal?.aborted)throw new Qt;let m=new AbortController,f=await this.fetchWithTimeout(s,a,d,m).catch(Up),h=Date.now();if(f instanceof globalThis.Error){let g=`retrying, ${n} attempts remaining`;if(r.signal?.aborted)throw new Qt;let v=Da(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):""));if(n)return gt(this).info(`[${u}] connection ${v?"timed out":"failed"} - ${g}`),gt(this).debug(`[${u}] connection ${v?"timed out":"failed"} (${g})`,zr({retryOfRequestLogID:i,url:s,durationMs:h-p,message:f.message})),this.retryRequest(r,n,i??u);throw gt(this).info(`[${u}] connection ${v?"timed out":"failed"} - error; no more retries left`),gt(this).debug(`[${u}] connection ${v?"timed out":"failed"} (error; no more retries left)`,zr({retryOfRequestLogID:i,url:s,durationMs:h-p,message:f.message})),v?new Dd:new Ji({cause:f})}let y=[...f.headers.entries()].filter(([g])=>g==="request-id").map(([g,v])=>", "+g+": "+JSON.stringify(v)).join(""),w=`[${u}${l}${y}] ${a.method} ${s} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${h-p}ms`;if(!f.ok){let g=await this.shouldRetry(f,r);if(n&&g){let C=`retrying, ${n} attempts remaining`;return await vq(f.body),gt(this).info(`${w} - ${C}`),gt(this).debug(`[${u}] response error (${C})`,zr({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:h-p})),this.retryRequest(r,n,i??u,f.headers)}let v=g?"error; no more retries left":"error; not retryable";gt(this).info(`${w} - ${v}`);let b=await f.text().catch(C=>Up(C).message),S=ok(b),T=S?void 0:b;throw gt(this).debug(`[${u}] response error (${v})`,zr({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,message:T,durationMs:Date.now()-p})),this.makeStatusError(f.status,S,T,f.headers)}return gt(this).info(w),gt(this).debug(`[${u}] response start`,zr({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:h-p})),{response:f,options:r,controller:m,requestLogID:u,retryOfRequestLogID:i,startTime:p}}getAPIList(t,n,i){return this.requestAPIList(n,i&&"then"in i?i.then(r=>({method:"get",path:t,...r})):{method:"get",path:t,...i})}requestAPIList(t,n){let i=this.makeRequest(n,null,void 0);return new Jp(this,i,t)}async fetchWithTimeout(t,n,i,r){let{signal:o,method:a,...s}=n||{},d=this._makeAbort(r);o&&o.addEventListener("abort",d,{once:!0});let u=setTimeout(d,i),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,p={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(p.method=a.toUpperCase());try{return await this.fetch.call(void 0,t,p)}finally{clearTimeout(u)}}async shouldRetry(t,n){let i=this._authFlags(n);if(t.status===401&&this._authState.tokenCache&&i.usedTokenCache&&!i.didRefreshFor401)return i.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,n,i,r){let o,a=r?.get("retry-after-ms");if(a){let d=parseFloat(a);Number.isNaN(d)||(o=d)}let s=r?.get("retry-after");if(s&&!o){let d=parseFloat(s);Number.isNaN(d)?o=Date.parse(s)-Date.now():o=d*1e3}if(o===void 0){let d=t.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(n,d)}return await fq(o),this.makeRequest(t,n-1,i)}calculateDefaultRetryTimeoutMillis(t,n){let i=n-t,r=Math.min(.5*Math.pow(2,i),8),o=1-Math.random()*.25;return r*o*1e3}calculateNonstreamingTimeout(t,n){if(36e5*t/128e3>6e5||n!=null&&t>n)throw new me("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(t,{retryCount:n=0}={}){let i={...t},{method:r,path:o,query:a,defaultBaseURL:s}=i;this._authState.resolution&&await this._authState.resolution,!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL&&(this.baseURL=this._authState.baseURL);let d=this.buildURL(o,a,s);"timeout"in i&&pq("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let{bodyHeaders:u,body:l}=this.buildBody({options:i}),p=await this.buildHeaders({options:t,method:r,bodyHeaders:u,retryCount:n});return{req:{method:r,headers:p,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...i.fetchOptions??{}},url:d,timeout:i.timeout}}async buildHeaders({options:t,method:n,bodyHeaders:i,retryCount:r}){let o={};this.idempotencyHeader&&n!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=t.idempotencyKey);let a=H([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{},...vm(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(t),this._options.defaultHeaders,i,t.headers]);return this.validateHeaders(a),a.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:n}}){if(!t)return{bodyHeaders:void 0,body:void 0};let i=H([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&i.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:sk(t)}:typeof t=="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:q(this,Ad,"f").call(this,{body:t,headers:i})}};Cm=it,Ad=new WeakMap,Qp=new WeakSet,Ak=function(){return this.baseURL!=="https://api.anthropic.com"};it.Anthropic=Cm;it.HUMAN_PROMPT=fD;it.AI_PROMPT=mD;it.DEFAULT_TIMEOUT=6e5;it.AnthropicError=me;it.APIError=Rt;it.APIConnectionError=Ji;it.APIConnectionTimeoutError=Dd;it.APIUserAbortError=Qt;it.NotFoundError=zd;it.ConflictError=Bd;it.RateLimitError=Jd;it.BadRequestError=Ld;it.AuthenticationError=Ud;it.InternalServerError=Wd;it.PermissionDeniedError=Fd;it.UnprocessableEntityError=Kd;it.toFile=Yq;Gi=class extends it{constructor(){super(...arguments),this.completions=new pu(this),this.messages=new za(this),this.models=new mu(this),this.beta=new Nt(this)}};Gi.Completions=pu;Gi.Messages=za;Gi.Models=mu;Gi.Beta=Nt;In=class extends Error{telemetryMessage;constructor(t,n){super(t),this.name="TelemetrySafeError",this.telemetryMessage=n??t}},hD=(e,t)=>e!==null&&typeof e=="object"&&!("telemetryMessage"in e)?Object.assign(e,{telemetryMessage:t}):e;ED=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),RD=new Set(["EPERM","EBUSY","EACCES"]),OD=4,AD=50,cae=new Int32Array(new SharedArrayBuffer(4));jD=new Set(["ENOSPC","EIO","EDQUOT","EFBIG"]);Yp=class{read(t){return Sb(t,"utf8")}readBytes(t){return Sb(t)}write(t,n,i){return fp(t,n,{encoding:"utf8",mode:i})}async mkdir(t){try{await wD(t,{recursive:!0})}catch(n){if(Pt(n)!=="EEXIST")throw n}}atomicWrite(t,n,i){return ND(t,n,i)}delete(t){return kD(t)}list(t){return wb(t)}append(t,n,i){return vD(t,n,{encoding:"utf8",mode:i})}writeExclusive(t,n,i){return fp(t,n,{encoding:"utf8",flag:"wx",mode:i})}writeBytes(t,n){return fp(t,n)}copy(t,n){return bD(t,n)}async stat(t){return{mtimeMs:(await SD(t)).mtimeMs}}async listEntries(t){return(await wb(t,{withFileTypes:!0})).map(n=>({name:n.name,isDirectory:n.isDirectory(),isFile:n.isFile()}))}async readRange(t,n,i){hp("readRange","offset",n),hp("readRange","length",i);let r=await bb(t,"r");try{return await kb(r,n,i)}finally{await r.close()}}async readTail(t,n){hp("readTail","maxBytes",n);let i=await bb(t,"r");try{let{size:r}=await i.stat(),o=Math.min(n,r);return await kb(i,r-o,o)}finally{await i.close()}}};qD=new _D;Ti=null;UD=LD;zD=FD;KD=BD;WD=JD,HD=200;VD=GD;bo.prototype.clear=UD;bo.prototype.delete=zD;bo.prototype.get=KD;bo.prototype.has=WD;bo.prototype.set=VD;Ra=bo,ZD=(function(){try{var e=oi(Object,"defineProperty");return e({},"",{}),e}catch{}})(),gu=ZD;Tm=QD,YD=Object.prototype,XD=YD.hasOwnProperty;jk=eL;nL=tL;iL=rL;kr=oL,aL="[object Arguments]";xb=sL,Nk=Object.prototype,dL=Nk.hasOwnProperty,uL=Nk.propertyIsEnumerable,lL=xb((function(){return arguments})())?xb:function(e){return kr(e)&&dL.call(e,"callee")&&!uL.call(e,"callee")},Ba=lL,cL=Array.isArray,mn=cL,wa={};zn(wa,{default:()=>Ka});fL=pL,qk=typeof wa=="object"&&wa&&!wa.nodeType&&wa,Cb=qk&&typeof wd=="object"&&wd&&!wd.nodeType&&wd,mL=Cb&&Cb.exports===qk,Tb=mL?Bn.Buffer:void 0,hL=Tb?Tb.isBuffer:void 0,gL=hL||fL,Ka=gL,yL=9007199254740991,_L=/^(?:0|[1-9]\d*)$/;hl=vL,bL=9007199254740991;Im=wL,SL="[object Arguments]",kL="[object Array]",xL="[object Boolean]",CL="[object Date]",TL="[object Error]",IL="[object Function]",PL="[object Map]",EL="[object Number]",RL="[object Object]",OL="[object RegExp]",AL="[object Set]",$L="[object String]",ML="[object WeakMap]",jL="[object ArrayBuffer]",NL="[object DataView]",qL="[object Float32Array]",DL="[object Float64Array]",LL="[object Int8Array]",UL="[object Int16Array]",FL="[object Int32Array]",zL="[object Uint8Array]",BL="[object Uint8ClampedArray]",KL="[object Uint16Array]",JL="[object Uint32Array]",We={};We[qL]=We[DL]=We[LL]=We[UL]=We[FL]=We[zL]=We[BL]=We[KL]=We[JL]=!0;We[SL]=We[kL]=We[jL]=We[xL]=We[NL]=We[CL]=We[TL]=We[IL]=We[PL]=We[EL]=We[RL]=We[OL]=We[AL]=We[$L]=We[ML]=!1;HL=WL;VL=GL,Sa={};zn(Sa,{default:()=>Xp});Dk=typeof Sa=="object"&&Sa&&!Sa.nodeType&&Sa,Oa=Dk&&typeof Ed=="object"&&Ed&&!Ed.nodeType&&Ed,ZL=Oa&&Oa.exports===Dk,gp=ZL&&nk.process,QL=(function(){try{var e=Oa&&Oa.require&&Oa.require("util").types;return e||gp&&gp.binding&&gp.binding("util")}catch{}})(),Xp=QL,Ib=Xp&&Xp.isTypedArray,YL=Ib?VL(Ib):HL,Pm=YL,XL=Object.prototype,eU=XL.hasOwnProperty;Lk=tU,nU=Object.prototype;Em=rU;Uk=iU,oU=Uk(Object.keys,Object),aU=oU,sU=Object.prototype,dU=sU.hasOwnProperty;lU=uU;gl=cU;Fk=pU;mU=fU,hU=Object.prototype,gU=hU.hasOwnProperty;_U=yU;Rm=vU,ka={};zn(ka,{default:()=>Bk});zk=typeof ka=="object"&&ka&&!ka.nodeType&&ka,Pb=zk&&typeof Od=="object"&&Od&&!Od.nodeType&&Od,bU=Pb&&Pb.exports===zk,Eb=bU?Bn.Buffer:void 0,Rb=Eb?Eb.allocUnsafe:void 0;Bk=wU;kU=SU;CU=xU;Kk=TU,IU=Object.prototype,PU=IU.propertyIsEnumerable,Ob=Object.getOwnPropertySymbols,EU=Ob?function(e){return e==null?[]:(e=Object(e),CU(Ob(e),function(t){return PU.call(e,t)}))}:Kk,Jk=EU;Om=RU,OU=Uk(Object.getPrototypeOf,Object),Am=OU,AU=Object.getOwnPropertySymbols,$U=AU?function(e){for(var t=[];e;)Om(t,Jk(e)),e=Am(e);return t}:Kk,MU=$U;Wk=jU;Ab=NU;DU=qU,LU=oi(Bn,"DataView"),ef=LU,UU=oi(Bn,"Promise"),tf=UU,FU=oi(Bn,"Set"),nf=FU,zU=oi(Bn,"WeakMap"),rf=zU,$b="[object Map]",BU="[object Object]",Mb="[object Promise]",jb="[object Set]",Nb="[object WeakMap]",qb="[object DataView]",KU=ii(ef),JU=ii(qa),WU=ii(tf),HU=ii(nf),GU=ii(rf),Br=ri;(ef&&Br(new ef(new ArrayBuffer(1)))!=qb||qa&&Br(new qa)!=$b||tf&&Br(tf.resolve())!=Mb||nf&&Br(new nf)!=jb||rf&&Br(new rf)!=Nb)&&(Br=function(e){var t=ri(e),n=t==BU?e.constructor:void 0,i=n?ii(n):"";if(i)switch(i){case KU:return qb;case JU:return $b;case WU:return Mb;case HU:return jb;case GU:return Nb}return t});Db=Br,VU=Bn.Uint8Array,yu=VU;QU=ZU;XU=YU,Lb=Object.create,eF=(function(){function e(){}return function(t){if(!Ln(t))return{};if(Lb)return Lb(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})(),tF=eF;rF=nF,iF="__lodash_hash_undefined__";aF=oF;dF=sF;_u.prototype.add=_u.prototype.push=aF;_u.prototype.has=dF;uF=_u;cF=lF;fF=pF,mF=1,hF=2;Hk=gF;_F=yF;bF=vF,wF=1,SF=2,kF="[object Boolean]",xF="[object Date]",CF="[object Error]",TF="[object Map]",IF="[object Number]",PF="[object RegExp]",EF="[object Set]",RF="[object String]",OF="[object Symbol]",AF="[object ArrayBuffer]",$F="[object DataView]",Fb=Dn?Dn.prototype:void 0,yp=Fb?Fb.valueOf:void 0;jF=MF,NF=1,qF=Object.prototype,DF=qF.hasOwnProperty;UF=LF,FF=1,zb="[object Arguments]",Bb="[object Array]",vd="[object Object]",zF=Object.prototype,Kb=zF.hasOwnProperty;KF=BF;Vk=Gk,JF=1,WF=2;GF=HF;Zk=VF;QF=ZF;Qk=YF;ez=XF,tz="[object Symbol]";$m=nz,rz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iz=/^\w*$/;Mm=oz,az=500;dz=sz,uz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lz=/\\(\\)?/g,cz=dz(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(uz,function(n,i,r,o){t.push(r?o.replace(lz,"$1"):i||n)}),t}),pz=cz;Yk=fz,mz=1/0,Jb=Dn?Dn.prototype:void 0,Wb=Jb?Jb.toString:void 0;hz=Xk;yz=gz;yl=_z,vz=1/0;ys=bz;jm=wz;kz=Sz;Cz=xz;Iz=Tz;ex=Pz,Ez=1,Rz=2;Az=Oz;Nm=$z;jz=Mz;qz=Nz;Lz=Dz;tx=Uz,nx="[\\w-]{1,63}",yae=new RegExp(`^${nx}$`),_ae=new RegExp(`^a(?:${nx}-)?[0-9a-f]{16}$`);Kz="3ab19d7e-9f35-45c2-926e-75e271cc60b3";qm=null;vu=new Map;Dm=new Map;a2={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};d2=s2(),u2=()=>{};l2=ms(),vae=l2.subscribe;c2=ms(),bae=c2.subscribe,p2=ms(),wae=p2.subscribe,f2=ms(),Sae=f2.subscribe,m2=ms(),kae=m2.subscribe;bu=class{#r=new Set;register(t){let n=b2(t);this.#r.add(n);let i=()=>{this.#r.delete(n)};return Object.assign(i,{[Symbol.dispose]:i})}async drain(){let t=Array.from(this.#r);this.#r.clear(),await Promise.all(t.map(async n=>n()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#r.size}},w2=new bu;Tae=new bu,S2=vt(e=>{if(!e||e.trim()==="")return null;let t=e.split(",").map(o=>o.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(o=>o.startsWith("!")),i=t.some(o=>!o.startsWith("!"));if(n&&i)return null;let r=t.map(o=>o.replace(/^!/,"").toLowerCase());return{include:n?[]:r,exclude:n?r:[],isExclusive:n}});bd="\u2192";z2={cwd(){return process.cwd()},existsSync(e){let t=[];try{let r=Xe(t,tt`fs.existsSync(${e})`,0);return _e.existsSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},async stat(e){return D2(e)},async lstat(e){return R2(e)},async readdir(e){return A2(e,{withFileTypes:!0})},async unlink(e){return U2(e)},async rmdir(e){return N2(e)},async rm(e,t){return q2(e,t)},async mkdir(e,t){try{await O2(e,{recursive:!0,...t})}catch(n){if(Pt(n)!=="EEXIST")throw n}},async readFile(e,t){return Qb(e,{encoding:t.encoding})},async rename(e,t){return j2(e,t)},async realpath(e){return Ki(await M2(e))},async readlink(e){return $2(e)},async copyFile(e,t){return P2(e,t)},async appendFile(e,t,n){if(n?.mode!==void 0)try{let i=await Zb(e,"ax",n.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(Pt(i)!=="EEXIST")throw i}return T2(e,t)},async symlink(e,t,n){return L2(e,t,n)},async link(e,t){return E2(e,t)},async chmod(e,t){return I2(e,t)},statSync(e){let t=[];try{let r=Xe(t,tt`fs.statSync(${e})`,0);return _e.statSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},lstatSync(e){let t=[];try{let r=Xe(t,tt`fs.lstatSync(${e})`,0);return _e.lstatSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},readFileSync(e,t){let n=[];try{let o=Xe(n,tt`fs.readFileSync(${e})`,0);return _e.readFileSync(e,{encoding:t.encoding})}catch(o){var i=o,r=1}finally{et(n,i,r)}},readFileBytesSync(e){let t=[];try{let r=Xe(t,tt`fs.readFileBytesSync(${e})`,0);return _e.readFileSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},readSync(e,t){let n=[];try{let o=Xe(n,tt`fs.readSync(${e}, ${t.length} bytes)`,0),a;try{a=_e.openSync(e,"r");let s=Buffer.alloc(t.length),d=_e.readSync(a,s,0,t.length,0);return{buffer:s,bytesRead:d}}finally{a&&_e.closeSync(a)}}catch(o){var i=o,r=1}finally{et(n,i,r)}},appendFileSync(e,t,n){let i=[];try{let a=Xe(i,tt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(n?.mode!==void 0)try{let s=_e.openSync(e,"ax",n.mode);try{_e.appendFileSync(s,t)}finally{_e.closeSync(s)}return}catch(s){if(Pt(s)!=="EEXIST")throw s}_e.appendFileSync(e,t)}catch(a){var r=a,o=1}finally{et(i,r,o)}},copyFileSync(e,t){let n=[];try{let o=Xe(n,tt`fs.copyFileSync(${e} ${bd} ${t})`,0);_e.copyFileSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},unlinkSync(e){let t=[];try{let r=Xe(t,tt`fs.unlinkSync(${e})`,0);_e.unlinkSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},renameSync(e,t){let n=[];try{let o=Xe(n,tt`fs.renameSync(${e} ${bd} ${t})`,0);_e.renameSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},linkSync(e,t){let n=[];try{let o=Xe(n,tt`fs.linkSync(${e} ${bd} ${t})`,0);_e.linkSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},symlinkSync(e,t,n){let i=[];try{let a=Xe(i,tt`fs.symlinkSync(${e} ${bd} ${t})`,0);_e.symlinkSync(e,t,n)}catch(a){var r=a,o=1}finally{et(i,r,o)}},readlinkSync(e){let t=[];try{let r=Xe(t,tt`fs.readlinkSync(${e})`,0);return _e.readlinkSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},realpathSync(e){let t=[];try{let r=Xe(t,tt`fs.realpathSync(${e})`,0);return Ki(_e.realpathSync(e))}catch(r){var n=r,i=1}finally{et(t,n,i)}},mkdirSync(e,t){let n=[];try{let o=Xe(n,tt`fs.mkdirSync(${e})`,0),a={recursive:!0};t?.mode!==void 0&&(a.mode=t.mode);try{_e.mkdirSync(e,a)}catch(s){if(Pt(s)!=="EEXIST")throw s}}catch(o){var i=o,r=1}finally{et(n,i,r)}},readdirSync(e){let t=[];try{let r=Xe(t,tt`fs.readdirSync(${e})`,0);return _e.readdirSync(e,{withFileTypes:!0})}catch(r){var n=r,i=1}finally{et(t,n,i)}},readdirStringSync(e){let t=[];try{let r=Xe(t,tt`fs.readdirStringSync(${e})`,0);return _e.readdirSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},isDirEmptySync(e){let t=[];try{let r=Xe(t,tt`fs.isDirEmptySync(${e})`,0);return this.readdirSync(e).length===0}catch(r){var n=r,i=1}finally{et(t,n,i)}},rmdirSync(e){let t=[];try{let r=Xe(t,tt`fs.rmdirSync(${e})`,0);_e.rmdirSync(e)}catch(r){var n=r,i=1}finally{et(t,n,i)}},rmSync(e,t){let n=[];try{let o=Xe(n,tt`fs.rmSync(${e})`,0);_e.rmSync(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}},createWriteStream(e){return _e.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return Qb(e);let n=await Zb(e,"r");try{let{size:i}=await n.stat(),r=Math.min(i,t),o=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:s}=await n.read(o,a,r-a,a);if(s===0)break;a+=s}return a<r?o.subarray(0,a):o}finally{await n.close()}}},B2=z2;G2=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,Yb=typeof String.prototype.isWellFormed=="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,Pae=typeof String.prototype.toWellFormed=="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;Q2=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,Xb="[^\\s,;&}\\])]+",ax="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",Y2=`[^\\s-]{0,4}${ax}['"\`]?`,ew=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${Xb})|${Y2}|${Xb}`,X2=["sk","ant","api"].join("-"),e4=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${Q2.source})[\\w.-]*["']?\\s*[=:]\\s*(${ew})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${ew})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${X2}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:ax,flags:"i",confidence:"high"}],tw=null;df={verbose:0,debug:1,info:2,warn:3,error:4},r4=vt(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(df,e)?e:"debug"}),i4=!1;sx=vt(()=>{let e=_l();return i4||kt(process.env.DEBUG)||kt(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||dx()||e.some(t=>t.startsWith("--debug="))||ux()!==null}),o4=vt(()=>{let e=_l().find(n=>n.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return S2(t)}),dx=vt(()=>{let e=_l();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),ux=vt(()=>{let e=_l();for(let t=0;t<e.length;t++){let n=e[t];if(n.startsWith("--debug-file="))return nw(n.substring(13));if(n==="--debug-file"&&t+1<e.length)return nw(e[t+1])}return null});s4=!1,d4=10485760,fa=null,_p=Promise.resolve(),Ai=[],xa=null,rw=null,ma=-1,vp=!1,uf=null;f4=vt(async()=>{try{let e=lf(),t=sf(e),n=Um(t,"latest");await af(n).catch(()=>{}),await y2(e,n)}catch{}}),Eae=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),m4={[Symbol.dispose](){}};tt=h4;An=(e,t)=>{let n=[];try{let o=Xe(n,tt`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(o){var i=o,r=1}finally{et(n,i,r)}};v4=2e3,wu=new Set,iw=!1;cf=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;forwardedAbort=Dp();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(t){this.options=t,this.abortController=t.abortController||Dp(),t.deferSpawn?(this.spawnPromise=new Promise((n,i)=>{this.spawnResolve=n,this.spawnReject=i}),this.spawnPromise.catch(()=>{})):this.initialize()}spawn(){try{this.initialize()}catch(n){throw this.spawnAbort(gs(n)),n}let t=this.pendingWrites;this.pendingWrites=[],this.spawnResolve&&(this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0);for(let n of t)this.write(n);this.pendingEndInput&&(this.pendingEndInput=!1,this.processStdin?.end())}spawnAbort(t){this.spawnReject&&(this.spawnReject(t),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[])}updateEnv(t){this.options.env?Object.assign(this.options.env,t):this.options.env={...t}}updateResume(t){this.options.resume=t}getDefaultExecutable(){return tk()?"bun":"node"}spawnLocalProcess(t){let{command:n,args:i,cwd:r,env:o,signal:a}=t,s=kt(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",d=yj(n,i,{cwd:r,stdio:["pipe","pipe",s],signal:a,env:o,windowsHide:!0});return(kt(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)&&d.stderr.on("data",u=>{let l=u.toString();dn(l),this.options.stderr&&this.options.stderr(l)}),{stdin:d.stdin,stdout:d.stdout,get killed(){return d.killed},get exitCode(){return d.exitCode},kill:d.kill.bind(d),on:d.on.bind(d),once:d.once.bind(d),off:d.off.bind(d)}}initialize(){try{let{additionalDirectories:t=[],agent:n,betas:i,cwd:r,executable:o=this.getDefaultExecutable(),executableArgs:a=[],extraArgs:s={},pathToClaudeCodeExecutable:d,env:u={...process.env},thinkingConfig:l,maxTurns:p,maxBudgetUsd:m,taskBudget:f,model:h,fallbackModel:y,jsonSchema:w,permissionMode:g,allowDangerouslySkipPermissions:v,permissionPromptToolName:b,continueConversation:S,resume:T,settingSources:C,skills:_,disallowedTools:k=[],tools:I,mcpServers:P,strictMcpConfig:R,canUseTool:M,includePartialMessages:A,plugins:F,sandbox:se}=this.options,{allowedTools:he=[]}=this.options;if(_!==void 0){let x=_==="all"?["Skill"]:_.map(O=>`Skill(${O})`),E=new Set(he);he=[...he,...x.filter(O=>!E.has(O))]}let ee=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(l){switch(l.type){case"enabled":l.budgetTokens===void 0?ee.push("--thinking","adaptive"):ee.push("--max-thinking-tokens",l.budgetTokens.toString());break;case"disabled":ee.push("--thinking","disabled");break;case"adaptive":ee.push("--thinking","adaptive");break}l.type!=="disabled"&&l.display&&ee.push("--thinking-display",l.display)}if(this.options.effort&&ee.push("--effort",this.options.effort),p&&ee.push("--max-turns",p.toString()),m!==void 0&&ee.push("--max-budget-usd",m.toString()),f&&ee.push("--task-budget",f.total.toString()),h&&ee.push("--model",h),n&&ee.push("--agent",n),i&&i.length>0&&ee.push("--betas",i.join(",")),w&&ee.push("--json-schema",ut(w)),this.options.debugFile?ee.push("--debug-file",this.options.debugFile):this.options.debug&&ee.push("--debug"),!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let x=DD();x&&ee.push("--debug-file",x)}if(M){if(b)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");ee.push("--permission-prompt-tool","stdio")}else b&&ee.push("--permission-prompt-tool",b);if(S&&ee.push("--continue"),T&&ee.push("--resume",T),this.options.channels&&this.options.channels.length>0&&ee.push("--channels",...this.options.channels),he.length>0&&ee.push("--allowedTools",he.join(",")),k.length>0&&ee.push("--disallowedTools",k.join(",")),I!==void 0&&(Array.isArray(I)?I.length===0?ee.push("--tools",""):ee.push("--tools",I.join(",")):ee.push("--tools","default")),P&&Object.keys(P).length>0&&ee.push("--mcp-config",ut({mcpServers:P})),C!==void 0&&ee.push(`--setting-sources=${C.join(",")}`),R&&ee.push("--strict-mcp-config"),g&&ee.push("--permission-mode",g),v&&ee.push("--allow-dangerously-skip-permissions"),y){if(h&&y===h)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");ee.push("--fallback-model",y)}this.options.includeHookEvents&&ee.push("--include-hook-events"),A&&ee.push("--include-partial-messages"),this.options.sessionMirror&&ee.push("--session-mirror");for(let x of t)ee.push("--add-dir",x);if(F&&F.length>0)for(let x of F)if(x.type==="local")ee.push(x.skipMcpDiscovery?"--plugin-dir-no-mcp":"--plugin-dir",x.path);else throw Error(`Unsupported plugin type: ${x.type}`);this.options.forkSession&&ee.push("--fork-session"),this.options.resumeSessionAt&&ee.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&ee.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&ee.push("--no-session-persistence"),this.options.managedSettings&&ee.push("--managed-settings",this.options.managedSettings);let $e={...s??{}};this.options.settings&&($e.settings=this.options.settings);let be=_4($e,se);for(let[x,E]of Object.entries(be))E===null?ee.push(`--${x}`):ee.push(`--${x}`,E);u.CLAUDE_CODE_ENTRYPOINT||(u.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete u.NODE_OPTIONS,kt(u.DEBUG_CLAUDE_AGENT_SDK)?u.DEBUG="1":delete u.DEBUG;let G=S4(d),$=G?d:o,B=G?[...a,...ee]:[...a,d,...ee],L={command:$,args:B,cwd:r,env:u,signal:this.forwardedAbort.signal};this.options.spawnClaudeCodeProcess?(dn(`Spawning Claude Code (custom): ${$} ${B.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(L)):(dn(`Spawning Claude Code: ${$} ${B.join(" ")}`),this.process=this.spawnLocalProcess(L)),this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,w4(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted&&this.close(),this.process.on("error",x=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Mt("Claude Code process aborted by user");else if(gD(x)){let E=k4(d,G);this.exitError=ReferenceError(E),dn(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${x.message}`),dn(this.exitError.message)}),this.process.on("exit",(x,E)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Mt("Claude Code process aborted by user");else{let O=this.getProcessExitError(x,E);O&&(this.exitError=O,dn(O.message))}}),this.ready=!this.abortController.signal.aborted}catch(t){throw this.ready=!1,t}}getProcessExitError(t,n){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);if(n)return Error(`Claude Code process terminated by signal ${n}`)}write(t){if(this.abortController.signal.aborted)throw new Mt("Operation aborted");if(this.spawnResolve){this.pendingWrites.push(t);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){dn("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);dn(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{this.processStdin.write(t)||dn("[ProcessTransport] Write buffer full, data queued")}catch(n){throw this.ready=!1,Error(`Failed to write to process stdin: ${$d(n)}`)}}[Symbol.dispose](){this.close()}close(){this.spawnAbort(this.abortController.signal.aborted?new Mt("Claude Code process aborted by user"):Error("Query closed before spawn")),this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:i}of this.exitListeners)this.process?.off("exit",i);this.exitListeners=[];let t=()=>{this.abortController.signal.aborted&&this.forwardedAbort.abort(this.abortController.signal.reason)},n=this.process;n&&!n.killed&&n.exitCode===null?(setTimeout((i,r)=>{if(i.exitCode!==null){r();return}if(process.platform==="win32"){setTimeout((o,a)=>{o.exitCode===null&&o.kill("SIGKILL"),a()},5e3,i,r).unref();return}i.kill("SIGTERM"),setTimeout(o=>{o.exitCode===null&&o.kill("SIGKILL")},5e3,i).unref(),r()},v4,n,t).unref(),n.once("exit",()=>wu.delete(n))):n&&(wu.delete(n),t()),this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise&&(await this.spawnPromise,this.spawnPromise=void 0),!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let t=vj({input:this.processStdout}),n=this.process?(()=>{let i=this.process,r=()=>t.close();return i.on("error",r),()=>i.off("error",r)})():void 0;this.exitError&&t.close();try{for await(let i of t)if(i.trim()){let r;try{r=An(i)}catch{dn(`Non-JSON stdout: ${i}`);continue}yield r}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(i){throw i}finally{n?.(),t.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let n=(i,r)=>{let o=this.getProcessExitError(i,r);t(o)};return this.process.on("exit",n),this.exitListeners.push({callback:t,handler:n}),()=>{this.process&&this.process.off("exit",n);let i=this.exitListeners.findIndex(r=>r.handler===n);i!==-1&&this.exitListeners.splice(i,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((t,n)=>{let i=(o,a)=>{if(this.abortController.signal.aborted){n(new Mt("Operation aborted"));return}let s=this.getProcessExitError(o,a);s?n(s):t()};this.process.once("exit",i);let r=o=>{this.process.off("exit",i),n(o)};this.process.once("error",r),this.process.once("exit",()=>{this.process.off("error",r)})})}};Ii="@anthropic-ai/claude-agent-sdk";Su=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((t,n)=>{this.readResolve=t,this.readReject=n})}enqueue(t){if(this.readResolve){let n=this.readResolve;this.readResolve=void 0,this.readReject=void 0,n({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let n=this.readReject;this.readResolve=void 0,this.readReject=void 0,n(t)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}};P4=I4();pf=class{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},bp=Symbol("suppressControlResponse"),ff=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new Su;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(t){this.isSingleUserTurn=t}setTranscriptMirrorBatcher(t){this.transcriptMirrorBatcher=t}reportMirrorError(t,n){let i={type:"system",subtype:"mirror_error",error:n,key:t,uuid:of(),session_id:t.sessionId};this.inputStream.enqueue(i)}addCleanupCallback(t){this.cleanupPerformed?t():this.cleanupCallbacks.push(t)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(t,n,i,r,o,a=new Map,s,d,u,l,p,m){this.transport=t,this.isSingleUserTurn=n,this.canUseTool=i,this.hooks=r,this.abortController=o,this.jsonSchema=s,this.initConfig=d,this.onElicitation=u,this.getOAuthToken=l,this.getHostAuthToken=p,this.onUserDialog=m;for(let[f,h]of a)this.connectSdkMcpServer(f,h);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}async stopTask(t){await this.request({subtype:"stop_task",task_id:t})}async backgroundTasks(t){return(await this.request({subtype:"background_tasks",tool_use_id:t})).response.backgrounded??!0}close(){this.cleanup()}cleanup(t){return this.cleanupPromise?this.cleanupPromise:(this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(t),this.cleanupPromise)}async performCleanup(t){for(let n of this.cleanupCallbacks)try{n()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let i of this.cancelControllers.values())i.abort();this.cancelControllers.clear(),this.transport.close();let n=t??Error("Query closed before response received");for(let{reject:i}of this.pendingControlResponses.values())i(n);this.pendingControlResponses.clear();for(let{reject:i}of this.pendingMcpResponses.values())i(n);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let i of this.sdkMcpTransports.values())i.close().catch(()=>{});this.sdkMcpTransports.clear(),t?this.inputStream.error(t):this.inputStream.done()}catch{}if(this.transport.waitForExit){let n=new AbortController;try{await Promise.race([this.transport.waitForExit(),dl(2e3,n.signal)])}catch{}finally{n.abort()}}}next(...[t]){return this.sdkMessages.next(t)}async return(t){return await this.cleanup(),this.sdkMessages.return(t)}async throw(t){return await this.cleanup(),this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let n=this.pendingControlResponses.get(t.response.request_id);n&&n.handler(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else{if(t.type==="keep_alive")continue;if(t.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(t.filePath,t.entries);continue}}if(t.type==="system"&&(t.subtype==="post_turn_summary"||t.subtype==="task_summary")){this.inputStream.enqueue(t);continue}if(t.type==="active_goal"){this.inputStream.enqueue(t);continue}t.type==="result"?(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.lastErrorResultText=t.is_error?t.subtype==="success"?t.result:t.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(Ne("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())):t.type==="system"&&t.subtype==="session_state_changed"||(this.lastErrorResultText=void 0),this.inputStream.enqueue(t)}this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(t){if(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.lastErrorResultText!==void 0&&!(t instanceof Mt)){let n=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Ne(`[Query.readMessages] Replacing exit error with result text. Original: ${$d(t)}`),this.inputStream.error(n),this.cleanup(n);return}this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){if(this.cancelControllers.has(t.request_id)){Ne(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${t.request_id} (${t.request.subtype}) \u2014 skipping`);return}let n=new AbortController;this.cancelControllers.set(t.request_id,n);try{let i=await this.processControlRequest(t,n.signal);if(this.cleanupPerformed||i===bp)return;let r={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:i}};await Promise.resolve(this.transport.write(ut(r)+`
|
|
84
84
|
`))}catch(i){if(this.cleanupPerformed)return;let r={type:"control_response",response:{subtype:"error",request_id:t.request_id,error:$d(i)}};try{await Promise.resolve(this.transport.write(ut(r)+`
|
|
85
85
|
`))}catch(o){Ne(`[Query.handleControlRequest] Error-response write failed: ${$d(o)}`,{level:"error"})}}finally{this.cancelControllers.delete(t.request_id)}}handleControlCancelRequest(t){let n=this.cancelControllers.get(t.request_id);n&&(n.abort(),this.cancelControllers.delete(t.request_id))}async processControlRequest(t,n){if(t.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");let i=await this.canUseTool(t.request.tool_name,t.request.input,{signal:n,suggestions:t.request.permission_suggestions,blockedPath:t.request.blocked_path,decisionReason:t.request.decision_reason,title:t.request.title,displayName:t.request.display_name,description:t.request.description,toolUseID:t.request.tool_use_id,agentID:t.request.agent_id,requestId:t.request_id});return i===null?bp:{...i,toolUseID:t.request.tool_use_id}}else{if(t.request.subtype==="hook_callback")return await this.handleHookCallbacks(t.request.callback_id,t.request.input,t.request.tool_use_id,n);if(t.request.subtype==="mcp_message"){let i=t.request,r=this.sdkMcpTransports.get(i.server_name);if(!r)throw Error(`SDK MCP server not found: ${i.server_name}`);return"method"in i.message&&"id"in i.message&&i.message.id!==null?{mcp_response:await this.handleMcpControlRequest(i.server_name,i,r)}:(r.onmessage&&r.onmessage(i.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}else if(t.request.subtype==="elicitation"){let i=t.request;return this.onElicitation?await this.onElicitation({serverName:i.mcp_server_name,message:i.message,mode:i.mode,url:i.url,elicitationId:i.elicitation_id,requestedSchema:i.requested_schema,title:i.title,displayName:i.display_name,description:i.description},{signal:n}):{action:"decline"}}else{if(t.request.subtype==="request_user_dialog")return this.onUserDialog?await this.onUserDialog({dialogKind:t.request.dialog_kind,payload:t.request.payload,toolUseID:t.request.tool_use_id},{signal:n}):(Ne(`[Query] No onUserDialog handler for request_user_dialog (kind=${t.request.dialog_kind}) \u2014 staying silent so a capable client (or the worker's park deadline) settles it`),vl("tengu_request_user_dialog_response_ignored",{shape:ml("auto_cancel")}),bp);if(t.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:n})??null}}else if(t.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");return{authToken:await this.getHostAuthToken({signal:n})??null}}}}throw Error("Unsupported control request subtype: "+t.request.subtype)}async*readSdkMessages(){try{for await(let t of this.inputStream)yield t}finally{await this.cleanup()}}async initialize(){if(this.hooks&&!this.initHooksPayload){this.initHooksPayload={};for(let[i,r]of Object.entries(this.hooks))r.length>0&&(this.initHooksPayload[i]=r.map(o=>{let a=[];for(let s of o.hooks){let d=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(d,s),a.push(d)}return{matcher:o.matcher,hookCallbackIds:a,timeout:o.timeout}}))}let t=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,n={subtype:"initialize",hooks:this.initHooksPayload,sdkMcpServers:t,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt=="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds};return(await this.request(n)).response}async interrupt(){return Sn("sdk_interrupt",async()=>{await this.request({subtype:"interrupt"})})}async setPermissionMode(t){await this.request({subtype:"set_permission_mode",mode:t})}async setMcpPermissionModeOverride(t,n){return(await this.request({subtype:"set_mcp_permission_mode_override",serverName:t,mode:n})).response??{}}async setModel(t){await this.request({subtype:"set_model",model:t})}async setMaxThinkingTokens(t,n){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:t,thinking_display:n})}async applyFlagSettings(t){return Sn("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:t})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(t,n){return Sn("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:t,dry_run:n?.dryRun})).response)}async cancelAsyncMessage(t){return(await this.request({subtype:"cancel_async_message",message_uuid:t})).response.cancelled}async seedReadState(t,n){await this.request({subtype:"seed_read_state",path:t,mtime:n})}async enableRemoteControl(t,n){return(await this.request({subtype:"remote_control",enabled:t,...n!==void 0&&{name:n}})).response}async submitFeedback(t,n){return(await this.request({subtype:"submit_feedback",description:t,surface:n?.surface})).response}async generateSessionTitle(t,n){return Sn("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:t,persist:n?.persist})).response.title)}async askSideQuestion(t){return Sn("sdk_side_question",async()=>{let n=(await this.request({subtype:"side_question",question:t})).response;return n.response===null?null:{response:n.response,synthetic:n.synthetic??!1}})}async launchUltrareview(t,n){return(await this.request({subtype:"ultrareview_launch",args:t,confirm:n?.confirm??!1})).response}async messageRated(t){await this.request({subtype:"message_rated",messageUuid:t.messageUuid,sentiment:t.sentiment,surface:t.surface,cleared:t.cleared??!1})}processPendingPermissionRequests(t){for(let n of t)n.request.subtype==="can_use_tool"&&this.handleControlRequest(n).catch(()=>{})}processPendingUserDialogRequests(t){for(let n of t)n.request.subtype==="request_user_dialog"&&this.handleControlRequest(n).catch(()=>{})}request(t){let n=Math.random().toString(36).substring(2,15),i={request_id:n,type:"control_request",request:t},r=t.subtype==="initialize";return new Promise((o,a)=>{this.pendingControlResponses.set(n,{handler:s=>{this.pendingControlResponses.delete(n),s.subtype==="success"?o(s):a(Error(s.error)),!r&&(s.pending_permission_requests||s.pending_user_dialog_requests)?Ne(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${t.subtype})`):(s.pending_permission_requests&&this.processPendingPermissionRequests(s.pending_permission_requests),s.pending_user_dialog_requests&&this.processPendingUserDialogRequests(s.pending_user_dialog_requests))},reject:a}),Promise.resolve(this.transport.write(ut(i)+`
|
|
86
86
|
`)).catch(s=>{this.pendingControlResponses.delete(n),a(s)})})}initializationResult(){return this.initialization}reinitialize(){return Sn("sdk_reinitialize",()=>this.initialize())}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(t){await this.request({subtype:"mcp_reconnect",serverName:t})}async toggleMcpServer(t,n){return Sn("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:t,enabled:n})})}async enableChannel(t){return Sn("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:t})})}async mcpAuthenticate(t,n){return(await this.request({subtype:"mcp_authenticate",serverName:t,redirectUri:n})).response}async mcpClearAuth(t){return(await this.request({subtype:"mcp_clear_auth",serverName:t})).response}async mcpSubmitOAuthCallbackUrl(t,n){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:t,callbackUrl:n})).response}async claudeAuthenticate(t){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:t})).response}async claudeOAuthCallback(t,n){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:t,state:n})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(t,n){try{return(await this.request({subtype:"read_file",path:t,max_bytes:n?.maxBytes,encoding:n?.encoding})).response}catch{return null}}async reloadPlugins(){return Sn("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return Sn("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(t){return Sn("sdk_mcp_set_servers",async()=>{let n={},i={};for(let[s,d]of Object.entries(t))d.type==="sdk"&&"instance"in d?n[s]=d.instance:i[s]=d;let r=new Set(this.sdkMcpServerInstances.keys()),o=new Set(Object.keys(n));for(let s of r)o.has(s)||await this.disconnectSdkMcpServer(s);for(let[s,d]of Object.entries(n))r.has(s)||this.connectSdkMcpServer(s,d);let a={};for(let s of Object.keys(n))a[s]={type:"sdk",name:s};return(await this.request({subtype:"mcp_set_servers",servers:{...i,...a}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(t){Ne("[Query.streamInput] Starting to process input stream");try{let n=0;for await(let i of t){if(n++,Ne(`[Query.streamInput] Processing message ${n}: ${i.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(ut(i)+`
|
|
87
87
|
`))}Ne(`[Query.streamInput] Finished processing ${n} messages from input stream`),n>0&&this.hasBidirectionalNeeds()&&(Ne("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult()),Ne("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(n){if(!(n instanceof Mt))throw n}}waitForFirstResult(){return this.firstResultReceived?(Ne("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve()):new Promise(t=>{if(this.abortController?.signal.aborted){t();return}this.abortController?.signal.addEventListener("abort",()=>t(),{once:!0}),this.firstResultReceivedResolve=t})}handleHookCallbacks(t,n,i,r){let o=this.hookCallbacks.get(t);if(!o)throw Error(`No hook callback found for ID: ${t}`);return o(n,i,{signal:r})}connectSdkMcpServer(t,n){let i=new pf(r=>this.sendMcpServerMessageToCli(t,r));this.sdkMcpTransports.set(t,i),this.sdkMcpServerInstances.set(t,n),n.connect(i).catch(r=>{this.sdkMcpTransports.get(t)===i&&this.sdkMcpTransports.delete(t),this.sdkMcpServerInstances.get(t)===n&&this.sdkMcpServerInstances.delete(t),Ne(`[Query.connectSdkMcpServer] Failed to connect MCP server '${t}': ${r}`,{level:"error"})})}async disconnectSdkMcpServer(t){let n=this.sdkMcpTransports.get(t);n&&(await n.close(),this.sdkMcpTransports.delete(t)),this.sdkMcpServerInstances.delete(t)}sendMcpServerMessageToCli(t,n){if("id"in n&&n.id!==null&&n.id!==void 0){let r=`${t}:${n.id}`,o=this.pendingMcpResponses.get(r);if(o){o.resolve(n),this.pendingMcpResponses.delete(r);return}}let i={type:"control_request",request_id:of(),request:{subtype:"mcp_message",server_name:t,message:n}};Promise.resolve(this.transport.write(ut(i)+`
|
|
88
|
-
`)).catch(r=>{Ne(`[Query.sendMcpServerMessageToCli] Transport write failed: ${r}`,{level:"error"})})}handleMcpControlRequest(t,n,i){let r="id"in n.message?n.message.id:null,o=`${t}:${r}`;return new Promise((a,s)=>{let d=()=>{this.pendingMcpResponses.delete(o)},u=p=>{d(),a(p)},l=p=>{d(),s(p)};if(this.pendingMcpResponses.set(o,{resolve:u,reject:l}),i.onmessage)i.onmessage(n.message);else{d(),s(Error("No message handler registered"));return}})}},Fm=500,zm=1048576,R4=[200,800],mf=class{send;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;constructor(t,n=6e4,i,r=Fm,o=zm,a=R4){this.send=t,this.sendTimeoutMs=n,this.onError=i,this.maxPendingEntries=r,this.maxPendingBytes=o,this.backoffMs=a}enqueue(t,n){let i=ut(n).length;this.pending.push({filePath:t,entries:n,bytes:i}),this.pendingEntries+=n.length,this.pendingBytes+=i,(this.pendingEntries>this.maxPendingEntries||this.pendingBytes>this.maxPendingBytes)&&(this.flushPromise=this.drain(),this.flushPromise.catch(()=>{}))}async flush(){let t=this.drain();this.flushPromise=t,await t,this.flushPromise===t&&(this.flushPromise=null)}async drain(){let t=this.flushPromise,n=this.pending.splice(0);this.pendingEntries=0,this.pendingBytes=0,t&&await t,n.length!==0&&await this.doFlush(n)}async doFlush(t){let n=new Map;for(let r of t){let o=n.get(r.filePath);o?o.push(...r.entries):n.set(r.filePath,r.entries.slice())}let i=this.backoffMs.length+1;for(let[r,o]of n){let a=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${r}`,s,d=1;for(;d<=i;d++)try{await Jr(this.send(r,o),this.sendTimeoutMs,a),s=void 0;break}catch(u){if(s=gs(u),s.message===a)break;let l=this.backoffMs[d-1];if(l===void 0)break;await dl(l)}if(s){Ne(`[TranscriptMirrorBatcher] flush failed for ${r} after ${d} attempt(s): ${s}`,{level:"error"});try{this.onError?.(r,s)}catch(u){Ne(`[TranscriptMirrorBatcher] onError callback threw: ${u}`,{level:"error"})}}}}},ow=am(o1(),1);Pi=new Map,K4=5e3;J4=new Set([".com",".exe",".bat",".cmd"]);Z4=L4(D4);nr=65536,Y4=new Set(["sdk-cli","sdk-ts","sdk-py"]);eB=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Wa=200;aB=1048576,sB=5242880;xu=Buffer.from('{"type":"attribution-snapshot"'),lB=Buffer.from('{"type":"system"'),Ha=10,cB=Buffer.from([Ha]),pB=256;dw=524288,uw=8192;EB=32;KB=new Set(["user","assistant","attachment","system","progress"]);oK="user:inference",Ax="user:profile",aK="org:create_api_key",sK=[aK,Ax],dK=[Ax,oK,"user:sessions:claude_code","user:mcp_servers","user:file_upload"],tse=Ox([...sK,...dK]),uK=["user:design:read","user:design:write"],nse=[...uK,"user:projects:read","user:projects:write"],fw={BASE_API_URL:"https://api.anthropic.com",CONSOLE_AUTHORIZE_URL:"https://platform.claude.com/oauth/authorize",CLAUDE_AI_AUTHORIZE_URL:"https://claude.com/cai/oauth/authorize",CLAUDE_AI_ORIGIN:"https://claude.ai",TOKEN_URL:"https://platform.claude.com/v1/oauth/token",API_KEY_URL:"https://api.anthropic.com/api/oauth/claude_cli/create_api_key",ROLES_URL:"https://api.anthropic.com/api/oauth/claude_cli/roles",CONSOLE_SUCCESS_URL:"https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code",CLAUDEAI_SUCCESS_URL:"https://platform.claude.com/oauth/code/success?app=claude-code",MANUAL_REDIRECT_URL:"https://platform.claude.com/oauth/code/callback",CLIENT_ID:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",DESIGN_CLIENT_ID:"59637612-477b-4836-a601-b0589eda7704",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"},lK=void 0;pK=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];mK="-credentials";gK=/^[a-zA-Z0-9._-]+$/;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw Error()}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let a of r)o[a]=a;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of o)a[s]=r[s];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(o){return r[o]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let o=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&o.push(a);return o},e.find=(r,o)=>{for(let a of r)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Oe||(Oe={}));(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mw||(mw={}));ae=Oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hr=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}},W=Oe.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"]),pn=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},i={_errors:[]},r=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let s=i,d=0;for(;d<a.path.length;){let u=a.path[d];d!==a.path.length-1?s[u]=s[u]||{_errors:[]}:(s[u]=s[u]||{_errors:[]},s[u]._errors.push(n(a))),s=s[u],d++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},i=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];n[o]=n[o]||[],n[o].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};pn.create=e=>new pn(e);bK=(e,t)=>{let n;switch(e.code){case W.invalid_type:e.received===ae.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Oe.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Oe.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Oe.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Oe.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Oe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case W.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case W.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Oe.assertNever(e)}return{message:n}},Ga=bK,wK=Ga;bf=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],a={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let s="",d=i.filter(u=>!!u).slice().reverse();for(let u of d)s=u(a,{data:t,defaultError:s}).message;return{...r,path:o,message:s}};Ot=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return ye;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let o=await r.key,a=await r.value;i.push({key:o,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:a}=r;if(o.status==="aborted"||a.status==="aborted")return ye;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[o.value]=a.value)}return{status:t.value,value:i}}},ye=Object.freeze({status:"aborted"}),Ta=e=>({status:"dirty",value:e}),qt=e=>({status:"valid",value:e}),hw=e=>e.status==="aborted",gw=e=>e.status==="dirty",Zi=e=>e.status==="valid",Cu=e=>typeof Promise<"u"&&e instanceof Promise;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(le||(le={}));hn=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},yw=(e,t)=>{if(Zi(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new pn(e.common.issues);return this._error=n,this._error}}};Ie=class{get description(){return this._def.description}_getType(t){return hr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ot,ctx:{common:t.parent.common,data:t.data,parsedType:hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Cu(n))throw Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)},r=this._parseSync({data:t,path:i.path,parent:i});return yw(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return Zi(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>Zi(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(Cu(r)?r:Promise.resolve(r));return yw(i,o)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,o)=>{let a=t(r),s=()=>o.addIssue({code:W.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Pn({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 fn.create(this,this._def)}nullable(){return ar.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xr.create(this)}promise(){return Xr.create(this,this._def)}or(t){return eo.create([this,t],this._def)}and(t){return to.create(this,t,this._def)}transform(t){return new Pn({...ke(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new ao({...ke(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new Tu({typeName:Z.ZodBranded,type:this,...ke(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new so({...ke(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return Iu.create(this,t)}readonly(){return uo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},SK=/^c[^\s-]{8,}$/i,kK=/^[0-9a-z]+$/,xK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,CK=/^[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,TK=/^[a-z0-9_-]{21}$/i,IK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,PK=/^[-+]?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)?)??$/,EK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",OK=/^(?:(?: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])$/,AK=/^(?:(?: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])$/,$K=/^(([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]))$/,MK=/^(([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])$/,jK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,NK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$x="((\\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])))",qK=new RegExp(`^${$x}$`);Qi=class e extends Ie{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_type,expected:ae.string,received:r.parsedType}),ye}let n=new Ot,i;for(let r of this._def.checks)if(r.kind==="min")t.data.length<r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")t.data.length>r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){let o=t.data.length>r.value,a=t.data.length<r.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?re(i,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&re(i,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")EK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"email",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")kp||(kp=new RegExp(RK,"u")),kp.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"emoji",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")CK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"uuid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")TK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"nanoid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")SK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")kK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid2",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")xK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ulid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),re(i,{validation:"url",code:W.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,!r.regex.test(t.data)&&(i=this._getOrReturnCtx(t,i),re(i,{validation:"regex",code:W.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?t.data=t.data.trim():r.kind==="includes"?t.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?t.data=t.data.toLowerCase():r.kind==="toUpperCase"?t.data=t.data.toUpperCase():r.kind==="startsWith"?t.data.startsWith(r.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?t.data.endsWith(r.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?LK(r).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?qK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?DK(r).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?PK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"duration",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?UK(t.data,r.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ip",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?FK(t.data,r.alg)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"jwt",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?zK(t.data,r.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cidr",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?jK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?NK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64url",code:W.invalid_string,message:r.message}),n.dirty()):Oe.assertNever(r);return{status:n.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:W.invalid_string,...le.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...le.errToObj(t)})}url(t){return this._addCheck({kind:"url",...le.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...le.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...le.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...le.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...le.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...le.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...le.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...le.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...le.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...le.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...le.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...le.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...le.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...le.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...le.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...le.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...le.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...le.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...le.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...le.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...le.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...le.errToObj(n)})}nonempty(t){return this.min(1,le.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Qi.create=e=>new Qi({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...ke(e)});Va=class e extends Ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ae.number){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_type,expected:ae.number,received:r.parsedType}),ye}let n,i=new Ot;for(let r of this._def.checks)r.kind==="int"?Oe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),re(n,{code:W.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?BK(t.data,r.value)!==0&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),re(n,{code:W.not_finite,message:r.message}),i.dirty()):Oe.assertNever(r);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:le.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:le.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:le.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:le.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Oe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Va.create=e=>new Va({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...ke(e)});Za=class e extends Ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ae.bigint)return this._getInvalidInput(t);let n,i=new Ot;for(let r of this._def.checks)r.kind==="min"?(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Oe.assertNever(r);return{status:i.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.bigint,received:n.parsedType}),ye}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Za.create=e=>new Za({checks:[],typeName:Z.ZodBigInt,coerce:e?.coerce??!1,...ke(e)});Qa=class extends Ie{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.boolean,received:n.parsedType}),ye}return qt(t.data)}};Qa.create=e=>new Qa({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...ke(e)});Ya=class e extends Ie{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_type,expected:ae.date,received:r.parsedType}),ye}if(Number.isNaN(t.data.getTime())){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_date}),ye}let n=new Ot,i;for(let r of this._def.checks)r.kind==="min"?t.data.getTime()<r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?t.data.getTime()>r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):Oe.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:le.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:le.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Ya.create=e=>new Ya({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...ke(e)});Xa=class extends Ie{_parse(t){if(this._getType(t)!==ae.symbol){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.symbol,received:n.parsedType}),ye}return qt(t.data)}};Xa.create=e=>new Xa({typeName:Z.ZodSymbol,...ke(e)});Yi=class extends Ie{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.undefined,received:n.parsedType}),ye}return qt(t.data)}};Yi.create=e=>new Yi({typeName:Z.ZodUndefined,...ke(e)});Xi=class extends Ie{_parse(t){if(this._getType(t)!==ae.null){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.null,received:n.parsedType}),ye}return qt(t.data)}};Xi.create=e=>new Xi({typeName:Z.ZodNull,...ke(e)});es=class extends Ie{constructor(){super(...arguments),this._any=!0}_parse(t){return qt(t.data)}};es.create=e=>new es({typeName:Z.ZodAny,...ke(e)});wr=class extends Ie{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qt(t.data)}};wr.create=e=>new wr({typeName:Z.ZodUnknown,...ke(e)});Un=class extends Ie{_parse(t){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.never,received:n.parsedType}),ye}};Un.create=e=>new Un({typeName:Z.ZodNever,...ke(e)});ts=class extends Ie{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.void,received:n.parsedType}),ye}return qt(t.data)}};ts.create=e=>new ts({typeName:Z.ZodVoid,...ke(e)});xr=class e extends Ie{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==ae.array)return re(n,{code:W.invalid_type,expected:ae.array,received:n.parsedType}),ye;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,s=n.data.length<r.exactLength.value;(a||s)&&(re(n,{code:a?W.too_big:W.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(re(n,{code:W.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(re(n,{code:W.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>r.type._parseAsync(new hn(n,a,n.path,s)))).then(a=>Ot.mergeArray(i,a));let o=[...n.data].map((a,s)=>r.type._parseSync(new hn(n,a,n.path,s)));return Ot.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:le.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:le.toString(n)}})}nonempty(t){return this.min(1,t)}};xr.create=(e,t)=>new xr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ke(t)});Xt=class e extends Ie{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Oe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ae.object){let d=this._getOrReturnCtx(t);return re(d,{code:W.invalid_type,expected:ae.object,received:d.parsedType}),ye}let{status:n,ctx:i}=this._processInputParams(t),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Un&&this._def.unknownKeys==="strip"))for(let d in i.data)o.includes(d)||a.push(d);let s=[];for(let d of o){let u=r[d],l=i.data[d];s.push({key:{status:"valid",value:d},value:u._parse(new hn(i,l,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof Un){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of a)s.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")a.length>0&&(re(i,{code:W.unrecognized_keys,keys:a}),n.dirty());else if(d!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let u of a){let l=i.data[u];s.push({key:{status:"valid",value:u},value:d._parse(new hn(i,l,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of s){let l=await u.key,p=await u.value;d.push({key:l,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>Ot.mergeObjectSync(n,d)):Ot.mergeObjectSync(n,s)}get shape(){return this._def.shape()}strict(t){return le.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:le.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Oe.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of Oe.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return $i(this)}partial(t){let n={};for(let i of Oe.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of Oe.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof fn;)r=r._def.innerType;n[i]=r}return new e({...this._def,shape:()=>n})}keyof(){return jx(Oe.objectKeys(this.shape))}};Xt.create=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strip",catchall:Un.create(),typeName:Z.ZodObject,...ke(t)});Xt.strictCreate=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strict",catchall:Un.create(),typeName:Z.ZodObject,...ke(t)});Xt.lazycreate=(e,t)=>new Xt({shape:e,unknownKeys:"strip",catchall:Un.create(),typeName:Z.ZodObject,...ke(t)});eo=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new pn(s.ctx.common.issues));return re(n,{code:W.invalid_union,unionErrors:a}),ye}if(n.common.async)return Promise.all(i.map(async o=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let o,a=[];for(let d of i){let u={...n,common:{...n.common,issues:[]},parent:null},l=d._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(d=>new pn(d));return re(n,{code:W.invalid_union,unionErrors:s}),ye}}get options(){return this._def.options}};eo.create=(e,t)=>new eo({options:e,typeName:Z.ZodUnion,...ke(t)});Xn=e=>e instanceof no?Xn(e.schema):e instanceof Pn?Xn(e.innerType()):e instanceof ro?[e.value]:e instanceof io?e.options:e instanceof oo?Oe.objectValues(e.enum):e instanceof ao?Xn(e._def.innerType):e instanceof Yi?[void 0]:e instanceof Xi?[null]:e instanceof fn?[void 0,...Xn(e.unwrap())]:e instanceof ar?[null,...Xn(e.unwrap())]:e instanceof Tu||e instanceof uo?Xn(e.unwrap()):e instanceof so?Xn(e._def.innerType):[],wf=class e extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.object)return re(n,{code:W.invalid_type,expected:ae.object,received:n.parsedType}),ye;let i=this.discriminator,r=n.data[i],o=this.optionsMap.get(r);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(re(n,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let o of n){let a=Xn(o.shape[t]);if(!a.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);r.set(s,o)}}return new e({typeName:Z.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...ke(i)})}};to=class extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,a)=>{if(hw(o)||hw(a))return ye;let s=Sf(o.value,a.value);return s.valid?((gw(o)||gw(a))&&n.dirty(),{status:n.value,value:s.data}):(re(i,{code:W.invalid_intersection_types}),ye)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>r(o,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};to.create=(e,t,n)=>new to({left:e,right:t,typeName:Z.ZodIntersection,...ke(n)});or=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.array)return re(i,{code:W.invalid_type,expected:ae.array,received:i.parsedType}),ye;if(i.data.length<this._def.items.length)return re(i,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&i.data.length>this._def.items.length&&(re(i,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let r=[...i.data].map((o,a)=>{let s=this._def.items[a]||this._def.rest;return s?s._parse(new hn(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(r).then(o=>Ot.mergeArray(n,o)):Ot.mergeArray(n,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};or.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new or({items:e,typeName:Z.ZodTuple,rest:null,...ke(t)})};kf=class e extends Ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.object)return re(i,{code:W.invalid_type,expected:ae.object,received:i.parsedType}),ye;let r=[],o=this._def.keyType,a=this._def.valueType;for(let s in i.data)r.push({key:o._parse(new hn(i,s,i.path,s)),value:a._parse(new hn(i,i.data[s],i.path,s)),alwaysSet:s in i.data});return i.common.async?Ot.mergeObjectAsync(n,r):Ot.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ie?new e({keyType:t,valueType:n,typeName:Z.ZodRecord,...ke(i)}):new e({keyType:Qi.create(),valueType:t,typeName:Z.ZodRecord,...ke(n)})}},ns=class extends Ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.map)return re(i,{code:W.invalid_type,expected:ae.map,received:i.parsedType}),ye;let r=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([s,d],u)=>({key:r._parse(new hn(i,s,i.path,[u,"key"])),value:o._parse(new hn(i,d,i.path,[u,"value"]))}));if(i.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let d of a){let u=await d.key,l=await d.value;if(u.status==="aborted"||l.status==="aborted")return ye;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let d of a){let{key:u,value:l}=d;if(u.status==="aborted"||l.status==="aborted")return ye;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}}}};ns.create=(e,t,n)=>new ns({valueType:t,keyType:e,typeName:Z.ZodMap,...ke(n)});rs=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.set)return re(i,{code:W.invalid_type,expected:ae.set,received:i.parsedType}),ye;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(re(i,{code:W.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(re(i,{code:W.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function a(d){let u=new Set;for(let l of d){if(l.status==="aborted")return ye;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}let s=[...i.data.values()].map((d,u)=>o._parse(new hn(i,d,i.path,u)));return i.common.async?Promise.all(s).then(d=>a(d)):a(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:le.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};rs.create=(e,t)=>new rs({valueType:e,minSize:null,maxSize:null,typeName:Z.ZodSet,...ke(t)});xf=class e extends Ie{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.function)return re(n,{code:W.invalid_type,expected:ae.function,received:n.parsedType}),ye;function i(s,d){return bf({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,vf(),Ga].filter(u=>!!u),issueData:{code:W.invalid_arguments,argumentsError:d}})}function r(s,d){return bf({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,vf(),Ga].filter(u=>!!u),issueData:{code:W.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Xr){let s=this;return qt(async function(...d){let u=new pn([]),l=await s._def.args.parseAsync(d,o).catch(m=>{throw u.addIssue(i(d,m)),u}),p=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(p,o).catch(m=>{throw u.addIssue(r(p,m)),u})})}else{let s=this;return qt(function(...d){let u=s._def.args.safeParse(d,o);if(!u.success)throw new pn([i(d,u.error)]);let l=Reflect.apply(a,this,u.data),p=s._def.returns.safeParse(l,o);if(!p.success)throw new pn([r(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:or.create(t).rest(wr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||or.create([]).rest(wr.create()),returns:n||wr.create(),typeName:Z.ZodFunction,...ke(i)})}},no=class extends Ie{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};no.create=(e,t)=>new no({getter:e,typeName:Z.ZodLazy,...ke(t)});ro=class extends Ie{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return re(n,{received:n.data,code:W.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:t.data}}get value(){return this._def.value}};ro.create=(e,t)=>new ro({value:e,typeName:Z.ZodLiteral,...ke(t)});io=class e extends Ie{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return re(n,{expected:Oe.joinValues(i),received:n.parsedType,code:W.invalid_type}),ye}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return re(n,{received:n.data,code:W.invalid_enum_value,options:i}),ye}return qt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};io.create=jx;oo=class extends Ie{_parse(t){let n=Oe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==ae.string&&i.parsedType!==ae.number){let r=Oe.objectValues(n);return re(i,{expected:Oe.joinValues(r),received:i.parsedType,code:W.invalid_type}),ye}if(this._cache||(this._cache=new Set(Oe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Oe.objectValues(n);return re(i,{received:i.data,code:W.invalid_enum_value,options:r}),ye}return qt(t.data)}get enum(){return this._def.values}};oo.create=(e,t)=>new oo({values:e,typeName:Z.ZodNativeEnum,...ke(t)});Xr=class extends Ie{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.promise&&n.common.async===!1)return re(n,{code:W.invalid_type,expected:ae.promise,received:n.parsedType}),ye;let i=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return qt(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Xr.create=(e,t)=>new Xr({type:e,typeName:Z.ZodPromise,...ke(t)});Pn=class extends Ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,o={addIssue:a=>{re(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let a=r.transform(i.data,o);if(i.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return ye;let d=await this._def.schema._parseAsync({data:s,path:i.path,parent:i});return d.status==="aborted"?ye:d.status==="dirty"||n.value==="dirty"?Ta(d.value):d});{if(n.value==="aborted")return ye;let s=this._def.schema._parseSync({data:a,path:i.path,parent:i});return s.status==="aborted"?ye:s.status==="dirty"||n.value==="dirty"?Ta(s.value):s}}if(r.type==="refinement"){let a=s=>{let d=r.refinement(s,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Zi(a))return ye;let s=r.transform(a.value,o);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>Zi(a)?Promise.resolve(r.transform(a.value,o)).then(s=>({status:n.value,value:s})):ye);Oe.assertNever(r)}};Pn.create=(e,t,n)=>new Pn({schema:e,typeName:Z.ZodEffects,effect:t,...ke(n)});Pn.createWithPreprocess=(e,t,n)=>new Pn({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...ke(n)});fn=class extends Ie{_parse(t){return this._getType(t)===ae.undefined?qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};fn.create=(e,t)=>new fn({innerType:e,typeName:Z.ZodOptional,...ke(t)});ar=class extends Ie{_parse(t){return this._getType(t)===ae.null?qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ar.create=(e,t)=>new ar({innerType:e,typeName:Z.ZodNullable,...ke(t)});ao=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===ae.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ao.create=(e,t)=>new ao({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ke(t)});so=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Cu(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new pn(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new pn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};so.create=(e,t)=>new so({innerType:e,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ke(t)});is=class extends Ie{_parse(t){if(this._getType(t)!==ae.nan){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.nan,received:n.parsedType}),ye}return{status:"valid",value:t.data}}};is.create=e=>new is({typeName:Z.ZodNaN,...ke(e)});Tu=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Iu=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ye:r.status==="dirty"?(n.dirty(),Ta(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ye:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:Z.ZodPipeline})}},uo=class extends Ie{_parse(t){let n=this._def.innerType._parse(t),i=r=>(Zi(r)&&(r.value=Object.freeze(r.value)),r);return Cu(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};uo.create=(e,t)=>new uo({innerType:e,typeName:Z.ZodReadonly,...ke(t)});rse={object:Xt.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Z||(Z={}));ise=Qi.create,ose=Va.create,ase=is.create,sse=Za.create,dse=Qa.create,use=Ya.create,lse=Xa.create,cse=Yi.create,pse=Xi.create,fse=es.create,mse=wr.create,hse=Un.create,gse=ts.create,yse=xr.create,KK=Xt.create,_se=Xt.strictCreate,vse=eo.create,bse=wf.create,wse=to.create,Sse=or.create,kse=kf.create,xse=ns.create,Cse=rs.create,Tse=xf.create,Ise=no.create,Pse=ro.create,Ese=io.create,Rse=oo.create,Ose=Xr.create,Ase=Pn.create,$se=fn.create,Mse=ar.create,jse=Pn.createWithPreprocess,Nse=Iu.create,Nx={};zn(Nx,{version:()=>H0,util:()=>Ee,treeifyError:()=>Gx,toJSONSchema:()=>Zh,toDotPath:()=>Vx,safeParseAsync:()=>Il,safeParse:()=>Tl,registry:()=>hh,regexes:()=>th,prettifyError:()=>Zx,parseAsync:()=>Ou,parse:()=>Ru,locales:()=>mh,isValidJWT:()=>yC,isValidBase64URL:()=>mC,isValidBase64:()=>oh,globalRegistry:()=>rr,globalConfig:()=>Pu,function:()=>LT,formatError:()=>Zm,flattenError:()=>Vm,config:()=>At,clone:()=>$n,_xid:()=>Ih,_void:()=>xT,_uuidv7:()=>bh,_uuidv6:()=>vh,_uuidv4:()=>_h,_uuid:()=>yh,_url:()=>wh,_uppercase:()=>Uh,_unknown:()=>ju,_union:()=>J6,_undefined:()=>bT,_ulid:()=>Th,_uint64:()=>_T,_uint32:()=>pT,_tuple:()=>$T,_trim:()=>Wh,_transform:()=>eW,_toUpperCase:()=>Gh,_toLowerCase:()=>Hh,_templateLiteral:()=>uW,_symbol:()=>vT,_success:()=>oW,_stringbool:()=>qT,_stringFormat:()=>DT,_string:()=>XC,_startsWith:()=>zh,_size:()=>qh,_set:()=>Z6,_safeParseAsync:()=>eh,_safeParse:()=>Xm,_regex:()=>Dh,_refine:()=>NT,_record:()=>G6,_readonly:()=>dW,_property:()=>AT,_promise:()=>cW,_positive:()=>PT,_pipe:()=>sW,_parseAsync:()=>Ym,_parse:()=>Qm,_overwrite:()=>di,_optional:()=>tW,_number:()=>aT,_nullable:()=>nW,_null:()=>wT,_normalize:()=>Jh,_nonpositive:()=>RT,_nonoptional:()=>iW,_nonnegative:()=>OT,_never:()=>kT,_negative:()=>ET,_nativeEnum:()=>Y6,_nanoid:()=>kh,_nan:()=>IT,_multipleOf:()=>ds,_minSize:()=>us,_minLength:()=>co,_min:()=>Zt,_mime:()=>Kh,_maxSize:()=>El,_maxLength:()=>Rl,_max:()=>Tn,_map:()=>V6,_lte:()=>Tn,_lt:()=>ei,_lowercase:()=>Lh,_literal:()=>X6,_length:()=>Ol,_lazy:()=>lW,_ksuid:()=>Ph,_jwt:()=>Nh,_isoTime:()=>iT,_isoDuration:()=>oT,_isoDateTime:()=>nT,_isoDate:()=>rT,_ipv6:()=>Rh,_ipv4:()=>Eh,_intersection:()=>H6,_int64:()=>yT,_int32:()=>cT,_int:()=>dT,_includes:()=>Fh,_guid:()=>Mu,_gte:()=>Zt,_gt:()=>ti,_float64:()=>lT,_float32:()=>uT,_file:()=>MT,_enum:()=>Q6,_endsWith:()=>Bh,_emoji:()=>Sh,_email:()=>gh,_e164:()=>jh,_discriminatedUnion:()=>W6,_default:()=>rW,_date:()=>CT,_custom:()=>jT,_cuid2:()=>Ch,_cuid:()=>xh,_coercedString:()=>eT,_coercedNumber:()=>sT,_coercedDate:()=>TT,_coercedBoolean:()=>mT,_coercedBigint:()=>gT,_cidrv6:()=>Ah,_cidrv4:()=>Oh,_catch:()=>aW,_boolean:()=>fT,_bigint:()=>hT,_base64url:()=>Mh,_base64:()=>$h,_array:()=>Vh,_any:()=>ST,TimePrecision:()=>tT,NEVER:()=>qx,JSONSchemaGenerator:()=>ls,JSONSchema:()=>pW,Doc:()=>Au,$output:()=>QC,$input:()=>YC,$constructor:()=>N,$brand:()=>Dx,$ZodXID:()=>rC,$ZodVoid:()=>IC,$ZodUnknown:()=>$u,$ZodUnion:()=>ch,$ZodUndefined:()=>kC,$ZodUUID:()=>V0,$ZodURL:()=>Q0,$ZodULID:()=>nC,$ZodType:()=>ve,$ZodTuple:()=>Pl,$ZodTransform:()=>ph,$ZodTemplateLiteral:()=>WC,$ZodSymbol:()=>SC,$ZodSuccess:()=>zC,$ZodStringFormat:()=>Ke,$ZodString:()=>ks,$ZodSet:()=>$C,$ZodRegistry:()=>ss,$ZodRecord:()=>OC,$ZodRealError:()=>ws,$ZodReadonly:()=>JC,$ZodPromise:()=>HC,$ZodPrefault:()=>UC,$ZodPipe:()=>fh,$ZodOptional:()=>qC,$ZodObject:()=>lh,$ZodNumberFormat:()=>bC,$ZodNumber:()=>ah,$ZodNullable:()=>DC,$ZodNull:()=>xC,$ZodNonOptional:()=>FC,$ZodNever:()=>TC,$ZodNanoID:()=>X0,$ZodNaN:()=>KC,$ZodMap:()=>AC,$ZodLiteral:()=>jC,$ZodLazy:()=>GC,$ZodKSUID:()=>iC,$ZodJWT:()=>_C,$ZodIntersection:()=>RC,$ZodISOTime:()=>sC,$ZodISODuration:()=>dC,$ZodISODateTime:()=>oC,$ZodISODate:()=>aC,$ZodIPv6:()=>lC,$ZodIPv4:()=>uC,$ZodGUID:()=>G0,$ZodFunction:()=>Nu,$ZodFile:()=>NC,$ZodError:()=>Gm,$ZodEnum:()=>MC,$ZodEmoji:()=>Y0,$ZodEmail:()=>Z0,$ZodE164:()=>gC,$ZodDiscriminatedUnion:()=>EC,$ZodDefault:()=>LC,$ZodDate:()=>PC,$ZodCustomStringFormat:()=>vC,$ZodCustom:()=>VC,$ZodCheckUpperCase:()=>U0,$ZodCheckStringFormat:()=>Ss,$ZodCheckStartsWith:()=>z0,$ZodCheckSizeEquals:()=>M0,$ZodCheckRegex:()=>D0,$ZodCheckProperty:()=>K0,$ZodCheckOverwrite:()=>W0,$ZodCheckNumberFormat:()=>R0,$ZodCheckMultipleOf:()=>E0,$ZodCheckMinSize:()=>$0,$ZodCheckMinLength:()=>N0,$ZodCheckMimeType:()=>J0,$ZodCheckMaxSize:()=>A0,$ZodCheckMaxLength:()=>j0,$ZodCheckLowerCase:()=>L0,$ZodCheckLessThan:()=>rh,$ZodCheckLengthEquals:()=>q0,$ZodCheckIncludes:()=>F0,$ZodCheckGreaterThan:()=>ih,$ZodCheckEndsWith:()=>B0,$ZodCheckBigIntFormat:()=>O0,$ZodCheck:()=>at,$ZodCatch:()=>BC,$ZodCUID2:()=>tC,$ZodCUID:()=>eC,$ZodCIDRv6:()=>pC,$ZodCIDRv4:()=>cC,$ZodBoolean:()=>sh,$ZodBigIntFormat:()=>wC,$ZodBigInt:()=>dh,$ZodBase64URL:()=>hC,$ZodBase64:()=>fC,$ZodAsyncError:()=>Cr,$ZodArray:()=>uh,$ZodAny:()=>CC});qx=Object.freeze({status:"aborted"});Dx=Symbol("zod_brand"),Cr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pu={};Ee={};zn(Ee,{unwrapMessage:()=>Ia,stringifyPrimitive:()=>Ce,required:()=>sJ,randomString:()=>YK,propertyKeyTypes:()=>Eu,promiseAllObject:()=>QK,primitiveTypes:()=>zx,prefixIssues:()=>cn,pick:()=>nJ,partial:()=>aJ,optionalKeys:()=>Bx,omit:()=>rJ,numKeys:()=>XK,nullish:()=>ai,normalizeParams:()=>Q,merge:()=>oJ,jsonStringifyReplacer:()=>Lx,joinValues:()=>te,issue:()=>Wx,isPlainObject:()=>as,isObject:()=>os,getSizableOrigin:()=>xl,getParsedType:()=>eJ,getLengthableOrigin:()=>Cl,getEnumValues:()=>Jm,getElementAtPath:()=>ZK,floatSafeRemainder:()=>Ux,finalizeIssue:()=>En,extend:()=>iJ,escapeRegex:()=>si,esc:()=>Mi,defineLazy:()=>qe,createTransparentProxy:()=>tJ,clone:()=>$n,cleanRegex:()=>kl,cleanEnum:()=>dJ,captureStackTrace:()=>Hm,cached:()=>Sl,assignProp:()=>Wm,assertNotEqual:()=>WK,assertNever:()=>GK,assertIs:()=>HK,assertEqual:()=>JK,assert:()=>VK,allowsEval:()=>Fx,aborted:()=>Ui,NUMBER_FORMAT_RANGES:()=>Kx,Class:()=>Cf,BIGINT_FORMAT_RANGES:()=>Jx});Hm=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};Fx=Sl(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});eJ=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw Error(`Unknown data type: ${t}`)}},Eu=new Set(["string","number","symbol"]),zx=new Set(["string","number","bigint","boolean","symbol","undefined"]);Kx={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Jx={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Cf=class{constructor(...t){}},Hx=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Lx,2)},enumerable:!0})},Gm=N("$ZodError",Hx),ws=N("$ZodError",Hx,{Parent:Error});Qm=e=>(t,n,i,r)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Cr;if(a.issues.length){let s=new(r?.Err??e)(a.issues.map(d=>En(d,o,At())));throw Hm(s,r?.callee),s}return a.value},Ru=Qm(ws),Ym=e=>async(t,n,i,r)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??e)(a.issues.map(d=>En(d,o,At())));throw Hm(s,r?.callee),s}return a.value},Ou=Ym(ws),Xm=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Cr;return o.issues.length?{success:!1,error:new(e??Gm)(o.issues.map(a=>En(a,r,At())))}:{success:!0,data:o.value}},Tl=Xm(ws),eh=e=>async(t,n,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>En(a,r,At())))}:{success:!0,data:o.value}},Il=eh(ws),th={};zn(th,{xid:()=>e0,uuid7:()=>pJ,uuid6:()=>cJ,uuid4:()=>lJ,uuid:()=>lo,uppercase:()=>I0,unicodeEmail:()=>hJ,undefined:()=>C0,ulid:()=>Xx,time:()=>y0,string:()=>v0,rfc5322Email:()=>mJ,number:()=>S0,null:()=>x0,nanoid:()=>n0,lowercase:()=>T0,ksuid:()=>t0,ipv6:()=>d0,ipv4:()=>s0,integer:()=>w0,html5Email:()=>fJ,hostname:()=>p0,guid:()=>i0,extendedDuration:()=>uJ,emoji:()=>a0,email:()=>o0,e164:()=>f0,duration:()=>r0,domain:()=>_J,datetime:()=>_0,date:()=>h0,cuid2:()=>Yx,cuid:()=>Qx,cidrv6:()=>l0,cidrv4:()=>u0,browserEmail:()=>gJ,boolean:()=>k0,bigint:()=>b0,base64url:()=>nh,base64:()=>c0,_emoji:()=>yJ});Qx=/^[cC][^\s-]{8,}$/,Yx=/^[0-9a-z]+$/,Xx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e0=/^[0-9a-vA-V]{20}$/,t0=/^[A-Za-z0-9]{27}$/,n0=/^[a-zA-Z0-9_-]{21}$/,r0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uJ=/^[-+]?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)?)??$/,i0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,lJ=lo(4),cJ=lo(6),pJ=lo(7),o0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fJ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,mJ=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,hJ=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,gJ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";s0=/^(?:(?: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])$/,d0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,u0=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,l0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,c0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nh=/^[A-Za-z0-9_-]*$/,p0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,_J=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,f0=/^\+(?:[0-9]){6,14}[0-9]$/,m0="(?:(?:\\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])))",h0=new RegExp(`^${m0}$`);v0=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},b0=/^\d+n?$/,w0=/^\d+$/,S0=/^-?\d+(?:\.\d+)?/i,k0=/true|false/i,x0=/null/i,C0=/undefined/i,T0=/^[^A-Z]*$/,I0=/^[^a-z]*$/,at=N("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),P0={number:"number",bigint:"bigint",object:"date"},rh=N("$ZodCheckLessThan",(e,t)=>{at.init(e,t);let n=P0[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ih=N("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);let n=P0[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),E0=N("$ZodCheckMultipleOf",(e,t)=>{at.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ux(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),R0=N("$ZodCheckNumberFormat",(e,t)=>{at.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=Kx[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=r,s.maximum=o,n&&(s.pattern=w0)}),e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:e})}}),O0=N("$ZodCheckBigIntFormat",(e,t)=>{at.init(e,t);let[n,i]=Jx[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:e})}}),A0=N("$ZodCheckMaxSize",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:xl(i),code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),$0=N("$ZodCheckMinSize",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:xl(i),code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),M0=N("$ZodCheckSizeEquals",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,r=i.size;if(r===t.size)return;let o=r>t.size;n.issues.push({origin:xl(i),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),j0=N("$ZodCheckMaxLength",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let r=Cl(i);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),N0=N("$ZodCheckMinLength",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let r=Cl(i);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),q0=N("$ZodCheckLengthEquals",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,r=i.length;if(r===t.length)return;let o=Cl(i),a=r>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ss=N("$ZodCheckStringFormat",(e,t)=>{var n,i;at.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),D0=N("$ZodCheckRegex",(e,t)=>{Ss.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),L0=N("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=T0),Ss.init(e,t)}),U0=N("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=I0),Ss.init(e,t)}),F0=N("$ZodCheckIncludes",(e,t)=>{at.init(e,t);let n=si(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),z0=N("$ZodCheckStartsWith",(e,t)=>{at.init(e,t);let n=new RegExp(`^${si(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),B0=N("$ZodCheckEndsWith",(e,t)=>{at.init(e,t);let n=new RegExp(`.*${si(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});K0=N("$ZodCheckProperty",(e,t)=>{at.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>_w(r,n,t.property));_w(i,n,t.property)}}),J0=N("$ZodCheckMimeType",(e,t)=>{at.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e})}}),W0=N("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}}),Au=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
88
|
+
`)).catch(r=>{Ne(`[Query.sendMcpServerMessageToCli] Transport write failed: ${r}`,{level:"error"})})}handleMcpControlRequest(t,n,i){let r="id"in n.message?n.message.id:null,o=`${t}:${r}`;return new Promise((a,s)=>{let d=()=>{this.pendingMcpResponses.delete(o)},u=p=>{d(),a(p)},l=p=>{d(),s(p)};if(this.pendingMcpResponses.set(o,{resolve:u,reject:l}),i.onmessage)i.onmessage(n.message);else{d(),s(Error("No message handler registered"));return}})}},Fm=500,zm=1048576,R4=[200,800],mf=class{send;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;constructor(t,n=6e4,i,r=Fm,o=zm,a=R4){this.send=t,this.sendTimeoutMs=n,this.onError=i,this.maxPendingEntries=r,this.maxPendingBytes=o,this.backoffMs=a}enqueue(t,n){let i=ut(n).length;this.pending.push({filePath:t,entries:n,bytes:i}),this.pendingEntries+=n.length,this.pendingBytes+=i,(this.pendingEntries>this.maxPendingEntries||this.pendingBytes>this.maxPendingBytes)&&(this.flushPromise=this.drain(),this.flushPromise.catch(()=>{}))}async flush(){let t=this.drain();this.flushPromise=t,await t,this.flushPromise===t&&(this.flushPromise=null)}async drain(){let t=this.flushPromise,n=this.pending.splice(0);this.pendingEntries=0,this.pendingBytes=0,t&&await t,n.length!==0&&await this.doFlush(n)}async doFlush(t){let n=new Map;for(let r of t){let o=n.get(r.filePath);o?o.push(...r.entries):n.set(r.filePath,r.entries.slice())}let i=this.backoffMs.length+1;for(let[r,o]of n){let a=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${r}`,s,d=1;for(;d<=i;d++)try{await Jr(this.send(r,o),this.sendTimeoutMs,a),s=void 0;break}catch(u){if(s=gs(u),s.message===a)break;let l=this.backoffMs[d-1];if(l===void 0)break;await dl(l)}if(s){Ne(`[TranscriptMirrorBatcher] flush failed for ${r} after ${d} attempt(s): ${s}`,{level:"error"});try{this.onError?.(r,s)}catch(u){Ne(`[TranscriptMirrorBatcher] onError callback threw: ${u}`,{level:"error"})}}}}},ow=am(o1(),1);Pi=new Map,K4=5e3;J4=new Set([".com",".exe",".bat",".cmd"]);Z4=L4(D4);nr=65536,Y4=new Set(["sdk-cli","sdk-ts","sdk-py"]);eB=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Wa=200;aB=1048576,sB=5242880;xu=Buffer.from('{"type":"attribution-snapshot"'),lB=Buffer.from('{"type":"system"'),Ha=10,cB=Buffer.from([Ha]),pB=256;dw=524288,uw=8192;EB=32;KB=new Set(["user","assistant","attachment","system","progress"]);oK="user:inference",Ax="user:profile",aK="org:create_api_key",sK=[aK,Ax],dK=[Ax,oK,"user:sessions:claude_code","user:mcp_servers","user:file_upload"],nse=Ox([...sK,...dK]),uK=["user:design:read","user:design:write"],rse=[...uK,"user:projects:read","user:projects:write"],fw={BASE_API_URL:"https://api.anthropic.com",CONSOLE_AUTHORIZE_URL:"https://platform.claude.com/oauth/authorize",CLAUDE_AI_AUTHORIZE_URL:"https://claude.com/cai/oauth/authorize",CLAUDE_AI_ORIGIN:"https://claude.ai",TOKEN_URL:"https://platform.claude.com/v1/oauth/token",API_KEY_URL:"https://api.anthropic.com/api/oauth/claude_cli/create_api_key",ROLES_URL:"https://api.anthropic.com/api/oauth/claude_cli/roles",CONSOLE_SUCCESS_URL:"https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code",CLAUDEAI_SUCCESS_URL:"https://platform.claude.com/oauth/code/success?app=claude-code",MANUAL_REDIRECT_URL:"https://platform.claude.com/oauth/code/callback",CLIENT_ID:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",DESIGN_CLIENT_ID:"59637612-477b-4836-a601-b0589eda7704",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"},lK=void 0;pK=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];mK="-credentials";gK=/^[a-zA-Z0-9._-]+$/;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw Error()}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let a of r)o[a]=a;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of o)a[s]=r[s];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(o){return r[o]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let o=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&o.push(a);return o},e.find=(r,o)=>{for(let a of r)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Oe||(Oe={}));(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mw||(mw={}));ae=Oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hr=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}},W=Oe.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"]),pn=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},i={_errors:[]},r=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let s=i,d=0;for(;d<a.path.length;){let u=a.path[d];d!==a.path.length-1?s[u]=s[u]||{_errors:[]}:(s[u]=s[u]||{_errors:[]},s[u]._errors.push(n(a))),s=s[u],d++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},i=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];n[o]=n[o]||[],n[o].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};pn.create=e=>new pn(e);bK=(e,t)=>{let n;switch(e.code){case W.invalid_type:e.received===ae.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Oe.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Oe.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Oe.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Oe.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Oe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case W.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case W.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Oe.assertNever(e)}return{message:n}},Ga=bK,wK=Ga;bf=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],a={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let s="",d=i.filter(u=>!!u).slice().reverse();for(let u of d)s=u(a,{data:t,defaultError:s}).message;return{...r,path:o,message:s}};Ot=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return ye;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let o=await r.key,a=await r.value;i.push({key:o,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:a}=r;if(o.status==="aborted"||a.status==="aborted")return ye;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[o.value]=a.value)}return{status:t.value,value:i}}},ye=Object.freeze({status:"aborted"}),Ta=e=>({status:"dirty",value:e}),qt=e=>({status:"valid",value:e}),hw=e=>e.status==="aborted",gw=e=>e.status==="dirty",Zi=e=>e.status==="valid",Cu=e=>typeof Promise<"u"&&e instanceof Promise;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(le||(le={}));hn=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},yw=(e,t)=>{if(Zi(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new pn(e.common.issues);return this._error=n,this._error}}};Ie=class{get description(){return this._def.description}_getType(t){return hr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ot,ctx:{common:t.parent.common,data:t.data,parsedType:hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Cu(n))throw Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)},r=this._parseSync({data:t,path:i.path,parent:i});return yw(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return Zi(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>Zi(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:hr(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(Cu(r)?r:Promise.resolve(r));return yw(i,o)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,o)=>{let a=t(r),s=()=>o.addIssue({code:W.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Pn({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 fn.create(this,this._def)}nullable(){return ar.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xr.create(this)}promise(){return Xr.create(this,this._def)}or(t){return eo.create([this,t],this._def)}and(t){return to.create(this,t,this._def)}transform(t){return new Pn({...ke(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new ao({...ke(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new Tu({typeName:Z.ZodBranded,type:this,...ke(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new so({...ke(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return Iu.create(this,t)}readonly(){return uo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},SK=/^c[^\s-]{8,}$/i,kK=/^[0-9a-z]+$/,xK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,CK=/^[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,TK=/^[a-z0-9_-]{21}$/i,IK=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,PK=/^[-+]?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)?)??$/,EK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",OK=/^(?:(?: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])$/,AK=/^(?:(?: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])$/,$K=/^(([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]))$/,MK=/^(([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])$/,jK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,NK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$x="((\\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])))",qK=new RegExp(`^${$x}$`);Qi=class e extends Ie{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_type,expected:ae.string,received:r.parsedType}),ye}let n=new Ot,i;for(let r of this._def.checks)if(r.kind==="min")t.data.length<r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")t.data.length>r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){let o=t.data.length>r.value,a=t.data.length<r.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?re(i,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&re(i,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")EK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"email",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")kp||(kp=new RegExp(RK,"u")),kp.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"emoji",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")CK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"uuid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")TK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"nanoid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")SK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")kK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid2",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")xK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ulid",code:W.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),re(i,{validation:"url",code:W.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,!r.regex.test(t.data)&&(i=this._getOrReturnCtx(t,i),re(i,{validation:"regex",code:W.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?t.data=t.data.trim():r.kind==="includes"?t.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?t.data=t.data.toLowerCase():r.kind==="toUpperCase"?t.data=t.data.toUpperCase():r.kind==="startsWith"?t.data.startsWith(r.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?t.data.endsWith(r.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?LK(r).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?qK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?DK(r).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:W.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?PK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"duration",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?UK(t.data,r.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ip",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?FK(t.data,r.alg)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"jwt",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?zK(t.data,r.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cidr",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?jK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64",code:W.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?NK.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64url",code:W.invalid_string,message:r.message}),n.dirty()):Oe.assertNever(r);return{status:n.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:W.invalid_string,...le.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...le.errToObj(t)})}url(t){return this._addCheck({kind:"url",...le.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...le.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...le.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...le.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...le.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...le.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...le.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...le.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...le.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...le.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...le.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...le.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...le.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...le.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...le.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...le.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...le.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...le.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...le.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...le.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...le.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...le.errToObj(n)})}nonempty(t){return this.min(1,le.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Qi.create=e=>new Qi({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...ke(e)});Va=class e extends Ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ae.number){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_type,expected:ae.number,received:r.parsedType}),ye}let n,i=new Ot;for(let r of this._def.checks)r.kind==="int"?Oe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),re(n,{code:W.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?BK(t.data,r.value)!==0&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),re(n,{code:W.not_finite,message:r.message}),i.dirty()):Oe.assertNever(r);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:le.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:le.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:le.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:le.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Oe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Va.create=e=>new Va({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...ke(e)});Za=class e extends Ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ae.bigint)return this._getInvalidInput(t);let n,i=new Ot;for(let r of this._def.checks)r.kind==="min"?(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),re(n,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Oe.assertNever(r);return{status:i.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.bigint,received:n.parsedType}),ye}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Za.create=e=>new Za({checks:[],typeName:Z.ZodBigInt,coerce:e?.coerce??!1,...ke(e)});Qa=class extends Ie{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.boolean,received:n.parsedType}),ye}return qt(t.data)}};Qa.create=e=>new Qa({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...ke(e)});Ya=class e extends Ie{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_type,expected:ae.date,received:r.parsedType}),ye}if(Number.isNaN(t.data.getTime())){let r=this._getOrReturnCtx(t);return re(r,{code:W.invalid_date}),ye}let n=new Ot,i;for(let r of this._def.checks)r.kind==="min"?t.data.getTime()<r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?t.data.getTime()>r.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):Oe.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:le.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:le.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Ya.create=e=>new Ya({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...ke(e)});Xa=class extends Ie{_parse(t){if(this._getType(t)!==ae.symbol){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.symbol,received:n.parsedType}),ye}return qt(t.data)}};Xa.create=e=>new Xa({typeName:Z.ZodSymbol,...ke(e)});Yi=class extends Ie{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.undefined,received:n.parsedType}),ye}return qt(t.data)}};Yi.create=e=>new Yi({typeName:Z.ZodUndefined,...ke(e)});Xi=class extends Ie{_parse(t){if(this._getType(t)!==ae.null){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.null,received:n.parsedType}),ye}return qt(t.data)}};Xi.create=e=>new Xi({typeName:Z.ZodNull,...ke(e)});es=class extends Ie{constructor(){super(...arguments),this._any=!0}_parse(t){return qt(t.data)}};es.create=e=>new es({typeName:Z.ZodAny,...ke(e)});wr=class extends Ie{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qt(t.data)}};wr.create=e=>new wr({typeName:Z.ZodUnknown,...ke(e)});Un=class extends Ie{_parse(t){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.never,received:n.parsedType}),ye}};Un.create=e=>new Un({typeName:Z.ZodNever,...ke(e)});ts=class extends Ie{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.void,received:n.parsedType}),ye}return qt(t.data)}};ts.create=e=>new ts({typeName:Z.ZodVoid,...ke(e)});xr=class e extends Ie{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==ae.array)return re(n,{code:W.invalid_type,expected:ae.array,received:n.parsedType}),ye;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,s=n.data.length<r.exactLength.value;(a||s)&&(re(n,{code:a?W.too_big:W.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(re(n,{code:W.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(re(n,{code:W.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>r.type._parseAsync(new hn(n,a,n.path,s)))).then(a=>Ot.mergeArray(i,a));let o=[...n.data].map((a,s)=>r.type._parseSync(new hn(n,a,n.path,s)));return Ot.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:le.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:le.toString(n)}})}nonempty(t){return this.min(1,t)}};xr.create=(e,t)=>new xr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ke(t)});Xt=class e extends Ie{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Oe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ae.object){let d=this._getOrReturnCtx(t);return re(d,{code:W.invalid_type,expected:ae.object,received:d.parsedType}),ye}let{status:n,ctx:i}=this._processInputParams(t),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Un&&this._def.unknownKeys==="strip"))for(let d in i.data)o.includes(d)||a.push(d);let s=[];for(let d of o){let u=r[d],l=i.data[d];s.push({key:{status:"valid",value:d},value:u._parse(new hn(i,l,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof Un){let d=this._def.unknownKeys;if(d==="passthrough")for(let u of a)s.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(d==="strict")a.length>0&&(re(i,{code:W.unrecognized_keys,keys:a}),n.dirty());else if(d!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let u of a){let l=i.data[u];s.push({key:{status:"valid",value:u},value:d._parse(new hn(i,l,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let u of s){let l=await u.key,p=await u.value;d.push({key:l,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>Ot.mergeObjectSync(n,d)):Ot.mergeObjectSync(n,s)}get shape(){return this._def.shape()}strict(t){return le.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:le.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Oe.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of Oe.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return $i(this)}partial(t){let n={};for(let i of Oe.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of Oe.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof fn;)r=r._def.innerType;n[i]=r}return new e({...this._def,shape:()=>n})}keyof(){return jx(Oe.objectKeys(this.shape))}};Xt.create=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strip",catchall:Un.create(),typeName:Z.ZodObject,...ke(t)});Xt.strictCreate=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strict",catchall:Un.create(),typeName:Z.ZodObject,...ke(t)});Xt.lazycreate=(e,t)=>new Xt({shape:e,unknownKeys:"strip",catchall:Un.create(),typeName:Z.ZodObject,...ke(t)});eo=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new pn(s.ctx.common.issues));return re(n,{code:W.invalid_union,unionErrors:a}),ye}if(n.common.async)return Promise.all(i.map(async o=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let o,a=[];for(let d of i){let u={...n,common:{...n.common,issues:[]},parent:null},l=d._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(d=>new pn(d));return re(n,{code:W.invalid_union,unionErrors:s}),ye}}get options(){return this._def.options}};eo.create=(e,t)=>new eo({options:e,typeName:Z.ZodUnion,...ke(t)});Xn=e=>e instanceof no?Xn(e.schema):e instanceof Pn?Xn(e.innerType()):e instanceof ro?[e.value]:e instanceof io?e.options:e instanceof oo?Oe.objectValues(e.enum):e instanceof ao?Xn(e._def.innerType):e instanceof Yi?[void 0]:e instanceof Xi?[null]:e instanceof fn?[void 0,...Xn(e.unwrap())]:e instanceof ar?[null,...Xn(e.unwrap())]:e instanceof Tu||e instanceof uo?Xn(e.unwrap()):e instanceof so?Xn(e._def.innerType):[],wf=class e extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.object)return re(n,{code:W.invalid_type,expected:ae.object,received:n.parsedType}),ye;let i=this.discriminator,r=n.data[i],o=this.optionsMap.get(r);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(re(n,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let o of n){let a=Xn(o.shape[t]);if(!a.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);r.set(s,o)}}return new e({typeName:Z.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...ke(i)})}};to=class extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,a)=>{if(hw(o)||hw(a))return ye;let s=Sf(o.value,a.value);return s.valid?((gw(o)||gw(a))&&n.dirty(),{status:n.value,value:s.data}):(re(i,{code:W.invalid_intersection_types}),ye)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>r(o,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};to.create=(e,t,n)=>new to({left:e,right:t,typeName:Z.ZodIntersection,...ke(n)});or=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.array)return re(i,{code:W.invalid_type,expected:ae.array,received:i.parsedType}),ye;if(i.data.length<this._def.items.length)return re(i,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&i.data.length>this._def.items.length&&(re(i,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let r=[...i.data].map((o,a)=>{let s=this._def.items[a]||this._def.rest;return s?s._parse(new hn(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(r).then(o=>Ot.mergeArray(n,o)):Ot.mergeArray(n,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};or.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new or({items:e,typeName:Z.ZodTuple,rest:null,...ke(t)})};kf=class e extends Ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.object)return re(i,{code:W.invalid_type,expected:ae.object,received:i.parsedType}),ye;let r=[],o=this._def.keyType,a=this._def.valueType;for(let s in i.data)r.push({key:o._parse(new hn(i,s,i.path,s)),value:a._parse(new hn(i,i.data[s],i.path,s)),alwaysSet:s in i.data});return i.common.async?Ot.mergeObjectAsync(n,r):Ot.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ie?new e({keyType:t,valueType:n,typeName:Z.ZodRecord,...ke(i)}):new e({keyType:Qi.create(),valueType:t,typeName:Z.ZodRecord,...ke(n)})}},ns=class extends Ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.map)return re(i,{code:W.invalid_type,expected:ae.map,received:i.parsedType}),ye;let r=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([s,d],u)=>({key:r._parse(new hn(i,s,i.path,[u,"key"])),value:o._parse(new hn(i,d,i.path,[u,"value"]))}));if(i.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let d of a){let u=await d.key,l=await d.value;if(u.status==="aborted"||l.status==="aborted")return ye;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let d of a){let{key:u,value:l}=d;if(u.status==="aborted"||l.status==="aborted")return ye;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}}}};ns.create=(e,t,n)=>new ns({valueType:t,keyType:e,typeName:Z.ZodMap,...ke(n)});rs=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ae.set)return re(i,{code:W.invalid_type,expected:ae.set,received:i.parsedType}),ye;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(re(i,{code:W.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(re(i,{code:W.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function a(d){let u=new Set;for(let l of d){if(l.status==="aborted")return ye;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}let s=[...i.data.values()].map((d,u)=>o._parse(new hn(i,d,i.path,u)));return i.common.async?Promise.all(s).then(d=>a(d)):a(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:le.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};rs.create=(e,t)=>new rs({valueType:e,minSize:null,maxSize:null,typeName:Z.ZodSet,...ke(t)});xf=class e extends Ie{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.function)return re(n,{code:W.invalid_type,expected:ae.function,received:n.parsedType}),ye;function i(s,d){return bf({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,vf(),Ga].filter(u=>!!u),issueData:{code:W.invalid_arguments,argumentsError:d}})}function r(s,d){return bf({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,vf(),Ga].filter(u=>!!u),issueData:{code:W.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Xr){let s=this;return qt(async function(...d){let u=new pn([]),l=await s._def.args.parseAsync(d,o).catch(m=>{throw u.addIssue(i(d,m)),u}),p=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(p,o).catch(m=>{throw u.addIssue(r(p,m)),u})})}else{let s=this;return qt(function(...d){let u=s._def.args.safeParse(d,o);if(!u.success)throw new pn([i(d,u.error)]);let l=Reflect.apply(a,this,u.data),p=s._def.returns.safeParse(l,o);if(!p.success)throw new pn([r(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:or.create(t).rest(wr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||or.create([]).rest(wr.create()),returns:n||wr.create(),typeName:Z.ZodFunction,...ke(i)})}},no=class extends Ie{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};no.create=(e,t)=>new no({getter:e,typeName:Z.ZodLazy,...ke(t)});ro=class extends Ie{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return re(n,{received:n.data,code:W.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:t.data}}get value(){return this._def.value}};ro.create=(e,t)=>new ro({value:e,typeName:Z.ZodLiteral,...ke(t)});io=class e extends Ie{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return re(n,{expected:Oe.joinValues(i),received:n.parsedType,code:W.invalid_type}),ye}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return re(n,{received:n.data,code:W.invalid_enum_value,options:i}),ye}return qt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};io.create=jx;oo=class extends Ie{_parse(t){let n=Oe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==ae.string&&i.parsedType!==ae.number){let r=Oe.objectValues(n);return re(i,{expected:Oe.joinValues(r),received:i.parsedType,code:W.invalid_type}),ye}if(this._cache||(this._cache=new Set(Oe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Oe.objectValues(n);return re(i,{received:i.data,code:W.invalid_enum_value,options:r}),ye}return qt(t.data)}get enum(){return this._def.values}};oo.create=(e,t)=>new oo({values:e,typeName:Z.ZodNativeEnum,...ke(t)});Xr=class extends Ie{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.promise&&n.common.async===!1)return re(n,{code:W.invalid_type,expected:ae.promise,received:n.parsedType}),ye;let i=n.parsedType===ae.promise?n.data:Promise.resolve(n.data);return qt(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Xr.create=(e,t)=>new Xr({type:e,typeName:Z.ZodPromise,...ke(t)});Pn=class extends Ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,o={addIssue:a=>{re(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let a=r.transform(i.data,o);if(i.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return ye;let d=await this._def.schema._parseAsync({data:s,path:i.path,parent:i});return d.status==="aborted"?ye:d.status==="dirty"||n.value==="dirty"?Ta(d.value):d});{if(n.value==="aborted")return ye;let s=this._def.schema._parseSync({data:a,path:i.path,parent:i});return s.status==="aborted"?ye:s.status==="dirty"||n.value==="dirty"?Ta(s.value):s}}if(r.type==="refinement"){let a=s=>{let d=r.refinement(s,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Zi(a))return ye;let s=r.transform(a.value,o);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>Zi(a)?Promise.resolve(r.transform(a.value,o)).then(s=>({status:n.value,value:s})):ye);Oe.assertNever(r)}};Pn.create=(e,t,n)=>new Pn({schema:e,typeName:Z.ZodEffects,effect:t,...ke(n)});Pn.createWithPreprocess=(e,t,n)=>new Pn({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...ke(n)});fn=class extends Ie{_parse(t){return this._getType(t)===ae.undefined?qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};fn.create=(e,t)=>new fn({innerType:e,typeName:Z.ZodOptional,...ke(t)});ar=class extends Ie{_parse(t){return this._getType(t)===ae.null?qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ar.create=(e,t)=>new ar({innerType:e,typeName:Z.ZodNullable,...ke(t)});ao=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===ae.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ao.create=(e,t)=>new ao({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ke(t)});so=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Cu(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new pn(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new pn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};so.create=(e,t)=>new so({innerType:e,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ke(t)});is=class extends Ie{_parse(t){if(this._getType(t)!==ae.nan){let n=this._getOrReturnCtx(t);return re(n,{code:W.invalid_type,expected:ae.nan,received:n.parsedType}),ye}return{status:"valid",value:t.data}}};is.create=e=>new is({typeName:Z.ZodNaN,...ke(e)});Tu=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Iu=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ye:r.status==="dirty"?(n.dirty(),Ta(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ye:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:Z.ZodPipeline})}},uo=class extends Ie{_parse(t){let n=this._def.innerType._parse(t),i=r=>(Zi(r)&&(r.value=Object.freeze(r.value)),r);return Cu(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};uo.create=(e,t)=>new uo({innerType:e,typeName:Z.ZodReadonly,...ke(t)});ise={object:Xt.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Z||(Z={}));ose=Qi.create,ase=Va.create,sse=is.create,dse=Za.create,use=Qa.create,lse=Ya.create,cse=Xa.create,pse=Yi.create,fse=Xi.create,mse=es.create,hse=wr.create,gse=Un.create,yse=ts.create,_se=xr.create,KK=Xt.create,vse=Xt.strictCreate,bse=eo.create,wse=wf.create,Sse=to.create,kse=or.create,xse=kf.create,Cse=ns.create,Tse=rs.create,Ise=xf.create,Pse=no.create,Ese=ro.create,Rse=io.create,Ose=oo.create,Ase=Xr.create,$se=Pn.create,Mse=fn.create,jse=ar.create,Nse=Pn.createWithPreprocess,qse=Iu.create,Nx={};zn(Nx,{version:()=>H0,util:()=>Ee,treeifyError:()=>Gx,toJSONSchema:()=>Zh,toDotPath:()=>Vx,safeParseAsync:()=>Il,safeParse:()=>Tl,registry:()=>hh,regexes:()=>th,prettifyError:()=>Zx,parseAsync:()=>Ou,parse:()=>Ru,locales:()=>mh,isValidJWT:()=>yC,isValidBase64URL:()=>mC,isValidBase64:()=>oh,globalRegistry:()=>rr,globalConfig:()=>Pu,function:()=>LT,formatError:()=>Zm,flattenError:()=>Vm,config:()=>At,clone:()=>$n,_xid:()=>Ih,_void:()=>xT,_uuidv7:()=>bh,_uuidv6:()=>vh,_uuidv4:()=>_h,_uuid:()=>yh,_url:()=>wh,_uppercase:()=>Uh,_unknown:()=>ju,_union:()=>J6,_undefined:()=>bT,_ulid:()=>Th,_uint64:()=>_T,_uint32:()=>pT,_tuple:()=>$T,_trim:()=>Wh,_transform:()=>eW,_toUpperCase:()=>Gh,_toLowerCase:()=>Hh,_templateLiteral:()=>uW,_symbol:()=>vT,_success:()=>oW,_stringbool:()=>qT,_stringFormat:()=>DT,_string:()=>XC,_startsWith:()=>zh,_size:()=>qh,_set:()=>Z6,_safeParseAsync:()=>eh,_safeParse:()=>Xm,_regex:()=>Dh,_refine:()=>NT,_record:()=>G6,_readonly:()=>dW,_property:()=>AT,_promise:()=>cW,_positive:()=>PT,_pipe:()=>sW,_parseAsync:()=>Ym,_parse:()=>Qm,_overwrite:()=>di,_optional:()=>tW,_number:()=>aT,_nullable:()=>nW,_null:()=>wT,_normalize:()=>Jh,_nonpositive:()=>RT,_nonoptional:()=>iW,_nonnegative:()=>OT,_never:()=>kT,_negative:()=>ET,_nativeEnum:()=>Y6,_nanoid:()=>kh,_nan:()=>IT,_multipleOf:()=>ds,_minSize:()=>us,_minLength:()=>co,_min:()=>Zt,_mime:()=>Kh,_maxSize:()=>El,_maxLength:()=>Rl,_max:()=>Tn,_map:()=>V6,_lte:()=>Tn,_lt:()=>ei,_lowercase:()=>Lh,_literal:()=>X6,_length:()=>Ol,_lazy:()=>lW,_ksuid:()=>Ph,_jwt:()=>Nh,_isoTime:()=>iT,_isoDuration:()=>oT,_isoDateTime:()=>nT,_isoDate:()=>rT,_ipv6:()=>Rh,_ipv4:()=>Eh,_intersection:()=>H6,_int64:()=>yT,_int32:()=>cT,_int:()=>dT,_includes:()=>Fh,_guid:()=>Mu,_gte:()=>Zt,_gt:()=>ti,_float64:()=>lT,_float32:()=>uT,_file:()=>MT,_enum:()=>Q6,_endsWith:()=>Bh,_emoji:()=>Sh,_email:()=>gh,_e164:()=>jh,_discriminatedUnion:()=>W6,_default:()=>rW,_date:()=>CT,_custom:()=>jT,_cuid2:()=>Ch,_cuid:()=>xh,_coercedString:()=>eT,_coercedNumber:()=>sT,_coercedDate:()=>TT,_coercedBoolean:()=>mT,_coercedBigint:()=>gT,_cidrv6:()=>Ah,_cidrv4:()=>Oh,_catch:()=>aW,_boolean:()=>fT,_bigint:()=>hT,_base64url:()=>Mh,_base64:()=>$h,_array:()=>Vh,_any:()=>ST,TimePrecision:()=>tT,NEVER:()=>qx,JSONSchemaGenerator:()=>ls,JSONSchema:()=>pW,Doc:()=>Au,$output:()=>QC,$input:()=>YC,$constructor:()=>N,$brand:()=>Dx,$ZodXID:()=>rC,$ZodVoid:()=>IC,$ZodUnknown:()=>$u,$ZodUnion:()=>ch,$ZodUndefined:()=>kC,$ZodUUID:()=>V0,$ZodURL:()=>Q0,$ZodULID:()=>nC,$ZodType:()=>ve,$ZodTuple:()=>Pl,$ZodTransform:()=>ph,$ZodTemplateLiteral:()=>WC,$ZodSymbol:()=>SC,$ZodSuccess:()=>zC,$ZodStringFormat:()=>Ke,$ZodString:()=>ks,$ZodSet:()=>$C,$ZodRegistry:()=>ss,$ZodRecord:()=>OC,$ZodRealError:()=>ws,$ZodReadonly:()=>JC,$ZodPromise:()=>HC,$ZodPrefault:()=>UC,$ZodPipe:()=>fh,$ZodOptional:()=>qC,$ZodObject:()=>lh,$ZodNumberFormat:()=>bC,$ZodNumber:()=>ah,$ZodNullable:()=>DC,$ZodNull:()=>xC,$ZodNonOptional:()=>FC,$ZodNever:()=>TC,$ZodNanoID:()=>X0,$ZodNaN:()=>KC,$ZodMap:()=>AC,$ZodLiteral:()=>jC,$ZodLazy:()=>GC,$ZodKSUID:()=>iC,$ZodJWT:()=>_C,$ZodIntersection:()=>RC,$ZodISOTime:()=>sC,$ZodISODuration:()=>dC,$ZodISODateTime:()=>oC,$ZodISODate:()=>aC,$ZodIPv6:()=>lC,$ZodIPv4:()=>uC,$ZodGUID:()=>G0,$ZodFunction:()=>Nu,$ZodFile:()=>NC,$ZodError:()=>Gm,$ZodEnum:()=>MC,$ZodEmoji:()=>Y0,$ZodEmail:()=>Z0,$ZodE164:()=>gC,$ZodDiscriminatedUnion:()=>EC,$ZodDefault:()=>LC,$ZodDate:()=>PC,$ZodCustomStringFormat:()=>vC,$ZodCustom:()=>VC,$ZodCheckUpperCase:()=>U0,$ZodCheckStringFormat:()=>Ss,$ZodCheckStartsWith:()=>z0,$ZodCheckSizeEquals:()=>M0,$ZodCheckRegex:()=>D0,$ZodCheckProperty:()=>K0,$ZodCheckOverwrite:()=>W0,$ZodCheckNumberFormat:()=>R0,$ZodCheckMultipleOf:()=>E0,$ZodCheckMinSize:()=>$0,$ZodCheckMinLength:()=>N0,$ZodCheckMimeType:()=>J0,$ZodCheckMaxSize:()=>A0,$ZodCheckMaxLength:()=>j0,$ZodCheckLowerCase:()=>L0,$ZodCheckLessThan:()=>rh,$ZodCheckLengthEquals:()=>q0,$ZodCheckIncludes:()=>F0,$ZodCheckGreaterThan:()=>ih,$ZodCheckEndsWith:()=>B0,$ZodCheckBigIntFormat:()=>O0,$ZodCheck:()=>at,$ZodCatch:()=>BC,$ZodCUID2:()=>tC,$ZodCUID:()=>eC,$ZodCIDRv6:()=>pC,$ZodCIDRv4:()=>cC,$ZodBoolean:()=>sh,$ZodBigIntFormat:()=>wC,$ZodBigInt:()=>dh,$ZodBase64URL:()=>hC,$ZodBase64:()=>fC,$ZodAsyncError:()=>Cr,$ZodArray:()=>uh,$ZodAny:()=>CC});qx=Object.freeze({status:"aborted"});Dx=Symbol("zod_brand"),Cr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pu={};Ee={};zn(Ee,{unwrapMessage:()=>Ia,stringifyPrimitive:()=>Ce,required:()=>sJ,randomString:()=>YK,propertyKeyTypes:()=>Eu,promiseAllObject:()=>QK,primitiveTypes:()=>zx,prefixIssues:()=>cn,pick:()=>nJ,partial:()=>aJ,optionalKeys:()=>Bx,omit:()=>rJ,numKeys:()=>XK,nullish:()=>ai,normalizeParams:()=>Q,merge:()=>oJ,jsonStringifyReplacer:()=>Lx,joinValues:()=>te,issue:()=>Wx,isPlainObject:()=>as,isObject:()=>os,getSizableOrigin:()=>xl,getParsedType:()=>eJ,getLengthableOrigin:()=>Cl,getEnumValues:()=>Jm,getElementAtPath:()=>ZK,floatSafeRemainder:()=>Ux,finalizeIssue:()=>En,extend:()=>iJ,escapeRegex:()=>si,esc:()=>Mi,defineLazy:()=>qe,createTransparentProxy:()=>tJ,clone:()=>$n,cleanRegex:()=>kl,cleanEnum:()=>dJ,captureStackTrace:()=>Hm,cached:()=>Sl,assignProp:()=>Wm,assertNotEqual:()=>WK,assertNever:()=>GK,assertIs:()=>HK,assertEqual:()=>JK,assert:()=>VK,allowsEval:()=>Fx,aborted:()=>Ui,NUMBER_FORMAT_RANGES:()=>Kx,Class:()=>Cf,BIGINT_FORMAT_RANGES:()=>Jx});Hm=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};Fx=Sl(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});eJ=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw Error(`Unknown data type: ${t}`)}},Eu=new Set(["string","number","symbol"]),zx=new Set(["string","number","bigint","boolean","symbol","undefined"]);Kx={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Jx={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Cf=class{constructor(...t){}},Hx=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Lx,2)},enumerable:!0})},Gm=N("$ZodError",Hx),ws=N("$ZodError",Hx,{Parent:Error});Qm=e=>(t,n,i,r)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Cr;if(a.issues.length){let s=new(r?.Err??e)(a.issues.map(d=>En(d,o,At())));throw Hm(s,r?.callee),s}return a.value},Ru=Qm(ws),Ym=e=>async(t,n,i,r)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??e)(a.issues.map(d=>En(d,o,At())));throw Hm(s,r?.callee),s}return a.value},Ou=Ym(ws),Xm=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Cr;return o.issues.length?{success:!1,error:new(e??Gm)(o.issues.map(a=>En(a,r,At())))}:{success:!0,data:o.value}},Tl=Xm(ws),eh=e=>async(t,n,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>En(a,r,At())))}:{success:!0,data:o.value}},Il=eh(ws),th={};zn(th,{xid:()=>e0,uuid7:()=>pJ,uuid6:()=>cJ,uuid4:()=>lJ,uuid:()=>lo,uppercase:()=>I0,unicodeEmail:()=>hJ,undefined:()=>C0,ulid:()=>Xx,time:()=>y0,string:()=>v0,rfc5322Email:()=>mJ,number:()=>S0,null:()=>x0,nanoid:()=>n0,lowercase:()=>T0,ksuid:()=>t0,ipv6:()=>d0,ipv4:()=>s0,integer:()=>w0,html5Email:()=>fJ,hostname:()=>p0,guid:()=>i0,extendedDuration:()=>uJ,emoji:()=>a0,email:()=>o0,e164:()=>f0,duration:()=>r0,domain:()=>_J,datetime:()=>_0,date:()=>h0,cuid2:()=>Yx,cuid:()=>Qx,cidrv6:()=>l0,cidrv4:()=>u0,browserEmail:()=>gJ,boolean:()=>k0,bigint:()=>b0,base64url:()=>nh,base64:()=>c0,_emoji:()=>yJ});Qx=/^[cC][^\s-]{8,}$/,Yx=/^[0-9a-z]+$/,Xx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e0=/^[0-9a-vA-V]{20}$/,t0=/^[A-Za-z0-9]{27}$/,n0=/^[a-zA-Z0-9_-]{21}$/,r0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uJ=/^[-+]?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)?)??$/,i0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,lJ=lo(4),cJ=lo(6),pJ=lo(7),o0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fJ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,mJ=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,hJ=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,gJ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";s0=/^(?:(?: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])$/,d0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,u0=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,l0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,c0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nh=/^[A-Za-z0-9_-]*$/,p0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,_J=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,f0=/^\+(?:[0-9]){6,14}[0-9]$/,m0="(?:(?:\\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])))",h0=new RegExp(`^${m0}$`);v0=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},b0=/^\d+n?$/,w0=/^\d+$/,S0=/^-?\d+(?:\.\d+)?/i,k0=/true|false/i,x0=/null/i,C0=/undefined/i,T0=/^[^A-Z]*$/,I0=/^[^a-z]*$/,at=N("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),P0={number:"number",bigint:"bigint",object:"date"},rh=N("$ZodCheckLessThan",(e,t)=>{at.init(e,t);let n=P0[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ih=N("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);let n=P0[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),E0=N("$ZodCheckMultipleOf",(e,t)=>{at.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ux(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),R0=N("$ZodCheckNumberFormat",(e,t)=>{at.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=Kx[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=r,s.maximum=o,n&&(s.pattern=w0)}),e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:e})}}),O0=N("$ZodCheckBigIntFormat",(e,t)=>{at.init(e,t);let[n,i]=Jx[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:e})}}),A0=N("$ZodCheckMaxSize",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:xl(i),code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),$0=N("$ZodCheckMinSize",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:xl(i),code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),M0=N("$ZodCheckSizeEquals",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,r=i.size;if(r===t.size)return;let o=r>t.size;n.issues.push({origin:xl(i),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),j0=N("$ZodCheckMaxLength",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let r=Cl(i);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),N0=N("$ZodCheckMinLength",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let r=Cl(i);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),q0=N("$ZodCheckLengthEquals",(e,t)=>{at.init(e,t),e._zod.when=n=>{let i=n.value;return!ai(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,r=i.length;if(r===t.length)return;let o=Cl(i),a=r>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ss=N("$ZodCheckStringFormat",(e,t)=>{var n,i;at.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),D0=N("$ZodCheckRegex",(e,t)=>{Ss.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),L0=N("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=T0),Ss.init(e,t)}),U0=N("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=I0),Ss.init(e,t)}),F0=N("$ZodCheckIncludes",(e,t)=>{at.init(e,t);let n=si(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),z0=N("$ZodCheckStartsWith",(e,t)=>{at.init(e,t);let n=new RegExp(`^${si(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),B0=N("$ZodCheckEndsWith",(e,t)=>{at.init(e,t);let n=new RegExp(`.*${si(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});K0=N("$ZodCheckProperty",(e,t)=>{at.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>_w(r,n,t.property));_w(i,n,t.property)}}),J0=N("$ZodCheckMimeType",(e,t)=>{at.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e})}}),W0=N("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}}),Au=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
89
89
|
`).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),r=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of r)this.content.push(o)}compile(){let t=Function,n=this?.args,i=[...(this?.content??[""]).map(r=>` ${r}`)];return new t(...n,i.join(`
|
|
90
90
|
`))}},H0={major:4,minor:0,patch:0},ve=N("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=H0;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(o,a,s)=>{let d=Ui(o),u;for(let l of a){if(l._zod.when){if(!l._zod.when(o))continue}else if(d)continue;let p=o.issues.length,m=l._zod.check(o);if(m instanceof Promise&&s?.async===!1)throw new Cr;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await m,o.issues.length!==p&&(d||(d=Ui(o,p)))});else{if(o.issues.length===p)continue;d||(d=Ui(o,p))}}return u?u.then(()=>o):o};e._zod.run=(o,a)=>{let s=e._zod.parse(o,a);if(s instanceof Promise){if(a.async===!1)throw new Cr;return s.then(d=>r(d,i,a))}return r(s,i,a)}}e["~standard"]={validate:r=>{try{let o=Tl(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Il(e,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),ks=N("$ZodString",(e,t)=>{ve.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??v0(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ke=N("$ZodStringFormat",(e,t)=>{Ss.init(e,t),ks.init(e,t)}),G0=N("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=i0),Ke.init(e,t)}),V0=N("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lo(n))}else t.pattern??(t.pattern=lo());Ke.init(e,t)}),Z0=N("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=o0),Ke.init(e,t)}),Q0=N("$ZodURL",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{try{let i=n.value,r=new URL(i),o=r.href;t.hostname&&(t.hostname.lastIndex=0,!t.hostname.test(r.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:p0.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!i.endsWith("/")&&o.endsWith("/")?n.value=o.slice(0,-1):n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Y0=N("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=a0()),Ke.init(e,t)}),X0=N("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=n0),Ke.init(e,t)}),eC=N("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qx),Ke.init(e,t)}),tC=N("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Yx),Ke.init(e,t)}),nC=N("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xx),Ke.init(e,t)}),rC=N("$ZodXID",(e,t)=>{t.pattern??(t.pattern=e0),Ke.init(e,t)}),iC=N("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=t0),Ke.init(e,t)}),oC=N("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_0(t)),Ke.init(e,t)}),aC=N("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=h0),Ke.init(e,t)}),sC=N("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=y0(t)),Ke.init(e,t)}),dC=N("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=r0),Ke.init(e,t)}),uC=N("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=s0),Ke.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format="ipv4"})}),lC=N("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=d0),Ke.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),cC=N("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=u0),Ke.init(e,t)}),pC=N("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=l0),Ke.init(e,t),e._zod.check=n=>{let[i,r]=n.value.split("/");try{if(!r)throw Error();let o=Number(r);if(`${o}`!==r||o<0||o>128)throw Error();new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});fC=N("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=c0),Ke.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{oh(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});hC=N("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nh),Ke.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{mC(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),gC=N("$ZodE164",(e,t)=>{t.pattern??(t.pattern=f0),Ke.init(e,t)});_C=N("$ZodJWT",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{yC(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),vC=N("$ZodCustomStringFormat",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),ah=N("$ZodNumber",(e,t)=>{ve.init(e,t),e._zod.pattern=e._zod.bag.pattern??S0,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}}),bC=N("$ZodNumber",(e,t)=>{R0.init(e,t),ah.init(e,t)}),sh=N("$ZodBoolean",(e,t)=>{ve.init(e,t),e._zod.pattern=k0,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),dh=N("$ZodBigInt",(e,t)=>{ve.init(e,t),e._zod.pattern=b0,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),wC=N("$ZodBigInt",(e,t)=>{O0.init(e,t),dh.init(e,t)}),SC=N("$ZodSymbol",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),kC=N("$ZodUndefined",(e,t)=>{ve.init(e,t),e._zod.pattern=C0,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),xC=N("$ZodNull",(e,t)=>{ve.init(e,t),e._zod.pattern=x0,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),CC=N("$ZodAny",(e,t)=>{ve.init(e,t),e._zod.parse=n=>n}),$u=N("$ZodUnknown",(e,t)=>{ve.init(e,t),e._zod.parse=n=>n}),TC=N("$ZodNever",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),IC=N("$ZodVoid",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),PC=N("$ZodDate",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});uh=N("$ZodArray",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let a=0;a<r.length;a++){let s=r[a],d=t.element._zod.run({value:s,issues:[]},i);d instanceof Promise?o.push(d.then(u=>vw(u,n,a))):vw(d,n,a)}return o.length?Promise.all(o).then(()=>n):n}});lh=N("$ZodObject",(e,t)=>{ve.init(e,t);let n=Sl(()=>{let l=Object.keys(t.shape);for(let m of l)if(!(t.shape[m]instanceof ve))throw Error(`Invalid element at key "${m}": expected a Zod schema`);let p=Bx(t.shape);return{shape:t.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(p)}});qe(e._zod,"propValues",()=>{let l=t.shape,p={};for(let m in l){let f=l[m]._zod;if(f.values){p[m]??(p[m]=new Set);for(let h of f.values)p[m].add(h)}}return p});let i=l=>{let p=new Au(["shape","payload","ctx"]),m=n.value,f=g=>{let v=Mi(g);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};p.write("const input = payload.value;");let h=Object.create(null),y=0;for(let g of m.keys)h[g]=`key_${y++}`;p.write("const newResult = {}");for(let g of m.keys)if(m.optionalKeys.has(g)){let v=h[g];p.write(`const ${v} = ${f(g)};`);let b=Mi(g);p.write(`
|
|
91
91
|
if (${v}.issues.length) {
|
|
@@ -112,14 +112,14 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
|
112
112
|
path: iss.path ? [${Mi(g)}, ...iss.path] : [${Mi(g)}]
|
|
113
113
|
})));`),p.write(`newResult[${Mi(g)}] = ${v}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");let w=p.compile();return(g,v)=>w(l,g,v)},r,o=os,a=!Pu.jitless,s=a&&Fx.value,d=t.catchall,u;e._zod.parse=(l,p)=>{u??(u=n.value);let m=l.value;if(!o(m))return l.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),l;let f=[];if(a&&s&&p?.async===!1&&p.jitless!==!0)r||(r=i(t.shape)),l=r(l,p);else{l.value={};let v=u.shape;for(let b of u.keys){let S=v[b],T=S._zod.run({value:m[b],issues:[]},p),C=S._zod.optin==="optional"&&S._zod.optout==="optional";T instanceof Promise?f.push(T.then(_=>C?bw(_,l,b,m):kd(_,l,b))):C?bw(T,l,b,m):kd(T,l,b)}}if(!d)return f.length?Promise.all(f).then(()=>l):l;let h=[],y=u.keySet,w=d._zod,g=w.def.type;for(let v of Object.keys(m)){if(y.has(v))continue;if(g==="never"){h.push(v);continue}let b=w.run({value:m[v],issues:[]},p);b instanceof Promise?f.push(b.then(S=>kd(S,l,v))):kd(b,l,v)}return h.length&&l.issues.push({code:"unrecognized_keys",keys:h,input:m,inst:e}),f.length?Promise.all(f).then(()=>l):l}});ch=N("$ZodUnion",(e,t)=>{ve.init(e,t),qe(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),qe(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),qe(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),qe(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>kl(i.source)).join("|")})$`)}}),e._zod.parse=(n,i)=>{let r=!1,o=[];for(let a of t.options){let s=a._zod.run({value:n.value,issues:[]},i);if(s instanceof Promise)o.push(s),r=!0;else{if(s.issues.length===0)return s;o.push(s)}}return r?Promise.all(o).then(a=>ww(a,n,e,i)):ww(o,n,e,i)}}),EC=N("$ZodDiscriminatedUnion",(e,t)=>{ch.init(e,t);let n=e._zod.parse;qe(e._zod,"propValues",()=>{let r={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,d]of Object.entries(a)){r[s]||(r[s]=new Set);for(let u of d)r[s].add(u)}}return r});let i=Sl(()=>{let r=t.options,o=new Map;for(let a of r){let s=a._zod.propValues[t.discriminator];if(!s||s.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let d of s){if(o.has(d))throw Error(`Duplicate discriminator value "${String(d)}"`);o.set(d,a)}}return o});e._zod.parse=(r,o)=>{let a=r.value;if(!os(a))return r.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),r;let s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(r,o):t.unionFallback?n(r,o):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[t.discriminator],inst:e}),r)}}),RC=N("$ZodIntersection",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,o=t.left._zod.run({value:r,issues:[]},i),a=t.right._zod.run({value:r,issues:[]},i);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([s,d])=>Sw(n,s,d)):Sw(n,o,a)}});Pl=N("$ZodTuple",(e,t)=>{ve.init(e,t);let n=t.items,i=n.length-[...n].reverse().findIndex(r=>r._zod.optin!=="optional");e._zod.parse=(r,o)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let s=[];if(!t.rest){let u=a.length>n.length,l=a.length<i-1;if(u||l)return r.issues.push({input:a,inst:e,origin:"array",...u?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length}}),r}let d=-1;for(let u of n){if(d++,d>=a.length&&d>=i)continue;let l=u._zod.run({value:a[d],issues:[]},o);l instanceof Promise?s.push(l.then(p=>xd(p,r,d))):xd(l,r,d)}if(t.rest){let u=a.slice(n.length);for(let l of u){d++;let p=t.rest._zod.run({value:l,issues:[]},o);p instanceof Promise?s.push(p.then(m=>xd(m,r,d))):xd(p,r,d)}}return s.length?Promise.all(s).then(()=>r):r}});OC=N("$ZodRecord",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!as(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let o=[];if(t.keyType._zod.values){let a=t.keyType._zod.values;n.value={};for(let d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){let u=t.valueType._zod.run({value:r[d],issues:[]},i);u instanceof Promise?o.push(u.then(l=>{l.issues.length&&n.issues.push(...cn(d,l.issues)),n.value[d]=l.value})):(u.issues.length&&n.issues.push(...cn(d,u.issues)),n.value[d]=u.value)}let s;for(let d in r)a.has(d)||(s=s??[],s.push(d));s&&s.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:s})}else{n.value={};for(let a of Reflect.ownKeys(r)){if(a==="__proto__")continue;let s=t.keyType._zod.run({value:a,issues:[]},i);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(u=>En(u,i,At())),input:a,path:[a],inst:e}),n.value[s.value]=s.value;continue}let d=t.valueType._zod.run({value:r[a],issues:[]},i);d instanceof Promise?o.push(d.then(u=>{u.issues.length&&n.issues.push(...cn(a,u.issues)),n.value[s.value]=u.value})):(d.issues.length&&n.issues.push(...cn(a,d.issues)),n.value[s.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}}),AC=N("$ZodMap",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let o=[];n.value=new Map;for(let[a,s]of r){let d=t.keyType._zod.run({value:a,issues:[]},i),u=t.valueType._zod.run({value:s,issues:[]},i);d instanceof Promise||u instanceof Promise?o.push(Promise.all([d,u]).then(([l,p])=>{kw(l,p,n,a,r,e,i)})):kw(d,u,n,a,r,e,i)}return o.length?Promise.all(o).then(()=>n):n}});$C=N("$ZodSet",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let o=[];n.value=new Set;for(let a of r){let s=t.valueType._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(d=>xw(d,n))):xw(s,n)}return o.length?Promise.all(o).then(()=>n):n}});MC=N("$ZodEnum",(e,t)=>{ve.init(e,t);let n=Jm(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(i=>Eu.has(typeof i)).map(i=>typeof i=="string"?si(i):i.toString()).join("|")})$`),e._zod.parse=(i,r)=>{let o=i.value;return e._zod.values.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),jC=N("$ZodLiteral",(e,t)=>{ve.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?si(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),NC=N("$ZodFile",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),ph=N("$ZodTransform",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then(o=>(n.value=o,n));if(r instanceof Promise)throw new Cr;return n.value=r,n}}),qC=N("$ZodOptional",(e,t)=>{ve.init(e,t),e._zod.optin="optional",e._zod.optout="optional",qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),qe(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${kl(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,i):n.value===void 0?n:t.innerType._zod.run(n,i)}),DC=N("$ZodNullable",(e,t)=>{ve.init(e,t),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${kl(n.source)}|null)$`):void 0}),qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),LC=N("$ZodDefault",(e,t)=>{ve.init(e,t),e._zod.optin="optional",qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Cw(o,t)):Cw(r,t)}});UC=N("$ZodPrefault",(e,t)=>{ve.init(e,t),e._zod.optin="optional",qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),FC=N("$ZodNonOptional",(e,t)=>{ve.init(e,t),qe(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>Tw(o,e)):Tw(r,e)}});zC=N("$ZodSuccess",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.issues.length===0,n)):(n.value=r.issues.length===0,n)}}),BC=N("$ZodCatch",(e,t)=>{ve.init(e,t),e._zod.optin="optional",qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>En(a,i,At()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(o=>En(o,i,At()))},input:n.value}),n.issues=[]),n)}}),KC=N("$ZodNaN",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),fh=N("$ZodPipe",(e,t)=>{ve.init(e,t),qe(e._zod,"values",()=>t.in._zod.values),qe(e._zod,"optin",()=>t.in._zod.optin),qe(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,i)=>{let r=t.in._zod.run(n,i);return r instanceof Promise?r.then(o=>Iw(o,t,i)):Iw(r,t,i)}});JC=N("$ZodReadonly",(e,t)=>{ve.init(e,t),qe(e._zod,"propValues",()=>t.innerType._zod.propValues),qe(e._zod,"values",()=>t.innerType._zod.values),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(Pw):Pw(r)}});WC=N("$ZodTemplateLiteral",(e,t)=>{ve.init(e,t);let n=[];for(let i of t.parts)if(i instanceof ve){if(!i._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let r=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!r)throw Error(`Invalid template literal part: ${i._zod.traits}`);let o=r.startsWith("^")?1:0,a=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(o,a))}else if(i===null||zx.has(typeof i))n.push(si(`${i}`));else throw Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(i,r)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"template_literal",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:"template_literal",pattern:e._zod.pattern.source}),i)}),HC=N("$ZodPromise",(e,t)=>{ve.init(e,t),e._zod.parse=(n,i)=>Promise.resolve(n.value).then(r=>t.innerType._zod.run({value:r,issues:[]},i))}),GC=N("$ZodLazy",(e,t)=>{ve.init(e,t),qe(e._zod,"innerType",()=>t.getter()),qe(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),qe(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),qe(e._zod,"optin",()=>e._zod.innerType._zod.optin),qe(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(n,i)=>e._zod.innerType._zod.run(n,i)}),VC=N("$ZodCustom",(e,t)=>{at.init(e,t),ve.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then(o=>Ew(o,n,i,e));Ew(r,n,i,e)}});mh={};zn(mh,{zhTW:()=>K6,zhCN:()=>z6,vi:()=>U6,ur:()=>D6,ua:()=>N6,tr:()=>M6,th:()=>O6,ta:()=>E6,sv:()=>I6,sl:()=>C6,ru:()=>k6,pt:()=>w6,ps:()=>y6,pl:()=>v6,ota:()=>h6,no:()=>f6,nl:()=>c6,ms:()=>u6,mk:()=>s6,ko:()=>o6,kh:()=>r6,ja:()=>t6,it:()=>XJ,id:()=>QJ,hu:()=>VJ,he:()=>HJ,frCA:()=>JJ,fr:()=>BJ,fi:()=>FJ,fa:()=>LJ,es:()=>qJ,eo:()=>jJ,en:()=>ZC,de:()=>RJ,cs:()=>PJ,ca:()=>TJ,be:()=>xJ,az:()=>SJ,ar:()=>bJ});vJ=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return r=>{switch(r.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${r.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Ce(r.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${r.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${i[o.format]??r.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${r.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${r.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${r.keys.length>1?"\u0629":""}: ${te(r.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};wJ=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Ce(r.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${i[o.format]??r.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${r.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${r.keys.length>1?"lar":""}: ${te(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${r.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};kJ=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(r))return"\u043C\u0430\u0441\u0456\u045E";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return r=>{switch(r.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${r.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Ce(r.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),d=Rw(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.maximum.toString()} ${d}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),d=Rw(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.minimum.toString()} ${d}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${i[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${r.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${te(r.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${r.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};CJ=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Valor inv\xE0lid: s'esperava ${Ce(r.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${te(r.values," o ")}`;case"too_big":{let o=r.inclusive?"com a m\xE0xim":"menys de",a=t(r.origin);return a?`Massa gran: s'esperava que ${r.origin??"el valor"} contingu\xE9s ${o} ${r.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(r.origin);return a?`Massa petit: s'esperava que ${r.origin} contingu\xE9s ${o} ${r.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${i[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${r.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${r.origin}`;default:return"Entrada inv\xE0lida"}}};IJ=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return r=>{switch(r.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${r.expected}, obdr\u017Eeno ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Ce(r.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${i[o.format]??r.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${r.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${te(r.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${r.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${r.origin}`;default:return"Neplatn\xFD vstup"}}};EJ=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return r=>{switch(r.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ung\xFCltige Eingabe: erwartet ${Ce(r.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ist`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ist`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${te(r.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${r.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${r.origin}`;default:return"Ung\xFCltige Eingabe"}}};OJ=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},AJ=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${OJ(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ce(i.values[0])}`:`Invalid option: expected one of ${te(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${r}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);return o?`Too small: expected ${i.origin} to have ${r}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;return r.format==="starts_with"?`Invalid string: must start with "${r.prefix}"`:r.format==="ends_with"?`Invalid string: must end with "${r.suffix}"`:r.format==="includes"?`Invalid string: must include "${r.includes}"`:r.format==="regex"?`Invalid string: must match pattern ${r.pattern}`:`Invalid ${n[r.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${te(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};$J=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},MJ=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(i){return e[i]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return i=>{switch(i.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${i.expected}, ricevi\u011Dis ${$J(i.input)}`;case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${Ce(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${te(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);return o?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);return o?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${r}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;return r.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${r.prefix}"`:r.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${r.suffix}"`:r.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${r.includes}"`:r.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`:`Nevalida ${n[r.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${te(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};NJ=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(r))return"arreglo";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype)return r.constructor.name}}return o},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${r.expected}, recibido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: se esperaba ${Ce(r.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Demasiado grande: se esperaba que ${r.origin??"valor"} tuviera ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${r.origin??"valor"} fuera ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Demasiado peque\xF1o: se esperaba que ${r.origin} tuviera ${o}${r.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${r.origin} fuera ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${i[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Llave${r.keys.length>1?"s":""} desconocida${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${r.origin}`;default:return"Entrada inv\xE1lida"}}};DJ=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(r))return"\u0622\u0631\u0627\u06CC\u0647";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return r=>{switch(r.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${r.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${n(r.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return r.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Ce(r.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${te(r.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${i[o.format]??r.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${r.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${r.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${te(r.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${r.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${r.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};UJ=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return r=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Ce(r.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${o}${r.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${o}${r.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${i[o.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${te(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};zJ=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return r=>{switch(r.code){case"invalid_type":return`Entr\xE9e invalide : ${r.expected} attendu, ${n(r.input)} re\xE7u`;case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : ${Ce(r.values[0])} attendu`:`Option invalide : une valeur parmi ${te(r.values,"|")} attendue`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Trop grand : ${r.origin??"valeur"} doit ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${r.origin??"valeur"} doit \xEAtre ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Trop petit : ${r.origin} doit ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : ${r.origin} doit \xEAtre ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${te(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};KJ=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return r=>{switch(r.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${r.expected}, re\xE7u ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : attendu ${Ce(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u2264":"<",a=t(r.origin);return a?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${o}${r.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u2265":">",a=t(r.origin);return a?`Trop petit : attendu que ${r.origin} ait ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${r.origin} soit ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${te(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};WJ=()=>{let e={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return r=>{switch(r.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${r.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${Ce(r.values[0])}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${r.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${r.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${r.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.minimum.toString()} ${a.unit}`:`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${r.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${o.prefix}"`:o.format==="ends_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${o.suffix}"`:o.format==="includes"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${o.includes}"`:o.format==="regex"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${o.pattern}`:`${i[o.format]??r.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${r.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${r.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${r.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${te(r.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};GJ=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(r))return"t\xF6mb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return r=>{switch(r.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${r.expected}, a kapott \xE9rt\xE9k ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Ce(r.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`T\xFAl nagy: ${r.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${r.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${r.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} m\xE9rete t\xFAl kicsi ${o}${r.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} t\xFAl kicsi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${i[o.format]??r.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${r.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${r.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${r.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};ZJ=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${Ce(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: diharapkan ${r.origin} memiliki ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${i[o.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};YJ=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input non valido: atteso ${Ce(r.values[0])}`:`Opzione non valida: atteso uno tra ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Troppo grande: ${r.origin??"valore"} deve avere ${o}${r.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Troppo piccolo: ${r.origin} deve avere ${o}${r.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${r.origin} deve essere ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${te(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};e6=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(r))return"\u914D\u5217";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return r=>{switch(r.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${r.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${n(r.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return r.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${Ce(r.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${te(r.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=r.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(r.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${a.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=r.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(r.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${a.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${i[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${r.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${r.keys.length>1?"\u7FA4":""}: ${te(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};n6=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(r))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(r===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return r=>{switch(r.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${Ce(r.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${r.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${te(r.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};i6=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return r=>{switch(r.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${r.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${n(r.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return r.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${Ce(r.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${te(r.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=r.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),d=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()}${d} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()} ${o}${a}`}case"too_small":{let o=r.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),d=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()}${d} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()} ${o}${a}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${i[o.format]??r.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${r.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${te(r.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${r.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${r.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};a6=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(r))return"\u043D\u0438\u0437\u0430";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return r=>{switch(r.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${Ce(r.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${te(r.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${r.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${r.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};d6=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${Ce(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: dijangka ${r.origin??"nilai"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: dijangka ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${i[o.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${te(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};l6=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return r=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${Ce(r.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} is`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} is`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};p6=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${Ce(r.values[0])}`:`Ugyldig valg: forventet en av ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${i[o.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${te(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};m6=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return r=>{switch(r.code){case"invalid_type":return`F\xE2sit giren: umulan ${r.expected}, al\u0131nan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`F\xE2sit giren: umulan ${Ce(r.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=r;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${i[o.format]??r.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${r.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${r.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};g6=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(r))return"\u0627\u0631\u06D0";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return r=>{switch(r.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${r.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${n(r.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return r.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${Ce(r.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${te(r.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0648\u064A`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${i[o.format]??r.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${r.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${r.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${te(r.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${r.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${r.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};_6=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return r=>{switch(r.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${Ce(r.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${i[o.format]??r.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${r.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${r.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};b6=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: esperado ${Ce(r.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Muito pequeno: esperado que ${r.origin} tivesse ${o}${r.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${i[o.format]??r.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${te(r.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${r.origin}`;default:return"Campo inv\xE1lido"}}};S6=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(r))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return r=>{switch(r.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${Ce(r.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),d=Ow(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.maximum.toString()} ${d}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),d=Ow(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.minimum.toString()} ${d}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${r.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0438":""}: ${te(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};x6=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return r=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${Ce(r.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} imelo ${o}${r.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${r.origin} imelo ${o}${r.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${i[o.format]??r.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${te(r.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};T6=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return r=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${Ce(r.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${i[o.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${te(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${r.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};P6=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(r))return"\u0B85\u0BA3\u0BBF";if(r===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Ce(r.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${te(r.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${r.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${r.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${te(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};R6=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(r))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(r===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return r=>{switch(r.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${r.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${Ce(r.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${i[o.format]??r.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${r.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${te(r.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};A6=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},$6=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(i){return e[i]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${i.expected}, al\u0131nan ${A6(i.input)}`;case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Ce(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${te(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);return o?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${r}${i.maximum.toString()} ${o.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);return o?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${r}${i.minimum.toString()} ${o.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;return r.format==="starts_with"?`Ge\xE7ersiz metin: "${r.prefix}" ile ba\u015Flamal\u0131`:r.format==="ends_with"?`Ge\xE7ersiz metin: "${r.suffix}" ile bitmeli`:r.format==="includes"?`Ge\xE7ersiz metin: "${r.includes}" i\xE7ermeli`:r.format==="regex"?`Ge\xE7ersiz metin: ${r.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${n[r.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${te(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};j6=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(r))return"\u043C\u0430\u0441\u0438\u0432";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return r=>{switch(r.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${r.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${Ce(r.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} \u0431\u0443\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0456":""}: ${te(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${r.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};q6=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(r))return"\u0622\u0631\u06D2";if(r===null)return"\u0646\u0644";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return r=>{switch(r.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${r.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${n(r.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return r.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${Ce(r.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${te(r.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${r.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u06D2 ${o}${r.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u0627 ${o}${r.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${r.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${r.keys.length>1?"\u0632":""}: ${te(r.keys,"\u060C ")}`;case"invalid_key":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};L6=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(r))return"m\u1EA3ng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return r=>{switch(r.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${r.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Ce(r.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${i[o.format]??r.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${r.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${te(r.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};F6=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(r))return"\u6570\u7EC4";if(r===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return r=>{switch(r.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${r.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Ce(r.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${i[o.format]??r.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${r.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${te(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${r.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};B6=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return r=>{switch(r.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${r.expected}\uFF0C\u4F46\u6536\u5230 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${Ce(r.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${te(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${r.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${r.keys.length>1?"\u5011":""}\uFF1A${te(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};QC=Symbol("ZodOutput"),YC=Symbol("ZodInput"),ss=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let i=n[0];if(this._map.set(t,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,t)}return this}remove(t){return this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let i={...this.get(n)??{}};return delete i.id,{...i,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};rr=hh();tT={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};Nu=class{constructor(t){this._def=t,this.def=t}implement(t){if(typeof t!="function")throw Error("implement() must be called with a function");let n=(...i)=>{let r=this._def.input?Ru(this._def.input,i,void 0,{callee:n}):i;if(!Array.isArray(r))throw Error("Invalid arguments schema: not an array or tuple schema.");let o=t(...r);return this._def.output?Ru(this._def.output,o,void 0,{callee:n}):o};return n}implementAsync(t){if(typeof t!="function")throw Error("implement() must be called with a function");let n=async(...i)=>{let r=this._def.input?await Ou(this._def.input,i,void 0,{callee:n}):i;if(!Array.isArray(r))throw Error("Invalid arguments schema: not an array or tuple schema.");let o=await t(...r);return this._def.output?Ou(this._def.output,o,void 0,{callee:n}):o};return n}input(...t){let n=this.constructor;return Array.isArray(t[0])?new n({type:"function",input:new Pl({type:"tuple",items:t[0],rest:t[1]}),output:this._def.output}):new n({type:"function",input:t[0],output:this._def.output})}output(t){return new this.constructor({type:"function",input:this._def.input,output:t})}};ls=class{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??rr,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var i;let r=t._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(t);if(a)return a.count++,n.schemaPath.includes(t)&&(a.cycle=n.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,s);let d=t._zod.toJSONSchema?.();if(d)s.schema=d;else{let l={...n,schemaPath:[...n.schemaPath,t],path:n.path},p=t._zod.parent;if(p)s.ref=p,this.process(p,l),this.seen.get(p).isParent=!0;else{let m=s.schema;switch(r.type){case"string":{let f=m;f.type="string";let{minimum:h,maximum:y,format:w,patterns:g,contentEncoding:v}=t._zod.bag;if(typeof h=="number"&&(f.minLength=h),typeof y=="number"&&(f.maxLength=y),w&&(f.format=o[w]??w,f.format===""&&delete f.format),v&&(f.contentEncoding=v),g&&g.size>0){let b=[...g];b.length===1?f.pattern=b[0].source:b.length>1&&(s.schema.allOf=[...b.map(S=>({...this.target==="draft-7"?{type:"string"}:{},pattern:S.source}))])}break}case"number":{let f=m,{minimum:h,maximum:y,format:w,multipleOf:g,exclusiveMaximum:v,exclusiveMinimum:b}=t._zod.bag;typeof w=="string"&&w.includes("int")?f.type="integer":f.type="number",typeof b=="number"&&(f.exclusiveMinimum=b),typeof h=="number"&&(f.minimum=h,typeof b=="number"&&(b>=h?delete f.minimum:delete f.exclusiveMinimum)),typeof v=="number"&&(f.exclusiveMaximum=v),typeof y=="number"&&(f.maximum=y,typeof v=="number"&&(v<=y?delete f.maximum:delete f.exclusiveMaximum)),typeof g=="number"&&(f.multipleOf=g);break}case"boolean":{let f=m;f.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":case"never":{m.not={};break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let f=m,{minimum:h,maximum:y}=t._zod.bag;typeof h=="number"&&(f.minItems=h),typeof y=="number"&&(f.maxItems=y),f.type="array",f.items=this.process(r.element,{...l,path:[...l.path,"items"]});break}case"object":{let f=m;f.type="object",f.properties={};let h=r.shape;for(let g in h)f.properties[g]=this.process(h[g],{...l,path:[...l.path,"properties",g]});let y=new Set(Object.keys(h)),w=new Set([...y].filter(g=>{let v=r.shape[g]._zod;return this.io==="input"?v.optin===void 0:v.optout===void 0}));w.size>0&&(f.required=Array.from(w)),r.catchall?._zod.def.type==="never"?f.additionalProperties=!1:r.catchall?r.catchall&&(f.additionalProperties=this.process(r.catchall,{...l,path:[...l.path,"additionalProperties"]})):this.io==="output"&&(f.additionalProperties=!1);break}case"union":{let f=m;f.anyOf=r.options.map((h,y)=>this.process(h,{...l,path:[...l.path,"anyOf",y]}));break}case"intersection":{let f=m,h=this.process(r.left,{...l,path:[...l.path,"allOf",0]}),y=this.process(r.right,{...l,path:[...l.path,"allOf",1]}),w=v=>"allOf"in v&&Object.keys(v).length===1,g=[...w(h)?h.allOf:[h],...w(y)?y.allOf:[y]];f.allOf=g;break}case"tuple":{let f=m;f.type="array";let h=r.items.map((g,v)=>this.process(g,{...l,path:[...l.path,"prefixItems",v]}));if(this.target==="draft-2020-12"?f.prefixItems=h:f.items=h,r.rest){let g=this.process(r.rest,{...l,path:[...l.path,"items"]});this.target==="draft-2020-12"?f.items=g:f.additionalItems=g}r.rest&&(f.items=this.process(r.rest,{...l,path:[...l.path,"items"]}));let{minimum:y,maximum:w}=t._zod.bag;typeof y=="number"&&(f.minItems=y),typeof w=="number"&&(f.maxItems=w);break}case"record":{let f=m;f.type="object",f.propertyNames=this.process(r.keyType,{...l,path:[...l.path,"propertyNames"]}),f.additionalProperties=this.process(r.valueType,{...l,path:[...l.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let f=m,h=Jm(r.entries);h.every(y=>typeof y=="number")&&(f.type="number"),h.every(y=>typeof y=="string")&&(f.type="string"),f.enum=h;break}case"literal":{let f=m,h=[];for(let y of r.values)if(y===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(y))}else h.push(y);if(h.length!==0)if(h.length===1){let y=h[0];f.type=y===null?"null":typeof y,f.const=y}else h.every(y=>typeof y=="number")&&(f.type="number"),h.every(y=>typeof y=="string")&&(f.type="string"),h.every(y=>typeof y=="boolean")&&(f.type="string"),h.every(y=>y===null)&&(f.type="null"),f.enum=h;break}case"file":{let f=m,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:w,mime:g}=t._zod.bag;y!==void 0&&(h.minLength=y),w!==void 0&&(h.maxLength=w),g?g.length===1?(h.contentMediaType=g[0],Object.assign(f,h)):f.anyOf=g.map(v=>({...h,contentMediaType:v})):Object.assign(f,h);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let f=this.process(r.innerType,l);m.anyOf=[f,{type:"null"}];break}case"nonoptional":{this.process(r.innerType,l),s.ref=r.innerType;break}case"success":{let f=m;f.type="boolean";break}case"default":{this.process(r.innerType,l),s.ref=r.innerType,m.default=JSON.parse(JSON.stringify(r.defaultValue));break}case"prefault":{this.process(r.innerType,l),s.ref=r.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break}case"catch":{this.process(r.innerType,l),s.ref=r.innerType;let f;try{f=r.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}m.default=f;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let f=m,h=t._zod.pattern;if(!h)throw Error("Pattern not found in template literal");f.type="string",f.pattern=h.source;break}case"pipe":{let f=this.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;this.process(f,l),s.ref=f;break}case"readonly":{this.process(r.innerType,l),s.ref=r.innerType,m.readOnly=!0;break}case"promise":{this.process(r.innerType,l),s.ref=r.innerType;break}case"optional":{this.process(r.innerType,l),s.ref=r.innerType;break}case"lazy":{let f=t._zod.innerType;this.process(f,l),s.ref=f;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(t);return u&&Object.assign(s.schema,u),this.io==="input"&&pt(t)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(t).schema}emit(t,n){let i={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},r=this.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=l=>{let p=this.target==="draft-2020-12"?"$defs":"definitions";if(i.external){let h=i.external.registry.get(l[0])?.id;if(h)return{ref:i.external.uri(h)};let y=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=y,{defId:y,ref:`${i.external.uri("__shared")}#/${p}/${y}`}}if(l[1]===r)return{ref:"#"};let m=`#/${p}/`,f=l[1].schema.id??`__schema${this.counter++}`;return{defId:f,ref:m+f}},a=l=>{if(l[1].schema.$ref)return;let p=l[1],{ref:m,defId:f}=o(l);p.def={...p.schema},f&&(p.defId=f);let h=p.schema;for(let y in h)delete h[y];h.$ref=m};for(let l of this.seen.entries()){let p=l[1];if(t===l[0]){a(l);continue}if(i.external){let m=i.external.registry.get(l[0])?.id;if(t!==l[0]&&m){a(l);continue}}if(this.metadataRegistry.get(l[0])?.id){a(l);continue}if(p.cycle){if(i.cycles==="throw")throw Error(`Cycle detected: #/${p.cycle?.join("/")}/<root>
|
|
114
114
|
|
|
115
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);i.cycles==="ref"&&a(l);continue}if(p.count>1&&i.reused==="ref"){a(l);continue}}let s=(l,p)=>{let m=this.seen.get(l),f=m.def??m.schema,h={...f};if(m.ref===null)return;let y=m.ref;if(m.ref=null,y){s(y,p);let w=this.seen.get(y).schema;w.$ref&&p.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(w)):(Object.assign(f,w),Object.assign(f,h))}m.isParent||this.override({zodSchema:l,jsonSchema:f,path:m.path??[]})};for(let l of[...this.seen.entries()].reverse())s(l[0],{target:this.target});let d={};this.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?d.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(d,r.def);let u=i.external?.defs??{};for(let l of this.seen.entries()){let p=l[1];p.def&&p.defId&&(u[p.defId]=p.def)}!i.external&&Object.keys(u).length>0&&(this.target==="draft-2020-12"?d.$defs=u:d.definitions=u);try{return JSON.parse(JSON.stringify(d))}catch{throw Error("Error converting schema to JSON.")}}};pW={},fW=N("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ve.init(e,t),e.def=t,e.parse=(n,i)=>Ru(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>Tl(e,n,i),e.parseAsync=async(n,i)=>Ou(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>Il(e,n,i),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>$n(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e)}),mW=N("ZodMiniObject",(e,t)=>{lh.init(e,t),fW.init(e,t),Ee.defineLazy(e,"shape",()=>t.shape)});c={};zn(c,{xid:()=>RW,void:()=>QW,uuidv7:()=>kW,uuidv6:()=>SW,uuidv4:()=>wW,uuid:()=>bW,url:()=>xW,uppercase:()=>Uh,unknown:()=>nt,union:()=>Be,undefined:()=>VW,ulid:()=>EW,uint64:()=>HW,uint32:()=>KW,tuple:()=>tH,trim:()=>Wh,treeifyError:()=>Gx,transform:()=>Ig,toUpperCase:()=>Gh,toLowerCase:()=>Hh,toJSONSchema:()=>Zh,templateLiteral:()=>lH,symbol:()=>GW,superRefine:()=>OI,success:()=>dH,stringbool:()=>fH,stringFormat:()=>UW,string:()=>U,strictObject:()=>eH,startsWith:()=>zh,size:()=>qh,setErrorMap:()=>gH,set:()=>iH,safeParseAsync:()=>VT,safeParse:()=>GT,registry:()=>hh,regexes:()=>th,regex:()=>Dh,refine:()=>RI,record:()=>ze,readonly:()=>kI,property:()=>AT,promise:()=>cH,prettifyError:()=>Zx,preprocess:()=>Og,prefault:()=>gI,positive:()=>PT,pipe:()=>Lu,partialRecord:()=>nH,parseAsync:()=>HT,parse:()=>WT,overwrite:()=>di,optional:()=>He,object:()=>oe,number:()=>je,nullish:()=>sH,nullable:()=>Du,null:()=>wg,normalize:()=>Jh,nonpositive:()=>RT,nonoptional:()=>yI,nonnegative:()=>OT,never:()=>Nl,negative:()=>ET,nativeEnum:()=>oH,nanoid:()=>TW,nan:()=>uH,multipleOf:()=>ds,minSize:()=>us,minLength:()=>co,mime:()=>Kh,maxSize:()=>El,maxLength:()=>Rl,map:()=>rH,lte:()=>Tn,lt:()=>ei,lowercase:()=>Lh,looseObject:()=>Et,locales:()=>mh,literal:()=>ce,length:()=>Ol,lazy:()=>TI,ksuid:()=>OW,keyof:()=>XW,jwt:()=>LW,json:()=>mH,iso:()=>Qh,ipv6:()=>$W,ipv4:()=>AW,intersection:()=>Dl,int64:()=>WW,int32:()=>BW,int:()=>If,instanceof:()=>pH,includes:()=>Fh,guid:()=>vW,gte:()=>Zt,gt:()=>ti,globalRegistry:()=>rr,getErrorMap:()=>yH,function:()=>LT,formatError:()=>Zm,float64:()=>zW,float32:()=>FW,flattenError:()=>Vm,file:()=>aH,enum:()=>Lt,endsWith:()=>Bh,emoji:()=>CW,email:()=>_W,e164:()=>DW,discriminatedUnion:()=>xg,date:()=>YW,custom:()=>EI,cuid2:()=>PW,cuid:()=>IW,core:()=>Nx,config:()=>At,coerce:()=>AI,clone:()=>$n,cidrv6:()=>jW,cidrv4:()=>MW,check:()=>PI,catch:()=>bI,boolean:()=>ft,bigint:()=>JW,base64url:()=>qW,base64:()=>NW,array:()=>Re,any:()=>ZW,_default:()=>mI,_ZodString:()=>ng,ZodXID:()=>lg,ZodVoid:()=>rI,ZodUnknown:()=>tI,ZodUnion:()=>kg,ZodUndefined:()=>YT,ZodUUID:()=>ir,ZodURL:()=>ig,ZodULID:()=>ug,ZodType:()=>Pe,ZodTuple:()=>sI,ZodTransform:()=>Tg,ZodTemplateLiteral:()=>xI,ZodSymbol:()=>QT,ZodSuccess:()=>_I,ZodStringFormat:()=>Ve,ZodString:()=>Al,ZodSet:()=>uI,ZodRecord:()=>Cg,ZodRealError:()=>Cs,ZodReadonly:()=>SI,ZodPromise:()=>II,ZodPrefault:()=>hI,ZodPipe:()=>Rg,ZodOptional:()=>Pg,ZodObject:()=>ql,ZodNumberFormat:()=>wo,ZodNumber:()=>$l,ZodNullable:()=>pI,ZodNull:()=>XT,ZodNonOptional:()=>Eg,ZodNever:()=>nI,ZodNanoID:()=>ag,ZodNaN:()=>wI,ZodMap:()=>dI,ZodLiteral:()=>lI,ZodLazy:()=>CI,ZodKSUID:()=>cg,ZodJWT:()=>vg,ZodIssueCode:()=>hH,ZodIntersection:()=>aI,ZodISOTime:()=>eg,ZodISODuration:()=>tg,ZodISODateTime:()=>Yh,ZodISODate:()=>Xh,ZodIPv6:()=>fg,ZodIPv4:()=>pg,ZodGUID:()=>qu,ZodFile:()=>cI,ZodError:()=>yW,ZodEnum:()=>cs,ZodEmoji:()=>og,ZodEmail:()=>rg,ZodE164:()=>_g,ZodDiscriminatedUnion:()=>oI,ZodDefault:()=>fI,ZodDate:()=>Sg,ZodCustomStringFormat:()=>ZT,ZodCustom:()=>Ll,ZodCatch:()=>vI,ZodCUID2:()=>dg,ZodCUID:()=>sg,ZodCIDRv6:()=>hg,ZodCIDRv4:()=>mg,ZodBoolean:()=>Ml,ZodBigIntFormat:()=>bg,ZodBigInt:()=>jl,ZodBase64URL:()=>yg,ZodBase64:()=>gg,ZodArray:()=>iI,ZodAny:()=>eI,TimePrecision:()=>tT,NEVER:()=>qx,$output:()=>QC,$input:()=>YC,$brand:()=>Dx});Qh={};zn(Qh,{time:()=>BT,duration:()=>KT,datetime:()=>FT,date:()=>zT,ZodISOTime:()=>eg,ZodISODuration:()=>tg,ZodISODateTime:()=>Yh,ZodISODate:()=>Xh});Yh=N("ZodISODateTime",(e,t)=>{oC.init(e,t),Ve.init(e,t)});Xh=N("ZodISODate",(e,t)=>{aC.init(e,t),Ve.init(e,t)});eg=N("ZodISOTime",(e,t)=>{sC.init(e,t),Ve.init(e,t)});tg=N("ZodISODuration",(e,t)=>{dC.init(e,t),Ve.init(e,t)});JT=(e,t)=>{Gm.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Zm(e,n)},flatten:{value:n=>Vm(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},yW=N("ZodError",JT),Cs=N("ZodError",JT,{Parent:Error}),WT=Qm(Cs),HT=Ym(Cs),GT=Xm(Cs),VT=eh(Cs),Pe=N("ZodType",(e,t)=>(ve.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>$n(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e),e.parse=(n,i)=>WT(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>GT(e,n,i),e.parseAsync=async(n,i)=>HT(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>VT(e,n,i),e.spa=e.safeParseAsync,e.refine=(n,i)=>e.check(RI(n,i)),e.superRefine=n=>e.check(OI(n)),e.overwrite=n=>e.check(di(n)),e.optional=()=>He(e),e.nullable=()=>Du(e),e.nullish=()=>He(Du(e)),e.nonoptional=n=>yI(e,n),e.array=()=>Re(e),e.or=n=>Be([e,n]),e.and=n=>Dl(e,n),e.transform=n=>Lu(e,Ig(n)),e.default=n=>mI(e,n),e.prefault=n=>gI(e,n),e.catch=n=>bI(e,n),e.pipe=n=>Lu(e,n),e.readonly=()=>kI(e),e.describe=n=>{let i=e.clone();return rr.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){return rr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return rr.get(e);let i=e.clone();return rr.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ng=N("_ZodString",(e,t)=>{ks.init(e,t),Pe.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(Dh(...i)),e.includes=(...i)=>e.check(Fh(...i)),e.startsWith=(...i)=>e.check(zh(...i)),e.endsWith=(...i)=>e.check(Bh(...i)),e.min=(...i)=>e.check(co(...i)),e.max=(...i)=>e.check(Rl(...i)),e.length=(...i)=>e.check(Ol(...i)),e.nonempty=(...i)=>e.check(co(1,...i)),e.lowercase=i=>e.check(Lh(i)),e.uppercase=i=>e.check(Uh(i)),e.trim=()=>e.check(Wh()),e.normalize=(...i)=>e.check(Jh(...i)),e.toLowerCase=()=>e.check(Hh()),e.toUpperCase=()=>e.check(Gh())}),Al=N("ZodString",(e,t)=>{ks.init(e,t),ng.init(e,t),e.email=n=>e.check(gh(rg,n)),e.url=n=>e.check(wh(ig,n)),e.jwt=n=>e.check(Nh(vg,n)),e.emoji=n=>e.check(Sh(og,n)),e.guid=n=>e.check(Mu(qu,n)),e.uuid=n=>e.check(yh(ir,n)),e.uuidv4=n=>e.check(_h(ir,n)),e.uuidv6=n=>e.check(vh(ir,n)),e.uuidv7=n=>e.check(bh(ir,n)),e.nanoid=n=>e.check(kh(ag,n)),e.guid=n=>e.check(Mu(qu,n)),e.cuid=n=>e.check(xh(sg,n)),e.cuid2=n=>e.check(Ch(dg,n)),e.ulid=n=>e.check(Th(ug,n)),e.base64=n=>e.check($h(gg,n)),e.base64url=n=>e.check(Mh(yg,n)),e.xid=n=>e.check(Ih(lg,n)),e.ksuid=n=>e.check(Ph(cg,n)),e.ipv4=n=>e.check(Eh(pg,n)),e.ipv6=n=>e.check(Rh(fg,n)),e.cidrv4=n=>e.check(Oh(mg,n)),e.cidrv6=n=>e.check(Ah(hg,n)),e.e164=n=>e.check(jh(_g,n)),e.datetime=n=>e.check(FT(n)),e.date=n=>e.check(zT(n)),e.time=n=>e.check(BT(n)),e.duration=n=>e.check(KT(n))});Ve=N("ZodStringFormat",(e,t)=>{Ke.init(e,t),ng.init(e,t)}),rg=N("ZodEmail",(e,t)=>{Z0.init(e,t),Ve.init(e,t)});qu=N("ZodGUID",(e,t)=>{G0.init(e,t),Ve.init(e,t)});ir=N("ZodUUID",(e,t)=>{V0.init(e,t),Ve.init(e,t)});ig=N("ZodURL",(e,t)=>{Q0.init(e,t),Ve.init(e,t)});og=N("ZodEmoji",(e,t)=>{Y0.init(e,t),Ve.init(e,t)});ag=N("ZodNanoID",(e,t)=>{X0.init(e,t),Ve.init(e,t)});sg=N("ZodCUID",(e,t)=>{eC.init(e,t),Ve.init(e,t)});dg=N("ZodCUID2",(e,t)=>{tC.init(e,t),Ve.init(e,t)});ug=N("ZodULID",(e,t)=>{nC.init(e,t),Ve.init(e,t)});lg=N("ZodXID",(e,t)=>{rC.init(e,t),Ve.init(e,t)});cg=N("ZodKSUID",(e,t)=>{iC.init(e,t),Ve.init(e,t)});pg=N("ZodIPv4",(e,t)=>{uC.init(e,t),Ve.init(e,t)});fg=N("ZodIPv6",(e,t)=>{lC.init(e,t),Ve.init(e,t)});mg=N("ZodCIDRv4",(e,t)=>{cC.init(e,t),Ve.init(e,t)});hg=N("ZodCIDRv6",(e,t)=>{pC.init(e,t),Ve.init(e,t)});gg=N("ZodBase64",(e,t)=>{fC.init(e,t),Ve.init(e,t)});yg=N("ZodBase64URL",(e,t)=>{hC.init(e,t),Ve.init(e,t)});_g=N("ZodE164",(e,t)=>{gC.init(e,t),Ve.init(e,t)});vg=N("ZodJWT",(e,t)=>{_C.init(e,t),Ve.init(e,t)});ZT=N("ZodCustomStringFormat",(e,t)=>{vC.init(e,t),Ve.init(e,t)});$l=N("ZodNumber",(e,t)=>{ah.init(e,t),Pe.init(e,t),e.gt=(i,r)=>e.check(ti(i,r)),e.gte=(i,r)=>e.check(Zt(i,r)),e.min=(i,r)=>e.check(Zt(i,r)),e.lt=(i,r)=>e.check(ei(i,r)),e.lte=(i,r)=>e.check(Tn(i,r)),e.max=(i,r)=>e.check(Tn(i,r)),e.int=i=>e.check(If(i)),e.safe=i=>e.check(If(i)),e.positive=i=>e.check(ti(0,i)),e.nonnegative=i=>e.check(Zt(0,i)),e.negative=i=>e.check(ei(0,i)),e.nonpositive=i=>e.check(Tn(0,i)),e.multipleOf=(i,r)=>e.check(ds(i,r)),e.step=(i,r)=>e.check(ds(i,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});wo=N("ZodNumberFormat",(e,t)=>{bC.init(e,t),$l.init(e,t)});Ml=N("ZodBoolean",(e,t)=>{sh.init(e,t),Pe.init(e,t)});jl=N("ZodBigInt",(e,t)=>{dh.init(e,t),Pe.init(e,t),e.gte=(i,r)=>e.check(Zt(i,r)),e.min=(i,r)=>e.check(Zt(i,r)),e.gt=(i,r)=>e.check(ti(i,r)),e.gte=(i,r)=>e.check(Zt(i,r)),e.min=(i,r)=>e.check(Zt(i,r)),e.lt=(i,r)=>e.check(ei(i,r)),e.lte=(i,r)=>e.check(Tn(i,r)),e.max=(i,r)=>e.check(Tn(i,r)),e.positive=i=>e.check(ti(BigInt(0),i)),e.negative=i=>e.check(ei(BigInt(0),i)),e.nonpositive=i=>e.check(Tn(BigInt(0),i)),e.nonnegative=i=>e.check(Zt(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(ds(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});bg=N("ZodBigIntFormat",(e,t)=>{wC.init(e,t),jl.init(e,t)});QT=N("ZodSymbol",(e,t)=>{SC.init(e,t),Pe.init(e,t)});YT=N("ZodUndefined",(e,t)=>{kC.init(e,t),Pe.init(e,t)});XT=N("ZodNull",(e,t)=>{xC.init(e,t),Pe.init(e,t)});eI=N("ZodAny",(e,t)=>{CC.init(e,t),Pe.init(e,t)});tI=N("ZodUnknown",(e,t)=>{$u.init(e,t),Pe.init(e,t)});nI=N("ZodNever",(e,t)=>{TC.init(e,t),Pe.init(e,t)});rI=N("ZodVoid",(e,t)=>{IC.init(e,t),Pe.init(e,t)});Sg=N("ZodDate",(e,t)=>{PC.init(e,t),Pe.init(e,t),e.min=(i,r)=>e.check(Zt(i,r)),e.max=(i,r)=>e.check(Tn(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});iI=N("ZodArray",(e,t)=>{uh.init(e,t),Pe.init(e,t),e.element=t.element,e.min=(n,i)=>e.check(co(n,i)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,i)=>e.check(Rl(n,i)),e.length=(n,i)=>e.check(Ol(n,i)),e.unwrap=()=>e.element});ql=N("ZodObject",(e,t)=>{lh.init(e,t),Pe.init(e,t),Ee.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Lt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:nt()}),e.loose=()=>e.clone({...e._zod.def,catchall:nt()}),e.strict=()=>e.clone({...e._zod.def,catchall:Nl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Ee.extend(e,n),e.merge=n=>Ee.merge(e,n),e.pick=n=>Ee.pick(e,n),e.omit=n=>Ee.omit(e,n),e.partial=(...n)=>Ee.partial(Pg,e,n[0]),e.required=(...n)=>Ee.required(Eg,e,n[0])});kg=N("ZodUnion",(e,t)=>{ch.init(e,t),Pe.init(e,t),e.options=t.options});oI=N("ZodDiscriminatedUnion",(e,t)=>{kg.init(e,t),EC.init(e,t)});aI=N("ZodIntersection",(e,t)=>{RC.init(e,t),Pe.init(e,t)});sI=N("ZodTuple",(e,t)=>{Pl.init(e,t),Pe.init(e,t),e.rest=n=>e.clone({...e._zod.def,rest:n})});Cg=N("ZodRecord",(e,t)=>{OC.init(e,t),Pe.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});dI=N("ZodMap",(e,t)=>{AC.init(e,t),Pe.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});uI=N("ZodSet",(e,t)=>{$C.init(e,t),Pe.init(e,t),e.min=(...n)=>e.check(us(...n)),e.nonempty=n=>e.check(us(1,n)),e.max=(...n)=>e.check(El(...n)),e.size=(...n)=>e.check(qh(...n))});cs=N("ZodEnum",(e,t)=>{MC.init(e,t),Pe.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new cs({...t,checks:[],...Ee.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw Error(`Key ${a} not found in enum`);return new cs({...t,checks:[],...Ee.normalizeParams(r),entries:o})}});lI=N("ZodLiteral",(e,t)=>{jC.init(e,t),Pe.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});cI=N("ZodFile",(e,t)=>{NC.init(e,t),Pe.init(e,t),e.min=(n,i)=>e.check(us(n,i)),e.max=(n,i)=>e.check(El(n,i)),e.mime=(n,i)=>e.check(Kh(Array.isArray(n)?n:[n],i))});Tg=N("ZodTransform",(e,t)=>{ph.init(e,t),Pe.init(e,t),e._zod.parse=(n,i)=>{n.addIssue=o=>{if(typeof o=="string")n.issues.push(Ee.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),a.continue??(a.continue=!0),n.issues.push(Ee.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});Pg=N("ZodOptional",(e,t)=>{qC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});pI=N("ZodNullable",(e,t)=>{DC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});fI=N("ZodDefault",(e,t)=>{LC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});hI=N("ZodPrefault",(e,t)=>{UC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});Eg=N("ZodNonOptional",(e,t)=>{FC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});_I=N("ZodSuccess",(e,t)=>{zC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});vI=N("ZodCatch",(e,t)=>{BC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});wI=N("ZodNaN",(e,t)=>{KC.init(e,t),Pe.init(e,t)});Rg=N("ZodPipe",(e,t)=>{fh.init(e,t),Pe.init(e,t),e.in=t.in,e.out=t.out});SI=N("ZodReadonly",(e,t)=>{JC.init(e,t),Pe.init(e,t)});xI=N("ZodTemplateLiteral",(e,t)=>{WC.init(e,t),Pe.init(e,t)});CI=N("ZodLazy",(e,t)=>{GC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.getter()});II=N("ZodPromise",(e,t)=>{HC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});Ll=N("ZodCustom",(e,t)=>{VC.init(e,t),Pe.init(e,t)});fH=(...e)=>qT({Pipe:Rg,Boolean:Ml,String:Al,Transform:Tg},...e);hH={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};AI={};zn(AI,{string:()=>_H,number:()=>vH,date:()=>SH,boolean:()=>bH,bigint:()=>wH});At(ZC());kH=c,$I=kH,MI="2025-11-25",xH=[MI,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Kr="io.modelcontextprotocol/related-task",Ul="2.0",mt=EI(e=>e!==null&&(typeof e=="object"||typeof e=="function")),jI=Be([U(),je().int()]),NI=U(),qse=Et({ttl:je().optional(),pollInterval:je().optional()}),CH=oe({ttl:je().optional()}),TH=oe({taskId:U()}),Ag=Et({progressToken:jI.optional(),[Kr]:TH.optional()}),en=oe({_meta:Ag.optional()}),Ts=en.extend({task:CH.optional()}),IH=e=>Ts.safeParse(e).success,bt=oe({method:U(),params:en.loose().optional()}),gn=oe({_meta:Ag.optional()}),yn=oe({method:U(),params:gn.loose().optional()}),wt=Et({_meta:Ag.optional()}),Fl=Be([U(),je().int()]),qI=oe({jsonrpc:ce(Ul),id:Fl,...bt.shape}).strict(),$w=e=>qI.safeParse(e).success,DI=oe({jsonrpc:ce(Ul),...yn.shape}).strict(),PH=e=>DI.safeParse(e).success,$g=oe({jsonrpc:ce(Ul),id:Fl,result:wt}).strict(),Cd=e=>$g.safeParse(e).success;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ge||(ge={}));Mg=oe({jsonrpc:ce(Ul),id:Fl.optional(),error:oe({code:je().int(),message:U(),data:nt().optional()})}).strict(),EH=e=>Mg.safeParse(e).success,Dse=Be([qI,DI,$g,Mg]),Lse=Be([$g,Mg]),jg=wt.strict(),RH=gn.extend({requestId:Fl.optional(),reason:U().optional()}),Ng=yn.extend({method:ce("notifications/cancelled"),params:RH}),OH=oe({src:U(),mimeType:U().optional(),sizes:Re(U()).optional(),theme:Lt(["light","dark"]).optional()}),Is=oe({icons:Re(OH).optional()}),po=oe({name:U(),title:U().optional()}),LI=po.extend({...po.shape,...Is.shape,version:U(),websiteUrl:U().optional(),description:U().optional()}),AH=Dl(oe({applyDefaults:ft().optional()}),ze(U(),nt())),$H=Og(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Dl(oe({form:AH.optional(),url:mt.optional()}),ze(U(),nt()).optional())),MH=Et({list:mt.optional(),cancel:mt.optional(),requests:Et({sampling:Et({createMessage:mt.optional()}).optional(),elicitation:Et({create:mt.optional()}).optional()}).optional()}),jH=Et({list:mt.optional(),cancel:mt.optional(),requests:Et({tools:Et({call:mt.optional()}).optional()}).optional()}),NH=oe({experimental:ze(U(),mt).optional(),sampling:oe({context:mt.optional(),tools:mt.optional()}).optional(),elicitation:$H.optional(),roots:oe({listChanged:ft().optional()}).optional(),tasks:MH.optional(),extensions:ze(U(),mt).optional()}),qH=en.extend({protocolVersion:U(),capabilities:NH,clientInfo:LI}),UI=bt.extend({method:ce("initialize"),params:qH}),DH=oe({experimental:ze(U(),mt).optional(),logging:mt.optional(),completions:mt.optional(),prompts:oe({listChanged:ft().optional()}).optional(),resources:oe({subscribe:ft().optional(),listChanged:ft().optional()}).optional(),tools:oe({listChanged:ft().optional()}).optional(),tasks:jH.optional(),extensions:ze(U(),mt).optional()}),LH=wt.extend({protocolVersion:U(),capabilities:DH,serverInfo:LI,instructions:U().optional()}),FI=yn.extend({method:ce("notifications/initialized"),params:gn.optional()}),qg=bt.extend({method:ce("ping"),params:en.optional()}),UH=oe({progress:je(),total:He(je()),message:He(U())}),FH=oe({...gn.shape,...UH.shape,progressToken:jI}),Dg=yn.extend({method:ce("notifications/progress"),params:FH}),zH=en.extend({cursor:NI.optional()}),Ps=bt.extend({params:zH.optional()}),Es=wt.extend({nextCursor:NI.optional()}),BH=Lt(["working","input_required","completed","failed","cancelled"]),Rs=oe({taskId:U(),status:BH,ttl:Be([je(),wg()]),createdAt:U(),lastUpdatedAt:U(),pollInterval:He(je()),statusMessage:He(U())}),zl=wt.extend({task:Rs}),KH=gn.merge(Rs),Uu=yn.extend({method:ce("notifications/tasks/status"),params:KH}),Lg=bt.extend({method:ce("tasks/get"),params:en.extend({taskId:U()})}),Ug=wt.merge(Rs),Fg=bt.extend({method:ce("tasks/result"),params:en.extend({taskId:U()})}),Use=wt.loose(),zg=Ps.extend({method:ce("tasks/list")}),Bg=Es.extend({tasks:Re(Rs)}),Kg=bt.extend({method:ce("tasks/cancel"),params:en.extend({taskId:U()})}),JH=wt.merge(Rs),zI=oe({uri:U(),mimeType:He(U()),_meta:ze(U(),nt()).optional()}),BI=zI.extend({text:U()}),Jg=U().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),KI=zI.extend({blob:Jg}),Os=Lt(["user","assistant"]),So=oe({audience:Re(Os).optional(),priority:je().min(0).max(1).optional(),lastModified:Qh.datetime({offset:!0}).optional()}),JI=oe({...po.shape,...Is.shape,uri:U(),description:He(U()),mimeType:He(U()),size:He(je()),annotations:So.optional(),_meta:He(Et({}))}),WH=oe({...po.shape,...Is.shape,uriTemplate:U(),description:He(U()),mimeType:He(U()),annotations:So.optional(),_meta:He(Et({}))}),Pf=Ps.extend({method:ce("resources/list")}),HH=Es.extend({resources:Re(JI)}),Ef=Ps.extend({method:ce("resources/templates/list")}),GH=Es.extend({resourceTemplates:Re(WH)}),Wg=en.extend({uri:U()}),VH=Wg,Rf=bt.extend({method:ce("resources/read"),params:VH}),ZH=wt.extend({contents:Re(Be([BI,KI]))}),QH=yn.extend({method:ce("notifications/resources/list_changed"),params:gn.optional()}),YH=Wg,XH=bt.extend({method:ce("resources/subscribe"),params:YH}),e9=Wg,t9=bt.extend({method:ce("resources/unsubscribe"),params:e9}),n9=gn.extend({uri:U()}),r9=yn.extend({method:ce("notifications/resources/updated"),params:n9}),i9=oe({name:U(),description:He(U()),required:He(ft())}),o9=oe({...po.shape,...Is.shape,description:He(U()),arguments:He(Re(i9)),_meta:He(Et({}))}),Of=Ps.extend({method:ce("prompts/list")}),a9=Es.extend({prompts:Re(o9)}),s9=en.extend({name:U(),arguments:ze(U(),U()).optional()}),Af=bt.extend({method:ce("prompts/get"),params:s9}),Hg=oe({type:ce("text"),text:U(),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),Gg=oe({type:ce("image"),data:Jg,mimeType:U(),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),Vg=oe({type:ce("audio"),data:Jg,mimeType:U(),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),d9=oe({type:ce("tool_use"),name:U(),id:U(),input:ze(U(),nt()),_meta:ze(U(),nt()).optional()}),u9=oe({type:ce("resource"),resource:Be([BI,KI]),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),l9=JI.extend({type:ce("resource_link")}),Zg=Be([Hg,Gg,Vg,l9,u9]),c9=oe({role:Os,content:Zg}),p9=wt.extend({description:U().optional(),messages:Re(c9)}),f9=yn.extend({method:ce("notifications/prompts/list_changed"),params:gn.optional()}),m9=oe({title:U().optional(),readOnlyHint:ft().optional(),destructiveHint:ft().optional(),idempotentHint:ft().optional(),openWorldHint:ft().optional()}),h9=oe({taskSupport:Lt(["required","optional","forbidden"]).optional()}),WI=oe({...po.shape,...Is.shape,description:U().optional(),inputSchema:oe({type:ce("object"),properties:ze(U(),mt).optional(),required:Re(U()).optional()}).catchall(nt()),outputSchema:oe({type:ce("object"),properties:ze(U(),mt).optional(),required:Re(U()).optional()}).catchall(nt()).optional(),annotations:m9.optional(),execution:h9.optional(),_meta:ze(U(),nt()).optional()}),$f=Ps.extend({method:ce("tools/list")}),g9=Es.extend({tools:Re(WI)}),Qg=wt.extend({content:Re(Zg).default([]),structuredContent:ze(U(),nt()).optional(),isError:ft().optional()}),Fse=Qg.or(wt.extend({toolResult:nt()})),y9=Ts.extend({name:U(),arguments:ze(U(),nt()).optional()}),Fu=bt.extend({method:ce("tools/call"),params:y9}),_9=yn.extend({method:ce("notifications/tools/list_changed"),params:gn.optional()}),zse=oe({autoRefresh:ft().default(!0),debounceMs:je().int().nonnegative().default(300)}),zu=Lt(["debug","info","notice","warning","error","critical","alert","emergency"]),v9=en.extend({level:zu}),HI=bt.extend({method:ce("logging/setLevel"),params:v9}),b9=gn.extend({level:zu,logger:U().optional(),data:nt()}),w9=yn.extend({method:ce("notifications/message"),params:b9}),S9=oe({name:U().optional()}),k9=oe({hints:Re(S9).optional(),costPriority:je().min(0).max(1).optional(),speedPriority:je().min(0).max(1).optional(),intelligencePriority:je().min(0).max(1).optional()}),x9=oe({mode:Lt(["auto","required","none"]).optional()}),C9=oe({type:ce("tool_result"),toolUseId:U().describe("The unique identifier for the corresponding tool call."),content:Re(Zg).default([]),structuredContent:oe({}).loose().optional(),isError:ft().optional(),_meta:ze(U(),nt()).optional()}),T9=xg("type",[Hg,Gg,Vg]),Bu=xg("type",[Hg,Gg,Vg,d9,C9]),I9=oe({role:Os,content:Be([Bu,Re(Bu)]),_meta:ze(U(),nt()).optional()}),P9=Ts.extend({messages:Re(I9),modelPreferences:k9.optional(),systemPrompt:U().optional(),includeContext:Lt(["none","thisServer","allServers"]).optional(),temperature:je().optional(),maxTokens:je().int(),stopSequences:Re(U()).optional(),metadata:mt.optional(),tools:Re(WI).optional(),toolChoice:x9.optional()}),E9=bt.extend({method:ce("sampling/createMessage"),params:P9}),Yg=wt.extend({model:U(),stopReason:He(Lt(["endTurn","stopSequence","maxTokens"]).or(U())),role:Os,content:T9}),GI=wt.extend({model:U(),stopReason:He(Lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(U())),role:Os,content:Be([Bu,Re(Bu)])}),R9=oe({type:ce("boolean"),title:U().optional(),description:U().optional(),default:ft().optional()}),O9=oe({type:ce("string"),title:U().optional(),description:U().optional(),minLength:je().optional(),maxLength:je().optional(),format:Lt(["email","uri","date","date-time"]).optional(),default:U().optional()}),A9=oe({type:Lt(["number","integer"]),title:U().optional(),description:U().optional(),minimum:je().optional(),maximum:je().optional(),default:je().optional()}),$9=oe({type:ce("string"),title:U().optional(),description:U().optional(),enum:Re(U()),default:U().optional()}),M9=oe({type:ce("string"),title:U().optional(),description:U().optional(),oneOf:Re(oe({const:U(),title:U()})),default:U().optional()}),j9=oe({type:ce("string"),title:U().optional(),description:U().optional(),enum:Re(U()),enumNames:Re(U()).optional(),default:U().optional()}),N9=Be([$9,M9]),q9=oe({type:ce("array"),title:U().optional(),description:U().optional(),minItems:je().optional(),maxItems:je().optional(),items:oe({type:ce("string"),enum:Re(U())}),default:Re(U()).optional()}),D9=oe({type:ce("array"),title:U().optional(),description:U().optional(),minItems:je().optional(),maxItems:je().optional(),items:oe({anyOf:Re(oe({const:U(),title:U()}))}),default:Re(U()).optional()}),L9=Be([q9,D9]),U9=Be([j9,N9,L9]),F9=Be([U9,R9,O9,A9]),z9=Ts.extend({mode:ce("form").optional(),message:U(),requestedSchema:oe({type:ce("object"),properties:ze(U(),F9),required:Re(U()).optional()})}),B9=Ts.extend({mode:ce("url"),message:U(),elicitationId:U(),url:U().url()}),K9=Be([z9,B9]),J9=bt.extend({method:ce("elicitation/create"),params:K9}),W9=gn.extend({elicitationId:U()}),H9=yn.extend({method:ce("notifications/elicitation/complete"),params:W9}),Ku=wt.extend({action:Lt(["accept","decline","cancel"]),content:Og(e=>e===null?void 0:e,ze(U(),Be([U(),je(),ft(),Re(U())])).optional())}),G9=oe({type:ce("ref/resource"),uri:U()}),V9=oe({type:ce("ref/prompt"),name:U()}),Z9=en.extend({ref:Be([V9,G9]),argument:oe({name:U(),value:U()}),context:oe({arguments:ze(U(),U()).optional()}).optional()}),Mf=bt.extend({method:ce("completion/complete"),params:Z9});X9=wt.extend({completion:Et({values:Re(U()).max(100),total:He(je().int()),hasMore:He(ft())})}),eG=oe({uri:U().startsWith("file://"),name:U().optional(),_meta:ze(U(),nt()).optional()}),tG=bt.extend({method:ce("roots/list"),params:en.optional()}),VI=wt.extend({roots:Re(eG)}),nG=yn.extend({method:ce("notifications/roots/list_changed"),params:gn.optional()}),Bse=Be([qg,UI,Mf,HI,Af,Of,Pf,Ef,Rf,XH,t9,Fu,$f,Lg,Fg,zg,Kg]),Kse=Be([Ng,Dg,FI,nG,Uu]),Jse=Be([jg,Yg,GI,Ku,VI,Ug,Bg,zl]),Wse=Be([qg,E9,J9,tG,Lg,Fg,zg,Kg]),Hse=Be([Ng,Dg,w9,r9,QH,_9,f9,Uu,H9]),Gse=Be([jg,LH,X9,p9,a9,HH,GH,ZH,Qg,g9,Ug,Bg,zl]),fe=class e extends Error{constructor(t,n,i){super(`MCP error ${t}: ${n}`),this.code=t,this.data=i,this.name="McpError"}static fromError(t,n,i){if(t===ge.UrlElicitationRequired&&i){let r=i;if(r.elicitations)return new jf(r.elicitations,n)}return new e(t,n,i)}},jf=class extends fe{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(ge.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};rG=Symbol("Let zodToJsonSchema decide on which parser to use"),Mw={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},iG=e=>typeof e=="string"?{...Mw,name:e}:{...Mw,...e},oG=e=>{let t=iG(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};QI=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};uG=(e,t)=>Me(e.innerType._def,t);lG=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let i of e.checks)switch(i.kind){case"min":De(n,"minimum",i.value,i.message,t);break;case"max":De(n,"maximum",i.value,i.message,t);break}return n};mG=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;Tp=void 0,kn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Tp===void 0&&(Tp=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tp),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};yG=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");Ju={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Nw=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,r)=>Me(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(i=>!!i&&(!t.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return n.length?{anyOf:n}:void 0};EG=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Me(e.innerType._def,t);let n=Me(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Dt(t)},n]}:Dt(t)},RG=(e,t)=>{if(t.pipeStrategy==="input")return Me(e.in._def,t);if(t.pipeStrategy==="output")return Me(e.out._def,t);let n=Me(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=Me(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,i].filter(r=>r!==void 0)}};NG=(e,t)=>Me(e.innerType._def,t),qG=(e,t,n)=>{switch(t){case Z.ZodString:return eP(e,n);case Z.ZodNumber:return CG(e,n);case Z.ZodObject:return TG(e,n);case Z.ZodBigInt:return sG(e,n);case Z.ZodBoolean:return dG();case Z.ZodDate:return XI(e,n);case Z.ZodUndefined:return MG(n);case Z.ZodNull:return SG(n);case Z.ZodArray:return aG(e,n);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return kG(e,n);case Z.ZodIntersection:return hG(e,n);case Z.ZodTuple:return $G(e,n);case Z.ZodRecord:return tP(e,n);case Z.ZodLiteral:return gG(e,n);case Z.ZodEnum:return fG(e);case Z.ZodNativeEnum:return bG(e);case Z.ZodNullable:return xG(e,n);case Z.ZodOptional:return EG(e,n);case Z.ZodMap:return vG(e,n);case Z.ZodSet:return AG(e,n);case Z.ZodLazy:return()=>e.getter()._def;case Z.ZodPromise:return OG(e,n);case Z.ZodNaN:case Z.ZodNever:return wG(n);case Z.ZodEffects:return pG(e,n);case Z.ZodAny:return Dt(n);case Z.ZodUnknown:return jG(n);case Z.ZodDefault:return cG(e,n);case Z.ZodBranded:return YI(e,n);case Z.ZodReadonly:return NG(e,n);case Z.ZodCatch:return uG(e,n);case Z.ZodPipeline:return RG(e,n);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return(i=>{})(t)}};DG=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:QI(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,i)=>t.currentPath[i]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Dt(t)):t.$refStrategy==="seen"?Dt(t):void 0}},LG=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),UG=(e,t)=>{let n=oG(t),i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((d,[u,l])=>({...d,[u]:Me(l._def,{...n,currentPath:[...n.basePath,n.definitionPath,u]},!0)??Dt(n)}),{}):void 0,r=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=Me(e._def,r===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,r]},!1)??Dt(n),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(o.title=a),n.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[n.openAiAnyTypeName]||(i[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let s=r===void 0?i?{...o,[n.definitionPath]:i}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,r].join("/"),[n.definitionPath]:{...i,[r]:o}};return n.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};zG=6e4,Nf=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ng,n=>{this._oncancel(n)}),this.setNotificationHandler(Dg,n=>{this._onprogress(n)}),this.setRequestHandler(qg,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Lg,async(n,i)=>{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new fe(ge.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(Fg,async(n,i)=>{let r=async()=>{let o=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(s.type==="response"||s.type==="error"){let d=s.message,u=d.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(d);else{let p=d,m=new fe(p.error.code,p.error.message,p.error.data);l(m)}else{let p=s.type==="response"?"Response":"Error";this._onerror(Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:i.requestId})}}let a=await this._taskStore.getTask(o,i.sessionId);if(!a)throw new fe(ge.InvalidParams,`Task not found: ${o}`);if(!Fr(a.status))return await this._waitForTaskUpdate(o,i.signal),await r();if(Fr(a.status)){let s=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...s,_meta:{...s._meta,[Kr]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(zg,async(n,i)=>{try{let{tasks:r,nextCursor:o}=await this._taskStore.listTasks(n.params?.cursor,i.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new fe(ge.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(Kg,async(n,i)=>{try{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new fe(ge.InvalidParams,`Task not found: ${n.params.taskId}`);if(Fr(r.status))throw new fe(ge.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(n.params.taskId);let o=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!o)throw new fe(ge.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof fe?r:new fe(ge.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,i,r,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(t){let n=this._timeoutInfo.get(t);if(!n)return!1;let i=Date.now()-n.startTime;if(n.maxTotalTimeout&&i>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),fe.fromError(ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:i});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){let n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let r=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{r?.(o,a),Cd(o)||EH(o)?this._onresponse(o):$w(o)?this._onrequest(o,a):PH(o)?this._onnotification(o):this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let n=fe.fromError(ge.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of t.values())i(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){let n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,n){let i=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,o=t.params?._meta?.[Kr]?.taskId;if(i===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:ge.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(p=>this._onerror(Error(`Failed to enqueue error response: ${p}`))):r?.send(l).catch(p=>this._onerror(Error(`Failed to send an error response: ${p}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=IH(t.params)?t.params.task:void 0,d=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,u={signal:a.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let p={relatedRequestId:t.id};o&&(p.relatedTask={taskId:o}),await this.notification(l,p)},sendRequest:async(l,p,m)=>{if(a.signal.aborted)throw new fe(ge.ConnectionClosed,"Request was cancelled");let f={...m,relatedRequestId:t.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let h=f.relatedTask?.taskId??o;return h&&d&&await d.updateTaskStatus(h,"input_required"),await this.request(l,p,f)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>i(t,u)).then(async l=>{if(a.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:p,timestamp:Date.now()},r?.sessionId):await r?.send(p)},async l=>{if(a.signal.aborted)return;let p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:ge.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},r?.sessionId):await r?.send(p)}).catch(l=>this._onerror(Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===a&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:n,...i}=t.params,r=Number(n),o=this._progressHandlers.get(r);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(d);return}o(i)}_onresponse(t){let n=Number(t.id),i=this._requestResolvers.get(n);if(i){if(this._requestResolvers.delete(n),Cd(t))i(t);else{let a=new fe(t.error.code,t.error.message,t.error.data);i(a)}return}let r=this._responseHandlers.get(n);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let o=!1;if(Cd(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,n))}}if(o||this._progressHandlers.delete(n),Cd(t))r(t);else{let a=fe.fromError(t.error.code,t.error.message,t.error.data);r(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,i){let{task:r}=i??{};if(!r){try{yield{type:"result",result:await this.request(t,n,i)}}catch(a){yield{type:"error",error:a instanceof fe?a:new fe(ge.InternalError,String(a))}}return}let o;try{let a=await this.request(t,zl,i);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new fe(ge.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:s},Fr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)}:s.status==="failed"?yield{type:"error",error:new fe(ge.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new fe(ge.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)};return}let d=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,d)),i?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof fe?a:new fe(ge.InternalError,String(a))}}}request(t,n,i){let{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:d}=i??{};return new Promise((u,l)=>{let p=v=>{l(v)};if(!this._transport){p(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(v){p(v);return}i?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};i?.onprogress&&(this._progressHandlers.set(m,i.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(f.params={...f.params,task:s}),d&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Kr]:d}});let h=v=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(v)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(S=>this._onerror(Error(`Failed to send cancellation: ${S}`)));let b=v instanceof fe?v:new fe(ge.RequestTimeout,String(v));l(b)};this._responseHandlers.set(m,v=>{if(!i?.signal?.aborted){if(v instanceof Error)return l(v);try{let b=Ma(n,v.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),i?.signal?.addEventListener("abort",()=>{h(i?.signal?.reason)});let y=i?.timeout??zG,w=()=>h(fe.fromError(ge.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(m,y,i?.maxTotalTimeout,w,i?.resetTimeoutOnProgress??!1);let g=d?.taskId;if(g){let v=b=>{let S=this._responseHandlers.get(m);S?S(b):this._onerror(Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,v),this._enqueueTaskMessage(g,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(m),l(b)})}else this._transport.send(f,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(v=>{this._cleanupTimeout(m),l(v)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},Ug,n)}async getTaskResult(t,n,i){return this.request({method:"tasks/result",params:t},n,i)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},Bg,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},JH,n)}async notification(t,n){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(t.method);let i=n?.relatedTask?.taskId;if(i){let o={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Kr]:n.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:o,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let o={...t,jsonrpc:"2.0"};n?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Kr]:n.relatedTask}}}),this._transport?.send(o,n).catch(a=>this._onerror(a))});return}let r={...t,jsonrpc:"2.0"};n?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[Kr]:n.relatedTask}}}),await this._transport.send(r,n)}setRequestHandler(t,n){let i=Dw(t);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(r,o)=>{let a=Lw(t,r);return Promise.resolve(n(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){let i=Dw(t);this._notificationHandlers.set(i,r=>{let o=Lw(t,r);return Promise.resolve(n(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,i){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,i,r)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(t,n);for(let r of i)if(r.type==="request"&&$w(r.message)){let o=r.message.id,a=this._requestResolvers.get(o);a?(a(new fe(ge.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){let i=this._options?.defaultTaskPollInterval??1e3;try{let r=await this._taskStore?.getTask(t);r?.pollInterval&&(i=r.pollInterval)}catch{}return new Promise((r,o)=>{if(n.aborted){o(new fe(ge.InvalidRequest,"Request cancelled"));return}let a=setTimeout(r,i);n.addEventListener("abort",()=>{clearTimeout(a),o(new fe(ge.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){let i=this._taskStore;if(!i)throw Error("No task store configured");return{createTask:async r=>{if(!t)throw Error("No request provided");return await i.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{let o=await i.getTask(r,n);if(!o)throw new fe(ge.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,a)=>{await i.storeTaskResult(r,o,a,n);let s=await i.getTask(r,n);if(s){let d=Uu.parse({method:"notifications/tasks/status",params:s});await this.notification(d),Fr(s.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>i.getTaskResult(r,n),updateTaskStatus:async(r,o,a)=>{let s=await i.getTask(r,n);if(!s)throw new fe(ge.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Fr(s.status))throw new fe(ge.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(r,o,a,n);let d=await i.getTask(r,n);if(d){let u=Uu.parse({method:"notifications/tasks/status",params:d});await this.notification(u),Fr(d.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>i.listTasks(r,n)}}};KG=am(GS(),1),JG=am(ej(),1);qf=class{constructor(t){this._ajv=t??WG()}getValidator(t){let n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}},Df=class{constructor(t){this._server=t}requestStream(t,n,i){return this._server.requestStream(t,n,i)}createMessageStream(t,n){let i=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!i?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages[t.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],a=o.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,d=s?Array.isArray(s.content)?s.content:[s.content]:[],u=d.some(l=>l.type==="tool_use");if(a){if(o.some(l=>l.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(d.filter(m=>m.type==="tool_use").map(m=>m.id)),p=new Set(o.filter(m=>m.type==="tool_result").map(m=>m.toolUseId));if(l.size!==p.size||![...l].every(m=>p.has(m)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Yg,n)}elicitInputStream(t,n){let i=this._server.getClientCapabilities(),r=t.mode??"form";switch(r){case"url":{if(!i?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=r==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},Ku,n)}async getTask(t,n){return this._server.getTask({taskId:t},n)}async getTaskResult(t,n,i){return this._server.getTaskResult({taskId:t},n,i)}async listTasks(t,n){return this._server.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._server.cancelTask({taskId:t},n)}};Lf=class extends Nf{constructor(t,n){super(n),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(zu.options.map((i,r)=>[i,r])),this.isMessageIgnored=(i,r)=>{let o=this._loggingLevels.get(r);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new qf,this.setRequestHandler(UI,i=>this._oninitialize(i)),this.setNotificationHandler(FI,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(HI,async(i,r)=>{let o=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=i.params,s=zu.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Df(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=BG(this._capabilities,t)}setRequestHandler(t,n){let i=xs(t)?.method;if(!i)throw Error("Schema is missing a method literal");let r;if(Fn(i)){let o=i;r=o._zod?.def?.value??o.value}else{let o=i;r=o._def?.value??o.value}if(typeof r!="string")throw Error("Schema method literal must be a string");if(r==="tools/call"){let o=async(a,s)=>{let d=Ma(Fu,a);if(!d.success){let m=d.error instanceof Error?d.error.message:String(d.error);throw new fe(ge.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:u}=d.data,l=await Promise.resolve(n(a,s));if(u.task){let m=Ma(zl,l);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new fe(ge.InvalidParams,`Invalid task creation result: ${f}`)}return m.data}let p=Ma(Qg,l);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new fe(ge.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(t,o)}return super.setRequestHandler(t,n)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){GG(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&HG(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let n=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:xH.includes(n)?n:MI,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},jg)}async createMessage(t,n){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],r=Array.isArray(i.content)?i.content:[i.content],o=r.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],d=s.some(u=>u.type==="tool_use");if(o){if(r.some(u=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!d)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(d){let u=new Set(s.filter(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(r.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},GI,n):this.request({method:"sampling/createMessage",params:t},Yg,n)}async elicitInput(t,n){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},Ku,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},r=await this.request({method:"elicitation/create",params:i},Ku,n);if(r.action==="accept"&&r.content&&i.requestedSchema)try{let o=this._jsonSchemaValidator.getValidator(i.requestedSchema)(r.content);if(!o.valid)throw new fe(ge.InvalidParams,`Elicitation response content does not match requested schema: ${o.errorMessage}`)}catch(o){throw o instanceof fe?o:new fe(ge.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return r}}}createElicitationCompletionNotifier(t,n){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},n)}async listRoots(t,n){return this.request({method:"roots/list",params:t},VI,n)}async sendLoggingMessage(t,n){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,n))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},nP=Symbol.for("mcp.completable");(function(e){e.Completable="McpCompletable"})(zw||(zw={}));ZG=/^[A-Za-z0-9._-]{1,128}$/;Uf=class{constructor(t){this._mcpServer=t}registerToolTask(t,n,i){let r={taskSupport:"required",...n.execution};if(r.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,r,n._meta,i)}},Ff=class{constructor(t,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Lf(t,n)}get experimental(){return this._experimental||(this._experimental={tasks:new Uf(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(fr($f)),this.server.assertCanSetRequestHandler(fr(Fu)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler($f,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,n])=>{let i={name:t,title:n.title,description:n.description,inputSchema:(()=>{let r=ha(n.inputSchema);return r?qw(r,{strictUnions:!0,pipeStrategy:"input"}):XG})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){let r=ha(n.outputSchema);r&&(i.outputSchema=qw(r,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(Fu,async(t,n)=>{try{let i=this._registeredTools[t.params.name];if(!i)throw new fe(ge.InvalidParams,`Tool ${t.params.name} not found`);if(!i.enabled)throw new fe(ge.InvalidParams,`Tool ${t.params.name} disabled`);let r=!!t.params.task,o=i.execution?.taskSupport,a="createTask"in i.handler;if((o==="required"||o==="optional")&&!a)throw new fe(ge.InternalError,`Tool ${t.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!r)throw new fe(ge.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!r&&a)return await this.handleAutomaticTaskPolling(i,t,n);let s=await this.validateToolInput(i,t.params.arguments,t.params.name),d=await this.executeToolHandler(i,s,n);return r||await this.validateToolOutput(i,d,t.params.name),d}catch(i){if(i instanceof fe&&i.code===ge.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,n,i){if(!t.inputSchema)return;let r=ha(t.inputSchema)??t.inputSchema,o=await xp(r,n);if(!o.success){let a="error"in o?o.error:"Unknown error",s=Cp(a);throw new fe(ge.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${s}`)}return o.data}async validateToolOutput(t,n,i){if(!t.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new fe(ge.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let r=ha(t.outputSchema),o=await xp(r,n.structuredContent);if(!o.success){let a="error"in o?o.error:"Unknown error",s=Cp(a);throw new fe(ge.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${s}`)}}async executeToolHandler(t,n,i){let r=t.handler;if("createTask"in r){if(!i.taskStore)throw Error("No task store provided.");let o={...i,taskStore:i.taskStore};return t.inputSchema?await Promise.resolve(r.createTask(n,o)):await Promise.resolve(r.createTask(o))}return t.inputSchema?await Promise.resolve(r(n,i)):await Promise.resolve(r(i))}async handleAutomaticTaskPolling(t,n,i){if(!i.taskStore)throw Error("No task store provided for task-capable tool.");let r=await this.validateToolInput(t,n.params.arguments,n.params.name),o=t.handler,a={...i,taskStore:i.taskStore},s=r?await Promise.resolve(o.createTask(r,a)):await Promise.resolve(o.createTask(a)),d=s.task.taskId,u=s.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(m=>setTimeout(m,l));let p=await i.taskStore.getTask(d);if(!p)throw new fe(ge.InternalError,`Task ${d} not found during polling`);u=p}return await i.taskStore.getTaskResult(d)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(fr(Mf)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Mf,async t=>{switch(t.params.ref.type){case"ref/prompt":return Q9(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Y9(t),this.handleResourceCompletion(t,t.params.ref);default:throw new fe(ge.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,n){let i=this._registeredPrompts[n.name];if(!i)throw new fe(ge.InvalidParams,`Prompt ${n.name} not found`);if(!i.enabled)throw new fe(ge.InvalidParams,`Prompt ${n.name} disabled`);if(!i.argsSchema)return ga;let r=xs(i.argsSchema)?.[t.params.argument.name];if(!Fw(r))return ga;let o=VG(r);if(!o)return ga;let a=await o(t.params.argument.value,t.params.context);return Jw(a)}async handleResourceCompletion(t,n){let i=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===n.uri);if(!i){if(this._registeredResources[n.uri])return ga;throw new fe(ge.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let r=i.resourceTemplate.completeCallback(t.params.argument.name);if(!r)return ga;let o=await r(t.params.argument.value,t.params.context);return Jw(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(fr(Pf)),this.server.assertCanSetRequestHandler(fr(Ef)),this.server.assertCanSetRequestHandler(fr(Rf)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Pf,async(t,n)=>{let i=Object.entries(this._registeredResources).filter(([o,a])=>a.enabled).map(([o,a])=>({uri:o,name:a.name,...a.metadata})),r=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let a=await o.resourceTemplate.listCallback(n);for(let s of a.resources)r.push({...o.metadata,...s})}return{resources:[...i,...r]}}),this.server.setRequestHandler(Ef,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,n])=>({name:t,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Rf,async(t,n)=>{let i=new URL(t.params.uri),r=this._registeredResources[i.toString()];if(r){if(!r.enabled)throw new fe(ge.InvalidParams,`Resource ${i} disabled`);return r.readCallback(i,n)}for(let o of Object.values(this._registeredResourceTemplates)){let a=o.resourceTemplate.uriTemplate.match(i.toString());if(a)return o.readCallback(i,a,n)}throw new fe(ge.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(fr(Of)),this.server.assertCanSetRequestHandler(fr(Af)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Of,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,n])=>({name:t,title:n.title,description:n.description,arguments:n.argsSchema?eV(n.argsSchema):void 0}))})),this.server.setRequestHandler(Af,async(t,n)=>{let i=this._registeredPrompts[t.params.name];if(!i)throw new fe(ge.InvalidParams,`Prompt ${t.params.name} not found`);if(!i.enabled)throw new fe(ge.InvalidParams,`Prompt ${t.params.name} disabled`);if(i.argsSchema){let r=ha(i.argsSchema),o=await xp(r,t.params.arguments);if(!o.success){let d="error"in o?o.error:"Unknown error",u=Cp(d);throw new fe(ge.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let a=o.data,s=i.callback;return await Promise.resolve(s(a,n))}else{let r=i.callback;return await Promise.resolve(r(n))}}),this._promptHandlersInitialized=!0)}resource(t,n,...i){let r;typeof i[0]=="object"&&(r=i.shift());let o=i[0];if(typeof n=="string"){if(this._registeredResources[n])throw Error(`Resource ${n} is already registered`);let a=this._createRegisteredResource(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let a=this._createRegisteredResourceTemplate(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(t,n,i,r){if(typeof n=="string"){if(this._registeredResources[n])throw Error(`Resource ${n} is already registered`);let o=this._createRegisteredResource(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(t,n,i,r,o){let a={name:t,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:s=>{typeof s.uri<"u"&&s.uri!==i&&(delete this._registeredResources[i],s.uri&&(this._registeredResources[s.uri]=a)),typeof s.name<"u"&&(a.name=s.name),typeof s.title<"u"&&(a.title=s.title),typeof s.metadata<"u"&&(a.metadata=s.metadata),typeof s.callback<"u"&&(a.readCallback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=a,a}_createRegisteredResourceTemplate(t,n,i,r,o){let a={resourceTemplate:i,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=a)),typeof d.title<"u"&&(a.title=d.title),typeof d.template<"u"&&(a.resourceTemplate=d.template),typeof d.metadata<"u"&&(a.metadata=d.metadata),typeof d.callback<"u"&&(a.readCallback=d.callback),typeof d.enabled<"u"&&(a.enabled=d.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=a;let s=i.uriTemplate.variableNames;return Array.isArray(s)&&s.some(d=>!!i.completeCallback(d))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(t,n,i,r,o){let a={title:n,description:i,argsSchema:r===void 0?void 0:ji(r),callback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:s=>{typeof s.name<"u"&&s.name!==t&&(delete this._registeredPrompts[t],s.name&&(this._registeredPrompts[s.name]=a)),typeof s.title<"u"&&(a.title=s.title),typeof s.description<"u"&&(a.description=s.description),typeof s.argsSchema<"u"&&(a.argsSchema=ji(s.argsSchema)),typeof s.callback<"u"&&(a.callback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=a,r&&Object.values(r).some(s=>{let d=s instanceof fn?s._def?.innerType:s;return Fw(d)})&&this.setCompletionRequestHandler(),a}_createRegisteredTool(t,n,i,r,o,a,s,d,u){Bw(t);let l={title:n,description:i,inputSchema:Kw(r),outputSchema:Kw(o),annotations:a,execution:s,_meta:d,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:p=>{typeof p.name<"u"&&p.name!==t&&(typeof p.name=="string"&&Bw(p.name),delete this._registeredTools[t],p.name&&(this._registeredTools[p.name]=l)),typeof p.title<"u"&&(l.title=p.title),typeof p.description<"u"&&(l.description=p.description),typeof p.paramsSchema<"u"&&(l.inputSchema=ji(p.paramsSchema)),typeof p.outputSchema<"u"&&(l.outputSchema=ji(p.outputSchema)),typeof p.callback<"u"&&(l.handler=p.callback),typeof p.annotations<"u"&&(l.annotations=p.annotations),typeof p._meta<"u"&&(l._meta=p._meta),typeof p.enabled<"u"&&(l.enabled=p.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...n){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let i,r,o,a;if(typeof n[0]=="string"&&(i=n.shift()),n.length>1){let d=n[0];if(zf(d))r=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!zf(n[0])&&(a=n.shift());else if(typeof d=="object"&&d!==null){if(Object.values(d).some(u=>typeof u=="object"&&u!==null))throw Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);a=n.shift()}}let s=n[0];return this._createRegisteredTool(t,void 0,i,r,o,a,{taskSupport:"forbidden"},void 0,s)}registerTool(t,n,i){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:r,description:o,inputSchema:a,outputSchema:s,annotations:d,_meta:u}=n;return this._createRegisteredTool(t,r,o,a,s,d,{taskSupport:"forbidden"},u,i)}prompt(t,...n){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let i;typeof n[0]=="string"&&(i=n.shift());let r;n.length>1&&(r=n.shift());let o=n[0],a=this._createRegisteredPrompt(t,void 0,i,r,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(t,n,i){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:r,description:o,argsSchema:a}=n,s=this._createRegisteredPrompt(t,r,o,a,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,n){return this.server.sendLoggingMessage(t,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},XG={type:"object",properties:{}};ga={completion:{values:[],hasMore:!1}};Ww=15e3,iV=J(()=>c.object({session_id:c.string(),ws_url:c.string(),work_dir:c.string().optional(),session_key:c.string().optional()})),un=class extends Error{code;constructor(t,n){super(t),this.name="DirectConnectError",this.code=n}},Bf=class{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new Su;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(t){this.options=t,this.abortController=t.abortController??new AbortController,this.readyPromise=new Promise((n,i)=>{this.readyResolve=n,this.readyReject=i}),this.readyPromise.catch(()=>{}),this.initialize()}get ready(){return this.readyPromise}getSessionId(){return this.sessionId}getWorkDir(){return this.workDir}async initialize(){if(this.abortController.signal.aborted){this.failInit(new Mt("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new Mt("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let t;try{let o=await aV(this.options);this.sessionId=o.sessionId,this.workDir=o.workDir,t=o.wsUrl}catch(o){let a=gs(o);if(!(a instanceof Mt)){let s=a instanceof un&&a.code?a.code:"session_create_failed";this.emitTelemetry("bad",s)}this.failInit(a);return}if(this.closed){this.options.deleteSessionOnClose&&this.sessionId&&Hw(this.options.serverUrl,this.sessionId,this.options.authToken);return}let n={};this.options.authToken&&(n.authorization=`Bearer ${this.options.authToken}`);let i=new WebSocket(t,{headers:n});this.ws=i;let r=setTimeout((o,a)=>{if(!o.readyState){a.close();let s=new un(`WebSocket connection timeout after ${Ww}ms`);o.exitError=s,o.readyReject?.(s),o.emitTelemetry("bad","connect_timeout")}},Ww,this,i);i.addEventListener("open",()=>{clearTimeout(r),this.readyState=!0,dn(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),i.addEventListener("message",o=>{let a=typeof o.data=="string"?o.data:"";if(a.indexOf(`
|
|
115
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);i.cycles==="ref"&&a(l);continue}if(p.count>1&&i.reused==="ref"){a(l);continue}}let s=(l,p)=>{let m=this.seen.get(l),f=m.def??m.schema,h={...f};if(m.ref===null)return;let y=m.ref;if(m.ref=null,y){s(y,p);let w=this.seen.get(y).schema;w.$ref&&p.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(w)):(Object.assign(f,w),Object.assign(f,h))}m.isParent||this.override({zodSchema:l,jsonSchema:f,path:m.path??[]})};for(let l of[...this.seen.entries()].reverse())s(l[0],{target:this.target});let d={};this.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?d.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(d,r.def);let u=i.external?.defs??{};for(let l of this.seen.entries()){let p=l[1];p.def&&p.defId&&(u[p.defId]=p.def)}!i.external&&Object.keys(u).length>0&&(this.target==="draft-2020-12"?d.$defs=u:d.definitions=u);try{return JSON.parse(JSON.stringify(d))}catch{throw Error("Error converting schema to JSON.")}}};pW={},fW=N("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ve.init(e,t),e.def=t,e.parse=(n,i)=>Ru(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>Tl(e,n,i),e.parseAsync=async(n,i)=>Ou(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>Il(e,n,i),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>$n(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e)}),mW=N("ZodMiniObject",(e,t)=>{lh.init(e,t),fW.init(e,t),Ee.defineLazy(e,"shape",()=>t.shape)});c={};zn(c,{xid:()=>RW,void:()=>QW,uuidv7:()=>kW,uuidv6:()=>SW,uuidv4:()=>wW,uuid:()=>bW,url:()=>xW,uppercase:()=>Uh,unknown:()=>nt,union:()=>Be,undefined:()=>VW,ulid:()=>EW,uint64:()=>HW,uint32:()=>KW,tuple:()=>tH,trim:()=>Wh,treeifyError:()=>Gx,transform:()=>Ig,toUpperCase:()=>Gh,toLowerCase:()=>Hh,toJSONSchema:()=>Zh,templateLiteral:()=>lH,symbol:()=>GW,superRefine:()=>OI,success:()=>dH,stringbool:()=>fH,stringFormat:()=>UW,string:()=>U,strictObject:()=>eH,startsWith:()=>zh,size:()=>qh,setErrorMap:()=>gH,set:()=>iH,safeParseAsync:()=>VT,safeParse:()=>GT,registry:()=>hh,regexes:()=>th,regex:()=>Dh,refine:()=>RI,record:()=>ze,readonly:()=>kI,property:()=>AT,promise:()=>cH,prettifyError:()=>Zx,preprocess:()=>Og,prefault:()=>gI,positive:()=>PT,pipe:()=>Lu,partialRecord:()=>nH,parseAsync:()=>HT,parse:()=>WT,overwrite:()=>di,optional:()=>He,object:()=>oe,number:()=>je,nullish:()=>sH,nullable:()=>Du,null:()=>wg,normalize:()=>Jh,nonpositive:()=>RT,nonoptional:()=>yI,nonnegative:()=>OT,never:()=>Nl,negative:()=>ET,nativeEnum:()=>oH,nanoid:()=>TW,nan:()=>uH,multipleOf:()=>ds,minSize:()=>us,minLength:()=>co,mime:()=>Kh,maxSize:()=>El,maxLength:()=>Rl,map:()=>rH,lte:()=>Tn,lt:()=>ei,lowercase:()=>Lh,looseObject:()=>Et,locales:()=>mh,literal:()=>ce,length:()=>Ol,lazy:()=>TI,ksuid:()=>OW,keyof:()=>XW,jwt:()=>LW,json:()=>mH,iso:()=>Qh,ipv6:()=>$W,ipv4:()=>AW,intersection:()=>Dl,int64:()=>WW,int32:()=>BW,int:()=>If,instanceof:()=>pH,includes:()=>Fh,guid:()=>vW,gte:()=>Zt,gt:()=>ti,globalRegistry:()=>rr,getErrorMap:()=>yH,function:()=>LT,formatError:()=>Zm,float64:()=>zW,float32:()=>FW,flattenError:()=>Vm,file:()=>aH,enum:()=>Lt,endsWith:()=>Bh,emoji:()=>CW,email:()=>_W,e164:()=>DW,discriminatedUnion:()=>xg,date:()=>YW,custom:()=>EI,cuid2:()=>PW,cuid:()=>IW,core:()=>Nx,config:()=>At,coerce:()=>AI,clone:()=>$n,cidrv6:()=>jW,cidrv4:()=>MW,check:()=>PI,catch:()=>bI,boolean:()=>ft,bigint:()=>JW,base64url:()=>qW,base64:()=>NW,array:()=>Re,any:()=>ZW,_default:()=>mI,_ZodString:()=>ng,ZodXID:()=>lg,ZodVoid:()=>rI,ZodUnknown:()=>tI,ZodUnion:()=>kg,ZodUndefined:()=>YT,ZodUUID:()=>ir,ZodURL:()=>ig,ZodULID:()=>ug,ZodType:()=>Pe,ZodTuple:()=>sI,ZodTransform:()=>Tg,ZodTemplateLiteral:()=>xI,ZodSymbol:()=>QT,ZodSuccess:()=>_I,ZodStringFormat:()=>Ve,ZodString:()=>Al,ZodSet:()=>uI,ZodRecord:()=>Cg,ZodRealError:()=>Cs,ZodReadonly:()=>SI,ZodPromise:()=>II,ZodPrefault:()=>hI,ZodPipe:()=>Rg,ZodOptional:()=>Pg,ZodObject:()=>ql,ZodNumberFormat:()=>wo,ZodNumber:()=>$l,ZodNullable:()=>pI,ZodNull:()=>XT,ZodNonOptional:()=>Eg,ZodNever:()=>nI,ZodNanoID:()=>ag,ZodNaN:()=>wI,ZodMap:()=>dI,ZodLiteral:()=>lI,ZodLazy:()=>CI,ZodKSUID:()=>cg,ZodJWT:()=>vg,ZodIssueCode:()=>hH,ZodIntersection:()=>aI,ZodISOTime:()=>eg,ZodISODuration:()=>tg,ZodISODateTime:()=>Yh,ZodISODate:()=>Xh,ZodIPv6:()=>fg,ZodIPv4:()=>pg,ZodGUID:()=>qu,ZodFile:()=>cI,ZodError:()=>yW,ZodEnum:()=>cs,ZodEmoji:()=>og,ZodEmail:()=>rg,ZodE164:()=>_g,ZodDiscriminatedUnion:()=>oI,ZodDefault:()=>fI,ZodDate:()=>Sg,ZodCustomStringFormat:()=>ZT,ZodCustom:()=>Ll,ZodCatch:()=>vI,ZodCUID2:()=>dg,ZodCUID:()=>sg,ZodCIDRv6:()=>hg,ZodCIDRv4:()=>mg,ZodBoolean:()=>Ml,ZodBigIntFormat:()=>bg,ZodBigInt:()=>jl,ZodBase64URL:()=>yg,ZodBase64:()=>gg,ZodArray:()=>iI,ZodAny:()=>eI,TimePrecision:()=>tT,NEVER:()=>qx,$output:()=>QC,$input:()=>YC,$brand:()=>Dx});Qh={};zn(Qh,{time:()=>BT,duration:()=>KT,datetime:()=>FT,date:()=>zT,ZodISOTime:()=>eg,ZodISODuration:()=>tg,ZodISODateTime:()=>Yh,ZodISODate:()=>Xh});Yh=N("ZodISODateTime",(e,t)=>{oC.init(e,t),Ve.init(e,t)});Xh=N("ZodISODate",(e,t)=>{aC.init(e,t),Ve.init(e,t)});eg=N("ZodISOTime",(e,t)=>{sC.init(e,t),Ve.init(e,t)});tg=N("ZodISODuration",(e,t)=>{dC.init(e,t),Ve.init(e,t)});JT=(e,t)=>{Gm.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Zm(e,n)},flatten:{value:n=>Vm(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},yW=N("ZodError",JT),Cs=N("ZodError",JT,{Parent:Error}),WT=Qm(Cs),HT=Ym(Cs),GT=Xm(Cs),VT=eh(Cs),Pe=N("ZodType",(e,t)=>(ve.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>$n(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e),e.parse=(n,i)=>WT(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>GT(e,n,i),e.parseAsync=async(n,i)=>HT(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>VT(e,n,i),e.spa=e.safeParseAsync,e.refine=(n,i)=>e.check(RI(n,i)),e.superRefine=n=>e.check(OI(n)),e.overwrite=n=>e.check(di(n)),e.optional=()=>He(e),e.nullable=()=>Du(e),e.nullish=()=>He(Du(e)),e.nonoptional=n=>yI(e,n),e.array=()=>Re(e),e.or=n=>Be([e,n]),e.and=n=>Dl(e,n),e.transform=n=>Lu(e,Ig(n)),e.default=n=>mI(e,n),e.prefault=n=>gI(e,n),e.catch=n=>bI(e,n),e.pipe=n=>Lu(e,n),e.readonly=()=>kI(e),e.describe=n=>{let i=e.clone();return rr.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){return rr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return rr.get(e);let i=e.clone();return rr.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ng=N("_ZodString",(e,t)=>{ks.init(e,t),Pe.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(Dh(...i)),e.includes=(...i)=>e.check(Fh(...i)),e.startsWith=(...i)=>e.check(zh(...i)),e.endsWith=(...i)=>e.check(Bh(...i)),e.min=(...i)=>e.check(co(...i)),e.max=(...i)=>e.check(Rl(...i)),e.length=(...i)=>e.check(Ol(...i)),e.nonempty=(...i)=>e.check(co(1,...i)),e.lowercase=i=>e.check(Lh(i)),e.uppercase=i=>e.check(Uh(i)),e.trim=()=>e.check(Wh()),e.normalize=(...i)=>e.check(Jh(...i)),e.toLowerCase=()=>e.check(Hh()),e.toUpperCase=()=>e.check(Gh())}),Al=N("ZodString",(e,t)=>{ks.init(e,t),ng.init(e,t),e.email=n=>e.check(gh(rg,n)),e.url=n=>e.check(wh(ig,n)),e.jwt=n=>e.check(Nh(vg,n)),e.emoji=n=>e.check(Sh(og,n)),e.guid=n=>e.check(Mu(qu,n)),e.uuid=n=>e.check(yh(ir,n)),e.uuidv4=n=>e.check(_h(ir,n)),e.uuidv6=n=>e.check(vh(ir,n)),e.uuidv7=n=>e.check(bh(ir,n)),e.nanoid=n=>e.check(kh(ag,n)),e.guid=n=>e.check(Mu(qu,n)),e.cuid=n=>e.check(xh(sg,n)),e.cuid2=n=>e.check(Ch(dg,n)),e.ulid=n=>e.check(Th(ug,n)),e.base64=n=>e.check($h(gg,n)),e.base64url=n=>e.check(Mh(yg,n)),e.xid=n=>e.check(Ih(lg,n)),e.ksuid=n=>e.check(Ph(cg,n)),e.ipv4=n=>e.check(Eh(pg,n)),e.ipv6=n=>e.check(Rh(fg,n)),e.cidrv4=n=>e.check(Oh(mg,n)),e.cidrv6=n=>e.check(Ah(hg,n)),e.e164=n=>e.check(jh(_g,n)),e.datetime=n=>e.check(FT(n)),e.date=n=>e.check(zT(n)),e.time=n=>e.check(BT(n)),e.duration=n=>e.check(KT(n))});Ve=N("ZodStringFormat",(e,t)=>{Ke.init(e,t),ng.init(e,t)}),rg=N("ZodEmail",(e,t)=>{Z0.init(e,t),Ve.init(e,t)});qu=N("ZodGUID",(e,t)=>{G0.init(e,t),Ve.init(e,t)});ir=N("ZodUUID",(e,t)=>{V0.init(e,t),Ve.init(e,t)});ig=N("ZodURL",(e,t)=>{Q0.init(e,t),Ve.init(e,t)});og=N("ZodEmoji",(e,t)=>{Y0.init(e,t),Ve.init(e,t)});ag=N("ZodNanoID",(e,t)=>{X0.init(e,t),Ve.init(e,t)});sg=N("ZodCUID",(e,t)=>{eC.init(e,t),Ve.init(e,t)});dg=N("ZodCUID2",(e,t)=>{tC.init(e,t),Ve.init(e,t)});ug=N("ZodULID",(e,t)=>{nC.init(e,t),Ve.init(e,t)});lg=N("ZodXID",(e,t)=>{rC.init(e,t),Ve.init(e,t)});cg=N("ZodKSUID",(e,t)=>{iC.init(e,t),Ve.init(e,t)});pg=N("ZodIPv4",(e,t)=>{uC.init(e,t),Ve.init(e,t)});fg=N("ZodIPv6",(e,t)=>{lC.init(e,t),Ve.init(e,t)});mg=N("ZodCIDRv4",(e,t)=>{cC.init(e,t),Ve.init(e,t)});hg=N("ZodCIDRv6",(e,t)=>{pC.init(e,t),Ve.init(e,t)});gg=N("ZodBase64",(e,t)=>{fC.init(e,t),Ve.init(e,t)});yg=N("ZodBase64URL",(e,t)=>{hC.init(e,t),Ve.init(e,t)});_g=N("ZodE164",(e,t)=>{gC.init(e,t),Ve.init(e,t)});vg=N("ZodJWT",(e,t)=>{_C.init(e,t),Ve.init(e,t)});ZT=N("ZodCustomStringFormat",(e,t)=>{vC.init(e,t),Ve.init(e,t)});$l=N("ZodNumber",(e,t)=>{ah.init(e,t),Pe.init(e,t),e.gt=(i,r)=>e.check(ti(i,r)),e.gte=(i,r)=>e.check(Zt(i,r)),e.min=(i,r)=>e.check(Zt(i,r)),e.lt=(i,r)=>e.check(ei(i,r)),e.lte=(i,r)=>e.check(Tn(i,r)),e.max=(i,r)=>e.check(Tn(i,r)),e.int=i=>e.check(If(i)),e.safe=i=>e.check(If(i)),e.positive=i=>e.check(ti(0,i)),e.nonnegative=i=>e.check(Zt(0,i)),e.negative=i=>e.check(ei(0,i)),e.nonpositive=i=>e.check(Tn(0,i)),e.multipleOf=(i,r)=>e.check(ds(i,r)),e.step=(i,r)=>e.check(ds(i,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});wo=N("ZodNumberFormat",(e,t)=>{bC.init(e,t),$l.init(e,t)});Ml=N("ZodBoolean",(e,t)=>{sh.init(e,t),Pe.init(e,t)});jl=N("ZodBigInt",(e,t)=>{dh.init(e,t),Pe.init(e,t),e.gte=(i,r)=>e.check(Zt(i,r)),e.min=(i,r)=>e.check(Zt(i,r)),e.gt=(i,r)=>e.check(ti(i,r)),e.gte=(i,r)=>e.check(Zt(i,r)),e.min=(i,r)=>e.check(Zt(i,r)),e.lt=(i,r)=>e.check(ei(i,r)),e.lte=(i,r)=>e.check(Tn(i,r)),e.max=(i,r)=>e.check(Tn(i,r)),e.positive=i=>e.check(ti(BigInt(0),i)),e.negative=i=>e.check(ei(BigInt(0),i)),e.nonpositive=i=>e.check(Tn(BigInt(0),i)),e.nonnegative=i=>e.check(Zt(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(ds(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});bg=N("ZodBigIntFormat",(e,t)=>{wC.init(e,t),jl.init(e,t)});QT=N("ZodSymbol",(e,t)=>{SC.init(e,t),Pe.init(e,t)});YT=N("ZodUndefined",(e,t)=>{kC.init(e,t),Pe.init(e,t)});XT=N("ZodNull",(e,t)=>{xC.init(e,t),Pe.init(e,t)});eI=N("ZodAny",(e,t)=>{CC.init(e,t),Pe.init(e,t)});tI=N("ZodUnknown",(e,t)=>{$u.init(e,t),Pe.init(e,t)});nI=N("ZodNever",(e,t)=>{TC.init(e,t),Pe.init(e,t)});rI=N("ZodVoid",(e,t)=>{IC.init(e,t),Pe.init(e,t)});Sg=N("ZodDate",(e,t)=>{PC.init(e,t),Pe.init(e,t),e.min=(i,r)=>e.check(Zt(i,r)),e.max=(i,r)=>e.check(Tn(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});iI=N("ZodArray",(e,t)=>{uh.init(e,t),Pe.init(e,t),e.element=t.element,e.min=(n,i)=>e.check(co(n,i)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,i)=>e.check(Rl(n,i)),e.length=(n,i)=>e.check(Ol(n,i)),e.unwrap=()=>e.element});ql=N("ZodObject",(e,t)=>{lh.init(e,t),Pe.init(e,t),Ee.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Lt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:nt()}),e.loose=()=>e.clone({...e._zod.def,catchall:nt()}),e.strict=()=>e.clone({...e._zod.def,catchall:Nl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Ee.extend(e,n),e.merge=n=>Ee.merge(e,n),e.pick=n=>Ee.pick(e,n),e.omit=n=>Ee.omit(e,n),e.partial=(...n)=>Ee.partial(Pg,e,n[0]),e.required=(...n)=>Ee.required(Eg,e,n[0])});kg=N("ZodUnion",(e,t)=>{ch.init(e,t),Pe.init(e,t),e.options=t.options});oI=N("ZodDiscriminatedUnion",(e,t)=>{kg.init(e,t),EC.init(e,t)});aI=N("ZodIntersection",(e,t)=>{RC.init(e,t),Pe.init(e,t)});sI=N("ZodTuple",(e,t)=>{Pl.init(e,t),Pe.init(e,t),e.rest=n=>e.clone({...e._zod.def,rest:n})});Cg=N("ZodRecord",(e,t)=>{OC.init(e,t),Pe.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});dI=N("ZodMap",(e,t)=>{AC.init(e,t),Pe.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});uI=N("ZodSet",(e,t)=>{$C.init(e,t),Pe.init(e,t),e.min=(...n)=>e.check(us(...n)),e.nonempty=n=>e.check(us(1,n)),e.max=(...n)=>e.check(El(...n)),e.size=(...n)=>e.check(qh(...n))});cs=N("ZodEnum",(e,t)=>{MC.init(e,t),Pe.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new cs({...t,checks:[],...Ee.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw Error(`Key ${a} not found in enum`);return new cs({...t,checks:[],...Ee.normalizeParams(r),entries:o})}});lI=N("ZodLiteral",(e,t)=>{jC.init(e,t),Pe.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});cI=N("ZodFile",(e,t)=>{NC.init(e,t),Pe.init(e,t),e.min=(n,i)=>e.check(us(n,i)),e.max=(n,i)=>e.check(El(n,i)),e.mime=(n,i)=>e.check(Kh(Array.isArray(n)?n:[n],i))});Tg=N("ZodTransform",(e,t)=>{ph.init(e,t),Pe.init(e,t),e._zod.parse=(n,i)=>{n.addIssue=o=>{if(typeof o=="string")n.issues.push(Ee.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),a.continue??(a.continue=!0),n.issues.push(Ee.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});Pg=N("ZodOptional",(e,t)=>{qC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});pI=N("ZodNullable",(e,t)=>{DC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});fI=N("ZodDefault",(e,t)=>{LC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});hI=N("ZodPrefault",(e,t)=>{UC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});Eg=N("ZodNonOptional",(e,t)=>{FC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});_I=N("ZodSuccess",(e,t)=>{zC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});vI=N("ZodCatch",(e,t)=>{BC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});wI=N("ZodNaN",(e,t)=>{KC.init(e,t),Pe.init(e,t)});Rg=N("ZodPipe",(e,t)=>{fh.init(e,t),Pe.init(e,t),e.in=t.in,e.out=t.out});SI=N("ZodReadonly",(e,t)=>{JC.init(e,t),Pe.init(e,t)});xI=N("ZodTemplateLiteral",(e,t)=>{WC.init(e,t),Pe.init(e,t)});CI=N("ZodLazy",(e,t)=>{GC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.getter()});II=N("ZodPromise",(e,t)=>{HC.init(e,t),Pe.init(e,t),e.unwrap=()=>e._zod.def.innerType});Ll=N("ZodCustom",(e,t)=>{VC.init(e,t),Pe.init(e,t)});fH=(...e)=>qT({Pipe:Rg,Boolean:Ml,String:Al,Transform:Tg},...e);hH={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};AI={};zn(AI,{string:()=>_H,number:()=>vH,date:()=>SH,boolean:()=>bH,bigint:()=>wH});At(ZC());kH=c,$I=kH,MI="2025-11-25",xH=[MI,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Kr="io.modelcontextprotocol/related-task",Ul="2.0",mt=EI(e=>e!==null&&(typeof e=="object"||typeof e=="function")),jI=Be([U(),je().int()]),NI=U(),Dse=Et({ttl:je().optional(),pollInterval:je().optional()}),CH=oe({ttl:je().optional()}),TH=oe({taskId:U()}),Ag=Et({progressToken:jI.optional(),[Kr]:TH.optional()}),en=oe({_meta:Ag.optional()}),Ts=en.extend({task:CH.optional()}),IH=e=>Ts.safeParse(e).success,bt=oe({method:U(),params:en.loose().optional()}),gn=oe({_meta:Ag.optional()}),yn=oe({method:U(),params:gn.loose().optional()}),wt=Et({_meta:Ag.optional()}),Fl=Be([U(),je().int()]),qI=oe({jsonrpc:ce(Ul),id:Fl,...bt.shape}).strict(),$w=e=>qI.safeParse(e).success,DI=oe({jsonrpc:ce(Ul),...yn.shape}).strict(),PH=e=>DI.safeParse(e).success,$g=oe({jsonrpc:ce(Ul),id:Fl,result:wt}).strict(),Cd=e=>$g.safeParse(e).success;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ge||(ge={}));Mg=oe({jsonrpc:ce(Ul),id:Fl.optional(),error:oe({code:je().int(),message:U(),data:nt().optional()})}).strict(),EH=e=>Mg.safeParse(e).success,Lse=Be([qI,DI,$g,Mg]),Use=Be([$g,Mg]),jg=wt.strict(),RH=gn.extend({requestId:Fl.optional(),reason:U().optional()}),Ng=yn.extend({method:ce("notifications/cancelled"),params:RH}),OH=oe({src:U(),mimeType:U().optional(),sizes:Re(U()).optional(),theme:Lt(["light","dark"]).optional()}),Is=oe({icons:Re(OH).optional()}),po=oe({name:U(),title:U().optional()}),LI=po.extend({...po.shape,...Is.shape,version:U(),websiteUrl:U().optional(),description:U().optional()}),AH=Dl(oe({applyDefaults:ft().optional()}),ze(U(),nt())),$H=Og(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Dl(oe({form:AH.optional(),url:mt.optional()}),ze(U(),nt()).optional())),MH=Et({list:mt.optional(),cancel:mt.optional(),requests:Et({sampling:Et({createMessage:mt.optional()}).optional(),elicitation:Et({create:mt.optional()}).optional()}).optional()}),jH=Et({list:mt.optional(),cancel:mt.optional(),requests:Et({tools:Et({call:mt.optional()}).optional()}).optional()}),NH=oe({experimental:ze(U(),mt).optional(),sampling:oe({context:mt.optional(),tools:mt.optional()}).optional(),elicitation:$H.optional(),roots:oe({listChanged:ft().optional()}).optional(),tasks:MH.optional(),extensions:ze(U(),mt).optional()}),qH=en.extend({protocolVersion:U(),capabilities:NH,clientInfo:LI}),UI=bt.extend({method:ce("initialize"),params:qH}),DH=oe({experimental:ze(U(),mt).optional(),logging:mt.optional(),completions:mt.optional(),prompts:oe({listChanged:ft().optional()}).optional(),resources:oe({subscribe:ft().optional(),listChanged:ft().optional()}).optional(),tools:oe({listChanged:ft().optional()}).optional(),tasks:jH.optional(),extensions:ze(U(),mt).optional()}),LH=wt.extend({protocolVersion:U(),capabilities:DH,serverInfo:LI,instructions:U().optional()}),FI=yn.extend({method:ce("notifications/initialized"),params:gn.optional()}),qg=bt.extend({method:ce("ping"),params:en.optional()}),UH=oe({progress:je(),total:He(je()),message:He(U())}),FH=oe({...gn.shape,...UH.shape,progressToken:jI}),Dg=yn.extend({method:ce("notifications/progress"),params:FH}),zH=en.extend({cursor:NI.optional()}),Ps=bt.extend({params:zH.optional()}),Es=wt.extend({nextCursor:NI.optional()}),BH=Lt(["working","input_required","completed","failed","cancelled"]),Rs=oe({taskId:U(),status:BH,ttl:Be([je(),wg()]),createdAt:U(),lastUpdatedAt:U(),pollInterval:He(je()),statusMessage:He(U())}),zl=wt.extend({task:Rs}),KH=gn.merge(Rs),Uu=yn.extend({method:ce("notifications/tasks/status"),params:KH}),Lg=bt.extend({method:ce("tasks/get"),params:en.extend({taskId:U()})}),Ug=wt.merge(Rs),Fg=bt.extend({method:ce("tasks/result"),params:en.extend({taskId:U()})}),Fse=wt.loose(),zg=Ps.extend({method:ce("tasks/list")}),Bg=Es.extend({tasks:Re(Rs)}),Kg=bt.extend({method:ce("tasks/cancel"),params:en.extend({taskId:U()})}),JH=wt.merge(Rs),zI=oe({uri:U(),mimeType:He(U()),_meta:ze(U(),nt()).optional()}),BI=zI.extend({text:U()}),Jg=U().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),KI=zI.extend({blob:Jg}),Os=Lt(["user","assistant"]),So=oe({audience:Re(Os).optional(),priority:je().min(0).max(1).optional(),lastModified:Qh.datetime({offset:!0}).optional()}),JI=oe({...po.shape,...Is.shape,uri:U(),description:He(U()),mimeType:He(U()),size:He(je()),annotations:So.optional(),_meta:He(Et({}))}),WH=oe({...po.shape,...Is.shape,uriTemplate:U(),description:He(U()),mimeType:He(U()),annotations:So.optional(),_meta:He(Et({}))}),Pf=Ps.extend({method:ce("resources/list")}),HH=Es.extend({resources:Re(JI)}),Ef=Ps.extend({method:ce("resources/templates/list")}),GH=Es.extend({resourceTemplates:Re(WH)}),Wg=en.extend({uri:U()}),VH=Wg,Rf=bt.extend({method:ce("resources/read"),params:VH}),ZH=wt.extend({contents:Re(Be([BI,KI]))}),QH=yn.extend({method:ce("notifications/resources/list_changed"),params:gn.optional()}),YH=Wg,XH=bt.extend({method:ce("resources/subscribe"),params:YH}),e9=Wg,t9=bt.extend({method:ce("resources/unsubscribe"),params:e9}),n9=gn.extend({uri:U()}),r9=yn.extend({method:ce("notifications/resources/updated"),params:n9}),i9=oe({name:U(),description:He(U()),required:He(ft())}),o9=oe({...po.shape,...Is.shape,description:He(U()),arguments:He(Re(i9)),_meta:He(Et({}))}),Of=Ps.extend({method:ce("prompts/list")}),a9=Es.extend({prompts:Re(o9)}),s9=en.extend({name:U(),arguments:ze(U(),U()).optional()}),Af=bt.extend({method:ce("prompts/get"),params:s9}),Hg=oe({type:ce("text"),text:U(),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),Gg=oe({type:ce("image"),data:Jg,mimeType:U(),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),Vg=oe({type:ce("audio"),data:Jg,mimeType:U(),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),d9=oe({type:ce("tool_use"),name:U(),id:U(),input:ze(U(),nt()),_meta:ze(U(),nt()).optional()}),u9=oe({type:ce("resource"),resource:Be([BI,KI]),annotations:So.optional(),_meta:ze(U(),nt()).optional()}),l9=JI.extend({type:ce("resource_link")}),Zg=Be([Hg,Gg,Vg,l9,u9]),c9=oe({role:Os,content:Zg}),p9=wt.extend({description:U().optional(),messages:Re(c9)}),f9=yn.extend({method:ce("notifications/prompts/list_changed"),params:gn.optional()}),m9=oe({title:U().optional(),readOnlyHint:ft().optional(),destructiveHint:ft().optional(),idempotentHint:ft().optional(),openWorldHint:ft().optional()}),h9=oe({taskSupport:Lt(["required","optional","forbidden"]).optional()}),WI=oe({...po.shape,...Is.shape,description:U().optional(),inputSchema:oe({type:ce("object"),properties:ze(U(),mt).optional(),required:Re(U()).optional()}).catchall(nt()),outputSchema:oe({type:ce("object"),properties:ze(U(),mt).optional(),required:Re(U()).optional()}).catchall(nt()).optional(),annotations:m9.optional(),execution:h9.optional(),_meta:ze(U(),nt()).optional()}),$f=Ps.extend({method:ce("tools/list")}),g9=Es.extend({tools:Re(WI)}),Qg=wt.extend({content:Re(Zg).default([]),structuredContent:ze(U(),nt()).optional(),isError:ft().optional()}),zse=Qg.or(wt.extend({toolResult:nt()})),y9=Ts.extend({name:U(),arguments:ze(U(),nt()).optional()}),Fu=bt.extend({method:ce("tools/call"),params:y9}),_9=yn.extend({method:ce("notifications/tools/list_changed"),params:gn.optional()}),Bse=oe({autoRefresh:ft().default(!0),debounceMs:je().int().nonnegative().default(300)}),zu=Lt(["debug","info","notice","warning","error","critical","alert","emergency"]),v9=en.extend({level:zu}),HI=bt.extend({method:ce("logging/setLevel"),params:v9}),b9=gn.extend({level:zu,logger:U().optional(),data:nt()}),w9=yn.extend({method:ce("notifications/message"),params:b9}),S9=oe({name:U().optional()}),k9=oe({hints:Re(S9).optional(),costPriority:je().min(0).max(1).optional(),speedPriority:je().min(0).max(1).optional(),intelligencePriority:je().min(0).max(1).optional()}),x9=oe({mode:Lt(["auto","required","none"]).optional()}),C9=oe({type:ce("tool_result"),toolUseId:U().describe("The unique identifier for the corresponding tool call."),content:Re(Zg).default([]),structuredContent:oe({}).loose().optional(),isError:ft().optional(),_meta:ze(U(),nt()).optional()}),T9=xg("type",[Hg,Gg,Vg]),Bu=xg("type",[Hg,Gg,Vg,d9,C9]),I9=oe({role:Os,content:Be([Bu,Re(Bu)]),_meta:ze(U(),nt()).optional()}),P9=Ts.extend({messages:Re(I9),modelPreferences:k9.optional(),systemPrompt:U().optional(),includeContext:Lt(["none","thisServer","allServers"]).optional(),temperature:je().optional(),maxTokens:je().int(),stopSequences:Re(U()).optional(),metadata:mt.optional(),tools:Re(WI).optional(),toolChoice:x9.optional()}),E9=bt.extend({method:ce("sampling/createMessage"),params:P9}),Yg=wt.extend({model:U(),stopReason:He(Lt(["endTurn","stopSequence","maxTokens"]).or(U())),role:Os,content:T9}),GI=wt.extend({model:U(),stopReason:He(Lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(U())),role:Os,content:Be([Bu,Re(Bu)])}),R9=oe({type:ce("boolean"),title:U().optional(),description:U().optional(),default:ft().optional()}),O9=oe({type:ce("string"),title:U().optional(),description:U().optional(),minLength:je().optional(),maxLength:je().optional(),format:Lt(["email","uri","date","date-time"]).optional(),default:U().optional()}),A9=oe({type:Lt(["number","integer"]),title:U().optional(),description:U().optional(),minimum:je().optional(),maximum:je().optional(),default:je().optional()}),$9=oe({type:ce("string"),title:U().optional(),description:U().optional(),enum:Re(U()),default:U().optional()}),M9=oe({type:ce("string"),title:U().optional(),description:U().optional(),oneOf:Re(oe({const:U(),title:U()})),default:U().optional()}),j9=oe({type:ce("string"),title:U().optional(),description:U().optional(),enum:Re(U()),enumNames:Re(U()).optional(),default:U().optional()}),N9=Be([$9,M9]),q9=oe({type:ce("array"),title:U().optional(),description:U().optional(),minItems:je().optional(),maxItems:je().optional(),items:oe({type:ce("string"),enum:Re(U())}),default:Re(U()).optional()}),D9=oe({type:ce("array"),title:U().optional(),description:U().optional(),minItems:je().optional(),maxItems:je().optional(),items:oe({anyOf:Re(oe({const:U(),title:U()}))}),default:Re(U()).optional()}),L9=Be([q9,D9]),U9=Be([j9,N9,L9]),F9=Be([U9,R9,O9,A9]),z9=Ts.extend({mode:ce("form").optional(),message:U(),requestedSchema:oe({type:ce("object"),properties:ze(U(),F9),required:Re(U()).optional()})}),B9=Ts.extend({mode:ce("url"),message:U(),elicitationId:U(),url:U().url()}),K9=Be([z9,B9]),J9=bt.extend({method:ce("elicitation/create"),params:K9}),W9=gn.extend({elicitationId:U()}),H9=yn.extend({method:ce("notifications/elicitation/complete"),params:W9}),Ku=wt.extend({action:Lt(["accept","decline","cancel"]),content:Og(e=>e===null?void 0:e,ze(U(),Be([U(),je(),ft(),Re(U())])).optional())}),G9=oe({type:ce("ref/resource"),uri:U()}),V9=oe({type:ce("ref/prompt"),name:U()}),Z9=en.extend({ref:Be([V9,G9]),argument:oe({name:U(),value:U()}),context:oe({arguments:ze(U(),U()).optional()}).optional()}),Mf=bt.extend({method:ce("completion/complete"),params:Z9});X9=wt.extend({completion:Et({values:Re(U()).max(100),total:He(je().int()),hasMore:He(ft())})}),eG=oe({uri:U().startsWith("file://"),name:U().optional(),_meta:ze(U(),nt()).optional()}),tG=bt.extend({method:ce("roots/list"),params:en.optional()}),VI=wt.extend({roots:Re(eG)}),nG=yn.extend({method:ce("notifications/roots/list_changed"),params:gn.optional()}),Kse=Be([qg,UI,Mf,HI,Af,Of,Pf,Ef,Rf,XH,t9,Fu,$f,Lg,Fg,zg,Kg]),Jse=Be([Ng,Dg,FI,nG,Uu]),Wse=Be([jg,Yg,GI,Ku,VI,Ug,Bg,zl]),Hse=Be([qg,E9,J9,tG,Lg,Fg,zg,Kg]),Gse=Be([Ng,Dg,w9,r9,QH,_9,f9,Uu,H9]),Vse=Be([jg,LH,X9,p9,a9,HH,GH,ZH,Qg,g9,Ug,Bg,zl]),fe=class e extends Error{constructor(t,n,i){super(`MCP error ${t}: ${n}`),this.code=t,this.data=i,this.name="McpError"}static fromError(t,n,i){if(t===ge.UrlElicitationRequired&&i){let r=i;if(r.elicitations)return new jf(r.elicitations,n)}return new e(t,n,i)}},jf=class extends fe{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(ge.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};rG=Symbol("Let zodToJsonSchema decide on which parser to use"),Mw={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},iG=e=>typeof e=="string"?{...Mw,name:e}:{...Mw,...e},oG=e=>{let t=iG(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};QI=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};uG=(e,t)=>Me(e.innerType._def,t);lG=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let i of e.checks)switch(i.kind){case"min":De(n,"minimum",i.value,i.message,t);break;case"max":De(n,"maximum",i.value,i.message,t);break}return n};mG=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;Tp=void 0,kn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Tp===void 0&&(Tp=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tp),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};yG=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");Ju={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Nw=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,r)=>Me(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(i=>!!i&&(!t.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return n.length?{anyOf:n}:void 0};EG=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Me(e.innerType._def,t);let n=Me(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Dt(t)},n]}:Dt(t)},RG=(e,t)=>{if(t.pipeStrategy==="input")return Me(e.in._def,t);if(t.pipeStrategy==="output")return Me(e.out._def,t);let n=Me(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=Me(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,i].filter(r=>r!==void 0)}};NG=(e,t)=>Me(e.innerType._def,t),qG=(e,t,n)=>{switch(t){case Z.ZodString:return eP(e,n);case Z.ZodNumber:return CG(e,n);case Z.ZodObject:return TG(e,n);case Z.ZodBigInt:return sG(e,n);case Z.ZodBoolean:return dG();case Z.ZodDate:return XI(e,n);case Z.ZodUndefined:return MG(n);case Z.ZodNull:return SG(n);case Z.ZodArray:return aG(e,n);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return kG(e,n);case Z.ZodIntersection:return hG(e,n);case Z.ZodTuple:return $G(e,n);case Z.ZodRecord:return tP(e,n);case Z.ZodLiteral:return gG(e,n);case Z.ZodEnum:return fG(e);case Z.ZodNativeEnum:return bG(e);case Z.ZodNullable:return xG(e,n);case Z.ZodOptional:return EG(e,n);case Z.ZodMap:return vG(e,n);case Z.ZodSet:return AG(e,n);case Z.ZodLazy:return()=>e.getter()._def;case Z.ZodPromise:return OG(e,n);case Z.ZodNaN:case Z.ZodNever:return wG(n);case Z.ZodEffects:return pG(e,n);case Z.ZodAny:return Dt(n);case Z.ZodUnknown:return jG(n);case Z.ZodDefault:return cG(e,n);case Z.ZodBranded:return YI(e,n);case Z.ZodReadonly:return NG(e,n);case Z.ZodCatch:return uG(e,n);case Z.ZodPipeline:return RG(e,n);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return(i=>{})(t)}};DG=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:QI(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,i)=>t.currentPath[i]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Dt(t)):t.$refStrategy==="seen"?Dt(t):void 0}},LG=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),UG=(e,t)=>{let n=oG(t),i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((d,[u,l])=>({...d,[u]:Me(l._def,{...n,currentPath:[...n.basePath,n.definitionPath,u]},!0)??Dt(n)}),{}):void 0,r=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=Me(e._def,r===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,r]},!1)??Dt(n),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(o.title=a),n.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[n.openAiAnyTypeName]||(i[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let s=r===void 0?i?{...o,[n.definitionPath]:i}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,r].join("/"),[n.definitionPath]:{...i,[r]:o}};return n.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};zG=6e4,Nf=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ng,n=>{this._oncancel(n)}),this.setNotificationHandler(Dg,n=>{this._onprogress(n)}),this.setRequestHandler(qg,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Lg,async(n,i)=>{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new fe(ge.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(Fg,async(n,i)=>{let r=async()=>{let o=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(s.type==="response"||s.type==="error"){let d=s.message,u=d.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(d);else{let p=d,m=new fe(p.error.code,p.error.message,p.error.data);l(m)}else{let p=s.type==="response"?"Response":"Error";this._onerror(Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:i.requestId})}}let a=await this._taskStore.getTask(o,i.sessionId);if(!a)throw new fe(ge.InvalidParams,`Task not found: ${o}`);if(!Fr(a.status))return await this._waitForTaskUpdate(o,i.signal),await r();if(Fr(a.status)){let s=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...s,_meta:{...s._meta,[Kr]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(zg,async(n,i)=>{try{let{tasks:r,nextCursor:o}=await this._taskStore.listTasks(n.params?.cursor,i.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new fe(ge.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(Kg,async(n,i)=>{try{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new fe(ge.InvalidParams,`Task not found: ${n.params.taskId}`);if(Fr(r.status))throw new fe(ge.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(n.params.taskId);let o=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!o)throw new fe(ge.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof fe?r:new fe(ge.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,i,r,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(t){let n=this._timeoutInfo.get(t);if(!n)return!1;let i=Date.now()-n.startTime;if(n.maxTotalTimeout&&i>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),fe.fromError(ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:i});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){let n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let r=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{r?.(o,a),Cd(o)||EH(o)?this._onresponse(o):$w(o)?this._onrequest(o,a):PH(o)?this._onnotification(o):this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let n=fe.fromError(ge.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of t.values())i(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){let n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,n){let i=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,o=t.params?._meta?.[Kr]?.taskId;if(i===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:ge.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(p=>this._onerror(Error(`Failed to enqueue error response: ${p}`))):r?.send(l).catch(p=>this._onerror(Error(`Failed to send an error response: ${p}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=IH(t.params)?t.params.task:void 0,d=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,u={signal:a.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let p={relatedRequestId:t.id};o&&(p.relatedTask={taskId:o}),await this.notification(l,p)},sendRequest:async(l,p,m)=>{if(a.signal.aborted)throw new fe(ge.ConnectionClosed,"Request was cancelled");let f={...m,relatedRequestId:t.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let h=f.relatedTask?.taskId??o;return h&&d&&await d.updateTaskStatus(h,"input_required"),await this.request(l,p,f)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>i(t,u)).then(async l=>{if(a.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:p,timestamp:Date.now()},r?.sessionId):await r?.send(p)},async l=>{if(a.signal.aborted)return;let p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:ge.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},r?.sessionId):await r?.send(p)}).catch(l=>this._onerror(Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===a&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:n,...i}=t.params,r=Number(n),o=this._progressHandlers.get(r);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(d);return}o(i)}_onresponse(t){let n=Number(t.id),i=this._requestResolvers.get(n);if(i){if(this._requestResolvers.delete(n),Cd(t))i(t);else{let a=new fe(t.error.code,t.error.message,t.error.data);i(a)}return}let r=this._responseHandlers.get(n);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let o=!1;if(Cd(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,n))}}if(o||this._progressHandlers.delete(n),Cd(t))r(t);else{let a=fe.fromError(t.error.code,t.error.message,t.error.data);r(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,i){let{task:r}=i??{};if(!r){try{yield{type:"result",result:await this.request(t,n,i)}}catch(a){yield{type:"error",error:a instanceof fe?a:new fe(ge.InternalError,String(a))}}return}let o;try{let a=await this.request(t,zl,i);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new fe(ge.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:s},Fr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)}:s.status==="failed"?yield{type:"error",error:new fe(ge.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new fe(ge.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)};return}let d=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,d)),i?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof fe?a:new fe(ge.InternalError,String(a))}}}request(t,n,i){let{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:d}=i??{};return new Promise((u,l)=>{let p=v=>{l(v)};if(!this._transport){p(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(v){p(v);return}i?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};i?.onprogress&&(this._progressHandlers.set(m,i.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(f.params={...f.params,task:s}),d&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Kr]:d}});let h=v=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(v)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(S=>this._onerror(Error(`Failed to send cancellation: ${S}`)));let b=v instanceof fe?v:new fe(ge.RequestTimeout,String(v));l(b)};this._responseHandlers.set(m,v=>{if(!i?.signal?.aborted){if(v instanceof Error)return l(v);try{let b=Ma(n,v.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),i?.signal?.addEventListener("abort",()=>{h(i?.signal?.reason)});let y=i?.timeout??zG,w=()=>h(fe.fromError(ge.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(m,y,i?.maxTotalTimeout,w,i?.resetTimeoutOnProgress??!1);let g=d?.taskId;if(g){let v=b=>{let S=this._responseHandlers.get(m);S?S(b):this._onerror(Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,v),this._enqueueTaskMessage(g,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(m),l(b)})}else this._transport.send(f,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(v=>{this._cleanupTimeout(m),l(v)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},Ug,n)}async getTaskResult(t,n,i){return this.request({method:"tasks/result",params:t},n,i)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},Bg,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},JH,n)}async notification(t,n){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(t.method);let i=n?.relatedTask?.taskId;if(i){let o={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Kr]:n.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:o,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let o={...t,jsonrpc:"2.0"};n?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Kr]:n.relatedTask}}}),this._transport?.send(o,n).catch(a=>this._onerror(a))});return}let r={...t,jsonrpc:"2.0"};n?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[Kr]:n.relatedTask}}}),await this._transport.send(r,n)}setRequestHandler(t,n){let i=Dw(t);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(r,o)=>{let a=Lw(t,r);return Promise.resolve(n(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){let i=Dw(t);this._notificationHandlers.set(i,r=>{let o=Lw(t,r);return Promise.resolve(n(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,i){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,i,r)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(t,n);for(let r of i)if(r.type==="request"&&$w(r.message)){let o=r.message.id,a=this._requestResolvers.get(o);a?(a(new fe(ge.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){let i=this._options?.defaultTaskPollInterval??1e3;try{let r=await this._taskStore?.getTask(t);r?.pollInterval&&(i=r.pollInterval)}catch{}return new Promise((r,o)=>{if(n.aborted){o(new fe(ge.InvalidRequest,"Request cancelled"));return}let a=setTimeout(r,i);n.addEventListener("abort",()=>{clearTimeout(a),o(new fe(ge.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){let i=this._taskStore;if(!i)throw Error("No task store configured");return{createTask:async r=>{if(!t)throw Error("No request provided");return await i.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{let o=await i.getTask(r,n);if(!o)throw new fe(ge.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,a)=>{await i.storeTaskResult(r,o,a,n);let s=await i.getTask(r,n);if(s){let d=Uu.parse({method:"notifications/tasks/status",params:s});await this.notification(d),Fr(s.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>i.getTaskResult(r,n),updateTaskStatus:async(r,o,a)=>{let s=await i.getTask(r,n);if(!s)throw new fe(ge.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Fr(s.status))throw new fe(ge.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(r,o,a,n);let d=await i.getTask(r,n);if(d){let u=Uu.parse({method:"notifications/tasks/status",params:d});await this.notification(u),Fr(d.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>i.listTasks(r,n)}}};KG=am(GS(),1),JG=am(ej(),1);qf=class{constructor(t){this._ajv=t??WG()}getValidator(t){let n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}},Df=class{constructor(t){this._server=t}requestStream(t,n,i){return this._server.requestStream(t,n,i)}createMessageStream(t,n){let i=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!i?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages[t.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],a=o.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,d=s?Array.isArray(s.content)?s.content:[s.content]:[],u=d.some(l=>l.type==="tool_use");if(a){if(o.some(l=>l.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(d.filter(m=>m.type==="tool_use").map(m=>m.id)),p=new Set(o.filter(m=>m.type==="tool_result").map(m=>m.toolUseId));if(l.size!==p.size||![...l].every(m=>p.has(m)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Yg,n)}elicitInputStream(t,n){let i=this._server.getClientCapabilities(),r=t.mode??"form";switch(r){case"url":{if(!i?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=r==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},Ku,n)}async getTask(t,n){return this._server.getTask({taskId:t},n)}async getTaskResult(t,n,i){return this._server.getTaskResult({taskId:t},n,i)}async listTasks(t,n){return this._server.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._server.cancelTask({taskId:t},n)}};Lf=class extends Nf{constructor(t,n){super(n),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(zu.options.map((i,r)=>[i,r])),this.isMessageIgnored=(i,r)=>{let o=this._loggingLevels.get(r);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new qf,this.setRequestHandler(UI,i=>this._oninitialize(i)),this.setNotificationHandler(FI,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(HI,async(i,r)=>{let o=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=i.params,s=zu.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Df(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=BG(this._capabilities,t)}setRequestHandler(t,n){let i=xs(t)?.method;if(!i)throw Error("Schema is missing a method literal");let r;if(Fn(i)){let o=i;r=o._zod?.def?.value??o.value}else{let o=i;r=o._def?.value??o.value}if(typeof r!="string")throw Error("Schema method literal must be a string");if(r==="tools/call"){let o=async(a,s)=>{let d=Ma(Fu,a);if(!d.success){let m=d.error instanceof Error?d.error.message:String(d.error);throw new fe(ge.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:u}=d.data,l=await Promise.resolve(n(a,s));if(u.task){let m=Ma(zl,l);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new fe(ge.InvalidParams,`Invalid task creation result: ${f}`)}return m.data}let p=Ma(Qg,l);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new fe(ge.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(t,o)}return super.setRequestHandler(t,n)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){GG(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&HG(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let n=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:xH.includes(n)?n:MI,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},jg)}async createMessage(t,n){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],r=Array.isArray(i.content)?i.content:[i.content],o=r.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],d=s.some(u=>u.type==="tool_use");if(o){if(r.some(u=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!d)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(d){let u=new Set(s.filter(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(r.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},GI,n):this.request({method:"sampling/createMessage",params:t},Yg,n)}async elicitInput(t,n){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},Ku,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},r=await this.request({method:"elicitation/create",params:i},Ku,n);if(r.action==="accept"&&r.content&&i.requestedSchema)try{let o=this._jsonSchemaValidator.getValidator(i.requestedSchema)(r.content);if(!o.valid)throw new fe(ge.InvalidParams,`Elicitation response content does not match requested schema: ${o.errorMessage}`)}catch(o){throw o instanceof fe?o:new fe(ge.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return r}}}createElicitationCompletionNotifier(t,n){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},n)}async listRoots(t,n){return this.request({method:"roots/list",params:t},VI,n)}async sendLoggingMessage(t,n){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,n))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},nP=Symbol.for("mcp.completable");(function(e){e.Completable="McpCompletable"})(zw||(zw={}));ZG=/^[A-Za-z0-9._-]{1,128}$/;Uf=class{constructor(t){this._mcpServer=t}registerToolTask(t,n,i){let r={taskSupport:"required",...n.execution};if(r.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,r,n._meta,i)}},Ff=class{constructor(t,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Lf(t,n)}get experimental(){return this._experimental||(this._experimental={tasks:new Uf(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(fr($f)),this.server.assertCanSetRequestHandler(fr(Fu)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler($f,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,n])=>{let i={name:t,title:n.title,description:n.description,inputSchema:(()=>{let r=ha(n.inputSchema);return r?qw(r,{strictUnions:!0,pipeStrategy:"input"}):XG})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){let r=ha(n.outputSchema);r&&(i.outputSchema=qw(r,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(Fu,async(t,n)=>{try{let i=this._registeredTools[t.params.name];if(!i)throw new fe(ge.InvalidParams,`Tool ${t.params.name} not found`);if(!i.enabled)throw new fe(ge.InvalidParams,`Tool ${t.params.name} disabled`);let r=!!t.params.task,o=i.execution?.taskSupport,a="createTask"in i.handler;if((o==="required"||o==="optional")&&!a)throw new fe(ge.InternalError,`Tool ${t.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!r)throw new fe(ge.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!r&&a)return await this.handleAutomaticTaskPolling(i,t,n);let s=await this.validateToolInput(i,t.params.arguments,t.params.name),d=await this.executeToolHandler(i,s,n);return r||await this.validateToolOutput(i,d,t.params.name),d}catch(i){if(i instanceof fe&&i.code===ge.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,n,i){if(!t.inputSchema)return;let r=ha(t.inputSchema)??t.inputSchema,o=await xp(r,n);if(!o.success){let a="error"in o?o.error:"Unknown error",s=Cp(a);throw new fe(ge.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${s}`)}return o.data}async validateToolOutput(t,n,i){if(!t.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new fe(ge.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let r=ha(t.outputSchema),o=await xp(r,n.structuredContent);if(!o.success){let a="error"in o?o.error:"Unknown error",s=Cp(a);throw new fe(ge.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${s}`)}}async executeToolHandler(t,n,i){let r=t.handler;if("createTask"in r){if(!i.taskStore)throw Error("No task store provided.");let o={...i,taskStore:i.taskStore};return t.inputSchema?await Promise.resolve(r.createTask(n,o)):await Promise.resolve(r.createTask(o))}return t.inputSchema?await Promise.resolve(r(n,i)):await Promise.resolve(r(i))}async handleAutomaticTaskPolling(t,n,i){if(!i.taskStore)throw Error("No task store provided for task-capable tool.");let r=await this.validateToolInput(t,n.params.arguments,n.params.name),o=t.handler,a={...i,taskStore:i.taskStore},s=r?await Promise.resolve(o.createTask(r,a)):await Promise.resolve(o.createTask(a)),d=s.task.taskId,u=s.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(m=>setTimeout(m,l));let p=await i.taskStore.getTask(d);if(!p)throw new fe(ge.InternalError,`Task ${d} not found during polling`);u=p}return await i.taskStore.getTaskResult(d)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(fr(Mf)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Mf,async t=>{switch(t.params.ref.type){case"ref/prompt":return Q9(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Y9(t),this.handleResourceCompletion(t,t.params.ref);default:throw new fe(ge.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,n){let i=this._registeredPrompts[n.name];if(!i)throw new fe(ge.InvalidParams,`Prompt ${n.name} not found`);if(!i.enabled)throw new fe(ge.InvalidParams,`Prompt ${n.name} disabled`);if(!i.argsSchema)return ga;let r=xs(i.argsSchema)?.[t.params.argument.name];if(!Fw(r))return ga;let o=VG(r);if(!o)return ga;let a=await o(t.params.argument.value,t.params.context);return Jw(a)}async handleResourceCompletion(t,n){let i=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===n.uri);if(!i){if(this._registeredResources[n.uri])return ga;throw new fe(ge.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let r=i.resourceTemplate.completeCallback(t.params.argument.name);if(!r)return ga;let o=await r(t.params.argument.value,t.params.context);return Jw(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(fr(Pf)),this.server.assertCanSetRequestHandler(fr(Ef)),this.server.assertCanSetRequestHandler(fr(Rf)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Pf,async(t,n)=>{let i=Object.entries(this._registeredResources).filter(([o,a])=>a.enabled).map(([o,a])=>({uri:o,name:a.name,...a.metadata})),r=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let a=await o.resourceTemplate.listCallback(n);for(let s of a.resources)r.push({...o.metadata,...s})}return{resources:[...i,...r]}}),this.server.setRequestHandler(Ef,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,n])=>({name:t,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Rf,async(t,n)=>{let i=new URL(t.params.uri),r=this._registeredResources[i.toString()];if(r){if(!r.enabled)throw new fe(ge.InvalidParams,`Resource ${i} disabled`);return r.readCallback(i,n)}for(let o of Object.values(this._registeredResourceTemplates)){let a=o.resourceTemplate.uriTemplate.match(i.toString());if(a)return o.readCallback(i,a,n)}throw new fe(ge.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(fr(Of)),this.server.assertCanSetRequestHandler(fr(Af)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Of,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,n])=>({name:t,title:n.title,description:n.description,arguments:n.argsSchema?eV(n.argsSchema):void 0}))})),this.server.setRequestHandler(Af,async(t,n)=>{let i=this._registeredPrompts[t.params.name];if(!i)throw new fe(ge.InvalidParams,`Prompt ${t.params.name} not found`);if(!i.enabled)throw new fe(ge.InvalidParams,`Prompt ${t.params.name} disabled`);if(i.argsSchema){let r=ha(i.argsSchema),o=await xp(r,t.params.arguments);if(!o.success){let d="error"in o?o.error:"Unknown error",u=Cp(d);throw new fe(ge.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let a=o.data,s=i.callback;return await Promise.resolve(s(a,n))}else{let r=i.callback;return await Promise.resolve(r(n))}}),this._promptHandlersInitialized=!0)}resource(t,n,...i){let r;typeof i[0]=="object"&&(r=i.shift());let o=i[0];if(typeof n=="string"){if(this._registeredResources[n])throw Error(`Resource ${n} is already registered`);let a=this._createRegisteredResource(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let a=this._createRegisteredResourceTemplate(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(t,n,i,r){if(typeof n=="string"){if(this._registeredResources[n])throw Error(`Resource ${n} is already registered`);let o=this._createRegisteredResource(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(t,n,i,r,o){let a={name:t,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:s=>{typeof s.uri<"u"&&s.uri!==i&&(delete this._registeredResources[i],s.uri&&(this._registeredResources[s.uri]=a)),typeof s.name<"u"&&(a.name=s.name),typeof s.title<"u"&&(a.title=s.title),typeof s.metadata<"u"&&(a.metadata=s.metadata),typeof s.callback<"u"&&(a.readCallback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=a,a}_createRegisteredResourceTemplate(t,n,i,r,o){let a={resourceTemplate:i,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=a)),typeof d.title<"u"&&(a.title=d.title),typeof d.template<"u"&&(a.resourceTemplate=d.template),typeof d.metadata<"u"&&(a.metadata=d.metadata),typeof d.callback<"u"&&(a.readCallback=d.callback),typeof d.enabled<"u"&&(a.enabled=d.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=a;let s=i.uriTemplate.variableNames;return Array.isArray(s)&&s.some(d=>!!i.completeCallback(d))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(t,n,i,r,o){let a={title:n,description:i,argsSchema:r===void 0?void 0:ji(r),callback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:s=>{typeof s.name<"u"&&s.name!==t&&(delete this._registeredPrompts[t],s.name&&(this._registeredPrompts[s.name]=a)),typeof s.title<"u"&&(a.title=s.title),typeof s.description<"u"&&(a.description=s.description),typeof s.argsSchema<"u"&&(a.argsSchema=ji(s.argsSchema)),typeof s.callback<"u"&&(a.callback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=a,r&&Object.values(r).some(s=>{let d=s instanceof fn?s._def?.innerType:s;return Fw(d)})&&this.setCompletionRequestHandler(),a}_createRegisteredTool(t,n,i,r,o,a,s,d,u){Bw(t);let l={title:n,description:i,inputSchema:Kw(r),outputSchema:Kw(o),annotations:a,execution:s,_meta:d,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:p=>{typeof p.name<"u"&&p.name!==t&&(typeof p.name=="string"&&Bw(p.name),delete this._registeredTools[t],p.name&&(this._registeredTools[p.name]=l)),typeof p.title<"u"&&(l.title=p.title),typeof p.description<"u"&&(l.description=p.description),typeof p.paramsSchema<"u"&&(l.inputSchema=ji(p.paramsSchema)),typeof p.outputSchema<"u"&&(l.outputSchema=ji(p.outputSchema)),typeof p.callback<"u"&&(l.handler=p.callback),typeof p.annotations<"u"&&(l.annotations=p.annotations),typeof p._meta<"u"&&(l._meta=p._meta),typeof p.enabled<"u"&&(l.enabled=p.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...n){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let i,r,o,a;if(typeof n[0]=="string"&&(i=n.shift()),n.length>1){let d=n[0];if(zf(d))r=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!zf(n[0])&&(a=n.shift());else if(typeof d=="object"&&d!==null){if(Object.values(d).some(u=>typeof u=="object"&&u!==null))throw Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);a=n.shift()}}let s=n[0];return this._createRegisteredTool(t,void 0,i,r,o,a,{taskSupport:"forbidden"},void 0,s)}registerTool(t,n,i){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:r,description:o,inputSchema:a,outputSchema:s,annotations:d,_meta:u}=n;return this._createRegisteredTool(t,r,o,a,s,d,{taskSupport:"forbidden"},u,i)}prompt(t,...n){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let i;typeof n[0]=="string"&&(i=n.shift());let r;n.length>1&&(r=n.shift());let o=n[0],a=this._createRegisteredPrompt(t,void 0,i,r,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(t,n,i){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:r,description:o,argsSchema:a}=n,s=this._createRegisteredPrompt(t,r,o,a,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,n){return this.server.sendLoggingMessage(t,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},XG={type:"object",properties:{}};ga={completion:{values:[],hasMore:!1}};Ww=15e3,iV=J(()=>c.object({session_id:c.string(),ws_url:c.string(),work_dir:c.string().optional(),session_key:c.string().optional()})),un=class extends Error{code;constructor(t,n){super(t),this.name="DirectConnectError",this.code=n}},Bf=class{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new Su;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(t){this.options=t,this.abortController=t.abortController??new AbortController,this.readyPromise=new Promise((n,i)=>{this.readyResolve=n,this.readyReject=i}),this.readyPromise.catch(()=>{}),this.initialize()}get ready(){return this.readyPromise}getSessionId(){return this.sessionId}getWorkDir(){return this.workDir}async initialize(){if(this.abortController.signal.aborted){this.failInit(new Mt("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new Mt("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let t;try{let o=await aV(this.options);this.sessionId=o.sessionId,this.workDir=o.workDir,t=o.wsUrl}catch(o){let a=gs(o);if(!(a instanceof Mt)){let s=a instanceof un&&a.code?a.code:"session_create_failed";this.emitTelemetry("bad",s)}this.failInit(a);return}if(this.closed){this.options.deleteSessionOnClose&&this.sessionId&&Hw(this.options.serverUrl,this.sessionId,this.options.authToken);return}let n={};this.options.authToken&&(n.authorization=`Bearer ${this.options.authToken}`);let i=new WebSocket(t,{headers:n});this.ws=i;let r=setTimeout((o,a)=>{if(!o.readyState){a.close();let s=new un(`WebSocket connection timeout after ${Ww}ms`);o.exitError=s,o.readyReject?.(s),o.emitTelemetry("bad","connect_timeout")}},Ww,this,i);i.addEventListener("open",()=>{clearTimeout(r),this.readyState=!0,dn(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),i.addEventListener("message",o=>{let a=typeof o.data=="string"?o.data:"";if(a.indexOf(`
|
|
116
116
|
`)===-1){a&&this.partialChunks.push(a);return}let s=this.partialChunks.join("")+a;this.partialChunks.length=0;let d=s.split(`
|
|
117
|
-
`),u=d.pop()??"";u&&this.partialChunks.push(u);for(let l of d){if(!l)continue;let p;try{p=An(l)}catch(m){dn(`DirectConnect: dropped malformed JSON line (${l.length} bytes): ${m}`);continue}this.messages.enqueue(p)}}),i.addEventListener("error",()=>{clearTimeout(r);let o=new un("WebSocket connection error");this.exitError=o,this.readyReject?.(o),this.messages.done(),!this.readyState&&this.emitTelemetry("bad","ws_error")}),i.addEventListener("close",o=>{let a=this.readyState;this.readyState=!1,this.closed=!0;let s=o.code!==1e3&&o.code!==1001;s&&!this.exitError&&(this.exitError=new un(`WebSocket closed abnormally: ${o.code} ${o.reason}`)),this.messages.done(),a&&s&&!this.abortController.signal.aborted&&this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(t,n){this.telemetryEmitted||(this.telemetryEmitted=!0,t==="ok"?px("transport_direct_connect"):t==="bad"?fx("transport_direct_connect",n??"unknown"):E4("transport_direct_connect",n??"unknown"))}failInit(t){this.exitError=t,this.closed=!0,this.readyReject?.(t),this.messages.done()}async write(t){if(this.abortController.signal.aborted)throw new Mt("Operation aborted");if(this.readyState||await this.readyPromise,!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new un("Transport is not ready for writing");this.ws.send(t)}isReady(){return this.readyState&&this.ws?.readyState===WebSocket.OPEN}endInput(){}[Symbol.dispose](){this.close()}close(){this.closed||(this.closed=!0,this.readyState=!1,this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0),this.abortController.signal.aborted||this.abortController.abort(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.close(1e3,"Normal closure"),this.messages.done(),this.options.deleteSessionOnClose&&this.sessionId&&Hw(this.options.serverUrl,this.sessionId,this.options.authToken))}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}};Kf=Promise.resolve(),Gw=!1;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Vw||(Vw={}));
|
|
117
|
+
`),u=d.pop()??"";u&&this.partialChunks.push(u);for(let l of d){if(!l)continue;let p;try{p=An(l)}catch(m){dn(`DirectConnect: dropped malformed JSON line (${l.length} bytes): ${m}`);continue}this.messages.enqueue(p)}}),i.addEventListener("error",()=>{clearTimeout(r);let o=new un("WebSocket connection error");this.exitError=o,this.readyReject?.(o),this.messages.done(),!this.readyState&&this.emitTelemetry("bad","ws_error")}),i.addEventListener("close",o=>{let a=this.readyState;this.readyState=!1,this.closed=!0;let s=o.code!==1e3&&o.code!==1001;s&&!this.exitError&&(this.exitError=new un(`WebSocket closed abnormally: ${o.code} ${o.reason}`)),this.messages.done(),a&&s&&!this.abortController.signal.aborted&&this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(t,n){this.telemetryEmitted||(this.telemetryEmitted=!0,t==="ok"?px("transport_direct_connect"):t==="bad"?fx("transport_direct_connect",n??"unknown"):E4("transport_direct_connect",n??"unknown"))}failInit(t){this.exitError=t,this.closed=!0,this.readyReject?.(t),this.messages.done()}async write(t){if(this.abortController.signal.aborted)throw new Mt("Operation aborted");if(this.readyState||await this.readyPromise,!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new un("Transport is not ready for writing");this.ws.send(t)}isReady(){return this.readyState&&this.ws?.readyState===WebSocket.OPEN}endInput(){}[Symbol.dispose](){this.close()}close(){this.closed||(this.closed=!0,this.readyState=!1,this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0),this.abortController.signal.aborted||this.abortController.abort(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.close(1e3,"Normal closure"),this.messages.done(),this.options.deleteSessionOnClose&&this.sessionId&&Hw(this.options.serverUrl,this.sessionId,this.options.authToken))}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}};Kf=Promise.resolve(),Gw=!1;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Vw||(Vw={}));Xse=Array(20).fill(0).map((e,t)=>" ".repeat(t)),ede={" ":{"\n":Array(200).fill(0).map((e,t)=>`
|
|
118
118
|
`+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
|
|
119
119
|
`+" ".repeat(t))}," ":{"\n":Array(200).fill(0).map((e,t)=>`
|
|
120
120
|
`+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
|
|
121
|
-
`+" ".repeat(t))}};(function(e){e.DEFAULT={allowTrailingComma:!1}})(Zw||(Zw={}));(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Qw||(Qw={}));(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Yw||(Yw={}));(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Xw||(Xw={}));_r=sP.homedir(),Xg=sP.tmpdir(),{env:Ni}=Wf,gV=e=>{let t=rt.join(_r,"Library");return{data:rt.join(t,"Application Support",e),config:rt.join(t,"Preferences",e),cache:rt.join(t,"Caches",e),log:rt.join(t,"Logs",e),temp:rt.join(Xg,e)}},yV=e=>{let t=Ni.APPDATA||rt.join(_r,"AppData","Roaming"),n=Ni.LOCALAPPDATA||rt.join(_r,"AppData","Local");return{data:rt.join(n,e,"Data"),config:rt.join(t,e,"Config"),cache:rt.join(n,e,"Cache"),log:rt.join(n,e,"Log"),temp:rt.join(Xg,e)}},_V=e=>{let t=rt.basename(_r);return{data:rt.join(Ni.XDG_DATA_HOME||rt.join(_r,".local","share"),e),config:rt.join(Ni.XDG_CONFIG_HOME||rt.join(_r,".config"),e),cache:rt.join(Ni.XDG_CACHE_HOME||rt.join(_r,".cache"),e),log:rt.join(Ni.XDG_STATE_HOME||rt.join(_r,".local","state"),e),temp:rt.join(Xg,t,e)}};rde=vV("claude-cli");SV=100,Pp=[];xV=[],eS=null,ide=vt(()=>process.argv.includes("--hard-fail"));Ei=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,uP=new Set,Hf=typeof process=="object"&&process?process:{},lP=(e,t,n,i)=>{typeof Hf.emitWarning=="function"?Hf.emitWarning(e,t,n,i):console.error(`[${n}] ${t}: ${e}`)},Wu=globalThis.AbortController,tS=globalThis.AbortSignal;if(typeof Wu>"u"){tS=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Wu=class{constructor(){t()}signal=new tS;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let e=Hf.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,lP("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}CV=e=>!uP.has(e),mr=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),cP=e=>mr(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?zi:null:null,zi=class extends Array{constructor(t){super(t),this.fill(0)}},Gf=class e{heap;length;static#r=!1;static create(t){let n=cP(t);if(!n)return[];e.#r=!0;let i=new e(t,n);return e.#r=!1,i}constructor(t,n){if(!e.#r)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Vf=class e{#r;#c;#h;#g;#R;#O;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#y;#i;#n;#e;#u;#p;#d;#a;#_;#s;#v;#b;#f;#w;#T;#l;static unsafeExposeInternals(t){return{starts:t.#b,ttls:t.#f,sizes:t.#v,keyMap:t.#i,keyList:t.#n,valList:t.#e,next:t.#u,prev:t.#p,get head(){return t.#d},get tail(){return t.#a},free:t.#_,isBackgroundFetch:n=>t.#t(n),backgroundFetch:(n,i,r,o)=>t.#M(n,i,r,o),moveToTail:n=>t.#E(n),indexes:n=>t.#S(n),rindexes:n=>t.#k(n),isStale:n=>t.#m(n)}}get max(){return this.#r}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#o}get fetchMethod(){return this.#R}get memoMethod(){return this.#O}get dispose(){return this.#h}get disposeAfter(){return this.#g}constructor(t){let{max:n=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:s,allowStale:d,dispose:u,disposeAfter:l,noDisposeOnSet:p,noUpdateTTL:m,maxSize:f=0,maxEntrySize:h=0,sizeCalculation:y,fetchMethod:w,memoMethod:g,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:T,ignoreFetchAbort:C}=t;if(n!==0&&!mr(n))throw TypeError("max option must be a nonnegative integer");let _=n?cP(n):Array;if(!_)throw Error("invalid max value: "+n);if(this.#r=n,this.#c=f,this.maxEntrySize=h||this.#c,this.sizeCalculation=y,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw TypeError("memoMethod must be a function if defined");if(this.#O=g,w!==void 0&&typeof w!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#R=w,this.#T=!!w,this.#i=new Map,this.#n=Array(n).fill(void 0),this.#e=Array(n).fill(void 0),this.#u=new _(n),this.#p=new _(n),this.#d=0,this.#a=0,this.#_=Gf.create(n),this.#o=0,this.#y=0,typeof u=="function"&&(this.#h=u),typeof l=="function"?(this.#g=l,this.#s=[]):(this.#g=void 0,this.#s=void 0),this.#w=!!this.#h,this.#l=!!this.#g,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#c!==0&&!mr(this.#c))throw TypeError("maxSize must be a positive integer if specified");if(!mr(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!s,this.ttlResolution=mr(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!mr(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#r===0&&this.ttl===0&&this.#c===0)throw TypeError("At least one of max, maxSize, or ttl is required");!this.ttlAutopurge&&!this.#r&&!this.#c&&CV("LRU_CACHE_UNBOUNDED")&&(uP.add("LRU_CACHE_UNBOUNDED"),lP("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",e))}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#j(){let t=new zi(this.#r),n=new zi(this.#r);this.#f=t,this.#b=n,this.#N=(o,a,s=Ei.now())=>{if(n[o]=a!==0?s:0,t[o]=a,a!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#m(o)&&this.#x(this.#n[o],"expire")},a+1);d.unref&&d.unref()}},this.#I=o=>{n[o]=t[o]!==0?Ei.now():0},this.#C=(o,a)=>{if(t[a]){let s=t[a],d=n[a];if(!s||!d)return;o.ttl=s,o.start=d,o.now=i||r();let u=o.now-d;o.remainingTTL=s-u}};let i=0,r=()=>{let o=Ei.now();if(this.ttlResolution>0){i=o;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return o};this.getRemainingTTL=o=>{let a=this.#i.get(o);if(a===void 0)return 0;let s=t[a],d=n[a];if(!s||!d)return 1/0;let u=(i||r())-d;return s-u},this.#m=o=>{let a=n[o],s=t[o];return!!s&&!!a&&(i||r())-a>s}}#I=()=>{};#C=()=>{};#N=()=>{};#m=()=>!1;#F(){let t=new zi(this.#r);this.#y=0,this.#v=t,this.#P=n=>{this.#y-=t[n],t[n]=0},this.#q=(n,i,r,o)=>{if(this.#t(i))return 0;if(!mr(r))if(o){if(typeof o!="function")throw TypeError("sizeCalculation must be a function");if(r=o(i,n),!mr(r))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#A=(n,i,r)=>{if(t[n]=i,this.#c){let o=this.#c-t[n];for(;this.#y>o;)this.#$(!0)}this.#y+=t[n],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y)}}#P=t=>{};#A=(t,n,i)=>{};#q=(t,n,i,r)=>{if(i||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#a;!(!this.#D(n)||((t||!this.#m(n))&&(yield n),n===this.#d));)n=this.#p[n]}*#k({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#d;!(!this.#D(n)||((t||!this.#m(n))&&(yield n),n===this.#a));)n=this.#u[n]}#D(t){return t!==void 0&&this.#i.get(this.#n[t])===t}*entries(){for(let t of this.#S())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*rentries(){for(let t of this.#k())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*keys(){for(let t of this.#S()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*rkeys(){for(let t of this.#k()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*values(){for(let t of this.#S())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}*rvalues(){for(let t of this.#k())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,n={}){for(let i of this.#S()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#n[i],this))return this.get(this.#n[i],n)}}forEach(t,n=this){for(let i of this.#S()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(n,o,this.#n[i],this)}}rforEach(t,n=this){for(let i of this.#k()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(n,o,this.#n[i],this)}}purgeStale(){let t=!1;for(let n of this.#k({allowStale:!0}))this.#m(n)&&(this.#x(this.#n[n],"expire"),t=!0);return t}info(t){let n=this.#i.get(t);if(n===void 0)return;let i=this.#e[n],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#f&&this.#b){let a=this.#f[n],s=this.#b[n];if(a&&s){let d=a-(Ei.now()-s);o.ttl=d,o.start=Date.now()}}return this.#v&&(o.size=this.#v[n]),o}dump(){let t=[];for(let n of this.#S({allowStale:!0})){let i=this.#n[n],r=this.#e[n],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let a={value:o};if(this.#f&&this.#b){a.ttl=this.#f[n];let s=Ei.now()-this.#b[n];a.start=Math.floor(Date.now()-s)}this.#v&&(a.size=this.#v[n]),t.unshift([i,a])}return t}load(t){this.clear();for(let[n,i]of t){if(i.start){let r=Date.now()-i.start;i.start=Ei.now()-r}this.set(n,i.value,i)}}set(t,n,i={}){if(n===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:d}=i,{noUpdateTTL:u=this.noUpdateTTL}=i,l=this.#q(t,n,i.size||0,s);if(this.maxEntrySize&&l>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#x(t,"set"),this;let p=this.#o===0?void 0:this.#i.get(t);if(p===void 0)p=this.#o===0?this.#a:this.#_.length!==0?this.#_.pop():this.#o===this.#r?this.#$(!1):this.#o,this.#n[p]=t,this.#e[p]=n,this.#i.set(t,p),this.#u[this.#a]=p,this.#p[p]=this.#a,this.#a=p,this.#o++,this.#A(p,l,d),d&&(d.set="add"),u=!1;else{this.#E(p);let m=this.#e[p];if(n!==m){if(this.#T&&this.#t(m)){m.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=m;f!==void 0&&!a&&(this.#w&&this.#h?.(f,t,"set"),this.#l&&this.#s?.push([f,t,"set"]))}else a||(this.#w&&this.#h?.(m,t,"set"),this.#l&&this.#s?.push([m,t,"set"]));if(this.#P(p),this.#A(p,l,d),this.#e[p]=n,d){d.set="replace";let f=m&&this.#t(m)?m.__staleWhileFetching:m;f!==void 0&&(d.oldValue=f)}}else d&&(d.set="update")}if(r!==0&&!this.#f&&this.#j(),this.#f&&(u||this.#N(p,r,o),d&&this.#C(d,p)),!a&&this.#l&&this.#s){let m=this.#s,f;for(;f=m?.shift();)this.#g?.(...f)}return this}pop(){try{for(;this.#o;){let t=this.#e[this.#d];if(this.#$(!0),this.#t(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#l&&this.#s){let t=this.#s,n;for(;n=t?.shift();)this.#g?.(...n)}}}#$(t){let n=this.#d,i=this.#n[n],r=this.#e[n];return this.#T&&this.#t(r)?r.__abortController.abort(Error("evicted")):(this.#w||this.#l)&&(this.#w&&this.#h?.(r,i,"evict"),this.#l&&this.#s?.push([r,i,"evict"])),this.#P(n),t&&(this.#n[n]=void 0,this.#e[n]=void 0,this.#_.push(n)),this.#o===1?(this.#d=this.#a=0,this.#_.length=0):this.#d=this.#u[n],this.#i.delete(i),this.#o--,n}has(t,n={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=n,o=this.#i.get(t);if(o!==void 0){let a=this.#e[o];if(this.#t(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#m(o))r&&(r.has="stale",this.#C(r,o));else return i&&this.#I(o),r&&(r.has="hit",this.#C(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,n={}){let{allowStale:i=this.allowStale}=n,r=this.#i.get(t);if(r===void 0||!i&&this.#m(r))return;let o=this.#e[r];return this.#t(o)?o.__staleWhileFetching:o}#M(t,n,i,r){let o=n===void 0?void 0:this.#e[n];if(this.#t(o))return o;let a=new Wu,{signal:s}=i;s?.addEventListener("abort",()=>a.abort(s.reason),{signal:a.signal});let d={signal:a.signal,options:i,context:r},u=(y,w=!1)=>{let{aborted:g}=a.signal,v=i.ignoreFetchAbort&&y!==void 0;if(i.status&&(g&&!w?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,v&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!v&&!w)return p(a.signal.reason);let b=f;return this.#e[n]===f&&(y===void 0?b.__staleWhileFetching?this.#e[n]=b.__staleWhileFetching:this.#x(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,y,d.options))),y},l=y=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=y),p(y)),p=y=>{let{aborted:w}=a.signal,g=w&&i.allowStaleOnFetchAbort,v=g||i.allowStaleOnFetchRejection,b=v||i.noDeleteOnFetchRejection,S=f;if(this.#e[n]===f&&(!b||S.__staleWhileFetching===void 0?this.#x(t,"fetch"):g||(this.#e[n]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw y},m=(y,w)=>{let g=this.#R?.(t,o,d);g&&g instanceof Promise&&g.then(v=>y(v===void 0?void 0:v),w),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(y(void 0),i.allowStaleOnFetchAbort&&(y=v=>u(v,!0)))})};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(m).then(u,l),h=Object.assign(f,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return n===void 0?(this.set(t,h,{...d.options,status:void 0}),n=this.#i.get(t)):this.#e[n]=h,h}#t(t){if(!this.#T)return!1;let n=t;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof Wu}async fetch(t,n={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:d=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:y,forceRefresh:w=!1,status:g,signal:v}=n;if(!this.#T)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let b={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:s,size:d,sizeCalculation:u,noUpdateTTL:l,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:h,ignoreFetchAbort:f,status:g,signal:v},S=this.#i.get(t);if(S===void 0){g&&(g.fetch="miss");let T=this.#M(t,S,b,y);return T.__returned=T}else{let T=this.#e[S];if(this.#t(T)){let I=i&&T.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",I&&(g.returnedStale=!0)),I?T.__staleWhileFetching:T.__returned=T}let C=this.#m(S);if(!w&&!C)return g&&(g.fetch="hit"),this.#E(S),r&&this.#I(S),g&&this.#C(g,S),T;let _=this.#M(t,S,b,y),k=_.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=C?"stale":"refresh",k&&C&&(g.returnedStale=!0)),k?_.__staleWhileFetching:_.__returned=_}}async forceFetch(t,n={}){let i=await this.fetch(t,n);if(i===void 0)throw Error("fetch() returned undefined");return i}memo(t,n={}){let i=this.#O;if(!i)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...a}=n,s=this.get(t,a);if(!o&&s!==void 0)return s;let d=i(t,s,{options:a,context:r});return this.set(t,d,a),d}get(t,n={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=n,s=this.#i.get(t);if(s!==void 0){let d=this.#e[s],u=this.#t(d);return a&&this.#C(a,s),this.#m(s)?(a&&(a.get="stale"),u?(a&&i&&d.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?d.__staleWhileFetching:void 0):(o||this.#x(t,"expire"),a&&i&&(a.returnedStale=!0),i?d:void 0)):(a&&(a.get="hit"),u?d.__staleWhileFetching:(this.#E(s),r&&this.#I(s),d))}else a&&(a.get="miss")}#L(t,n){this.#p[n]=t,this.#u[t]=n}#E(t){t!==this.#a&&(t===this.#d?this.#d=this.#u[t]:this.#L(this.#p[t],this.#u[t]),this.#L(this.#a,t),this.#a=t)}delete(t){return this.#x(t,"delete")}#x(t,n){let i=!1;if(this.#o!==0){let r=this.#i.get(t);if(r!==void 0)if(i=!0,this.#o===1)this.#U(n);else{this.#P(r);let o=this.#e[r];if(this.#t(o)?o.__abortController.abort(Error("deleted")):(this.#w||this.#l)&&(this.#w&&this.#h?.(o,t,n),this.#l&&this.#s?.push([o,t,n])),this.#i.delete(t),this.#n[r]=void 0,this.#e[r]=void 0,r===this.#a)this.#a=this.#p[r];else if(r===this.#d)this.#d=this.#u[r];else{let a=this.#p[r];this.#u[a]=this.#u[r];let s=this.#u[r];this.#p[s]=this.#p[r]}this.#o--,this.#_.push(r)}}if(this.#l&&this.#s?.length){let r=this.#s,o;for(;o=r?.shift();)this.#g?.(...o)}return i}clear(){return this.#U("delete")}#U(t){for(let n of this.#k({allowStale:!0})){let i=this.#e[n];if(this.#t(i))i.__abortController.abort(Error("deleted"));else{let r=this.#n[n];this.#w&&this.#h?.(i,r,t),this.#l&&this.#s?.push([i,r,t])}}if(this.#i.clear(),this.#e.fill(void 0),this.#n.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#v&&this.#v.fill(0),this.#d=0,this.#a=0,this.#_.length=0,this.#y=0,this.#o=0,this.#l&&this.#s){let n=this.#s,i;for(;i=n?.shift();)this.#g?.(...i)}}};IV=8192;nS=TV(pP,e=>e,50),Kl=Object.assign(function(e,t=!0){if(!e)return null;let n=e.length>IV?pP(e,t):nS(e,t);return n.ok?n.value:null},{cache:nS.cache}),Jl=vt(()=>{try{if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";if(process.platform==="linux"){if(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)return"wsl";try{let e=Yt().readFileSync("/proc/version",{encoding:"utf8"});if(e.toLowerCase().includes("microsoft")||e.toLowerCase().includes("wsl"))return"wsl"}catch(e){Ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"})}return"linux"}return"unknown"}catch(e){return dP(e),"unknown"}}),ude=vt(()=>{if(process.platform==="linux")try{let e=Yt().readFileSync("/proc/version",{encoding:"utf8"}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes("microsoft")?"1":void 0}catch(e){Ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}}),lde=vt(async()=>{if(process.platform!=="linux")return;let e={linuxKernel:fP()};try{let t=await EV("/etc/os-release","utf8");for(let n of t.split(`
|
|
122
|
-
`)){let i=n.match(/^(ID|VERSION_ID)=(.*)$/);if(i&&i[1]&&i[2]){let r=i[2].replace(/^"|"$/g,"");i[1]==="ID"?e.linuxDistroId=r:e.linuxDistroVersion=r}}}catch{}return e}),cde=vt(()=>{if(process.platform!=="darwin")return;let e=fP().match(/^(\d+)\./);if(!(!e||!e[1]))return parseInt(e[1],10)-9}),ps=vt(function(){switch(Jl()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),pde=vt(function(){return PV(ps(),"managed-settings.d")});Zf=RV;AV=OV,$V=AV(),MV=$V;NV=jV,qV="[object Object]",DV=Function.prototype,LV=Object.prototype,mP=DV.toString,UV=LV.hasOwnProperty,FV=mP.call(Object);BV=zV;Qf=KV;WV=JV;GV=HV;VV=hP;QV=ZV,rS=Math.max;gP=YV;e5=XV,t5=gu?function(e,t){return gu(e,"toString",{configurable:!0,enumerable:!1,value:e5(t),writable:!0})}:Nm,n5=t5,r5=800,i5=16,o5=Date.now;s5=a5,d5=s5(n5),yP=d5;l5=u5;p5=c5;m5=f5,h5=m5(function(e,t,n,i){VV(e,t,n,i)}),vr=h5;y5=g5;_P=_5;b5=v5,iS=Dn?Dn.isConcatSpreadable:void 0;S5=w5;k5=vP;C5=x5;I5=T5,P5=I5(function(e,t){return e==null?{}:b5(e,t)}),Ep=P5,R5="Expected a function";A5=O5;M5=$5;N5=j5,bP=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","CLOUD_ML_REGION"],wP=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL"],SP=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_AWS_API_KEY","ANTHROPIC_BEDROCK_MANTLE_API_KEY"],D5=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],L5=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL"],hde=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...bP,...wP,...SP,...D5,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...L5,"ANTHROPIC_BEDROCK_SERVICE_TIER","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK"]),U5="remote-settings.json",Rp=null,z5=null;J5=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...bP,...wP,"CLAUDE_CODE_CUSTOM_OAUTH_URL",...SP,"ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE"].map(e=>e.toUpperCase()));V5=["userSettings","projectSettings","localSettings","flagSettings","policySettings"],oS="com.anthropic.claudecode",Yf="HKLM\\SOFTWARE\\Policies\\ClaudeCode",Xf="HKCU\\SOFTWARE\\Policies\\ClaudeCode",qi="Settings",Q5="/usr/bin/plutil",Y5=["-convert","json","-o","-","--"],X5=5e3,aS="/mnt/c/Windows/System32/reg.exe",Hu="/mnt/c/Program Files/ClaudeCode";t3=J(()=>c.object({allowedDomains:c.array(c.string()).optional(),deniedDomains:c.array(c.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),allowManagedDomainsOnly:c.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:c.array(c.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:c.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:c.boolean().optional(),allowMachLookup:c.array(c.string().refine(e=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:c.number().optional(),socksProxyPort:c.number().optional(),tlsTerminate:c.object({caCertPath:c.string().min(1).optional(),caKeyPath:c.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. Only honored from user, managed/policy, or CLI (`--settings`) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),n3=J(()=>c.object({allowWrite:c.array(c.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:c.array(c.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:c.array(c.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:c.array(c.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:c.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),xP=J(()=>c.object({path:c.string().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:c.literal("deny").describe("Access mode for this path. Only `deny` is supported.")})),CP=J(()=>c.object({name:c.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores").describe("Environment variable name."),mode:c.enum(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the host proxy swaps sentinel\u2192real on egress to `injectHosts`."),injectHosts:c.array(c.string()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to `network.allowedDomains` \u2014 the credential is injected at every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")})),r3=J(()=>c.object({files:c.array(xP()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox."),envVars:c.array(CP()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:c.boolean().optional().describe("Allow sentinel\u2192real substitution on the plain-HTTP proxy path. Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),TP=J(()=>c.object({enabled:c.boolean().optional(),failIfUnavailable:c.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:c.boolean().optional(),allowUnsandboxedCommands:c.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:t3(),filesystem:n3(),credentials:r3(),ignoreViolations:c.record(c.string(),c.array(c.string())).optional(),enableWeakerNestedSandbox:c.boolean().optional(),enableWeakerNetworkIsolation:c.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. **Reduces security** \u2014 opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:c.boolean().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. **Removes code-execution isolation** \u2014 sandboxed commands can launch other applications unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. Only honored from user, managed/policy, or CLI (--settings) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:c.array(c.string()).optional(),ripgrep:c.object({command:c.string(),args:c.array(c.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:c.preprocess(e=>typeof e=="string"&&sS(e)?e:void 0,c.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:c.preprocess(e=>typeof e=="string"&&sS(e)?e:void 0,c.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough()),i3=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],o3=["normal","vim"],a3=["auto","tmux","iterm2","in-process"],s3=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],d3=["auto",...s3],_de=Jl()==="macos"?"\u23FA":"\u25CF",ey=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],u3=[...ey,"bubble"],l3=u3,vde=J(()=>$I.enum(l3)),bde=J(()=>$I.enum(ey)),c3=["bash","powershell"],ya=J(()=>c.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));f3=J(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:i,McpToolHookSchema:r}=p3();return c.discriminatedUnion("type",[e,t,n,i,r])}),m3=J(()=>c.object({matcher:c.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:c.array(f3()).describe("List of hooks to execute when the matcher matches")})),Gu=J(()=>c.partialRecord(c.enum(ul),c.array(m3()))),wde=J(()=>c.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),Sde=J(()=>c.enum(["stdio","sse","sse-ide","http","ws","sdk"])),ko=J(()=>c.literal("comms").optional().catch(void 0)),Pr=J(()=>c.number().int().positive()),h3=J(()=>c.object({type:c.literal("stdio").optional(),command:c.string().min(1,"Command cannot be empty"),args:c.array(c.string()).default([]),env:c.record(c.string(),c.string()).optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),g3=J(()=>c.boolean()),IP=J(()=>c.object({clientId:c.string().optional(),callbackPort:c.number().int().positive().optional(),authServerMetadataUrl:c.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:c.string().min(1).optional(),xaa:g3().optional()})),PP=J(()=>c.object({name:c.string(),permission_policy:c.enum(["always_allow","always_ask","always_deny"]).optional()})),y3=J(()=>c.object({type:c.literal("sse"),url:c.string(),headers:c.record(c.string(),c.string()).optional(),headersHelper:c.string().optional(),oauth:IP().optional(),timeout:Pr().optional(),tools:c.array(PP()).optional(),alwaysLoad:c.boolean().optional(),role:ko(),toolPermissions:c.record(c.string(),ty()).optional()})),_3=J(()=>c.object({type:c.literal("sse-ide"),url:c.string(),ideName:c.string(),ideRunningInWindows:c.boolean().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),v3=J(()=>c.object({type:c.literal("ws-ide"),url:c.string(),ideName:c.string(),authToken:c.string().optional(),ideRunningInWindows:c.boolean().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),b3=J(()=>c.object({type:c.enum(["http","streamable-http"]).transform(()=>"http"),url:c.string(),headers:c.record(c.string(),c.string()).optional(),headersHelper:c.string().optional(),oauth:IP().optional(),timeout:Pr().optional(),tools:c.array(PP()).optional(),alwaysLoad:c.boolean().optional(),role:ko(),toolPermissions:c.record(c.string(),ty()).optional()})),w3=J(()=>c.object({type:c.literal("ws"),url:c.string(),headers:c.record(c.string(),c.string()).optional(),headersHelper:c.string().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),S3=J(()=>c.object({type:c.literal("sdk"),name:c.string(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional()})),ty=J(()=>c.enum(["allow","ask","blocked"])),k3=J(()=>c.object({type:c.literal("claudeai-proxy"),url:c.string(),id:c.string(),displayName:c.string().optional(),iconUrl:c.string().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),toolPermissions:c.record(c.string(),ty()).optional(),stateless:c.boolean().optional(),cachedInitResponse:c.record(c.string(),c.unknown()).nullish()})),em=J(()=>c.union([h3(),y3(),_3(),v3(),b3(),w3(),S3(),k3()])),kde=J(()=>c.object({mcpServers:c.record(c.string(),em())})),x3=new Set(["claude-community","claude-plugins-community"]),C3=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins"]),EP=new Set([...C3,...x3]),T3=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,I3=/[^\u0020-\u007E]/;Rn=J(()=>c.string().startsWith("./")),ni=J(()=>Rn().endsWith(".json")),dS=J(()=>c.union([Rn().refine(e=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),c.string().url().refine(e=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),tm=J(()=>Rn().endsWith(".md")),nm=J(()=>c.union([tm(),Rn()])),RP=J(()=>c.string().min(1,"Marketplace must have a name").refine(e=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine(e=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine(e=>!P3(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine(e=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine(e=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine(e=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),ny=J(()=>c.object({name:c.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:c.string().optional().describe("Contact email for support or feedback"),url:c.string().optional().describe("Website, GitHub profile, or organization URL")})),E3=J(()=>c.object({$schema:c.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:c.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:c.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:c.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:c.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:ny().optional().describe("Information about the plugin creator or maintainer"),homepage:c.string().url().optional().describe("Plugin homepage or documentation URL"),repository:c.string().optional().describe("Source code repository URL"),license:c.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:c.array(c.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:c.boolean().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:c.array(dZ()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),xde=J(()=>c.object({description:c.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:c.lazy(()=>Gu()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),R3=J(()=>c.object({hooks:c.union([ni().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),c.lazy(()=>Gu()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),c.array(c.union([ni().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),c.lazy(()=>Gu()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),O3=J(()=>c.object({source:nm().optional().describe("Path to command markdown file, relative to plugin root"),content:c.string().optional().describe("Inline markdown content for the command"),description:c.string().optional().describe("Command description override"),argumentHint:c.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:c.string().optional().describe("Default model for this command"),allowedTools:c.array(c.string()).optional().describe("Tools allowed when command runs")}).refine(e=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),A3=J(()=>c.object({commands:c.union([nm().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(nm().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),c.record(c.string(),O3()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" \u2192 "/plugin:about")')])})),$3=J(()=>c.object({agents:c.union([tm().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(tm().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),M3=J(()=>c.object({skills:c.union([Rn().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan)."),c.array(Rn().describe("Path to a skill directory, relative to the plugin root.")).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),OP=J(()=>c.object({outputStyles:c.union([Rn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(Rn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),j3=J(()=>c.string().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),N3=16,q3=J(()=>c.object({id:j3(),remote:c.string().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:c.string().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),D3=J(()=>c.object({syntaxHighlighting:c.object({hljsLanguages:c.array(q3()).max(N3)}).strict()})),AP=J(()=>c.object({themes:c.union([Rn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(Rn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),L3=J(()=>c.object({})),uS=J(()=>c.string().min(1)),U3=J(()=>c.string().min(2).refine(e=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),F3=J(()=>c.object({mcpServers:c.union([ni().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),dS().describe("Path or URL to MCPB file containing MCP server configuration"),c.record(c.string(),em()).describe("MCP server configurations keyed by server name"),c.array(c.union([ni().describe("Path to MCP servers configuration file"),dS().describe("Path or URL to MCPB file"),c.record(c.string(),em()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),$P=J(()=>c.object({type:c.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:c.string().describe("Human-readable label shown in the config dialog"),description:c.string().describe("Help text shown beneath the field in the config dialog"),required:c.boolean().optional().describe("If true, validation fails when this field is empty"),default:c.union([c.string(),c.number(),c.boolean(),c.array(c.string())]).optional().describe("Default value used when the user provides nothing"),multiple:c.boolean().optional().describe("For string type: allow an array of strings"),sensitive:c.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:c.number().optional().describe("Minimum value (number type only)"),max:c.number().optional().describe("Maximum value (number type only)")}).strict()),z3=J(()=>c.object({userConfig:c.record(c.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) \u2014 they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),$P()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),B3=J(()=>c.object({channels:c.array(c.object({server:c.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:c.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:c.record(c.string(),$P()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),lS=J(()=>c.strictObject({command:c.string().min(1).refine(e=>!(e.includes(" ")&&!e.startsWith("/")),{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:c.array(uS()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:c.record(U3(),uS()).refine(e=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:c.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:c.record(c.string(),c.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:c.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:c.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:c.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:c.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:c.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:c.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:c.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:c.boolean().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),K3=J(()=>c.strictObject({name:c.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:c.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd \u2014 prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:c.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:c.union([c.literal("always"),c.string().startsWith("on-skill-invoke:").refine(e=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),J3=J(()=>c.array(K3()).refine(e=>new Set(e.map(t=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),MP=J(()=>c.object({monitors:c.union([ni().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),J3()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),W3=J(()=>c.object({lspServers:c.union([ni().describe("Path to .lsp.json configuration file relative to plugin root"),c.record(c.string(),lS()).describe("LSP server configurations keyed by server name"),c.array(c.union([ni().describe("Path to LSP configuration file"),c.record(c.string(),lS()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),jP=J(()=>c.string().refine(e=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine(e=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,n=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||n.test(e)},"Invalid npm package name format")),H3=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,G3=/^[0-9a-f]{64}$/,V3=J(()=>c.object({sha256:c.string().regex(G3)}));Q3=J(()=>c.object({binaries:c.unknown().transform(Z3).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),Y3=J(()=>c.object({settings:c.record(c.string(),c.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),X3=J(()=>c.object({experimental:c.preprocess(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,c.object({...AP().partial().shape,...D3().partial().shape,...MP().partial().shape,...OP().partial().shape,evals:c.union([c.string(),c.array(c.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),eZ=J(()=>c.object({...E3().shape,...R3().partial().shape,...A3().partial().shape,...$3().partial().shape,...M3().partial().shape,...OP().partial().shape,...AP().partial().shape,...L3().shape,...B3().partial().shape,...F3().partial().shape,...W3().partial().shape,...MP().partial().shape,...Y3().partial().shape,...z3().partial().shape,...Q3().partial().shape,...X3().partial().shape})),Vu=J(()=>c.discriminatedUnion("source",[c.object({source:c.literal("url"),url:c.string().url().describe("Direct URL to marketplace.json file"),headers:c.record(c.string(),c.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),c.object({source:c.literal("github"),repo:c.string().describe("GitHub repository in owner/repo format"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:c.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:c.array(c.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:c.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),c.object({source:c.literal("git"),url:c.string().describe("Full git repository URL"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:c.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:c.array(c.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:c.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),c.object({source:c.literal("npm"),package:jP().describe("NPM package containing marketplace.json")}),c.object({source:c.literal("file"),path:c.string().describe("Local file path to marketplace.json")}),c.object({source:c.literal("directory"),path:c.string().describe("Local directory containing .claude-plugin/marketplace.json")}),c.object({source:c.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),c.object({source:c.literal("hostPattern"),hostPattern:c.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),c.object({source:c.literal("pathPattern"),pathPattern:c.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),c.object({source:c.literal("settings"),name:RP().refine(e=>!EP.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation as PluginMarketplaceSchema plus reserved-name rejection \u2014 validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:c.array(tZ()).describe("Plugin entries declared inline in settings.json"),owner:ny().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),Op=J(()=>c.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),NP=J(()=>c.union([c.preprocess(e=>e==="."?"./":e,Rn()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),c.object({source:c.literal("npm"),package:jP().or(c.string().refine(e=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:c.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:c.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),c.object({source:c.literal("url"),url:c.string().describe("Full git repository URL (https:// or git@)"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Op().optional().describe("Specific commit SHA to use")}),c.object({source:c.literal("github"),repo:c.string().describe("GitHub repository in owner/repo format"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Op().optional().describe("Specific commit SHA to use")}),c.object({source:c.literal("git-subdir"),url:c.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:c.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Op().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),c.object({source:c.literal("unsupported")}).describe('Placeholder for source types this Claude Code version does not recognize. Never authored by hand \u2014 PluginMarketplaceSchema rewrites unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),tZ=J(()=>c.object({name:c.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:NP().describe("Where to fetch the plugin from. Must be a remote source \u2014 relative paths have no marketplace repository to resolve against."),description:c.string().optional(),version:c.string().optional(),strict:c.boolean().optional()}).refine(e=>typeof e.source!="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine(e=>typeof e.source=="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."})),nZ=J(()=>c.object({cli:c.array(c.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) \u2014 exact match against commands run this session.'),hosts:c.array(c.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) \u2014 exact, case-insensitive match against hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path.'),filesRead:c.array(c.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) \u2014 the plugin is relevant when a file Claude has read this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive.'),manifestDeps:c.array(c.object({file:c.string().max(256),pattern:c.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: `file` matches the manifest filename (package.json, go.mod, requirements.txt, \u2026); `pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:c.array(c.string().max(256)).max(10).optional().describe(`Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) \u2014 the plugin is relevant when the session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),rZ=J(()=>c.object({topic:c.string().max(64).optional().describe('What the user is working with when this plugin is relevant \u2014 fills "Working with {topic}?". Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:nZ().optional().describe("Matchers that determine when the plugin is relevant.")})),iZ=J(()=>eZ().partial().extend({name:c.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:NP().describe("Where to fetch the plugin from"),category:c.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:c.array(c.string()).optional().describe("Tags for searchability and discovery"),strict:c.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:c.preprocess(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,rZ().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),oZ=J(()=>c.object({name:c.string().min(1).refine(e=>!e.includes(" "))}));Cde=J(()=>c.object({$schema:c.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:RP(),version:c.string().optional().describe("Marketplace manifest version"),description:c.string().optional().describe("Human-readable description of this marketplace"),owner:ny().describe("Marketplace maintainer or curator information"),plugins:c.array(c.unknown()).transform(aZ).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:c.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:c.object({pluginRoot:c.string().optional().describe("Base path for relative plugin sources"),version:c.string().optional().describe("Marketplace version"),description:c.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:c.array(c.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies \u2014 no transitive trust."),renames:c.record(c.string(),c.string().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name \u2192 current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),qP=J(()=>c.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),sZ=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,dZ=J(()=>c.union([c.string().regex(sZ,"Dependency must be a plugin name, optionally qualified with @marketplace").transform(e=>e.replace(/@\^[^@]*$/,"")),c.object({name:c.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:c.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform(e=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),uZ=J(()=>c.object({version:c.string().describe("Currently installed version"),installedAt:c.string().describe("ISO 8601 timestamp of installation"),lastUpdated:c.string().optional().describe("ISO 8601 timestamp of last update"),installPath:c.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:c.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:c.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:c.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),lZ=J(()=>c.object({version:c.literal(1).describe("Schema version 1"),plugins:c.record(qP(),uZ()).describe("Map of plugin IDs to their installation metadata")})),cZ=J(()=>c.enum(["managed","user","project","local"])),pZ=J(()=>c.object({scope:cZ().describe("Installation scope"),projectPath:c.string().optional().describe("Project path (required for project/local scopes)"),installPath:c.string().describe("Absolute path to the versioned plugin directory"),version:c.string().optional().describe("Currently installed version"),installedAt:c.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:c.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:c.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:c.string().optional().describe("Tag-derived semver this install resolved to"),auto:c.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),fZ=J(()=>c.object({version:c.literal(2).describe("Schema version 2"),plugins:c.record(qP(),c.array(pZ())).describe("Map of plugin IDs to arrays of installation entries")})),Tde=J(()=>c.union([lZ(),fZ()])),mZ=J(()=>c.object({source:Vu().describe("Where to fetch the marketplace from"),installLocation:c.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:c.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:c.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Ide=J(()=>c.record(c.string(),mZ())),hZ=["autoMode","deepLink","voice","briefView","screenReader"],Td={},Wl={autoMode:{buildGate:()=>!1,shape:()=>Td,permissionsShape:()=>Td,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:c.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>Td},briefView:{buildGate:()=>!0,shape:()=>({defaultView:c.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>Td}};cS={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};UP="workspace",Pde=`mcp__${UP}__bash`,Ede=`mcp__${UP}__web_fetch`;Zu={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:e=>e.includes("*")||e.includes("?")?{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]}:{valid:!0},WebFetch:e=>e.includes("://")||e.startsWith("http")?{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]}:e.startsWith("domain:")?{valid:!0}:{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]}}};mS=J(()=>BP()),IZ=J(()=>BP("allow"));PZ=J(()=>c.record(c.string(),c.coerce.string()));Rde=J(()=>KP(DP())),EZ=J(()=>c.object({source:Vu().describe("Where to fetch the marketplace from"),installLocation:c.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:c.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),ry=J(()=>c.object({serverName:c.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:c.array(c.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:c.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(e=>Rx([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),iy=J(()=>c.object({serverName:c.string().min(1,"Server name must be non-empty").refine(e=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine(e=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:c.array(c.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:c.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(e=>Rx([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),RZ=J(()=>c.object({path:c.string().describe("Absolute path to the helper executable"),timeoutMs:c.number().int().min(1e3).optional(),refreshIntervalMs:c.union([c.literal(0),c.number().int().min(6e4)]).optional()})),hS=["skills","agents","hooks","mcp"],gS=Object.freeze({type:"invalid-entry-stripped"}),OZ=J(()=>c.union([c.object({type:c.literal("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:c.string().describe("Regex matched against turn output (tool results and assistant text)"),url:c.string().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:c.string().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),c.object({type:c.string().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()]));Hl=J(()=>AZ(DP())),yS=Object.freeze({serverName:"invalid-entry-stripped"});er="https://code.claude.com/docs/en",$Z=[{matches:e=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${er}/iam#permission-modes`}},{matches:e=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:e=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:e=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${er}/settings#environment-variables`}},{matches:e=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:e=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${er}/hooks`}},{matches:e=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${er}/hooks#exec-form-and-shell-form`}},{matches:e=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:e=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:e=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${er}/settings`}},{matches:e=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:e=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${er}/iam#working-directories`}}],MZ={permissions:`${er}/iam#configuring-permissions`,env:`${er}/settings#environment-variables`,hooks:`${er}/hooks`};Ode=J(()=>Hl().strict());DZ=new Set(ul);UZ=[{key:"allowedMcpServers",schema:ry},{key:"deniedMcpServers",schema:iy}];JZ=2097152;Mp=!1;s8=null;gr=Object.freeze({settings:{},errors:[]}),XP=null,eE=null,tE=!1,el=null;_8={user:"userSettings",project:"projectSettings",local:"localSettings"},IS={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},v8=["user","project","local"],b8=new Set(["bypassPermissions","auto","acceptEdits"]),w8=new Set(["project"]);process.env.NoDefaultCurrentDirectoryInExePath="1";P8=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"])});import{spawn as vy}from"node:child_process";import{randomUUID as x7}from"node:crypto";import{createConnection as C7,createServer as T7}from"node:net";import{appendFileSync as I7,rmSync as ci,writeFileSync as $s,mkdirSync as To,mkdtempSync as by,chmodSync as xo,existsSync as Co,readFileSync as pi,readdirSync as P7,statSync as E7,unlinkSync as R7}from"node:fs";import{dirname as TE,join as Jn}from"node:path";import{spawn as RA}from"node:child_process";import{randomUUID as OA}from"node:crypto";import{createServer as AA}from"node:net";var gO=Oo(b_(),1),yO=Oo(pc(),1),_O=Oo(hc(),1),kc=Oo(Hs(),1),vO=Oo(E_(),1);function Le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R_(e){let t=[["threadId",e.threadId],["turnId",e.turnId],["itemId",e.itemId],["processId",e.processId],["requestId",e.requestId]].filter(n=>n[1]!==void 0);return Object.fromEntries(t)}function pe(e){return e!==void 0&&Le(e)?e:void 0}function _t(e){return Array.isArray(e)?e:void 0}function V(e){return typeof e=="string"&&e.trim()!==""?e.trim():void 0}function Qe(e){return typeof e=="number"&&Number.isInteger(e)?e:void 0}import{appendFileSync as TO,openSync as tY}from"node:fs";import{homedir as j_}from"node:os";import{dirname as IO,join as N_,resolve as PO,sep as EO}from"node:path";import{mkdirSync as RO}from"node:fs";var Nn={_generated:"GENERATED by scripts/naming_dual_emit_codegen.mjs from scripts/naming_canonical_key_map.json (N2.2 dual-emit, D46) - DO NOT EDIT; run: node scripts/naming_dual_emit_codegen.mjs --write",events:[["codex.agent_turn_narration_only_no_reply","harness.agent_turn_narration_only_no_reply"],["codex.cost_cap_402_seen","harness.cost_cap_402_seen"],["codex.edge_blocked_captured","harness.edge_blocked_captured"],["codex.empty_turn_auto_retry_suppressed_cost_cap","harness.empty_turn_auto_retry_suppressed_cost_cap"],["codex.empty_turn_loop_guard_tripped","harness.empty_turn_loop_guard_tripped"],["codex.error_without_http_status_captured","harness.error_without_http_status_captured"],["codex.mid_stream_stall_auto_resume_flagged","harness.mid_stream_stall_auto_resume_flagged"],["codex.mid_stream_stall_fresh_session_resume","harness.mid_stream_stall_fresh_session_resume"],["codex.mid_stream_stall_fresh_session_resume_failed","harness.mid_stream_stall_fresh_session_resume_failed"],["codex.mid_stream_stall_fresh_session_resume_flagged","harness.mid_stream_stall_fresh_session_resume_flagged"],["codex.mid_stream_stall_resume_suppressed_rate_limit","harness.mid_stream_stall_resume_suppressed_rate_limit"],["codex.mid_stream_stall_second_stall_after_resume","harness.mid_stream_stall_second_stall_after_resume"],["codex.pre_first_byte_stall_auto_retry_flagged","harness.pre_first_byte_stall_auto_retry_flagged"],["codex.pre_first_byte_stall_retry_suppressed_cost_cap","harness.pre_first_byte_stall_retry_suppressed_cost_cap"],["codex.provider_outage_flagged_captured","harness.provider_outage_flagged_captured"],["codex.reasoning_loop_breaker_tripped","harness.reasoning_loop_breaker_tripped"],["codex.tool_fatal_captured","harness.tool_fatal_captured"],["codex.turn_completed","job.turn_completed"],["codex.turn_completed_with_protocol_failure","job.turn_completed_with_protocol_failure"],["codex.turn_completed_with_unsupported_tool_call_ignored","job.turn_completed_with_unsupported_tool_call_ignored"],["codex.turn_completed_without_assistant_output","job.turn_completed_without_assistant_output"],["codex.turn_demoted_late_upstream_error","job.turn_demoted_late_upstream_error"],["codex.turn_forward_failed","job.turn_forward_failed"],["codex.upstream_error_captured","harness.upstream_error_captured"],["codex.upstream_rejection_captured","harness.upstream_rejection_captured"],["codex.upstream_turn_error_captured","harness.upstream_turn_error_captured"],["kandan.chat_event","linzumi.chat_event"],["kandan.chat_event_abandoned","linzumi.chat_event_abandoned"],["kandan.chat_event_failed","linzumi.chat_event_failed"],["kandan.chat_event_failure_cleared","linzumi.chat_event_failure_cleared"],["kandan.child_thread_event_failed","linzumi.child_thread_event_failed"],["kandan.child_thread_event_skipped_missing_thread_binding","linzumi.child_thread_event_skipped_missing_thread_binding"],["kandan.child_thread_upsert_failed","linzumi.child_thread_upsert_failed"],["kandan.child_thread_upsert_skipped_missing_thread_binding","linzumi.child_thread_upsert_skipped_missing_thread_binding"],["kandan.claude_code_interrupt_state_push_failed","linzumi.claude_code_interrupt_state_push_failed"],["kandan.claude_code_stop_state_push_failed","linzumi.claude_code_stop_state_push_failed"],["kandan.claude_code_typing_heartbeat_failed","linzumi.claude_code_typing_heartbeat_failed"],["kandan.claude_code_typing_start_wait_timeout","linzumi.claude_code_typing_start_wait_timeout"],["kandan.claude_code_typing_stop_failed","linzumi.claude_code_typing_stop_failed"],["kandan.claude_code_user_input_abort_publish_failed","linzumi.claude_code_user_input_abort_publish_failed"],["kandan.claude_code_user_question_completed_publish_failed","linzumi.claude_code_user_question_completed_publish_failed"],["kandan.codex_command_output_forwarded","linzumi.codex_command_output_forwarded"],["kandan.codex_delta_forwarded","linzumi.codex_delta_forwarded"],["kandan.codex_file_change_forwarded","linzumi.codex_file_change_forwarded"],["kandan.codex_notification_push_failed","linzumi.codex_notification_push_failed"],["kandan.codex_output_forwarded","linzumi.codex_output_forwarded"],["kandan.codex_reasoning_delta_forwarded","linzumi.codex_reasoning_delta_forwarded"],["kandan.codex_web_search_progress_forwarded","linzumi.codex_web_search_progress_forwarded"],["kandan.connection_force_reconnect","linzumi.connection_force_reconnect"],["kandan.connection_force_reconnect_dispatched","linzumi.connection_force_reconnect_dispatched"],["kandan.connection_hard_reset","linzumi.connection_hard_reset"],["kandan.connection_hard_reset_exhausted","linzumi.connection_hard_reset_exhausted"],["kandan.connection_recovered","linzumi.connection_recovered"],["kandan.connection_stale","linzumi.connection_stale"],["kandan.connection_unrecoverable","linzumi.connection_unrecoverable"],["kandan.control","linzumi.control"],["kandan.control_ack_withheld_on_failure","linzumi.control_ack_withheld_on_failure"],["kandan.control_epoch_changed","linzumi.control_epoch_changed"],["kandan.control_handler_threw","linzumi.control_handler_threw"],["kandan.control_ignored","linzumi.control_ignored"],["kandan.control_response_push_failed","linzumi.control_response_push_failed"],["kandan.failed_seq_overflow","linzumi.failed_seq_overflow"],["kandan.forward_port_revoked_push_failed","linzumi.forward_port_revoked_push_failed"],["kandan.forward_response","linzumi.forward_response"],["kandan.forward_response_push_failed","linzumi.forward_response_push_failed"],["kandan.forward_tunnel_error","linzumi.forward_tunnel_error"],["kandan.forward_tunnel_open_failed","linzumi.forward_tunnel_open_failed"],["kandan.heartbeat_push_failed","linzumi.heartbeat_push_failed"],["kandan.local_editor_initial_status_failed","linzumi.local_editor_initial_status_failed"],["kandan.local_editor_status_push_failed","linzumi.local_editor_status_push_failed"],["kandan.message_duplicate_ignored","linzumi.message_duplicate_ignored"],["kandan.message_ignored","linzumi.message_ignored"],["kandan.message_queued","linzumi.message_queued"],["kandan.message_spawn_on_miss","linzumi.message_spawn_on_miss"],["kandan.message_spawn_on_miss_failed","linzumi.message_spawn_on_miss_failed"],["kandan.message_state_refresh_failed","linzumi.message_state_refresh_failed"],["kandan.optional_push_failed","linzumi.optional_push_failed"],["kandan.post_stop_queue_drain_failed","linzumi.post_stop_queue_drain_failed"],["kandan.queue_drain_blocked","linzumi.queue_drain_blocked"],["kandan.queue_drain_dead_worker_fail_publish_failed","linzumi.queue_drain_dead_worker_fail_publish_failed"],["kandan.queue_drain_dead_worker_rebuild","linzumi.queue_drain_dead_worker_rebuild"],["kandan.queue_drain_dead_worker_rebuild_exhausted","linzumi.queue_drain_dead_worker_rebuild_exhausted"],["kandan.queue_drain_dead_worker_rebuild_failed","linzumi.queue_drain_dead_worker_rebuild_failed"],["kandan.reconnect_handling_failed","linzumi.reconnect_handling_failed"],["kandan.reconnect_thread_context_fetch_failed","linzumi.reconnect_thread_context_fetch_failed"],["kandan.reconnect_thread_cwd_failed_state_push_failed","linzumi.reconnect_thread_cwd_failed_state_push_failed"],["kandan.reconnect_thread_failed","linzumi.reconnect_thread_failed"],["kandan.reconnect_thread_processing_state_push_failed","linzumi.reconnect_thread_processing_state_push_failed"],["kandan.reconnect_thread_queue_closed_state_push_failed","linzumi.reconnect_thread_queue_closed_state_push_failed"],["kandan.reconnect_thread_queue_failed_state_push_failed","linzumi.reconnect_thread_queue_failed_state_push_failed"],["kandan.reconnect_thread_queue_state_push_failed","linzumi.reconnect_thread_queue_state_push_failed"],["kandan.reconnect_thread_rehydrate_forced","linzumi.reconnect_thread_rehydrate_forced"],["kandan.reconnect_thread_rehydrated","linzumi.reconnect_thread_rehydrated"],["kandan.reconnect_thread_rehydrated_state_push_failed","linzumi.reconnect_thread_rehydrated_state_push_failed"],["kandan.reconnect_thread_rehydration_failed","linzumi.reconnect_thread_rehydration_failed"],["kandan.reconnect_thread_rehydration_ir_emitted","linzumi.reconnect_thread_rehydration_ir_emitted"],["kandan.reconnect_thread_rehydration_items_failed","linzumi.reconnect_thread_rehydration_items_failed"],["kandan.reconnect_thread_resume_failed","linzumi.reconnect_thread_resume_failed"],["kandan.reconnect_thread_seq_already_applied","linzumi.reconnect_thread_seq_already_applied"],["kandan.reconnect_thread_transcript_fetch_failed","linzumi.reconnect_thread_transcript_fetch_failed"],["kandan.reconnect_thread_unarchive_failed","linzumi.reconnect_thread_unarchive_failed"],["kandan.reconnect_thread_unarchive_resumed","linzumi.reconnect_thread_unarchive_resumed"],["kandan.reconnect_thread_unarchive_started","linzumi.reconnect_thread_unarchive_started"],["kandan.reconnect_thread_unavailable_state_push_failed","linzumi.reconnect_thread_unavailable_state_push_failed"],["kandan.reconnected","linzumi.reconnected"],["kandan.roster_seeded","linzumi.roster_seeded"],["kandan.session_app_server_lost_push_failed","linzumi.session_app_server_lost_push_failed"],["kandan.session_settings_publish_failed","linzumi.session_settings_publish_failed"],["kandan.start_instance_claude_code_attachment_failed_state_push_failed","linzumi.start_instance_claude_code_attachment_failed_state_push_failed"],["kandan.start_instance_codex_app_server_unavailable","linzumi.start_instance_codex_app_server_unavailable"],["kandan.start_instance_cwd_failed_state_push_failed","linzumi.start_instance_cwd_failed_state_push_failed"],["kandan.start_instance_cwd_rejected","linzumi.start_instance_cwd_rejected"],["kandan.start_instance_failed","linzumi.start_instance_failed"],["kandan.start_instance_processing_state_push_failed","linzumi.start_instance_processing_state_push_failed"],["kandan.start_instance_skipped_known_session","linzumi.start_instance_skipped_known_session"],["kandan.start_instance_stale_skipped","linzumi.start_instance_stale_skipped"],["kandan.start_instance_unavailable_state_push_failed","linzumi.start_instance_unavailable_state_push_failed"],["kandan.start_instance_wafer_state_push_failed","linzumi.start_instance_wafer_state_push_failed"],["kandan.start_turn_replay_skipped","linzumi.start_turn_replay_skipped"],["kandan.steer_duplicate_ignored","linzumi.steer_duplicate_ignored"],["kandan.steer_parked_as_own_turn","linzumi.steer_parked_as_own_turn"],["kandan.thread_bind_from_historical_reply_failed","linzumi.thread_bind_from_historical_reply_failed"],["kandan.thread_bound_from_historical_reply","linzumi.thread_bound_from_historical_reply"],["kandan.thread_sessions_reannounce_failed","linzumi.thread_sessions_reannounce_failed"],["kandan.thread_sessions_reannounced","linzumi.thread_sessions_reannounced"],["kandan.tui_input_mirrored","linzumi.tui_input_mirrored"],["kandan.typing_heartbeat_failed","linzumi.typing_heartbeat_failed"],["kandan.typing_stop_after_completion_failed","linzumi.typing_stop_after_completion_failed"]],keys:[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],keyPrimaryLegacy:[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],values:[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]],topic:{legacyPrefix:"local_codex_runner:",canonicalPrefix:"commander:"},originator:{legacy:"kandan-local-codex-runner",canonical:"linzumi-commander"}};var wO=new Map(Nn.events),SO=new Map(Nn.events.map(([e,t])=>[t,e])),A_=new Map(Nn.keys),$_=new Map(Nn.keyPrimaryLegacy),kO=new Map(Nn.values),xO=new Map(Nn.values.map(([e,t])=>[t,e])),QQ={eventCanonicalByLegacy:wO,eventLegacyByCanonical:SO,keyCanonicalByLegacy:A_,keyPrimaryLegacyByCanonical:$_,valueCanonicalByLegacy:kO,valueLegacyByCanonical:xO,originator:Nn.originator,topic:Nn.topic};function M_(e){let t=new Set(e);for(let n of e){let i=A_.get(n);i!==void 0&&t.add(i);let r=$_.get(n);r!==void 0&&t.add(r)}return t}var O_=new Map;for(let[e,t]of Nn.keys){let n=O_.get(t)??[];n.push(e),O_.set(t,n)}var Nr="<SENSITIVE_DATA>",q_=M_(new Set(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"])),OO=new Set(["--access-token","--api-key","--authorization","--cookie","--oauth-code","--password","--refresh-token","--secret","--token"]);function AO(e){if(process.env.VITEST===void 0)return;let t=N_(j_(),".linzumi"),n=PO(e);if(n===t||n.startsWith(`${t}${EO}`))throw new Error(`test-mode log isolation violated: refusing to open ${e} inside the real ~/.linzumi (point the logger at a temp path; the harness defaults LINZUMI_RUNNER_LOG_FILE / LINZUMI_CLI_AUDIT_LOG for exactly this - see plans/2026-07-10-cli-test-hygiene-spec.md item 2)`)}function Ye(e,t,n={}){let i=n.logFile??$O();AO(i);try{RO(IO(i),{recursive:!0}),TO(i,`${JSON.stringify({ts:new Date().toISOString(),event:e,...n.sessionId===void 0?{}:{sessionId:n.sessionId},...D_(t)})}
|
|
121
|
+
`+" ".repeat(t))}};(function(e){e.DEFAULT={allowTrailingComma:!1}})(Zw||(Zw={}));(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Qw||(Qw={}));(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Yw||(Yw={}));(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Xw||(Xw={}));_r=sP.homedir(),Xg=sP.tmpdir(),{env:Ni}=Wf,gV=e=>{let t=rt.join(_r,"Library");return{data:rt.join(t,"Application Support",e),config:rt.join(t,"Preferences",e),cache:rt.join(t,"Caches",e),log:rt.join(t,"Logs",e),temp:rt.join(Xg,e)}},yV=e=>{let t=Ni.APPDATA||rt.join(_r,"AppData","Roaming"),n=Ni.LOCALAPPDATA||rt.join(_r,"AppData","Local");return{data:rt.join(n,e,"Data"),config:rt.join(t,e,"Config"),cache:rt.join(n,e,"Cache"),log:rt.join(n,e,"Log"),temp:rt.join(Xg,e)}},_V=e=>{let t=rt.basename(_r);return{data:rt.join(Ni.XDG_DATA_HOME||rt.join(_r,".local","share"),e),config:rt.join(Ni.XDG_CONFIG_HOME||rt.join(_r,".config"),e),cache:rt.join(Ni.XDG_CACHE_HOME||rt.join(_r,".cache"),e),log:rt.join(Ni.XDG_STATE_HOME||rt.join(_r,".local","state"),e),temp:rt.join(Xg,t,e)}};ide=vV("claude-cli");SV=100,Pp=[];xV=[],eS=null,ode=vt(()=>process.argv.includes("--hard-fail"));Ei=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,uP=new Set,Hf=typeof process=="object"&&process?process:{},lP=(e,t,n,i)=>{typeof Hf.emitWarning=="function"?Hf.emitWarning(e,t,n,i):console.error(`[${n}] ${t}: ${e}`)},Wu=globalThis.AbortController,tS=globalThis.AbortSignal;if(typeof Wu>"u"){tS=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Wu=class{constructor(){t()}signal=new tS;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let e=Hf.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,lP("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}CV=e=>!uP.has(e),mr=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),cP=e=>mr(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?zi:null:null,zi=class extends Array{constructor(t){super(t),this.fill(0)}},Gf=class e{heap;length;static#r=!1;static create(t){let n=cP(t);if(!n)return[];e.#r=!0;let i=new e(t,n);return e.#r=!1,i}constructor(t,n){if(!e.#r)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Vf=class e{#r;#c;#h;#g;#R;#O;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#y;#i;#n;#e;#u;#p;#d;#a;#_;#s;#v;#b;#f;#w;#T;#l;static unsafeExposeInternals(t){return{starts:t.#b,ttls:t.#f,sizes:t.#v,keyMap:t.#i,keyList:t.#n,valList:t.#e,next:t.#u,prev:t.#p,get head(){return t.#d},get tail(){return t.#a},free:t.#_,isBackgroundFetch:n=>t.#t(n),backgroundFetch:(n,i,r,o)=>t.#M(n,i,r,o),moveToTail:n=>t.#E(n),indexes:n=>t.#S(n),rindexes:n=>t.#k(n),isStale:n=>t.#m(n)}}get max(){return this.#r}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#o}get fetchMethod(){return this.#R}get memoMethod(){return this.#O}get dispose(){return this.#h}get disposeAfter(){return this.#g}constructor(t){let{max:n=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:s,allowStale:d,dispose:u,disposeAfter:l,noDisposeOnSet:p,noUpdateTTL:m,maxSize:f=0,maxEntrySize:h=0,sizeCalculation:y,fetchMethod:w,memoMethod:g,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:T,ignoreFetchAbort:C}=t;if(n!==0&&!mr(n))throw TypeError("max option must be a nonnegative integer");let _=n?cP(n):Array;if(!_)throw Error("invalid max value: "+n);if(this.#r=n,this.#c=f,this.maxEntrySize=h||this.#c,this.sizeCalculation=y,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw TypeError("memoMethod must be a function if defined");if(this.#O=g,w!==void 0&&typeof w!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#R=w,this.#T=!!w,this.#i=new Map,this.#n=Array(n).fill(void 0),this.#e=Array(n).fill(void 0),this.#u=new _(n),this.#p=new _(n),this.#d=0,this.#a=0,this.#_=Gf.create(n),this.#o=0,this.#y=0,typeof u=="function"&&(this.#h=u),typeof l=="function"?(this.#g=l,this.#s=[]):(this.#g=void 0,this.#s=void 0),this.#w=!!this.#h,this.#l=!!this.#g,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#c!==0&&!mr(this.#c))throw TypeError("maxSize must be a positive integer if specified");if(!mr(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!s,this.ttlResolution=mr(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!mr(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#r===0&&this.ttl===0&&this.#c===0)throw TypeError("At least one of max, maxSize, or ttl is required");!this.ttlAutopurge&&!this.#r&&!this.#c&&CV("LRU_CACHE_UNBOUNDED")&&(uP.add("LRU_CACHE_UNBOUNDED"),lP("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",e))}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#j(){let t=new zi(this.#r),n=new zi(this.#r);this.#f=t,this.#b=n,this.#N=(o,a,s=Ei.now())=>{if(n[o]=a!==0?s:0,t[o]=a,a!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#m(o)&&this.#x(this.#n[o],"expire")},a+1);d.unref&&d.unref()}},this.#I=o=>{n[o]=t[o]!==0?Ei.now():0},this.#C=(o,a)=>{if(t[a]){let s=t[a],d=n[a];if(!s||!d)return;o.ttl=s,o.start=d,o.now=i||r();let u=o.now-d;o.remainingTTL=s-u}};let i=0,r=()=>{let o=Ei.now();if(this.ttlResolution>0){i=o;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return o};this.getRemainingTTL=o=>{let a=this.#i.get(o);if(a===void 0)return 0;let s=t[a],d=n[a];if(!s||!d)return 1/0;let u=(i||r())-d;return s-u},this.#m=o=>{let a=n[o],s=t[o];return!!s&&!!a&&(i||r())-a>s}}#I=()=>{};#C=()=>{};#N=()=>{};#m=()=>!1;#F(){let t=new zi(this.#r);this.#y=0,this.#v=t,this.#P=n=>{this.#y-=t[n],t[n]=0},this.#q=(n,i,r,o)=>{if(this.#t(i))return 0;if(!mr(r))if(o){if(typeof o!="function")throw TypeError("sizeCalculation must be a function");if(r=o(i,n),!mr(r))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#A=(n,i,r)=>{if(t[n]=i,this.#c){let o=this.#c-t[n];for(;this.#y>o;)this.#$(!0)}this.#y+=t[n],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y)}}#P=t=>{};#A=(t,n,i)=>{};#q=(t,n,i,r)=>{if(i||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#a;!(!this.#D(n)||((t||!this.#m(n))&&(yield n),n===this.#d));)n=this.#p[n]}*#k({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#d;!(!this.#D(n)||((t||!this.#m(n))&&(yield n),n===this.#a));)n=this.#u[n]}#D(t){return t!==void 0&&this.#i.get(this.#n[t])===t}*entries(){for(let t of this.#S())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*rentries(){for(let t of this.#k())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*keys(){for(let t of this.#S()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*rkeys(){for(let t of this.#k()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*values(){for(let t of this.#S())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}*rvalues(){for(let t of this.#k())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,n={}){for(let i of this.#S()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#n[i],this))return this.get(this.#n[i],n)}}forEach(t,n=this){for(let i of this.#S()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(n,o,this.#n[i],this)}}rforEach(t,n=this){for(let i of this.#k()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(n,o,this.#n[i],this)}}purgeStale(){let t=!1;for(let n of this.#k({allowStale:!0}))this.#m(n)&&(this.#x(this.#n[n],"expire"),t=!0);return t}info(t){let n=this.#i.get(t);if(n===void 0)return;let i=this.#e[n],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#f&&this.#b){let a=this.#f[n],s=this.#b[n];if(a&&s){let d=a-(Ei.now()-s);o.ttl=d,o.start=Date.now()}}return this.#v&&(o.size=this.#v[n]),o}dump(){let t=[];for(let n of this.#S({allowStale:!0})){let i=this.#n[n],r=this.#e[n],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let a={value:o};if(this.#f&&this.#b){a.ttl=this.#f[n];let s=Ei.now()-this.#b[n];a.start=Math.floor(Date.now()-s)}this.#v&&(a.size=this.#v[n]),t.unshift([i,a])}return t}load(t){this.clear();for(let[n,i]of t){if(i.start){let r=Date.now()-i.start;i.start=Ei.now()-r}this.set(n,i.value,i)}}set(t,n,i={}){if(n===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:d}=i,{noUpdateTTL:u=this.noUpdateTTL}=i,l=this.#q(t,n,i.size||0,s);if(this.maxEntrySize&&l>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#x(t,"set"),this;let p=this.#o===0?void 0:this.#i.get(t);if(p===void 0)p=this.#o===0?this.#a:this.#_.length!==0?this.#_.pop():this.#o===this.#r?this.#$(!1):this.#o,this.#n[p]=t,this.#e[p]=n,this.#i.set(t,p),this.#u[this.#a]=p,this.#p[p]=this.#a,this.#a=p,this.#o++,this.#A(p,l,d),d&&(d.set="add"),u=!1;else{this.#E(p);let m=this.#e[p];if(n!==m){if(this.#T&&this.#t(m)){m.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=m;f!==void 0&&!a&&(this.#w&&this.#h?.(f,t,"set"),this.#l&&this.#s?.push([f,t,"set"]))}else a||(this.#w&&this.#h?.(m,t,"set"),this.#l&&this.#s?.push([m,t,"set"]));if(this.#P(p),this.#A(p,l,d),this.#e[p]=n,d){d.set="replace";let f=m&&this.#t(m)?m.__staleWhileFetching:m;f!==void 0&&(d.oldValue=f)}}else d&&(d.set="update")}if(r!==0&&!this.#f&&this.#j(),this.#f&&(u||this.#N(p,r,o),d&&this.#C(d,p)),!a&&this.#l&&this.#s){let m=this.#s,f;for(;f=m?.shift();)this.#g?.(...f)}return this}pop(){try{for(;this.#o;){let t=this.#e[this.#d];if(this.#$(!0),this.#t(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#l&&this.#s){let t=this.#s,n;for(;n=t?.shift();)this.#g?.(...n)}}}#$(t){let n=this.#d,i=this.#n[n],r=this.#e[n];return this.#T&&this.#t(r)?r.__abortController.abort(Error("evicted")):(this.#w||this.#l)&&(this.#w&&this.#h?.(r,i,"evict"),this.#l&&this.#s?.push([r,i,"evict"])),this.#P(n),t&&(this.#n[n]=void 0,this.#e[n]=void 0,this.#_.push(n)),this.#o===1?(this.#d=this.#a=0,this.#_.length=0):this.#d=this.#u[n],this.#i.delete(i),this.#o--,n}has(t,n={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=n,o=this.#i.get(t);if(o!==void 0){let a=this.#e[o];if(this.#t(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#m(o))r&&(r.has="stale",this.#C(r,o));else return i&&this.#I(o),r&&(r.has="hit",this.#C(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,n={}){let{allowStale:i=this.allowStale}=n,r=this.#i.get(t);if(r===void 0||!i&&this.#m(r))return;let o=this.#e[r];return this.#t(o)?o.__staleWhileFetching:o}#M(t,n,i,r){let o=n===void 0?void 0:this.#e[n];if(this.#t(o))return o;let a=new Wu,{signal:s}=i;s?.addEventListener("abort",()=>a.abort(s.reason),{signal:a.signal});let d={signal:a.signal,options:i,context:r},u=(y,w=!1)=>{let{aborted:g}=a.signal,v=i.ignoreFetchAbort&&y!==void 0;if(i.status&&(g&&!w?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,v&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!v&&!w)return p(a.signal.reason);let b=f;return this.#e[n]===f&&(y===void 0?b.__staleWhileFetching?this.#e[n]=b.__staleWhileFetching:this.#x(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,y,d.options))),y},l=y=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=y),p(y)),p=y=>{let{aborted:w}=a.signal,g=w&&i.allowStaleOnFetchAbort,v=g||i.allowStaleOnFetchRejection,b=v||i.noDeleteOnFetchRejection,S=f;if(this.#e[n]===f&&(!b||S.__staleWhileFetching===void 0?this.#x(t,"fetch"):g||(this.#e[n]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw y},m=(y,w)=>{let g=this.#R?.(t,o,d);g&&g instanceof Promise&&g.then(v=>y(v===void 0?void 0:v),w),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(y(void 0),i.allowStaleOnFetchAbort&&(y=v=>u(v,!0)))})};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(m).then(u,l),h=Object.assign(f,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return n===void 0?(this.set(t,h,{...d.options,status:void 0}),n=this.#i.get(t)):this.#e[n]=h,h}#t(t){if(!this.#T)return!1;let n=t;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof Wu}async fetch(t,n={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:d=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:y,forceRefresh:w=!1,status:g,signal:v}=n;if(!this.#T)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let b={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:s,size:d,sizeCalculation:u,noUpdateTTL:l,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:h,ignoreFetchAbort:f,status:g,signal:v},S=this.#i.get(t);if(S===void 0){g&&(g.fetch="miss");let T=this.#M(t,S,b,y);return T.__returned=T}else{let T=this.#e[S];if(this.#t(T)){let I=i&&T.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",I&&(g.returnedStale=!0)),I?T.__staleWhileFetching:T.__returned=T}let C=this.#m(S);if(!w&&!C)return g&&(g.fetch="hit"),this.#E(S),r&&this.#I(S),g&&this.#C(g,S),T;let _=this.#M(t,S,b,y),k=_.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=C?"stale":"refresh",k&&C&&(g.returnedStale=!0)),k?_.__staleWhileFetching:_.__returned=_}}async forceFetch(t,n={}){let i=await this.fetch(t,n);if(i===void 0)throw Error("fetch() returned undefined");return i}memo(t,n={}){let i=this.#O;if(!i)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...a}=n,s=this.get(t,a);if(!o&&s!==void 0)return s;let d=i(t,s,{options:a,context:r});return this.set(t,d,a),d}get(t,n={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=n,s=this.#i.get(t);if(s!==void 0){let d=this.#e[s],u=this.#t(d);return a&&this.#C(a,s),this.#m(s)?(a&&(a.get="stale"),u?(a&&i&&d.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?d.__staleWhileFetching:void 0):(o||this.#x(t,"expire"),a&&i&&(a.returnedStale=!0),i?d:void 0)):(a&&(a.get="hit"),u?d.__staleWhileFetching:(this.#E(s),r&&this.#I(s),d))}else a&&(a.get="miss")}#L(t,n){this.#p[n]=t,this.#u[t]=n}#E(t){t!==this.#a&&(t===this.#d?this.#d=this.#u[t]:this.#L(this.#p[t],this.#u[t]),this.#L(this.#a,t),this.#a=t)}delete(t){return this.#x(t,"delete")}#x(t,n){let i=!1;if(this.#o!==0){let r=this.#i.get(t);if(r!==void 0)if(i=!0,this.#o===1)this.#U(n);else{this.#P(r);let o=this.#e[r];if(this.#t(o)?o.__abortController.abort(Error("deleted")):(this.#w||this.#l)&&(this.#w&&this.#h?.(o,t,n),this.#l&&this.#s?.push([o,t,n])),this.#i.delete(t),this.#n[r]=void 0,this.#e[r]=void 0,r===this.#a)this.#a=this.#p[r];else if(r===this.#d)this.#d=this.#u[r];else{let a=this.#p[r];this.#u[a]=this.#u[r];let s=this.#u[r];this.#p[s]=this.#p[r]}this.#o--,this.#_.push(r)}}if(this.#l&&this.#s?.length){let r=this.#s,o;for(;o=r?.shift();)this.#g?.(...o)}return i}clear(){return this.#U("delete")}#U(t){for(let n of this.#k({allowStale:!0})){let i=this.#e[n];if(this.#t(i))i.__abortController.abort(Error("deleted"));else{let r=this.#n[n];this.#w&&this.#h?.(i,r,t),this.#l&&this.#s?.push([i,r,t])}}if(this.#i.clear(),this.#e.fill(void 0),this.#n.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#v&&this.#v.fill(0),this.#d=0,this.#a=0,this.#_.length=0,this.#y=0,this.#o=0,this.#l&&this.#s){let n=this.#s,i;for(;i=n?.shift();)this.#g?.(...i)}}};IV=8192;nS=TV(pP,e=>e,50),Kl=Object.assign(function(e,t=!0){if(!e)return null;let n=e.length>IV?pP(e,t):nS(e,t);return n.ok?n.value:null},{cache:nS.cache}),Jl=vt(()=>{try{if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";if(process.platform==="linux"){if(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)return"wsl";try{let e=Yt().readFileSync("/proc/version",{encoding:"utf8"});if(e.toLowerCase().includes("microsoft")||e.toLowerCase().includes("wsl"))return"wsl"}catch(e){Ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"})}return"linux"}return"unknown"}catch(e){return dP(e),"unknown"}}),lde=vt(()=>{if(process.platform==="linux")try{let e=Yt().readFileSync("/proc/version",{encoding:"utf8"}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes("microsoft")?"1":void 0}catch(e){Ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}}),cde=vt(async()=>{if(process.platform!=="linux")return;let e={linuxKernel:fP()};try{let t=await EV("/etc/os-release","utf8");for(let n of t.split(`
|
|
122
|
+
`)){let i=n.match(/^(ID|VERSION_ID)=(.*)$/);if(i&&i[1]&&i[2]){let r=i[2].replace(/^"|"$/g,"");i[1]==="ID"?e.linuxDistroId=r:e.linuxDistroVersion=r}}}catch{}return e}),pde=vt(()=>{if(process.platform!=="darwin")return;let e=fP().match(/^(\d+)\./);if(!(!e||!e[1]))return parseInt(e[1],10)-9}),ps=vt(function(){switch(Jl()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),fde=vt(function(){return PV(ps(),"managed-settings.d")});Zf=RV;AV=OV,$V=AV(),MV=$V;NV=jV,qV="[object Object]",DV=Function.prototype,LV=Object.prototype,mP=DV.toString,UV=LV.hasOwnProperty,FV=mP.call(Object);BV=zV;Qf=KV;WV=JV;GV=HV;VV=hP;QV=ZV,rS=Math.max;gP=YV;e5=XV,t5=gu?function(e,t){return gu(e,"toString",{configurable:!0,enumerable:!1,value:e5(t),writable:!0})}:Nm,n5=t5,r5=800,i5=16,o5=Date.now;s5=a5,d5=s5(n5),yP=d5;l5=u5;p5=c5;m5=f5,h5=m5(function(e,t,n,i){VV(e,t,n,i)}),vr=h5;y5=g5;_P=_5;b5=v5,iS=Dn?Dn.isConcatSpreadable:void 0;S5=w5;k5=vP;C5=x5;I5=T5,P5=I5(function(e,t){return e==null?{}:b5(e,t)}),Ep=P5,R5="Expected a function";A5=O5;M5=$5;N5=j5,bP=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","CLOUD_ML_REGION"],wP=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL"],SP=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_AWS_API_KEY","ANTHROPIC_BEDROCK_MANTLE_API_KEY"],D5=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],L5=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL"],gde=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...bP,...wP,...SP,...D5,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...L5,"ANTHROPIC_BEDROCK_SERVICE_TIER","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK"]),U5="remote-settings.json",Rp=null,z5=null;J5=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...bP,...wP,"CLAUDE_CODE_CUSTOM_OAUTH_URL",...SP,"ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE"].map(e=>e.toUpperCase()));V5=["userSettings","projectSettings","localSettings","flagSettings","policySettings"],oS="com.anthropic.claudecode",Yf="HKLM\\SOFTWARE\\Policies\\ClaudeCode",Xf="HKCU\\SOFTWARE\\Policies\\ClaudeCode",qi="Settings",Q5="/usr/bin/plutil",Y5=["-convert","json","-o","-","--"],X5=5e3,aS="/mnt/c/Windows/System32/reg.exe",Hu="/mnt/c/Program Files/ClaudeCode";t3=J(()=>c.object({allowedDomains:c.array(c.string()).optional(),deniedDomains:c.array(c.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),allowManagedDomainsOnly:c.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:c.array(c.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:c.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:c.boolean().optional(),allowMachLookup:c.array(c.string().refine(e=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:c.number().optional(),socksProxyPort:c.number().optional(),tlsTerminate:c.object({caCertPath:c.string().min(1).optional(),caKeyPath:c.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. Only honored from user, managed/policy, or CLI (`--settings`) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),n3=J(()=>c.object({allowWrite:c.array(c.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:c.array(c.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:c.array(c.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:c.array(c.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:c.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),xP=J(()=>c.object({path:c.string().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:c.literal("deny").describe("Access mode for this path. Only `deny` is supported.")})),CP=J(()=>c.object({name:c.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores").describe("Environment variable name."),mode:c.enum(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the host proxy swaps sentinel\u2192real on egress to `injectHosts`."),injectHosts:c.array(c.string()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to `network.allowedDomains` \u2014 the credential is injected at every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")})),r3=J(()=>c.object({files:c.array(xP()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox."),envVars:c.array(CP()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:c.boolean().optional().describe("Allow sentinel\u2192real substitution on the plain-HTTP proxy path. Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),TP=J(()=>c.object({enabled:c.boolean().optional(),failIfUnavailable:c.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:c.boolean().optional(),allowUnsandboxedCommands:c.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:t3(),filesystem:n3(),credentials:r3(),ignoreViolations:c.record(c.string(),c.array(c.string())).optional(),enableWeakerNestedSandbox:c.boolean().optional(),enableWeakerNetworkIsolation:c.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. **Reduces security** \u2014 opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:c.boolean().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. **Removes code-execution isolation** \u2014 sandboxed commands can launch other applications unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. Only honored from user, managed/policy, or CLI (--settings) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:c.array(c.string()).optional(),ripgrep:c.object({command:c.string(),args:c.array(c.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:c.preprocess(e=>typeof e=="string"&&sS(e)?e:void 0,c.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:c.preprocess(e=>typeof e=="string"&&sS(e)?e:void 0,c.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough()),i3=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],o3=["normal","vim"],a3=["auto","tmux","iterm2","in-process"],s3=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],d3=["auto",...s3],vde=Jl()==="macos"?"\u23FA":"\u25CF",ey=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],u3=[...ey,"bubble"],l3=u3,bde=J(()=>$I.enum(l3)),wde=J(()=>$I.enum(ey)),c3=["bash","powershell"],ya=J(()=>c.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));f3=J(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:i,McpToolHookSchema:r}=p3();return c.discriminatedUnion("type",[e,t,n,i,r])}),m3=J(()=>c.object({matcher:c.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:c.array(f3()).describe("List of hooks to execute when the matcher matches")})),Gu=J(()=>c.partialRecord(c.enum(ul),c.array(m3()))),Sde=J(()=>c.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),kde=J(()=>c.enum(["stdio","sse","sse-ide","http","ws","sdk"])),ko=J(()=>c.literal("comms").optional().catch(void 0)),Pr=J(()=>c.number().int().positive()),h3=J(()=>c.object({type:c.literal("stdio").optional(),command:c.string().min(1,"Command cannot be empty"),args:c.array(c.string()).default([]),env:c.record(c.string(),c.string()).optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),g3=J(()=>c.boolean()),IP=J(()=>c.object({clientId:c.string().optional(),callbackPort:c.number().int().positive().optional(),authServerMetadataUrl:c.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:c.string().min(1).optional(),xaa:g3().optional()})),PP=J(()=>c.object({name:c.string(),permission_policy:c.enum(["always_allow","always_ask","always_deny"]).optional()})),y3=J(()=>c.object({type:c.literal("sse"),url:c.string(),headers:c.record(c.string(),c.string()).optional(),headersHelper:c.string().optional(),oauth:IP().optional(),timeout:Pr().optional(),tools:c.array(PP()).optional(),alwaysLoad:c.boolean().optional(),role:ko(),toolPermissions:c.record(c.string(),ty()).optional()})),_3=J(()=>c.object({type:c.literal("sse-ide"),url:c.string(),ideName:c.string(),ideRunningInWindows:c.boolean().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),v3=J(()=>c.object({type:c.literal("ws-ide"),url:c.string(),ideName:c.string(),authToken:c.string().optional(),ideRunningInWindows:c.boolean().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),b3=J(()=>c.object({type:c.enum(["http","streamable-http"]).transform(()=>"http"),url:c.string(),headers:c.record(c.string(),c.string()).optional(),headersHelper:c.string().optional(),oauth:IP().optional(),timeout:Pr().optional(),tools:c.array(PP()).optional(),alwaysLoad:c.boolean().optional(),role:ko(),toolPermissions:c.record(c.string(),ty()).optional()})),w3=J(()=>c.object({type:c.literal("ws"),url:c.string(),headers:c.record(c.string(),c.string()).optional(),headersHelper:c.string().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),role:ko()})),S3=J(()=>c.object({type:c.literal("sdk"),name:c.string(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional()})),ty=J(()=>c.enum(["allow","ask","blocked"])),k3=J(()=>c.object({type:c.literal("claudeai-proxy"),url:c.string(),id:c.string(),displayName:c.string().optional(),iconUrl:c.string().optional(),timeout:Pr().optional(),alwaysLoad:c.boolean().optional(),toolPermissions:c.record(c.string(),ty()).optional(),stateless:c.boolean().optional(),cachedInitResponse:c.record(c.string(),c.unknown()).nullish()})),em=J(()=>c.union([h3(),y3(),_3(),v3(),b3(),w3(),S3(),k3()])),xde=J(()=>c.object({mcpServers:c.record(c.string(),em())})),x3=new Set(["claude-community","claude-plugins-community"]),C3=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins"]),EP=new Set([...C3,...x3]),T3=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,I3=/[^\u0020-\u007E]/;Rn=J(()=>c.string().startsWith("./")),ni=J(()=>Rn().endsWith(".json")),dS=J(()=>c.union([Rn().refine(e=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),c.string().url().refine(e=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),tm=J(()=>Rn().endsWith(".md")),nm=J(()=>c.union([tm(),Rn()])),RP=J(()=>c.string().min(1,"Marketplace must have a name").refine(e=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine(e=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine(e=>!P3(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine(e=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine(e=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine(e=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),ny=J(()=>c.object({name:c.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:c.string().optional().describe("Contact email for support or feedback"),url:c.string().optional().describe("Website, GitHub profile, or organization URL")})),E3=J(()=>c.object({$schema:c.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:c.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:c.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:c.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:c.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:ny().optional().describe("Information about the plugin creator or maintainer"),homepage:c.string().url().optional().describe("Plugin homepage or documentation URL"),repository:c.string().optional().describe("Source code repository URL"),license:c.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:c.array(c.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:c.boolean().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:c.array(dZ()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),Cde=J(()=>c.object({description:c.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:c.lazy(()=>Gu()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),R3=J(()=>c.object({hooks:c.union([ni().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),c.lazy(()=>Gu()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),c.array(c.union([ni().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),c.lazy(()=>Gu()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),O3=J(()=>c.object({source:nm().optional().describe("Path to command markdown file, relative to plugin root"),content:c.string().optional().describe("Inline markdown content for the command"),description:c.string().optional().describe("Command description override"),argumentHint:c.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:c.string().optional().describe("Default model for this command"),allowedTools:c.array(c.string()).optional().describe("Tools allowed when command runs")}).refine(e=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),A3=J(()=>c.object({commands:c.union([nm().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(nm().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),c.record(c.string(),O3()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" \u2192 "/plugin:about")')])})),$3=J(()=>c.object({agents:c.union([tm().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(tm().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),M3=J(()=>c.object({skills:c.union([Rn().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan)."),c.array(Rn().describe("Path to a skill directory, relative to the plugin root.")).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),OP=J(()=>c.object({outputStyles:c.union([Rn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(Rn().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),j3=J(()=>c.string().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),N3=16,q3=J(()=>c.object({id:j3(),remote:c.string().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:c.string().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),D3=J(()=>c.object({syntaxHighlighting:c.object({hljsLanguages:c.array(q3()).max(N3)}).strict()})),AP=J(()=>c.object({themes:c.union([Rn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded \u2014 list its files here if you want both."),c.array(Rn().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),L3=J(()=>c.object({})),uS=J(()=>c.string().min(1)),U3=J(()=>c.string().min(2).refine(e=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),F3=J(()=>c.object({mcpServers:c.union([ni().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),dS().describe("Path or URL to MCPB file containing MCP server configuration"),c.record(c.string(),em()).describe("MCP server configurations keyed by server name"),c.array(c.union([ni().describe("Path to MCP servers configuration file"),dS().describe("Path or URL to MCPB file"),c.record(c.string(),em()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),$P=J(()=>c.object({type:c.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:c.string().describe("Human-readable label shown in the config dialog"),description:c.string().describe("Help text shown beneath the field in the config dialog"),required:c.boolean().optional().describe("If true, validation fails when this field is empty"),default:c.union([c.string(),c.number(),c.boolean(),c.array(c.string())]).optional().describe("Default value used when the user provides nothing"),multiple:c.boolean().optional().describe("For string type: allow an array of strings"),sensitive:c.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:c.number().optional().describe("Minimum value (number type only)"),max:c.number().optional().describe("Maximum value (number type only)")}).strict()),z3=J(()=>c.object({userConfig:c.record(c.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) \u2014 they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),$P()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),B3=J(()=>c.object({channels:c.array(c.object({server:c.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:c.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:c.record(c.string(),$P()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),lS=J(()=>c.strictObject({command:c.string().min(1).refine(e=>!(e.includes(" ")&&!e.startsWith("/")),{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:c.array(uS()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:c.record(U3(),uS()).refine(e=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:c.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:c.record(c.string(),c.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:c.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:c.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:c.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:c.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:c.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:c.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:c.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:c.boolean().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),K3=J(()=>c.strictObject({name:c.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:c.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd \u2014 prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:c.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:c.union([c.literal("always"),c.string().startsWith("on-skill-invoke:").refine(e=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),J3=J(()=>c.array(K3()).refine(e=>new Set(e.map(t=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),MP=J(()=>c.object({monitors:c.union([ni().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),J3()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),W3=J(()=>c.object({lspServers:c.union([ni().describe("Path to .lsp.json configuration file relative to plugin root"),c.record(c.string(),lS()).describe("LSP server configurations keyed by server name"),c.array(c.union([ni().describe("Path to LSP configuration file"),c.record(c.string(),lS()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),jP=J(()=>c.string().refine(e=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine(e=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,n=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||n.test(e)},"Invalid npm package name format")),H3=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,G3=/^[0-9a-f]{64}$/,V3=J(()=>c.object({sha256:c.string().regex(G3)}));Q3=J(()=>c.object({binaries:c.unknown().transform(Z3).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),Y3=J(()=>c.object({settings:c.record(c.string(),c.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),X3=J(()=>c.object({experimental:c.preprocess(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,c.object({...AP().partial().shape,...D3().partial().shape,...MP().partial().shape,...OP().partial().shape,evals:c.union([c.string(),c.array(c.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),eZ=J(()=>c.object({...E3().shape,...R3().partial().shape,...A3().partial().shape,...$3().partial().shape,...M3().partial().shape,...OP().partial().shape,...AP().partial().shape,...L3().shape,...B3().partial().shape,...F3().partial().shape,...W3().partial().shape,...MP().partial().shape,...Y3().partial().shape,...z3().partial().shape,...Q3().partial().shape,...X3().partial().shape})),Vu=J(()=>c.discriminatedUnion("source",[c.object({source:c.literal("url"),url:c.string().url().describe("Direct URL to marketplace.json file"),headers:c.record(c.string(),c.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),c.object({source:c.literal("github"),repo:c.string().describe("GitHub repository in owner/repo format"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:c.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:c.array(c.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:c.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),c.object({source:c.literal("git"),url:c.string().describe("Full git repository URL"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:c.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:c.array(c.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:c.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),c.object({source:c.literal("npm"),package:jP().describe("NPM package containing marketplace.json")}),c.object({source:c.literal("file"),path:c.string().describe("Local file path to marketplace.json")}),c.object({source:c.literal("directory"),path:c.string().describe("Local directory containing .claude-plugin/marketplace.json")}),c.object({source:c.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),c.object({source:c.literal("hostPattern"),hostPattern:c.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),c.object({source:c.literal("pathPattern"),pathPattern:c.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),c.object({source:c.literal("settings"),name:RP().refine(e=>!EP.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation as PluginMarketplaceSchema plus reserved-name rejection \u2014 validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:c.array(tZ()).describe("Plugin entries declared inline in settings.json"),owner:ny().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),Op=J(()=>c.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),NP=J(()=>c.union([c.preprocess(e=>e==="."?"./":e,Rn()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),c.object({source:c.literal("npm"),package:jP().or(c.string().refine(e=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:c.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:c.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),c.object({source:c.literal("url"),url:c.string().describe("Full git repository URL (https:// or git@)"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Op().optional().describe("Specific commit SHA to use")}),c.object({source:c.literal("github"),repo:c.string().describe("GitHub repository in owner/repo format"),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Op().optional().describe("Specific commit SHA to use")}),c.object({source:c.literal("git-subdir"),url:c.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:c.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:c.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Op().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),c.object({source:c.literal("unsupported")}).describe('Placeholder for source types this Claude Code version does not recognize. Never authored by hand \u2014 PluginMarketplaceSchema rewrites unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),tZ=J(()=>c.object({name:c.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:NP().describe("Where to fetch the plugin from. Must be a remote source \u2014 relative paths have no marketplace repository to resolve against."),description:c.string().optional(),version:c.string().optional(),strict:c.boolean().optional()}).refine(e=>typeof e.source!="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine(e=>typeof e.source=="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."})),nZ=J(()=>c.object({cli:c.array(c.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) \u2014 exact match against commands run this session.'),hosts:c.array(c.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) \u2014 exact, case-insensitive match against hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path.'),filesRead:c.array(c.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) \u2014 the plugin is relevant when a file Claude has read this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive.'),manifestDeps:c.array(c.object({file:c.string().max(256),pattern:c.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: `file` matches the manifest filename (package.json, go.mod, requirements.txt, \u2026); `pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:c.array(c.string().max(256)).max(10).optional().describe(`Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) \u2014 the plugin is relevant when the session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),rZ=J(()=>c.object({topic:c.string().max(64).optional().describe('What the user is working with when this plugin is relevant \u2014 fills "Working with {topic}?". Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:nZ().optional().describe("Matchers that determine when the plugin is relevant.")})),iZ=J(()=>eZ().partial().extend({name:c.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:NP().describe("Where to fetch the plugin from"),category:c.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:c.array(c.string()).optional().describe("Tags for searchability and discovery"),strict:c.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:c.preprocess(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,rZ().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),oZ=J(()=>c.object({name:c.string().min(1).refine(e=>!e.includes(" "))}));Tde=J(()=>c.object({$schema:c.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:RP(),version:c.string().optional().describe("Marketplace manifest version"),description:c.string().optional().describe("Human-readable description of this marketplace"),owner:ny().describe("Marketplace maintainer or curator information"),plugins:c.array(c.unknown()).transform(aZ).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:c.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:c.object({pluginRoot:c.string().optional().describe("Base path for relative plugin sources"),version:c.string().optional().describe("Marketplace version"),description:c.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:c.array(c.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies \u2014 no transitive trust."),renames:c.record(c.string(),c.string().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name \u2192 current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),qP=J(()=>c.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),sZ=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,dZ=J(()=>c.union([c.string().regex(sZ,"Dependency must be a plugin name, optionally qualified with @marketplace").transform(e=>e.replace(/@\^[^@]*$/,"")),c.object({name:c.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:c.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform(e=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),uZ=J(()=>c.object({version:c.string().describe("Currently installed version"),installedAt:c.string().describe("ISO 8601 timestamp of installation"),lastUpdated:c.string().optional().describe("ISO 8601 timestamp of last update"),installPath:c.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:c.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:c.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:c.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),lZ=J(()=>c.object({version:c.literal(1).describe("Schema version 1"),plugins:c.record(qP(),uZ()).describe("Map of plugin IDs to their installation metadata")})),cZ=J(()=>c.enum(["managed","user","project","local"])),pZ=J(()=>c.object({scope:cZ().describe("Installation scope"),projectPath:c.string().optional().describe("Project path (required for project/local scopes)"),installPath:c.string().describe("Absolute path to the versioned plugin directory"),version:c.string().optional().describe("Currently installed version"),installedAt:c.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:c.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:c.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:c.string().optional().describe("Tag-derived semver this install resolved to"),auto:c.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),fZ=J(()=>c.object({version:c.literal(2).describe("Schema version 2"),plugins:c.record(qP(),c.array(pZ())).describe("Map of plugin IDs to arrays of installation entries")})),Ide=J(()=>c.union([lZ(),fZ()])),mZ=J(()=>c.object({source:Vu().describe("Where to fetch the marketplace from"),installLocation:c.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:c.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:c.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Pde=J(()=>c.record(c.string(),mZ())),hZ=["autoMode","deepLink","voice","briefView","screenReader"],Td={},Wl={autoMode:{buildGate:()=>!1,shape:()=>Td,permissionsShape:()=>Td,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:c.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>Td},briefView:{buildGate:()=>!0,shape:()=>({defaultView:c.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>Td}};cS={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};UP="workspace",Ede=`mcp__${UP}__bash`,Rde=`mcp__${UP}__web_fetch`;Zu={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:e=>e.includes("*")||e.includes("?")?{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]}:{valid:!0},WebFetch:e=>e.includes("://")||e.startsWith("http")?{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]}:e.startsWith("domain:")?{valid:!0}:{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]}}};mS=J(()=>BP()),IZ=J(()=>BP("allow"));PZ=J(()=>c.record(c.string(),c.coerce.string()));Ode=J(()=>KP(DP())),EZ=J(()=>c.object({source:Vu().describe("Where to fetch the marketplace from"),installLocation:c.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:c.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),ry=J(()=>c.object({serverName:c.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:c.array(c.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:c.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(e=>Rx([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),iy=J(()=>c.object({serverName:c.string().min(1,"Server name must be non-empty").refine(e=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine(e=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:c.array(c.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:c.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(e=>Rx([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),RZ=J(()=>c.object({path:c.string().describe("Absolute path to the helper executable"),timeoutMs:c.number().int().min(1e3).optional(),refreshIntervalMs:c.union([c.literal(0),c.number().int().min(6e4)]).optional()})),hS=["skills","agents","hooks","mcp"],gS=Object.freeze({type:"invalid-entry-stripped"}),OZ=J(()=>c.union([c.object({type:c.literal("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:c.string().describe("Regex matched against turn output (tool results and assistant text)"),url:c.string().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:c.string().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),c.object({type:c.string().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()]));Hl=J(()=>AZ(DP())),yS=Object.freeze({serverName:"invalid-entry-stripped"});er="https://code.claude.com/docs/en",$Z=[{matches:e=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${er}/iam#permission-modes`}},{matches:e=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:e=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:e=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${er}/settings#environment-variables`}},{matches:e=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:e=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${er}/hooks`}},{matches:e=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${er}/hooks#exec-form-and-shell-form`}},{matches:e=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:e=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:e=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${er}/settings`}},{matches:e=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:e=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${er}/iam#working-directories`}}],MZ={permissions:`${er}/iam#configuring-permissions`,env:`${er}/settings#environment-variables`,hooks:`${er}/hooks`};Ade=J(()=>Hl().strict());DZ=new Set(ul);UZ=[{key:"allowedMcpServers",schema:ry},{key:"deniedMcpServers",schema:iy}];JZ=2097152;Mp=!1;s8=null;gr=Object.freeze({settings:{},errors:[]}),XP=null,eE=null,tE=!1,el=null;_8={user:"userSettings",project:"projectSettings",local:"localSettings"},IS={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},v8=["user","project","local"],b8=new Set(["bypassPermissions","auto","acceptEdits"]),w8=new Set(["project"]);process.env.NoDefaultCurrentDirectoryInExePath="1";P8=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"])});import{spawn as vy}from"node:child_process";import{randomUUID as x7}from"node:crypto";import{createConnection as C7,createServer as T7}from"node:net";import{appendFileSync as I7,rmSync as ci,writeFileSync as $s,mkdirSync as To,mkdtempSync as by,chmodSync as xo,existsSync as Co,readFileSync as pi,readdirSync as P7,statSync as E7,unlinkSync as R7}from"node:fs";import{dirname as TE,join as Jn}from"node:path";import{spawn as RA}from"node:child_process";import{randomUUID as OA}from"node:crypto";import{createServer as AA}from"node:net";var gO=Oo(b_(),1),yO=Oo(pc(),1),_O=Oo(hc(),1),kc=Oo(Hs(),1),vO=Oo(E_(),1);function Le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R_(e){let t=[["threadId",e.threadId],["turnId",e.turnId],["itemId",e.itemId],["processId",e.processId],["requestId",e.requestId]].filter(n=>n[1]!==void 0);return Object.fromEntries(t)}function pe(e){return e!==void 0&&Le(e)?e:void 0}function _t(e){return Array.isArray(e)?e:void 0}function V(e){return typeof e=="string"&&e.trim()!==""?e.trim():void 0}function Qe(e){return typeof e=="number"&&Number.isInteger(e)?e:void 0}import{appendFileSync as TO,openSync as tY}from"node:fs";import{homedir as j_}from"node:os";import{dirname as IO,join as N_,resolve as PO,sep as EO}from"node:path";import{mkdirSync as RO}from"node:fs";var Nn={_generated:"GENERATED by scripts/naming_dual_emit_codegen.mjs from scripts/naming_canonical_key_map.json (N2.2 dual-emit, D46) - DO NOT EDIT; run: node scripts/naming_dual_emit_codegen.mjs --write",events:[["codex.agent_turn_narration_only_no_reply","harness.agent_turn_narration_only_no_reply"],["codex.cost_cap_402_seen","harness.cost_cap_402_seen"],["codex.edge_blocked_captured","harness.edge_blocked_captured"],["codex.empty_turn_auto_retry_suppressed_cost_cap","harness.empty_turn_auto_retry_suppressed_cost_cap"],["codex.empty_turn_loop_guard_tripped","harness.empty_turn_loop_guard_tripped"],["codex.error_without_http_status_captured","harness.error_without_http_status_captured"],["codex.mid_stream_stall_auto_resume_flagged","harness.mid_stream_stall_auto_resume_flagged"],["codex.mid_stream_stall_fresh_session_resume","harness.mid_stream_stall_fresh_session_resume"],["codex.mid_stream_stall_fresh_session_resume_failed","harness.mid_stream_stall_fresh_session_resume_failed"],["codex.mid_stream_stall_fresh_session_resume_flagged","harness.mid_stream_stall_fresh_session_resume_flagged"],["codex.mid_stream_stall_resume_suppressed_rate_limit","harness.mid_stream_stall_resume_suppressed_rate_limit"],["codex.mid_stream_stall_second_stall_after_resume","harness.mid_stream_stall_second_stall_after_resume"],["codex.pre_first_byte_stall_auto_retry_flagged","harness.pre_first_byte_stall_auto_retry_flagged"],["codex.pre_first_byte_stall_retry_suppressed_cost_cap","harness.pre_first_byte_stall_retry_suppressed_cost_cap"],["codex.provider_outage_flagged_captured","harness.provider_outage_flagged_captured"],["codex.reasoning_loop_breaker_tripped","harness.reasoning_loop_breaker_tripped"],["codex.tool_fatal_captured","harness.tool_fatal_captured"],["codex.turn_completed","job.turn_completed"],["codex.turn_completed_with_protocol_failure","job.turn_completed_with_protocol_failure"],["codex.turn_completed_with_unsupported_tool_call_ignored","job.turn_completed_with_unsupported_tool_call_ignored"],["codex.turn_completed_without_assistant_output","job.turn_completed_without_assistant_output"],["codex.turn_demoted_late_upstream_error","job.turn_demoted_late_upstream_error"],["codex.turn_forward_failed","job.turn_forward_failed"],["codex.upstream_error_captured","harness.upstream_error_captured"],["codex.upstream_rejection_captured","harness.upstream_rejection_captured"],["codex.upstream_turn_error_captured","harness.upstream_turn_error_captured"],["kandan.chat_event","linzumi.chat_event"],["kandan.chat_event_abandoned","linzumi.chat_event_abandoned"],["kandan.chat_event_failed","linzumi.chat_event_failed"],["kandan.chat_event_failure_cleared","linzumi.chat_event_failure_cleared"],["kandan.child_thread_event_failed","linzumi.child_thread_event_failed"],["kandan.child_thread_event_skipped_missing_thread_binding","linzumi.child_thread_event_skipped_missing_thread_binding"],["kandan.child_thread_upsert_failed","linzumi.child_thread_upsert_failed"],["kandan.child_thread_upsert_skipped_missing_thread_binding","linzumi.child_thread_upsert_skipped_missing_thread_binding"],["kandan.claude_code_interrupt_state_push_failed","linzumi.claude_code_interrupt_state_push_failed"],["kandan.claude_code_stop_state_push_failed","linzumi.claude_code_stop_state_push_failed"],["kandan.claude_code_typing_heartbeat_failed","linzumi.claude_code_typing_heartbeat_failed"],["kandan.claude_code_typing_start_wait_timeout","linzumi.claude_code_typing_start_wait_timeout"],["kandan.claude_code_typing_stop_failed","linzumi.claude_code_typing_stop_failed"],["kandan.claude_code_user_input_abort_publish_failed","linzumi.claude_code_user_input_abort_publish_failed"],["kandan.claude_code_user_question_completed_publish_failed","linzumi.claude_code_user_question_completed_publish_failed"],["kandan.codex_command_output_forwarded","linzumi.codex_command_output_forwarded"],["kandan.codex_delta_forwarded","linzumi.codex_delta_forwarded"],["kandan.codex_file_change_forwarded","linzumi.codex_file_change_forwarded"],["kandan.codex_notification_push_failed","linzumi.codex_notification_push_failed"],["kandan.codex_output_forwarded","linzumi.codex_output_forwarded"],["kandan.codex_reasoning_delta_forwarded","linzumi.codex_reasoning_delta_forwarded"],["kandan.codex_web_search_progress_forwarded","linzumi.codex_web_search_progress_forwarded"],["kandan.connection_force_reconnect","linzumi.connection_force_reconnect"],["kandan.connection_force_reconnect_dispatched","linzumi.connection_force_reconnect_dispatched"],["kandan.connection_hard_reset","linzumi.connection_hard_reset"],["kandan.connection_hard_reset_exhausted","linzumi.connection_hard_reset_exhausted"],["kandan.connection_recovered","linzumi.connection_recovered"],["kandan.connection_stale","linzumi.connection_stale"],["kandan.connection_unrecoverable","linzumi.connection_unrecoverable"],["kandan.control","linzumi.control"],["kandan.control_ack_withheld_on_failure","linzumi.control_ack_withheld_on_failure"],["kandan.control_epoch_changed","linzumi.control_epoch_changed"],["kandan.control_handler_threw","linzumi.control_handler_threw"],["kandan.control_ignored","linzumi.control_ignored"],["kandan.control_response_push_failed","linzumi.control_response_push_failed"],["kandan.failed_seq_overflow","linzumi.failed_seq_overflow"],["kandan.forward_port_revoked_push_failed","linzumi.forward_port_revoked_push_failed"],["kandan.forward_response","linzumi.forward_response"],["kandan.forward_response_push_failed","linzumi.forward_response_push_failed"],["kandan.forward_tunnel_error","linzumi.forward_tunnel_error"],["kandan.forward_tunnel_open_failed","linzumi.forward_tunnel_open_failed"],["kandan.heartbeat_push_failed","linzumi.heartbeat_push_failed"],["kandan.local_editor_initial_status_failed","linzumi.local_editor_initial_status_failed"],["kandan.local_editor_status_push_failed","linzumi.local_editor_status_push_failed"],["kandan.message_duplicate_ignored","linzumi.message_duplicate_ignored"],["kandan.message_ignored","linzumi.message_ignored"],["kandan.message_queued","linzumi.message_queued"],["kandan.message_spawn_on_miss","linzumi.message_spawn_on_miss"],["kandan.message_spawn_on_miss_failed","linzumi.message_spawn_on_miss_failed"],["kandan.message_state_refresh_failed","linzumi.message_state_refresh_failed"],["kandan.optional_push_failed","linzumi.optional_push_failed"],["kandan.post_stop_queue_drain_failed","linzumi.post_stop_queue_drain_failed"],["kandan.queue_drain_blocked","linzumi.queue_drain_blocked"],["kandan.queue_drain_dead_worker_fail_publish_failed","linzumi.queue_drain_dead_worker_fail_publish_failed"],["kandan.queue_drain_dead_worker_rebuild","linzumi.queue_drain_dead_worker_rebuild"],["kandan.queue_drain_dead_worker_rebuild_exhausted","linzumi.queue_drain_dead_worker_rebuild_exhausted"],["kandan.queue_drain_dead_worker_rebuild_failed","linzumi.queue_drain_dead_worker_rebuild_failed"],["kandan.reconnect_handling_failed","linzumi.reconnect_handling_failed"],["kandan.reconnect_thread_context_fetch_failed","linzumi.reconnect_thread_context_fetch_failed"],["kandan.reconnect_thread_cwd_failed_state_push_failed","linzumi.reconnect_thread_cwd_failed_state_push_failed"],["kandan.reconnect_thread_failed","linzumi.reconnect_thread_failed"],["kandan.reconnect_thread_processing_state_push_failed","linzumi.reconnect_thread_processing_state_push_failed"],["kandan.reconnect_thread_queue_closed_state_push_failed","linzumi.reconnect_thread_queue_closed_state_push_failed"],["kandan.reconnect_thread_queue_failed_state_push_failed","linzumi.reconnect_thread_queue_failed_state_push_failed"],["kandan.reconnect_thread_queue_state_push_failed","linzumi.reconnect_thread_queue_state_push_failed"],["kandan.reconnect_thread_rehydrate_forced","linzumi.reconnect_thread_rehydrate_forced"],["kandan.reconnect_thread_rehydrated","linzumi.reconnect_thread_rehydrated"],["kandan.reconnect_thread_rehydrated_state_push_failed","linzumi.reconnect_thread_rehydrated_state_push_failed"],["kandan.reconnect_thread_rehydration_failed","linzumi.reconnect_thread_rehydration_failed"],["kandan.reconnect_thread_rehydration_ir_emitted","linzumi.reconnect_thread_rehydration_ir_emitted"],["kandan.reconnect_thread_rehydration_items_failed","linzumi.reconnect_thread_rehydration_items_failed"],["kandan.reconnect_thread_resume_failed","linzumi.reconnect_thread_resume_failed"],["kandan.reconnect_thread_seq_already_applied","linzumi.reconnect_thread_seq_already_applied"],["kandan.reconnect_thread_transcript_fetch_failed","linzumi.reconnect_thread_transcript_fetch_failed"],["kandan.reconnect_thread_unarchive_failed","linzumi.reconnect_thread_unarchive_failed"],["kandan.reconnect_thread_unarchive_resumed","linzumi.reconnect_thread_unarchive_resumed"],["kandan.reconnect_thread_unarchive_started","linzumi.reconnect_thread_unarchive_started"],["kandan.reconnect_thread_unavailable_state_push_failed","linzumi.reconnect_thread_unavailable_state_push_failed"],["kandan.reconnected","linzumi.reconnected"],["kandan.roster_seeded","linzumi.roster_seeded"],["kandan.session_app_server_lost_push_failed","linzumi.session_app_server_lost_push_failed"],["kandan.session_settings_publish_failed","linzumi.session_settings_publish_failed"],["kandan.start_instance_claude_code_attachment_failed_state_push_failed","linzumi.start_instance_claude_code_attachment_failed_state_push_failed"],["kandan.start_instance_codex_app_server_unavailable","linzumi.start_instance_codex_app_server_unavailable"],["kandan.start_instance_cwd_failed_state_push_failed","linzumi.start_instance_cwd_failed_state_push_failed"],["kandan.start_instance_cwd_rejected","linzumi.start_instance_cwd_rejected"],["kandan.start_instance_failed","linzumi.start_instance_failed"],["kandan.start_instance_processing_state_push_failed","linzumi.start_instance_processing_state_push_failed"],["kandan.start_instance_skipped_known_session","linzumi.start_instance_skipped_known_session"],["kandan.start_instance_stale_skipped","linzumi.start_instance_stale_skipped"],["kandan.start_instance_unavailable_state_push_failed","linzumi.start_instance_unavailable_state_push_failed"],["kandan.start_instance_wafer_state_push_failed","linzumi.start_instance_wafer_state_push_failed"],["kandan.start_turn_replay_skipped","linzumi.start_turn_replay_skipped"],["kandan.steer_duplicate_ignored","linzumi.steer_duplicate_ignored"],["kandan.steer_parked_as_own_turn","linzumi.steer_parked_as_own_turn"],["kandan.thread_bind_from_historical_reply_failed","linzumi.thread_bind_from_historical_reply_failed"],["kandan.thread_bound_from_historical_reply","linzumi.thread_bound_from_historical_reply"],["kandan.thread_sessions_reannounce_failed","linzumi.thread_sessions_reannounce_failed"],["kandan.thread_sessions_reannounced","linzumi.thread_sessions_reannounced"],["kandan.tui_input_mirrored","linzumi.tui_input_mirrored"],["kandan.typing_heartbeat_failed","linzumi.typing_heartbeat_failed"],["kandan.typing_stop_after_completion_failed","linzumi.typing_stop_after_completion_failed"]],keys:[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],keyPrimaryLegacy:[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],values:[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]],topic:{legacyPrefix:"local_codex_runner:",canonicalPrefix:"commander:"},originator:{legacy:"kandan-local-codex-runner",canonical:"linzumi-commander"}};var wO=new Map(Nn.events),SO=new Map(Nn.events.map(([e,t])=>[t,e])),A_=new Map(Nn.keys),$_=new Map(Nn.keyPrimaryLegacy),kO=new Map(Nn.values),xO=new Map(Nn.values.map(([e,t])=>[t,e])),QQ={eventCanonicalByLegacy:wO,eventLegacyByCanonical:SO,keyCanonicalByLegacy:A_,keyPrimaryLegacyByCanonical:$_,valueCanonicalByLegacy:kO,valueLegacyByCanonical:xO,originator:Nn.originator,topic:Nn.topic};function M_(e){let t=new Set(e);for(let n of e){let i=A_.get(n);i!==void 0&&t.add(i);let r=$_.get(n);r!==void 0&&t.add(r)}return t}var O_=new Map;for(let[e,t]of Nn.keys){let n=O_.get(t)??[];n.push(e),O_.set(t,n)}var Nr="<SENSITIVE_DATA>",q_=M_(new Set(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"])),OO=new Set(["--access-token","--api-key","--authorization","--cookie","--oauth-code","--password","--refresh-token","--secret","--token"]);function AO(e){if(process.env.VITEST===void 0)return;let t=N_(j_(),".linzumi"),n=PO(e);if(n===t||n.startsWith(`${t}${EO}`))throw new Error(`test-mode log isolation violated: refusing to open ${e} inside the real ~/.linzumi (point the logger at a temp path; the harness defaults LINZUMI_RUNNER_LOG_FILE / LINZUMI_CLI_AUDIT_LOG for exactly this - see plans/2026-07-10-cli-test-hygiene-spec.md item 2)`)}function Ye(e,t,n={}){let i=n.logFile??$O();AO(i);try{RO(IO(i),{recursive:!0}),TO(i,`${JSON.stringify({ts:new Date().toISOString(),event:e,...n.sessionId===void 0?{}:{sessionId:n.sessionId},...D_(t)})}
|
|
123
123
|
`,"utf8")}catch{return}}function $O(){let e=process.env.LINZUMI_CLI_AUDIT_LOG?.trim();return e===void 0||e===""?N_(j_(),".linzumi","logs","command-events.jsonl"):e}function D_(e){return L_(e)}function xc(e,t){return NO(t)?Nr:typeof e=="string"?U_(e):Array.isArray(e)?t==="args"?MO(e):e.map(n=>xc(n,void 0)):e!==null&&typeof e=="object"?L_(e):e}function L_(e){let t=typeof e.name=="string"?e.name.toLowerCase():void 0,n=t==="authorization"||t==="cookie"||t==="set-cookie";return Object.fromEntries(Object.entries(e).filter(([i])=>i!=="runner_console").map(([i,r])=>[i,n&&i==="value"?Nr:xc(r,i)]))}function MO(e){let t=!1;return e.map(n=>{if(typeof n!="string")return t=!1,xc(n,void 0);if(t)return t=!1,Nr;let[i,r]=jO(n);return OO.has(i)?r===void 0?(t=!0,n):`${i}=${Nr}`:U_(n)})}function jO(e){let t=e.indexOf("=");return t===-1?[e,void 0]:[e.slice(0,t),e.slice(t+1)]}function NO(e){return e===void 0?!1:/^(authorization|cookie|set-cookie|password)$/i.test(e)||/(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$/i.test(e)}function U_(e){return qO(e).replace(/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,Nr)}function qO(e){let t;try{t=new URL(e)}catch{return DO(e)}for(let n of[...t.searchParams.keys()])q_.has(n.toLowerCase())&&t.searchParams.set(n,Nr);return t.toString()}function DO(e){let t=e.indexOf("?"),n=e.indexOf("#");if(t===-1||n!==-1&&n<t)return e;let i=e.slice(0,t),r=n===-1?e.slice(t+1):e.slice(t+1,n),o=n===-1?"":e.slice(n),a=new URLSearchParams(r),s=!1;for(let d of[...a.keys()])q_.has(d.toLowerCase())&&(a.set(d,Nr),s=!0);switch(s){case!0:return`${i}?${a.toString()}${o}`;case!1:return e}}import{stripVTControlCharacters as WO}from"node:util";function Vs(e){let t=e.channelSession,n=t.linzumiAgentSession===!0,i=n?"read-only":t.sandbox,r=LO(t);return{cwd:e.cwd,...t.model===void 0?{}:{model:t.model},...r===void 0?{}:{config:r},...e.fast===!0?{serviceTier:"fast"}:{},...t.codexEnvironmentId===void 0?{}:{environmentId:t.codexEnvironmentId},approvalPolicy:n?"never":F_(t.approvalPolicy,i,{sandboxedNeverDefault:t.sandboxedApprovalNeverDefault}),...i===void 0?{}:{sandbox:i}}}function Cc(e){let t=e.channelSession,n=t.linzumiAgentSession===!0,i=n?"read-only":t.sandbox;return{cwd:e.cwd,...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{effort:t.reasoningEffort},...e.fast===!0?{serviceTier:"fast"}:{},...t.codexEnvironmentId===void 0?{}:{environmentId:t.codexEnvironmentId},approvalPolicy:n?"never":F_(t.approvalPolicy,i,{sandboxedNeverDefault:t.sandboxedApprovalNeverDefault}),...i===void 0?{}:{sandboxPolicy:zO(i,e.cwd)}}}function LO(e){let t=e.reasoningEffort===void 0?{}:{model_reasoning_effort:e.reasoningEffort};return e.linzumiAgentSession!==!0?e.reasoningEffort===void 0?void 0:t:{...t,web_search:"disabled",tools:{view_image:!1},features:{apps:!1,shell_tool:!1,unified_exec:!1,multi_agent:!1,code_mode:!1,image_generation:!1,browser_use:!1,browser_use_external:!1,computer_use:!1,remote_plugin:!1,tool_suggest:!1,workspace_dependencies:!1}}}function UO(e,t,n){let i=n?.sandboxedNeverDefault===!0&&t==="workspace-write";switch(e){case void 0:case"default":return i?"never":"on-request";case"never":return t==="danger-full-access"||i?"never":"on-request";case"on-request":case"on-failure":return e;default:return console.warn(`linzumi approval-policy clamp: unknown Codex approval policy ${e}; clamping to most-restrictive approval (on-request)`),"on-request"}}var FO={granular:{sandbox_approval:!1,rules:!1,skill_approval:!1,request_permissions:!1,mcp_elicitations:!0}};function F_(e,t,n){let i=UO(e,t,n);return i==="never"&&t==="danger-full-access"?FO:i==="on-failure"?"on-request":i}function zO(e,t){switch(e){case"danger-full-access":return{type:"dangerFullAccess"};case"read-only":return{type:"readOnly",networkAccess:!1};case"workspace-write":return{type:"workspaceWrite",writableRoots:[t],networkAccess:!1,excludeTmpdirEnvVar:!1,excludeSlashTmp:!1};default:throw new Error(`unsupported Codex sandbox mode: ${e}`)}}function z_(e){let t=WO(e),n=t.match(/https:\/\/[^\s\u0000-\u001f\u007f]+/u)?.[0],i=t.match(/\b[A-Z0-9]{4,}(?:-[A-Z0-9]{4,})+\b/u)?.[0];return n===void 0||i===void 0?void 0:{verificationUrl:n,userCode:i}}function Tc(e){return e==="final_answer"?"final_answer":"commentary"}function Ic(e){let t=HO(e),n=pe(e.item);if(!(t===void 0||t===""))return{itemKey:V(e.itemId)??V(e.item_id)??V(pe(e.item)?.id)??"assistant-message",turnId:V(e.turnId)??V(e.turn_id)??V(pe(e.turn)?.id),delta:t,phase:Tc(e.phase??n?.phase)}}function Pc(e){let t=B_(e);if(!(t===void 0||t===""))return{itemKey:V(e.itemId)??V(e.item_id)??V(pe(e.item)?.id)??"reasoning",turnId:V(e.turnId)??V(e.turn_id)??V(pe(e.turn)?.id),delta:t}}function HO(e){return B_(e)}function GO(e){return e>=55296&&e<=56319}function VO(e){return e>=56320&&e<=57343}function Ec(e,t){let n=Math.min(Math.max(0,t),e.length),i=n>0&&n<e.length&&GO(e.charCodeAt(n-1))&&VO(e.charCodeAt(n))?n-1:n;return e.slice(0,i)}function B_(e){let t=e.delta;return typeof t=="string"?t:Le(t)?V(t.text)??V(t.content)??V(t.delta)??V(t.message):V(e.text)??V(e.content)??V(e.message)}import{mkdirSync as ZO,appendFileSync as QO}from"node:fs";import{dirname as YO}from"node:path";function K_(e){return JSON.stringify(e)}var Uo,XO=/(^|[_-])(token|secret|api[_-]?key|authorization|cookie|private[_-]?key|login[_-]?url)([_-]|$)/iu;function Rc(){return J_()!==void 0}function zo(e){let t=J_();if(t===void 0)return;let n=eA(t),i=tA(e),r={schemaVersion:1,provider:e.provider,captureKind:e.captureKind,ordinal:n.nextOrdinal,offsetMs:Math.max(0,Date.now()-n.startedAtMs),...i.rawText===void 0?{}:{rawText:i.rawText},...i.rawValue===void 0?{}:{rawValue:i.rawValue},...e.captureMetadata===void 0?{}:{captureMetadata:Fo(e.captureMetadata)},...i.transforms.length===0?e.transforms===void 0?{}:{transforms:e.transforms}:{transforms:[...e.transforms??[],...i.transforms]}};n.nextOrdinal+=1,QO(t,`${K_(r)}
|
|
124
124
|
`,"utf8")}function J_(){let e=process.env.LINZUMI_AGENT_REPLAY_RECORD_FILE?.trim();return e===void 0||e===""?void 0:e}function eA(e){return Uo!==void 0&&Uo.path===e||(ZO(YO(e),{recursive:!0}),Uo={path:e,startedAtMs:Date.now(),nextOrdinal:0}),Uo}function tA(e){if(process.env.LINZUMI_AGENT_REPLAY_EXACT_RAW==="1")return{rawText:e.rawText,rawValue:e.rawValue,transforms:[]};let t=[],n=e.rawValue===void 0?void 0:Fo(e.rawValue,"$.rawValue",t);return{rawText:nA(e.rawText,t),rawValue:n,transforms:t}}function nA(e,t){if(e!==void 0)try{let n=JSON.parse(e);return JSON.stringify(Fo(n,"$.rawText",t))}catch{return e}}function Fo(e,t="$",n=[]){if(Array.isArray(e))return e.map((r,o)=>Fo(r,`${t}[${o}]`,n));if(!Le(e))return e;let i=Object.entries(e).map(([r,o])=>{let a=`${t}.${r}`;return XO.test(r)?(n.push({type:"credential_redaction",path:a}),[r,"[REDACTED]"]):[r,o===void 0?void 0:Fo(o,a,n)]});return Object.fromEntries(i)}import{spawnSync as G_}from"node:child_process";import{existsSync as V_}from"node:fs";import{homedir as rA}from"node:os";import{basename as iA,posix as Z_,win32 as oA}from"node:path";function Bo(e){return e==="win32"?oA:Z_}var Zs="__LINZUMI_LOGIN_PATH_BEGIN__",Ac="__LINZUMI_LOGIN_PATH_END__";function aA(e,t){let n=iA(e).includes("fish")?`printf '%s%s%s' '${Zs}' (string join ':' $PATH) '${Ac}'`:`printf '%s%s%s' '${Zs}' "$PATH" '${Ac}'`;switch(t){case"interactive_login":return["-l","-i","-c",n];case"interactive":return["-i","-c",n];case"login":return["-l","-c",n]}}function sA(e,t){let n=G_(e,[...t],{encoding:"utf8",timeout:5e3,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"]});return{stdout:typeof n.stdout=="string"?n.stdout:void 0,error:n.error}}function Si(e){return{env:e?.env??process.env,platform:e?.platform??process.platform,homeDir:e?.homeDir??rA(),fileExists:e?.fileExists??V_,runLoginShell:e?.runLoginShell}}var W_,H_=!1;function dA(e){if(e===void 0)return;let t=e.lastIndexOf(Zs),n=e.lastIndexOf(Ac);if(t===-1||n===-1||n<=t)return;let i=e.slice(t+Zs.length,n).trim();return i===""?void 0:i}function $c(e){let t=Si(e);if(t.platform==="win32")return;let n=e===void 0;if(e!==void 0&&e.runLoginShell===void 0||n&&process.env.VITEST!==void 0)return;if(n&&H_)return W_;let i=t.env.SHELL?.trim(),r=t.runLoginShell??sA,o=[];if(i!==void 0&&i!=="")for(let s of["interactive_login","interactive","login"]){let d=r(i,aA(i,s)),u=dA(d.stdout);if(u!==void 0)for(let l of u.split(":"))l!==""&&o.push(l)}let a=o.length===0?void 0:Ys(o).join(":");return n&&(W_=a,H_=!0),a}function Q_(e){let t=Si(e);if(t.platform==="win32")return[];let n=t.homeDir,i=Z_.join,r=t.env.VOLTA_HOME?.trim(),o=t.env.BUN_INSTALL?.trim(),a=t.env.npm_config_prefix?.trim(),s=t.env.N_PREFIX?.trim();return Ys([i(n,".local","bin"),i(n,".volta","bin"),r===void 0||r===""?void 0:i(r,"bin"),i(n,".bun","bin"),o===void 0||o===""?void 0:i(o,"bin"),i(n,".npm-global","bin"),a===void 0||a===""?void 0:i(a,"bin"),s===void 0||s===""?void 0:i(s,"bin"),i(n,".claude","local"),"/opt/homebrew/bin","/usr/local/bin"].filter(d=>d!==void 0))}function Qs(e,t){return e===void 0?[]:e.split(Bo(t).delimiter).filter(n=>n!=="")}function Ys(e){return Array.from(new Set(e))}function Y_(e){let t=Si(e);return Ys([...Qs(t.env.PATH,t.platform),...Qs($c(e),t.platform),...Q_(e)])}var Oc;function X_(e){let t=e===void 0;if(t&&process.env.VITEST!==void 0)return process.env.PATH??"";if(t&&Oc!==void 0)return Oc;let n=Si(e),i=Y_(e).join(Bo(n.platform).delimiter);i!==""&&(n.env.PATH=i);let r=$c(e);return r!==void 0&&r!==""&&(n.env[ev]=r),t&&(Oc=i),i}function Mc(e,t){let n=Si(t);if(e.includes("/")||e.includes("\\"))return n.fileExists(e)?e:void 0;let i=n.platform==="win32"?[`${e}.exe`,`${e}.cmd`,e]:[e],r=Bo(n.platform).join;for(let o of Y_(t))for(let a of i){let s=r(o,a);if(n.fileExists(s))return s}}var uA="LINZUMI_DISABLE_JOB_PATH_PARITY",lA="LINZUMI_DIRENV",ev="LINZUMI_LOGIN_SHELL_PATH";function cA(e){return Ys([...Qs(e.jobPath,e.platform),...Qs(e.loginShellPath,e.platform),...e.installDirs]).join(Bo(e.platform).delimiter)}function jc(e,t){if(e[uA]==="1"||t===void 0&&process.env.VITEST!==void 0)return e;let i=Si(t);if(i.platform==="win32")return e;let r=e[ev]?.trim(),o=r!==void 0&&r!==""?r:$c(t),a=cA({jobPath:e.PATH,loginShellPath:o,installDirs:Q_(t),platform:i.platform});return a===""||a===e.PATH?e:{...e,PATH:a}}var pA=3e3;function fA(e,t,n){let i=G_(e,["export","json"],{cwd:t,env:n,encoding:"utf8",timeout:pA,killSignal:"SIGKILL",stdio:["ignore","pipe","pipe"]});return{stdout:typeof i.stdout=="string"?i.stdout:void 0,stderr:typeof i.stderr=="string"?i.stderr:void 0,status:i.status,error:i.error}}function mA(e,t,n){let i=Bo(n),r=e;for(let o=0;o<64;o+=1){if(t(i.join(r,".envrc")))return r;let a=i.dirname(r);if(a===r)return;r=a}}function Nc(e,t,n){try{if(t[lA]!=="1")return t;let i=n?.platform??process.platform;if(i==="win32")return t;let r=n?.fileExists??V_,o=n?.log??(()=>{}),a=mA(e,r,i);if(a===void 0)return t;let s=Mc("direnv",{env:t,platform:i,fileExists:r});if(s===void 0)return o("direnv.unavailable",{cwd:e,envrc_dir:a}),t;let u=(n?.runDirenvExport??fA)(s,e,t);if(u.error!==void 0||u.status!==0)return o("direnv.export_failed",{cwd:e,envrc_dir:a,status:u.status??null,error:u.error?.message??null,stderr_head:u.stderr?.slice(0,300)??null}),t;let l=u.stdout?.trim()??"";if(l==="")return t;let p=JSON.parse(l);if(p===null||typeof p!="object"||Array.isArray(p))return o("direnv.export_failed",{cwd:e,envrc_dir:a,status:0,error:"direnv export json did not produce an object",stderr_head:null}),t;let m={...t},f=0;for(let[h,y]of Object.entries(p))y===null?(delete m[h],f+=1):typeof y=="string"&&(m[h]=y,f+=1);return f===0?t:(o("direnv.export_applied",{cwd:e,envrc_dir:a,vars:f}),m)}catch(i){return n?.log?.("direnv.export_failed",{cwd:e,envrc_dir:null,status:null,error:i instanceof Error?i.message:String(i),stderr_head:null}),t}}function tv(e){return{name:"linzumi",command:e.command??"linzumi",args:[...e.argsPrefix??[],"mcp","server","--api-url",e.kandanUrl,...e.authFilePath===void 0?[]:["--auth-file",e.authFilePath],...e.delegationAuthFilePath===void 0?[]:["--delegation-auth-file",e.delegationAuthFilePath],...e.ownerUsername===void 0?[]:["--owner-username",e.ownerUsername],...e.cwd===void 0?[]:["--cwd",e.cwd],...e.threadId===void 0?[]:["--thread-id",e.threadId],"--mode",e.operatingMode??"text",...e.toolScope===void 0||e.toolScope==="all"?[]:["--tool-scope",e.toolScope],...e.agentSession===!0?["--agent-session"]:[],...e.askUserQuestionTool===!0?["--ask-user-question-tool"]:[],...e.multiAgentJobs===!0?["--multi-agent-jobs"]:[]],env:{...e.accessToken===void 0?{}:{LINZUMI_MCP_ACCESS_TOKEN:e.accessToken},...e.devServices===void 0?{}:{LINZUMI_DEV_SERVICES_SCOPE:e.devServices.scope,LINZUMI_DEV_SERVICES_OWNER_PID:String(e.devServices.ownerPid)},ELECTRON_RUN_AS_NODE:"1"}}}function qc(e,t){return["-c",`mcp_servers.${e.name}.command=${JSON.stringify(e.command)}`,"-c",`mcp_servers.${e.name}.args=${hA(e.args)}`,...Object.entries(e.env).flatMap(([n,i])=>["-c",`mcp_servers.${e.name}.env.${n}=${JSON.stringify(i)}`]),...t.neverEquivalentGranularApprovalPolicy?["-c",`mcp_servers.${e.name}.default_tools_approval_mode="approve"`]:[],...e.args.includes("--ask-user-question-tool")?["-c",`mcp_servers.${e.name}.tool_timeout_sec=${nv}`]:[]]}function hA(e){return`[${e.map(t=>JSON.stringify(t)).join(", ")}]`}var nv=2147483,gA=nv*1e3-5*6e4;var EY=["# Managed by Linzumi - do not edit by hand.","# This isolated CODEX_HOME keeps Linzumi-spawned codex processes off the","# user's ~/.codex config and the macOS Keychain. See codexHome.ts.",'mcp_oauth_credentials_store = "file"','cli_auth_credentials_store = "file"',""].join(`
|
|
125
125
|
`);function rv(){return["-c",'mcp_oauth_credentials_store="file"',"-c",'cli_auth_credentials_store="file"']}import{spawnSync as yA}from"node:child_process";import{homedir as _A}from"node:os";import{dirname as MY,join as vA}from"node:path";var Dc=5*6e4;var bA={listenersBySource:new Map,lastMirrorPayloadJson:void 0,lastMirrorWriteMs:0,mirrorPathOverride:void 0};function iv(){return vA(_A(),".linzumi","protected-dev-listeners")}function Lc(e=Date.now()){let t=new Set;for(let n of bA.listenersBySource.values())if(!(e-n.updatedAtMs>Dc))for(let i of n.listeners)t.add(i.pid);return t}function wA(e){return e.split(`
|
|
@@ -251,7 +251,7 @@ const watchdog = setInterval(() => {
|
|
|
251
251
|
|
|
252
252
|
<linzumi_pr_footer_instruction>
|
|
253
253
|
For any GitHub pull request you open from this session, include this Markdown footer link in the PR description: [Continue this on Linzumi](${e.conversationUrl})
|
|
254
|
-
</linzumi_pr_footer_instruction>`}function td(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}var T$=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],JX=new Set(T$);var I$={runner_updating:"transient_local",stillborn_worker:"transient_local",infra_turn_kill:"transient_local",resume_transient:"transient_local",start_stage_transient:"transient_local",resume_torn_tail:"transient_local",resurrection_interrupted:"transient_local",dead_letter_exhausted:"transient_local",dead_letter_withheld:"needs_decision",dead_letter_permanent:"deterministic",resume_cwd_not_allowed:"deterministic",cwd_stillbirth_circuit_open:"deterministic",engine_unavailable:"deterministic",provider_binding_rejected:"deterministic",project_untrusted:"deterministic",attachment_download_failed:"transient_local",claude_input_queue_closed:"transient_local",claude_dispatch_wedged:"transient_local"};var WX=Object.keys(I$);var P$=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,YX=new RegExp(P$.source,"g");var dee=1440*60*1e3;var lee=10*6e4;var cte=10*6e4;var Sv=new Map([["function_call","function_call_output"],["custom_tool_call","custom_tool_call_output"]]),
|
|
254
|
+
</linzumi_pr_footer_instruction>`}function td(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}var T$=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],JX=new Set(T$);var I$={runner_updating:"transient_local",stillborn_worker:"transient_local",infra_turn_kill:"transient_local",resume_transient:"transient_local",start_stage_transient:"transient_local",resume_torn_tail:"transient_local",resurrection_interrupted:"transient_local",dead_letter_exhausted:"transient_local",dead_letter_withheld:"needs_decision",dead_letter_permanent:"deterministic",resume_cwd_not_allowed:"deterministic",cwd_stillbirth_circuit_open:"deterministic",engine_unavailable:"deterministic",provider_binding_rejected:"deterministic",project_untrusted:"deterministic",attachment_download_failed:"transient_local",claude_input_queue_closed:"transient_local",claude_dispatch_wedged:"transient_local"};var WX=Object.keys(I$);var P$=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,YX=new RegExp(P$.source,"g");var dee=1440*60*1e3;var lee=10*6e4;var cte=10*6e4;var Sv=new Map([["function_call","function_call_output"],["custom_tool_call","custom_tool_call_output"]]),Ute=new Set([...Sv.keys(),...Sv.values()]);import{execFile as L$}from"node:child_process";import{promisify as U$}from"node:util";var Kte=U$(L$);var Jte=200*1024*1024,Wte=4320*60*1e3;var Go=String.raw`\bgit\s+(?:-[Cc]\s+\S+\s+|-\S+\s+)*`,Hte=[new RegExp(`${Go}restore\\b`),new RegExp(`${Go}checkout\\b[^\\n;|&]*(\\s--(\\s|$)|\\s-f\\b|\\s\\.(\\s|$))`),new RegExp(`${Go}reset\\b[^\\n;|&]*--(hard|merge|keep)\\b`),new RegExp(`${Go}clean\\b`),new RegExp(`${Go}stash\\s+(drop|clear|pop)\\b`),/\brm\s+(-[A-Za-z]*f[A-Za-z]*)\b/];var kv=76800;function xv(e){return Math.ceil(e.length/4)}function Zc(e){if(!Le(e))return;let t=Qe(e.ir_version),n=_t(e.nodes);if(!(t===void 0||n===void 0))return{irVersion:t,threadTitle:V(e.thread_title),nodes:n.flatMap(F$),hasMore:e.has_more===!0,cursor:Qe(e.cursor),budget:z$(e.budget)}}function F$(e){if(!Le(e))return[];let t=V(e.kind),n=Qe(e.seq),i=V(e.body)??"";return t===void 0||n===void 0?[]:[{kind:t,seq:n,at:V(e.at),engine:V(e.engine)??"none",body:i,structured:pe(e.structured),actor:pe(e.actor),attachments:_t(e.attachments)??[],sourceSeq:Qe(e.source_seq),streamKey:V(e.stream_key)}]}function z$(e){if(!Le(e))return;let t=Qe(e.context_window),n=Qe(e.max_emission_tokens);if(!(t===void 0||n===void 0||n<=0))return{model:V(e.model),contextWindow:t,maxEmissionTokens:n}}function B$(e,t){let n=t>0?t:kv,i=e.filter(s=>s.kind!=="reasoning"),r=e.length-i.length,o=[],a=0;for(let s=i.length-1;s>=0;s-=1){let d=i[s];if(d===void 0)continue;let u=xv(Cv(d,n));if(o.length>0&&a+u>n)break;a+=u,o.unshift(d)}return{tail:o,omittedNodeCount:i.length-o.length,redactedReasoningCount:r,artifacts:K$(e)}}function K$(e){let t=new Set,n=new Set,i=0;for(let r of e){if(r.kind==="error"&&(i+=1),r.kind==="file_change")for(let o of J$(r.structured))t.add(o);if(r.kind==="command_execution"){let o=V(r.structured?.command)?.trim();o!==void 0&&o!==""&&n.add(o.split(`
|
|
255
255
|
`,1)[0]??o)}}return{filesTouched:[...t].slice(0,100),commandsRun:[...n].slice(0,100),errorCount:i}}function J$(e){if(e===void 0)return[];let t=V(e.path),i=(_t(e.paths)??_t(e.files)??[]).flatMap(r=>{let o=V(r);if(o!==void 0)return[o];let a=Le(r)?V(r.path):void 0;return a===void 0?[]:[a]});return t===void 0?i:[t,...i]}function Qc(e){let t=e.budget?.maxEmissionTokens??kv,n=B$(e.nodes,t),i=Q$({resumeFailure:e.resumeFailure,threadTitle:e.threadTitle,linzumiContext:e.linzumiContext,budgeted:n,transcriptEmpty:n.tail.length===0}),r=[qn(i,"commentary")],o=0;for(let s of n.tail)o+=1,r.push(...W$(s,t,o));let a=r.reduce((s,d)=>s+xv(JSON.stringify(d)),0);return{items:r,emittedNodeCount:n.tail.length,omittedNodeCount:n.omittedNodeCount,redactedReasoningCount:n.redactedReasoningCount,emittedTokenEstimate:a,maxEmissionTokens:t}}function W$(e,t,n){let i=Cv(e,t);switch(e.kind){case"user_message":return[{type:"message",role:"user",content:[{type:"input_text",text:Z$(e,i)}]}];case"assistant_message":return[qn(i,V$(e))];case"command_execution":return H$(e,i,n);case"tool_call":return G$(e,i,n);case"reasoning":return[];case"file_change":return[qn(`[file change]
|
|
256
256
|
${i}`,"commentary")];case"terminal_input":return[qn(`[terminal input]
|
|
257
257
|
${i}`,"commentary")];case"tool_result":return[qn(`[tool result]
|
|
@@ -260,8 +260,8 @@ ${s}`}]}function G$(e,t,n){let i=Tv(e,n);return[{type:"function_call",name:Y$(V(
|
|
|
260
260
|
[${e.attachments.length} attachment(s) in the original message]`}function Cv(e,t){let n=Math.max(1e3,t*4),i=e.body;return i.length<=n?i:`[...truncated...]
|
|
261
261
|
${i.slice(i.length-n)}`}function Q$(e){let t=e.resumeFailure.trim(),{artifacts:n}=e.budgeted,i=["Rebuilt Linzumi coding session","","This session was rebuilt after an interrupted durable engine session: the previous engine session for this Linzumi thread could not be resumed"+(t===""?".":` (${eM(t,400)}).`),e.transcriptEmpty?"The durable server-side transcript could not be fetched or is empty - ask the user for any missing context instead of guessing.":"You are continuing the SAME task in the SAME Linzumi thread. The transcript below is replayed from the durable server-side record. Re-derive any local state (files, branches, running processes) from the workspace itself; do not assume in-memory state survived.",...e.threadTitle===void 0||e.threadTitle.trim()===""?[]:["",`Thread: ${e.threadTitle.trim()}`],...e.linzumiContext===void 0?[]:["",nd(e.linzumiContext)]],r=[...e.budgeted.omittedNodeCount>0?[`${e.budgeted.omittedNodeCount} older transcript entries were omitted to fit the emission budget.`]:[],...e.budgeted.redactedReasoningCount>0?[`${e.budgeted.redactedReasoningCount} reasoning entries were redacted (provider-private; never replayed).`]:[],...n.filesTouched.length>0?[`Files touched: ${n.filesTouched.join(", ")}`]:[],...n.commandsRun.length>0?[`Commands run: ${n.commandsRun.join("; ")}`]:[],...n.errorCount>0?[`${n.errorCount} error entries in the full history.`]:[]];return[...i,...r.length===0?[]:["",...r]].join(`
|
|
262
262
|
`)}function Tv(e,t){return`linzumi_replay_${e.seq}_${t}`}function Y$(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64);return t===""?"linzumi_replayed_tool":t}function X$(e){return e.split(`
|
|
263
|
-
`,1)[0]??e}function eM(e,t){return e.length<=t?e:`[...truncated...]${e.slice(e.length-t)}`}var rd={default:{maxLadderMs:9e5},wafer:{maxLadderMs:36e5}};var mne={maxRecoveryRungs:4,maxLadderMs:rd.default.maxLadderMs,maxRateLimitHoldMs:30*6e4},hne={default:rd.default,wafer:rd.wafer};var vne=10*6e4;var iM=[{appName:"Bun",iconKey:"bun",names:["bun","bunx"]},{appName:"Node.js",iconKey:"nodejs",names:["node","nodejs","node.exe"]},{appName:"npm",iconKey:"npm",names:["npm","npm-cli.js","npx"]},{appName:"pnpm",iconKey:"pnpm",names:["pnpm","pnpx"]},{appName:"Yarn",iconKey:"yarn",names:["yarn","yarnpkg","yarn.js"]},{appName:"Corepack",iconKey:"corepack",names:["corepack"]},{appName:"Deno",iconKey:"deno",names:["deno"]},{appName:"Vite",iconKey:"vite",names:["vite","vite-node"]},{appName:"Vitest",iconKey:"vitest",names:["vitest"]},{appName:"Next.js",iconKey:"nextjs",names:["next","next-server"]},{appName:"Nuxt",iconKey:"nuxt",names:["nuxt","nuxi"]},{appName:"Astro",iconKey:"astro",names:["astro"]},{appName:"SvelteKit",iconKey:"svelte",names:["svelte-kit","sveltekit"]},{appName:"Remix",iconKey:"remix",names:["remix"]},{appName:"Expo",iconKey:"expo",names:["expo","expo-cli"]},{appName:"React Native",iconKey:"react",names:["react-native"]},{appName:"Metro",iconKey:"metro",names:["metro","metro-inspector-proxy"]},{appName:"Webpack",iconKey:"webpack",names:["webpack","webpack-dev-server","webpack-cli"]},{appName:"Parcel",iconKey:"parcel",names:["parcel"]},{appName:"Rollup",iconKey:"rollup",names:["rollup"]},{appName:"esbuild",iconKey:"esbuild",names:["esbuild"]},{appName:"SWC",iconKey:"swc",names:["swc"]},{appName:"TypeScript",iconKey:"typescript",names:["tsc","tsserver","tsx","ts-node","typescript-language-server"]},{appName:"ESLint",iconKey:"eslint",names:["eslint","eslint_d"]},{appName:"Prettier",iconKey:"prettier",names:["prettier"]},{appName:"Biome",iconKey:"biome",names:["biome"]},{appName:"Storybook",iconKey:"storybook",names:["storybook","start-storybook"]},{appName:"Playwright",iconKey:"playwright",names:["playwright"]},{appName:"Cypress",iconKey:"cypress",names:["cypress"]},{appName:"Jest",iconKey:"jest",names:["jest"]},{appName:"Python",iconKey:"python",names:["python","python2","python3","python3.9","python3.10","python3.11","python3.12","python3.13","pypy","pypy3"]},{appName:"pip",iconKey:"python",names:["pip","pip2","pip3"]},{appName:"pipx",iconKey:"python",names:["pipx"]},{appName:"uv",iconKey:"python",names:["uv","uvx"]},{appName:"Poetry",iconKey:"poetry",names:["poetry"]},{appName:"Pipenv",iconKey:"python",names:["pipenv"]},{appName:"Conda",iconKey:"conda",names:["conda","mamba","micromamba"]},{appName:"Django",iconKey:"django",names:["django-admin","django-admin.py","manage.py"]},{appName:"Flask",iconKey:"flask",names:["flask"]},{appName:"Uvicorn",iconKey:"uvicorn",names:["uvicorn"]},{appName:"Gunicorn",iconKey:"gunicorn",names:["gunicorn"]},{appName:"Hypercorn",iconKey:"python",names:["hypercorn"]},{appName:"Celery",iconKey:"celery",names:["celery"]},{appName:"Jupyter",iconKey:"jupyter",names:["jupyter","jupyter-lab","jupyter-notebook","ipython"]},{appName:"Ruby",iconKey:"ruby",names:["ruby","erb","irb"]},{appName:"Bundler",iconKey:"ruby",names:["bundle","bundler"]},{appName:"Rails",iconKey:"rails",names:["rails","bin/rails"]},{appName:"Rack",iconKey:"ruby",names:["rackup"]},{appName:"Puma",iconKey:"puma",names:["puma"]},{appName:"Sidekiq",iconKey:"sidekiq",names:["sidekiq"]},{appName:"RSpec",iconKey:"ruby",names:["rspec"]},{appName:"Go",iconKey:"go",names:["go","gofmt","gopls","air"]},{appName:"Delve",iconKey:"go",names:["dlv"]},{appName:"Rust",iconKey:"rust",names:["rustc","rustup","cargo","rust-analyzer"]},{appName:"Java",iconKey:"java",names:["java","javac","jar","jshell","jwebserver"]},{appName:"Gradle",iconKey:"gradle",names:["gradle","gradlew"]},{appName:"Maven",iconKey:"maven",names:["mvn","mvnw"]},{appName:"Spring Boot",iconKey:"spring",names:["spring","spring-boot"]},{appName:"Kotlin",iconKey:"kotlin",names:["kotlin","kotlinc","kotlin-language-server"]},{appName:"Scala",iconKey:"scala",names:["scala","scalac","sbt","metals"]},{appName:"Clojure",iconKey:"clojure",names:["clojure","clj","lein","boot"]},{appName:"PHP",iconKey:"php",names:["php","php-fpm","php-cgi","composer"]},{appName:"Laravel",iconKey:"laravel",names:["artisan","laravel"]},{appName:"Symfony",iconKey:"symfony",names:["symfony"]},{appName:"Elixir",iconKey:"elixir",names:["elixir","iex","mix"]},{appName:"Erlang",iconKey:"erlang",names:["erl","beam.smp","beam","epmd","rebar3"]},{appName:"Phoenix",iconKey:"phoenix",names:["phx.server","phoenix"]},{appName:"PostgreSQL",iconKey:"postgresql",names:["postgres","postmaster","pg_ctl","psql","pg_isready"]},{appName:"Redis",iconKey:"redis",names:["redis-server","redis-cli","redis-sentinel"]},{appName:"MySQL",iconKey:"mysql",names:["mysql","mysqld","mysqladmin"]},{appName:"MariaDB",iconKey:"mariadb",names:["mariadb","mariadbd","mariadb-admin"]},{appName:"SQLite",iconKey:"sqlite",names:["sqlite3","sqlite"]},{appName:"MongoDB",iconKey:"mongodb",names:["mongod","mongosh","mongo"]},{appName:"Elasticsearch",iconKey:"elasticsearch",names:["elasticsearch"]},{appName:"OpenSearch",iconKey:"opensearch",names:["opensearch"]},{appName:"Solr",iconKey:"solr",names:["solr"]},{appName:"Kafka",iconKey:"kafka",names:["kafka-server-start","kafka-console-consumer","kafka-console-producer"]},{appName:"ZooKeeper",iconKey:"zookeeper",names:["zookeeper-server-start","zkserver"]},{appName:"RabbitMQ",iconKey:"rabbitmq",names:["rabbitmq-server","rabbitmqctl"]},{appName:"NATS",iconKey:"nats",names:["nats-server","nats"]},{appName:"Docker",iconKey:"docker",names:["docker","dockerd","docker-compose","docker-proxy","com.docker.backend"]},{appName:"Podman",iconKey:"podman",names:["podman","podman-compose"]},{appName:"Kubernetes",iconKey:"kubernetes",names:["kubectl","kube-apiserver","kubelet","minikube","kind"]},{appName:"Helm",iconKey:"helm",names:["helm"]},{appName:"Tilt",iconKey:"tilt",names:["tilt"]},{appName:"nginx",iconKey:"nginx",names:["nginx"]},{appName:"Caddy",iconKey:"caddy",names:["caddy"]},{appName:"Apache HTTP Server",iconKey:"apache",names:["httpd","apache2","apachectl"]},{appName:"HAProxy",iconKey:"haproxy",names:["haproxy"]},{appName:"Traefik",iconKey:"traefik",names:["traefik"]},{appName:"Envoy",iconKey:"envoy",names:["envoy"]},{appName:"Tailscale",iconKey:"tailscale",names:["tailscale","tailscaled"]},{appName:"Cloudflare Tunnel",iconKey:"cloudflare",names:["cloudflared"]},{appName:"ngrok",iconKey:"ngrok",names:["ngrok"]},{appName:"localtunnel",iconKey:"terminal",names:["lt","localtunnel"]},{appName:"SSH",iconKey:"ssh",names:["ssh","sshd","scp","sftp"]},{appName:"Git",iconKey:"git",names:["git","git-lfs","git-upload-pack","git-receive-pack"]},{appName:"GitHub CLI",iconKey:"github",names:["gh"]},{appName:"GitLab CLI",iconKey:"gitlab",names:["glab"]},{appName:"Subversion",iconKey:"subversion",names:["svn"]},{appName:"Mercurial",iconKey:"mercurial",names:["hg"]},{appName:"AWS CLI",iconKey:"aws",names:["aws","aws-vault","sam"]},{appName:"Azure CLI",iconKey:"azure",names:["az"]},{appName:"Google Cloud CLI",iconKey:"google-cloud",names:["gcloud","gsutil","bq"]},{appName:"Terraform",iconKey:"terraform",names:["terraform"]},{appName:"OpenTofu",iconKey:"opentofu",names:["tofu"]},{appName:"Ansible",iconKey:"ansible",names:["ansible","ansible-playbook"]},{appName:"Pulumi",iconKey:"pulumi",names:["pulumi"]},{appName:"Nomad",iconKey:"nomad",names:["nomad"]},{appName:"Vault",iconKey:"vault",names:["vault"]},{appName:"Consul",iconKey:"consul",names:["consul"]},{appName:"Make",iconKey:"make",names:["make","gmake"]},{appName:"CMake",iconKey:"cmake",names:["cmake","ctest","cpack"]},{appName:"Ninja",iconKey:"ninja",names:["ninja"]},{appName:"Bazel",iconKey:"bazel",names:["bazel","bazelisk"]},{appName:"Buck",iconKey:"buck",names:["buck","buck2"]},{appName:"Clang",iconKey:"clang",names:["clang","clang++","clangd"]},{appName:"GCC",iconKey:"gcc",names:["gcc","g++","cc","c++"]},{appName:"LLDB",iconKey:"terminal",names:["lldb"]},{appName:"GDB",iconKey:"terminal",names:["gdb"]},{appName:"Swift",iconKey:"swift",names:["swift","swiftc","sourcekit-lsp"]},{appName:"Xcode",iconKey:"xcode",names:["xcodebuild","xcrun","simctl"]},{appName:"Zig",iconKey:"zig",names:["zig"]},{appName:"Lua",iconKey:"lua",names:["lua","luajit","lua-language-server"]},{appName:"Perl",iconKey:"perl",names:["perl"]},{appName:"R",iconKey:"r",names:["r","rscript","rserver","rsession"]},{appName:"Julia",iconKey:"julia",names:["julia"]},{appName:"Haskell",iconKey:"haskell",names:["ghc","ghci","cabal","stack","haskell-language-server-wrapper"]},{appName:"OCaml",iconKey:"ocaml",names:["ocaml","ocamlc","dune","opam"]},{appName:"F#",iconKey:"fsharp",names:["fsharpi","fsautocomplete"]},{appName:".NET",iconKey:"dotnet",names:["dotnet","csharp-ls","omnisharp"]},{appName:"PowerShell",iconKey:"powershell",names:["pwsh","powershell"]},{appName:"Bash",iconKey:"terminal",names:["bash"]},{appName:"Zsh",iconKey:"terminal",names:["zsh"]},{appName:"fish",iconKey:"terminal",names:["fish"]},{appName:"tmux",iconKey:"terminal",names:["tmux"]},{appName:"GNU Screen",iconKey:"terminal",names:["screen"]},{appName:"direnv",iconKey:"terminal",names:["direnv"]},{appName:"Nix",iconKey:"nix",names:["nix","nix-shell","nix-daemon","nix-build","nix develop"]},{appName:"Homebrew",iconKey:"homebrew",names:["brew"]},{appName:"mise",iconKey:"terminal",names:["mise"]},{appName:"asdf",iconKey:"terminal",names:["asdf"]},{appName:"Volta",iconKey:"volta",names:["volta"]},{appName:"fnm",iconKey:"nodejs",names:["fnm"]},{appName:"nvm",iconKey:"nodejs",names:["nvm"]},{appName:"curl",iconKey:"terminal",names:["curl"]},{appName:"HTTPie",iconKey:"httpie",names:["http","https","httpie"]},{appName:"wget",iconKey:"terminal",names:["wget"]},{appName:"jq",iconKey:"terminal",names:["jq"]},{appName:"ripgrep",iconKey:"terminal",names:["rg","ripgrep"]},{appName:"fd",iconKey:"terminal",names:["fd"]},{appName:"fzf",iconKey:"terminal",names:["fzf"]},{appName:"bat",iconKey:"terminal",names:["bat"]},{appName:"eza",iconKey:"terminal",names:["eza","exa"]},{appName:"htop",iconKey:"terminal",names:["htop","top","btop"]},{appName:"Vim",iconKey:"vim",names:["vim","view","vimdiff"]},{appName:"Neovim",iconKey:"neovim",names:["nvim","nvim-qt"]},{appName:"Emacs",iconKey:"emacs",names:["emacs","emacsclient"]},{appName:"Visual Studio Code",iconKey:"vscode",names:["code","code-insiders","vscode","visual studio code","visual studio code - insiders"]},{appName:"code-server",iconKey:"vscode",names:["code-server"]},{appName:"Cursor",iconKey:"cursor",names:["cursor"]},{appName:"Zed",iconKey:"zed",names:["zed"]},{appName:"Sublime Text",iconKey:"sublime-text",names:["subl","sublime_text","sublime text"]},{appName:"Atom",iconKey:"atom",names:["atom"]},{appName:"IntelliJ IDEA",iconKey:"intellij-idea",names:["idea","idea.sh","intellij idea","idea64.exe"]},{appName:"WebStorm",iconKey:"webstorm",names:["webstorm","webstorm.sh"]},{appName:"PyCharm",iconKey:"pycharm",names:["pycharm","pycharm.sh"]},{appName:"RubyMine",iconKey:"rubymine",names:["rubymine","rubymine.sh"]},{appName:"GoLand",iconKey:"goland",names:["goland","goland.sh"]},{appName:"CLion",iconKey:"clion",names:["clion","clion.sh"]},{appName:"DataGrip",iconKey:"datagrip",names:["datagrip","datagrip.sh"]},{appName:"Rider",iconKey:"rider",names:["rider","rider.sh"]},{appName:"Android Studio",iconKey:"android-studio",names:["studio","studio.sh","android studio"]},{appName:"Xcode",iconKey:"xcode",names:["xcode","xcode.app"]},{appName:"Postman",iconKey:"postman",names:["postman"]},{appName:"Insomnia",iconKey:"insomnia",names:["insomnia"]},{appName:"Hoppscotch",iconKey:"hoppscotch",names:["hoppscotch"]},{appName:"TablePlus",iconKey:"tableplus",names:["tableplus"]},{appName:"DBeaver",iconKey:"dbeaver",names:["dbeaver"]},{appName:"RedisInsight",iconKey:"redis",names:["redisinsight"]},{appName:"Prisma",iconKey:"prisma",names:["prisma"]},{appName:"Drizzle Kit",iconKey:"drizzle",names:["drizzle-kit"]},{appName:"Supabase",iconKey:"supabase",names:["supabase"]},{appName:"Firebase",iconKey:"firebase",names:["firebase"]},{appName:"Vercel",iconKey:"vercel",names:["vercel"]},{appName:"Netlify",iconKey:"netlify",names:["netlify","ntl"]},{appName:"Fly.io",iconKey:"fly",names:["fly","flyctl"]},{appName:"Heroku",iconKey:"heroku",names:["heroku"]},{appName:"Stripe CLI",iconKey:"stripe",names:["stripe"]},{appName:"Twilio CLI",iconKey:"twilio",names:["twilio"]},{appName:"Mailpit",iconKey:"mail",names:["mailpit"]},{appName:"MailHog",iconKey:"mail",names:["mailhog"]},{appName:"OpenSSL",iconKey:"openssl",names:["openssl"]},{appName:"mkcert",iconKey:"certificate",names:["mkcert"]},{appName:"mkdocs",iconKey:"markdown",names:["mkdocs"]},{appName:"Hugo",iconKey:"hugo",names:["hugo"]},{appName:"Jekyll",iconKey:"jekyll",names:["jekyll"]},{appName:"Eleventy",iconKey:"eleventy",names:["eleventy","11ty"]},{appName:"Docusaurus",iconKey:"docusaurus",names:["docusaurus"]},{appName:"Trunk",iconKey:"rust",names:["trunk"]},{appName:"wasm-pack",iconKey:"webassembly",names:["wasm-pack"]},{appName:"wasmtime",iconKey:"webassembly",names:["wasmtime"]},{appName:"Language Server",iconKey:"language-server",names:["lua-language-server","yaml-language-server","vscode-json-language-server","docker-langserver","bash-language-server","marksman","taplo"]}],Iv=new Map;for(let e of iM)for(let t of e.names)Iv.set(aM(t),{appName:e.appName,iconKey:e.iconKey});var Mne=Iv.size;function oM(e){let t=e.toLowerCase();switch(!0){case t.endsWith(".app"):return e.slice(0,-4);case t.endsWith(".exe"):return e.slice(0,-4);case t.endsWith(".cmd"):case t.endsWith(".bat"):return e.slice(0,-4);default:return e}}function aM(e){return oM(e.trim().replaceAll("\\","/").toLowerCase())}var Pv=100,sM=100,Yc=20,dM=255,on=class extends Error{constructor(t){super(t),this.name="NativeModelCatalogInvalidResponseError"}},wn=e=>new on(e),Vo=e=>e!==""&&e.length<=dM;async function Ov(e){let t=[],n=new Set,i=new Set,r=[],o=null;for(let s=0;s<Yc;s+=1){let d=await e.request("model/list",{cursor:o,limit:sM,includeHidden:!1}),u=uM(d,"model/list"),l=_t(u.data);if(l===void 0)throw wn("model/list response did not include data");for(let f of l){let h=pe(f),y=V(h?.model)?.trim(),w=V(h?.displayName)?.trim(),g=_t(h?.supportedReasoningEfforts),v=V(h?.defaultReasoningEffort)?.trim();if(h===void 0||y===void 0||!Vo(y)||w===void 0||!Vo(w)||h.hidden!==!1||g===void 0||v===void 0||!Vo(v)||typeof h.isDefault!="boolean")throw wn("model/list included invalid visible model metadata");if(n.has(y))throw wn(`model/list repeated model ${y}`);let b=g.map(S=>{let T=pe(S),C=V(T?.reasoningEffort)?.trim();if(C===void 0||!Vo(C))throw wn(`model/list ${y} included invalid reasoning effort metadata`);return C});if(new Set(b).size!==b.length||!b.includes(v))throw wn(`model/list ${y} included inconsistent reasoning effort metadata`);if(n.add(y),t.push({id:y,displayName:w,reasoningEfforts:b,defaultReasoningEffort:v}),h.isDefault&&r.push(y),t.length>Pv)throw wn(`model/list exceeded ${Pv} visible models`)}let p=u.nextCursor;if(p===null)break;let m=V(p)?.trim();if(m===void 0||!Vo(m))throw wn("model/list included invalid pagination cursor");if(i.has(m))throw wn(`model/list repeated pagination cursor ${m}`);if(i.add(m),o=m,s===Yc-1)throw wn(`model/list exceeded ${Yc} pagination pages`)}if(t.length===0)return{type:"empty"};if(r.length!==1)throw wn("model/list did not advertise exactly one valid default model");let[a]=r;if(a===void 0)throw wn("model/list did not advertise exactly one valid default model");return{type:"ready",catalog:{defaultModel:a,models:t}}}function uM(e,t){if("error"in e)throw new Error(`${t} failed: ${e.error.message}`);let n=pe(e.result);if(n===void 0)throw new Error(`${t} response did not include an object result`);return n}var Ev=12e4;function lM(){let e=process.env.LINZUMI_CODEX_START_REQUEST_TIMEOUT_MS?.trim();if(e===void 0||e==="")return Ev;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:Ev}var Xc=class extends Error{constructor(t,n){super(`Codex ${t} did not reply within ${n}ms (start request timed out)`),this.name="CodexStartRequestTimeoutError"}};function cM(e,t,n=lM()){return pM(e,t,n,(i,r)=>new Xc(i,r))}function pM(e,t,n,i){return n>0?new Promise((r,o)=>{let a=setTimeout(()=>{o(i(e,n))},n);a.unref?.(),t.then(s=>{clearTimeout(a),r(s)},s=>{clearTimeout(a),o(s)})}):t}function Zo(e,t,n){return cM(t,e.request(t,n))}var fM=e=>/\bsession\b.+\bis archived\b/i.test(e),mM=e=>/^thread not found(?:\s*:|\b)/i.test(e.trim()),hM=e=>/\bno rollout found\b/i.test(e)||/\bsession not found\b[\s\S]*\brollout\b/i.test(e);async function Rv(e,t,n,i,r,o){o("kandan.reconnect_thread_unarchive_started",{codex_thread_id:t,discovered_by:i,message:r});try{let a=await Zo(e,"thread/unarchive",{threadId:t});if("error"in a)throw new Error(`thread/unarchive failed: ${a.error.message}`);let s=await Zo(e,"thread/resume",n);if("error"in s)throw new Error(`thread/resume after unarchive failed: ${s.error.message}`);return o("kandan.reconnect_thread_unarchive_resumed",{codex_thread_id:t,discovered_by:i}),{mode:"resumed"}}catch(a){let s=a instanceof Error?a.message:String(a);throw o("kandan.reconnect_thread_unarchive_failed",{codex_thread_id:t,discovered_by:i,archive_error:r,message:s}),new Error(i==="forced_inject_not_found"?`thread/inject_items failed: ${r}; archive recovery failed: ${s}`:s)}}async function Av(e){let{codex:t,codexThreadId:n,rehydration:i}=e,r={threadId:n,...e.resumeOverrides},o;if(i.forceRehydrate===!0)o="the server marked the durable engine session dead after an acknowledged-but-unexecuted turn";else{let s=await Zo(t,"thread/resume",r);if(!("error"in s))return{mode:"resumed"};if(fM(s.error.message))return await Rv(t,n,r,"resume_archived",s.error.message,i.log);if(e.rebuildWhen==="missing-rollout-only"&&!hM(s.error.message))throw i.log("linzumi.agent_thread_resume_failed_unrecoverable",{codex_thread_id:n,message:s.error.message,rehydrating:!1}),new Error(s.error.message);o=s.error.message}i.log(i.forceRehydrate===!0?"kandan.reconnect_thread_rehydrate_forced":"kandan.reconnect_thread_resume_failed",{codex_thread_id:n,message:o,forced:i.forceRehydrate===!0,rehydrating:!0});let a;try{let s;try{s=await i.buildRehydrationItems?.(o)}catch(l){i.log("kandan.reconnect_thread_rehydration_items_failed",{codex_thread_id:n,message:l instanceof Error?l.message:String(l)}),s=void 0}let d=s!==void 0&&s.length>0?[...s]:[{type:"agentMessage",text:await i.buildRehydrationText(o)}],u=await Zo(t,"thread/inject_items",{threadId:n,items:d});if("error"in u){if(i.forceRehydrate===!0&&mM(u.error.message))return await Rv(t,n,r,"forced_inject_not_found",u.error.message,i.log);a=`thread/inject_items failed: ${u.error.message}`}else{let l=await Zo(t,"thread/resume",r);"error"in l&&(a=`rehydrated thread/resume failed: ${l.error.message}`)}}catch(s){a=s instanceof Error?s.message:String(s)}if(a!==void 0)throw i.log("kandan.reconnect_thread_rehydration_failed",{codex_thread_id:n,resume_failure:o,rehydration_failure:a}),new Error(`could not resume this thread's engine session (${o}) and rebuilding a fresh session from the thread transcript also failed (${a})`);return i.log("kandan.reconnect_thread_rehydrated",{codex_thread_id:n,resume_failure:o}),{mode:"rehydrated",resumeFailure:o}}import{existsSync as Y8,readFileSync as X8,statSync as Jde}from"node:fs";import{homedir as uE}from"node:os";import{join as Mn,posix as uy,win32 as e7}from"node:path";var gM=[/(--token[=\s]+)\S+/gi,/(bearer\s+)[^\s,;"'\]\}]+/gi,/((?:access[_-]?token|api[_-]?key|auth[_-]?token|authorization|secret|password|refresh[_-]?token|session[_-]?token|jwt|token)["']?\s*[:=]\s*["']?)[^\s,;"'\]\}]+/gi,/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g];function $v(e){return typeof e!="string"||e===""?e:gM.reduce((t,n)=>n.source.startsWith("\\beyJ")?t.replace(n,"<redacted>"):t.replace(n,"$1<redacted>"),e)}var Aoe=64*1024;var $oe=16*1024;function t7(){return["user","project","local"]}function n7(e){return[uy.join(e,".local","bin"),uy.join(e,".claude","local")]}function lE(e){return e instanceof Error&&e.message.includes("Native CLI binary for")&&e.message.includes("not found")}function r7(e){let t=e.env.LINZUMI_CLAUDE_CODE_EXECUTABLE?.trim();if(t!==void 0&&t!=="")return e.fileExists(t)?t:void 0;let n=e.platform==="win32",i=e.env.PATH??"",r=n?";":":",o=n?e7.join:uy.join,a=n?["claude.exe","claude.cmd","claude"]:["claude"],s=[...i.split(r),...!n&&e.homeDir!==void 0?n7(e.homeDir):[]];for(let d of s)if(d!=="")for(let u of a){let l=o(d,u);if(e.fileExists(l))return l}}var cE;var pE,i7="claude_code.probe_executable_fallback";function fE(e,t,n){let i=pE;pE=e,!(i!==void 0&&(i.kind==="sdk"?e.kind==="sdk":e.kind==="fallback"&&i.executable===e.executable))&&(e.kind==="sdk"&&i===void 0||n({severity:e.kind==="fallback"?"warning":"info",key:i7,message:t()}))}var mE=100,sy=255,o7=1e4;async function*a7(){}async function s7(e,t){let n;try{return await Promise.race([e.supportedModels(),new Promise((i,r)=>{n=setTimeout(()=>r(new Error("Claude model discovery timed out")),t),n.unref?.()})])}finally{n!==void 0&&clearTimeout(n)}}async function d7(e,t=o7){let n=e.query(a7()),i;try{i=await s7(n,t)}finally{await n.return(void 0)}if(i.length===0)return{type:"empty"};let r=[],o=new Set;for(let a of i){let s=a.value.trim(),d=a.displayName.trim(),u=(a.supportedEffortLevels??[]).map(l=>l.trim());if(s===""||s.length>sy||d===""||d.length>sy||o.has(s)||u.some(l=>l===""||l.length>sy)||new Set(u).size!==u.length||a.supportsEffort===!0&&u.length===0||a.supportsEffort===!1&&u.length>0)throw new on("Claude supportedModels included invalid model metadata");if(o.add(s),r.push({id:s,displayName:d,reasoningEfforts:u}),r.length>mE)throw new on(`Claude supportedModels exceeded ${mE} models`)}if(!o.has("default"))throw new on("Claude supportedModels did not advertise the runtime default model");return{type:"ready",catalog:{defaultModel:"default",models:r}}}async function hE(e){try{return await d7(e)}catch(t){let n=t instanceof on?"invalid_response":"discovery_failed";return Ye("claude_code.model_catalog_discovery_failed",{failure_code:n}),{type:"failed",failureCode:n}}}function gE(e){return e===void 0?{}:{pathToClaudeCodeExecutable:e}}function u7(e){return e!==void 0?e:(X_(),process.env)}function l7(e){return e instanceof Error&&e.message.includes("initialization did not complete within")}var c7=600;function p7(e){return $v(e).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,"<redacted>").replace(/(\/\/[^\s/:@]+):[^\s@]+@/g,"$1:<redacted>@")}function yE(e,t){let n=e instanceof Error?e.message:String(e),i=t.map(({executable:o,stderrTail:a})=>a===""?`${o}: (no stderr output from the claude subprocess)`:`${o}: stderr tail: ${a}`),r=t.length===0?"no claude subprocess was spawned":i.join(" | ");return p7(`${n} [probed ${r}]`.replace(/\s+/g," ").trim())}async function _E(e,t){let n=[],i=t?.reportNotice??Gc,r=o=>{let a={executable:o,stderrTail:""};return n.push(a),s=>{a.stderrTail=`${a.stderrTail}${s}`.slice(-c7)}};try{let o=u7(t?.env),a=t?.platform??process.platform,s=t?.fileExists??Y8,d=e.claudeBin===void 0?void 0:Mc(e.claudeBin,{env:o,platform:a,fileExists:s});if(e.claudeBin!==void 0&&d===void 0)return i({severity:"error",key:"claude_code.claude_bin_missing",message:`--claude-bin ${e.claudeBin} does not exist (checked the given path and the runner's search PATH). Claude Code stays disabled; fix the path or remove the flag.`}),{status:"binary_missing",transient:!1};if(d===void 0&&!f7(o,{cwd:e.cwd,homeDir:uE(),platform:a,fileExists:s,readTextFile:b7}))return{status:"not_logged_in",transient:!1};let u=t?.startup??(await Promise.resolve().then(()=>(dE(),sE))).startup,l={cwd:e.cwd,persistSession:!1,settingSources:t7(),tools:[],env:o},p=15e3,m;try{m=await u({options:{...l,...gE(d),stderr:r(d??"the SDK-bundled claude")},initializeTimeoutMs:p})}catch(f){let h=d??r7({env:o,platform:a,fileExists:s,homeDir:uE()});if(h===void 0||h===d)throw f;return fE({kind:"fallback",executable:h},()=>lE(f)?`claude agent SDK native binary is missing; retrying the availability probe with the user-installed claude executable at ${h}`:`claude agent SDK startup failed (${yE(f,n)}); retrying the availability probe with the user-installed claude executable at ${h}`,i),m=await u({options:{...l,...gE(h),stderr:r(h)},initializeTimeoutMs:p}),cE=h,{status:"logged_in",transient:!1,fallbackExecutable:h,modelCatalogDiscovery:await hE(m)}}return cE=d,d===void 0&&fE({kind:"sdk"},()=>"claude agent SDK startup recovered; the availability probe is using the SDK's own claude executable again",i),{status:"logged_in",transient:!1,modelCatalogDiscovery:await hE(m)}}catch(o){let a=lE(o),s=e.claudeBin===void 0?a?`The claude agent SDK's platform-native package (@anthropic-ai/claude-agent-sdk-${t?.platform??process.platform}-${process.arch}) is missing from this install, and no user-installed claude executable was found (checked PATH, ~/.local/bin, ~/.claude/local). Restart the runner on the current CLI (it rebuilds the worker-entry mirror with the native package at boot), or install Claude Code and pass --claude-bin "$(command -v claude)" when starting the runner.`:'If `claude` works in your terminal, pass --claude-bin "$(command -v claude)" when starting the runner, or set LINZUMI_CLAUDE_CODE_EXECUTABLE to the binary\'s absolute path.':`--claude-bin ${e.claudeBin} was found but Claude Code failed to start (an auth or startup error, not a missing binary). Check \`claude\` runs and is logged in, then restart the runner.`,d=yE(o,n),u=l7(o)?" The startup PROBE hit its deadline - this is a liveness verdict about the probe, not proof the binary is broken; the runner re-probes on credential changes without a restart (#2989).":"";return i({severity:"error",key:"claude_code.availability_probe_failed",message:`claude code availability probe failed: ${d}
|
|
264
|
-
Claude Code sessions stay disabled for this runner (Codex is unaffected).${u} ${s}`}),{status:a?"binary_missing":"probe_failed",transient:!a,detail:d}}}function f7(e,t){let n=e.CLAUDE_CONFIG_DIR??Mn(t.homeDir,".claude");return m7(e)||h7(e)||g7(n,t)||y7(n,t)||v7(t)}function dy(e){return e!==void 0&&e.trim()!==""}function As(e){let t=e?.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function m7(e){return dy(e.ANTHROPIC_API_KEY)||dy(e.ANTHROPIC_AUTH_TOKEN)||dy(e.CLAUDE_CODE_OAUTH_TOKEN)}function h7(e){return As(e.CLAUDE_CODE_USE_BEDROCK)||As(e.CLAUDE_CODE_USE_VERTEX)||As(e.CLAUDE_CODE_USE_FOUNDRY)||As(e.CLAUDE_CODE_USE_ANTHROPIC_AWS)||As(e.CLAUDE_CODE_USE_MANTLE)}function g7(e,t){return t.fileExists(Mn(e,".credentials.json"))||t.fileExists(Mn(e,".claude.json"))||t.fileExists(Mn(t.homeDir,".claude.json"))}function y7(e,t){return[Mn(e,"settings.json"),Mn(e,"settings.local.json"),Mn(t.cwd,".claude","settings.json"),Mn(t.cwd,".claude","settings.local.json")].some(n=>_7(n,t))}function _7(e,t){let n=t.readTextFile(e);if(n===void 0)return!1;try{let i=pe(JSON.parse(n));return w7(V(i?.apiKeyHelper))!==void 0}catch{return!1}}function v7(e){return e.platform!=="darwin"?!1:[Mn(e.homeDir,"Library","Application Support","claude-cli-nodejs"),Mn(e.homeDir,"Library","Application Support","Claude"),Mn(e.homeDir,"Library","Preferences","claude-cli-nodejs")].some(t=>e.fileExists(t))}function b7(e){try{return X8(e,"utf8")}catch{return}}function w7(e){if(e===void 0)return;let t=e.trim();return t.length===0?void 0:t}var ly={mcpAuthFileContents:"LINZUMI_CLOUD_MCP_AUTH_JSON",llmProxyToken:"LINZUMI_CLOUD_LLM_PROXY_TOKEN"};function vE(e){let t;try{t=JSON.parse(Buffer.from(e,"base64").toString("utf8"))}catch{throw new Error("invalid guest cloud turn config payload (not base64 JSON)")}if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("invalid guest cloud turn config payload");let n=t;for(let[i,r]of[["codexVersion",n.codexVersion],["sandbox",n.sandbox],["approvalPolicy",n.approvalPolicy],["kandanUrl",n.kandanUrl],["cwd",n.cwd]])if(typeof r!="string"||r==="")throw new Error(`invalid guest cloud turn config payload (${i} missing)`);if(!Array.isArray(n.input))throw new Error("invalid guest cloud turn config payload (input)");if(typeof n.appServerPort!="number"||!Number.isInteger(n.appServerPort))throw new Error("invalid guest cloud turn config payload (appServerPort)");return n}var ui="/home/agent",S7=`${ui}/.linzumi-provisioned`;var cy="/dev/shm/linzumi",
|
|
263
|
+
`,1)[0]??e}function eM(e,t){return e.length<=t?e:`[...truncated...]${e.slice(e.length-t)}`}var rd={default:{maxLadderMs:9e5},wafer:{maxLadderMs:36e5}};var hne={maxRecoveryRungs:4,maxLadderMs:rd.default.maxLadderMs,maxRateLimitHoldMs:30*6e4},gne={default:rd.default,wafer:rd.wafer};var bne=10*6e4;var iM=[{appName:"Bun",iconKey:"bun",names:["bun","bunx"]},{appName:"Node.js",iconKey:"nodejs",names:["node","nodejs","node.exe"]},{appName:"npm",iconKey:"npm",names:["npm","npm-cli.js","npx"]},{appName:"pnpm",iconKey:"pnpm",names:["pnpm","pnpx"]},{appName:"Yarn",iconKey:"yarn",names:["yarn","yarnpkg","yarn.js"]},{appName:"Corepack",iconKey:"corepack",names:["corepack"]},{appName:"Deno",iconKey:"deno",names:["deno"]},{appName:"Vite",iconKey:"vite",names:["vite","vite-node"]},{appName:"Vitest",iconKey:"vitest",names:["vitest"]},{appName:"Next.js",iconKey:"nextjs",names:["next","next-server"]},{appName:"Nuxt",iconKey:"nuxt",names:["nuxt","nuxi"]},{appName:"Astro",iconKey:"astro",names:["astro"]},{appName:"SvelteKit",iconKey:"svelte",names:["svelte-kit","sveltekit"]},{appName:"Remix",iconKey:"remix",names:["remix"]},{appName:"Expo",iconKey:"expo",names:["expo","expo-cli"]},{appName:"React Native",iconKey:"react",names:["react-native"]},{appName:"Metro",iconKey:"metro",names:["metro","metro-inspector-proxy"]},{appName:"Webpack",iconKey:"webpack",names:["webpack","webpack-dev-server","webpack-cli"]},{appName:"Parcel",iconKey:"parcel",names:["parcel"]},{appName:"Rollup",iconKey:"rollup",names:["rollup"]},{appName:"esbuild",iconKey:"esbuild",names:["esbuild"]},{appName:"SWC",iconKey:"swc",names:["swc"]},{appName:"TypeScript",iconKey:"typescript",names:["tsc","tsserver","tsx","ts-node","typescript-language-server"]},{appName:"ESLint",iconKey:"eslint",names:["eslint","eslint_d"]},{appName:"Prettier",iconKey:"prettier",names:["prettier"]},{appName:"Biome",iconKey:"biome",names:["biome"]},{appName:"Storybook",iconKey:"storybook",names:["storybook","start-storybook"]},{appName:"Playwright",iconKey:"playwright",names:["playwright"]},{appName:"Cypress",iconKey:"cypress",names:["cypress"]},{appName:"Jest",iconKey:"jest",names:["jest"]},{appName:"Python",iconKey:"python",names:["python","python2","python3","python3.9","python3.10","python3.11","python3.12","python3.13","pypy","pypy3"]},{appName:"pip",iconKey:"python",names:["pip","pip2","pip3"]},{appName:"pipx",iconKey:"python",names:["pipx"]},{appName:"uv",iconKey:"python",names:["uv","uvx"]},{appName:"Poetry",iconKey:"poetry",names:["poetry"]},{appName:"Pipenv",iconKey:"python",names:["pipenv"]},{appName:"Conda",iconKey:"conda",names:["conda","mamba","micromamba"]},{appName:"Django",iconKey:"django",names:["django-admin","django-admin.py","manage.py"]},{appName:"Flask",iconKey:"flask",names:["flask"]},{appName:"Uvicorn",iconKey:"uvicorn",names:["uvicorn"]},{appName:"Gunicorn",iconKey:"gunicorn",names:["gunicorn"]},{appName:"Hypercorn",iconKey:"python",names:["hypercorn"]},{appName:"Celery",iconKey:"celery",names:["celery"]},{appName:"Jupyter",iconKey:"jupyter",names:["jupyter","jupyter-lab","jupyter-notebook","ipython"]},{appName:"Ruby",iconKey:"ruby",names:["ruby","erb","irb"]},{appName:"Bundler",iconKey:"ruby",names:["bundle","bundler"]},{appName:"Rails",iconKey:"rails",names:["rails","bin/rails"]},{appName:"Rack",iconKey:"ruby",names:["rackup"]},{appName:"Puma",iconKey:"puma",names:["puma"]},{appName:"Sidekiq",iconKey:"sidekiq",names:["sidekiq"]},{appName:"RSpec",iconKey:"ruby",names:["rspec"]},{appName:"Go",iconKey:"go",names:["go","gofmt","gopls","air"]},{appName:"Delve",iconKey:"go",names:["dlv"]},{appName:"Rust",iconKey:"rust",names:["rustc","rustup","cargo","rust-analyzer"]},{appName:"Java",iconKey:"java",names:["java","javac","jar","jshell","jwebserver"]},{appName:"Gradle",iconKey:"gradle",names:["gradle","gradlew"]},{appName:"Maven",iconKey:"maven",names:["mvn","mvnw"]},{appName:"Spring Boot",iconKey:"spring",names:["spring","spring-boot"]},{appName:"Kotlin",iconKey:"kotlin",names:["kotlin","kotlinc","kotlin-language-server"]},{appName:"Scala",iconKey:"scala",names:["scala","scalac","sbt","metals"]},{appName:"Clojure",iconKey:"clojure",names:["clojure","clj","lein","boot"]},{appName:"PHP",iconKey:"php",names:["php","php-fpm","php-cgi","composer"]},{appName:"Laravel",iconKey:"laravel",names:["artisan","laravel"]},{appName:"Symfony",iconKey:"symfony",names:["symfony"]},{appName:"Elixir",iconKey:"elixir",names:["elixir","iex","mix"]},{appName:"Erlang",iconKey:"erlang",names:["erl","beam.smp","beam","epmd","rebar3"]},{appName:"Phoenix",iconKey:"phoenix",names:["phx.server","phoenix"]},{appName:"PostgreSQL",iconKey:"postgresql",names:["postgres","postmaster","pg_ctl","psql","pg_isready"]},{appName:"Redis",iconKey:"redis",names:["redis-server","redis-cli","redis-sentinel"]},{appName:"MySQL",iconKey:"mysql",names:["mysql","mysqld","mysqladmin"]},{appName:"MariaDB",iconKey:"mariadb",names:["mariadb","mariadbd","mariadb-admin"]},{appName:"SQLite",iconKey:"sqlite",names:["sqlite3","sqlite"]},{appName:"MongoDB",iconKey:"mongodb",names:["mongod","mongosh","mongo"]},{appName:"Elasticsearch",iconKey:"elasticsearch",names:["elasticsearch"]},{appName:"OpenSearch",iconKey:"opensearch",names:["opensearch"]},{appName:"Solr",iconKey:"solr",names:["solr"]},{appName:"Kafka",iconKey:"kafka",names:["kafka-server-start","kafka-console-consumer","kafka-console-producer"]},{appName:"ZooKeeper",iconKey:"zookeeper",names:["zookeeper-server-start","zkserver"]},{appName:"RabbitMQ",iconKey:"rabbitmq",names:["rabbitmq-server","rabbitmqctl"]},{appName:"NATS",iconKey:"nats",names:["nats-server","nats"]},{appName:"Docker",iconKey:"docker",names:["docker","dockerd","docker-compose","docker-proxy","com.docker.backend"]},{appName:"Podman",iconKey:"podman",names:["podman","podman-compose"]},{appName:"Kubernetes",iconKey:"kubernetes",names:["kubectl","kube-apiserver","kubelet","minikube","kind"]},{appName:"Helm",iconKey:"helm",names:["helm"]},{appName:"Tilt",iconKey:"tilt",names:["tilt"]},{appName:"nginx",iconKey:"nginx",names:["nginx"]},{appName:"Caddy",iconKey:"caddy",names:["caddy"]},{appName:"Apache HTTP Server",iconKey:"apache",names:["httpd","apache2","apachectl"]},{appName:"HAProxy",iconKey:"haproxy",names:["haproxy"]},{appName:"Traefik",iconKey:"traefik",names:["traefik"]},{appName:"Envoy",iconKey:"envoy",names:["envoy"]},{appName:"Tailscale",iconKey:"tailscale",names:["tailscale","tailscaled"]},{appName:"Cloudflare Tunnel",iconKey:"cloudflare",names:["cloudflared"]},{appName:"ngrok",iconKey:"ngrok",names:["ngrok"]},{appName:"localtunnel",iconKey:"terminal",names:["lt","localtunnel"]},{appName:"SSH",iconKey:"ssh",names:["ssh","sshd","scp","sftp"]},{appName:"Git",iconKey:"git",names:["git","git-lfs","git-upload-pack","git-receive-pack"]},{appName:"GitHub CLI",iconKey:"github",names:["gh"]},{appName:"GitLab CLI",iconKey:"gitlab",names:["glab"]},{appName:"Subversion",iconKey:"subversion",names:["svn"]},{appName:"Mercurial",iconKey:"mercurial",names:["hg"]},{appName:"AWS CLI",iconKey:"aws",names:["aws","aws-vault","sam"]},{appName:"Azure CLI",iconKey:"azure",names:["az"]},{appName:"Google Cloud CLI",iconKey:"google-cloud",names:["gcloud","gsutil","bq"]},{appName:"Terraform",iconKey:"terraform",names:["terraform"]},{appName:"OpenTofu",iconKey:"opentofu",names:["tofu"]},{appName:"Ansible",iconKey:"ansible",names:["ansible","ansible-playbook"]},{appName:"Pulumi",iconKey:"pulumi",names:["pulumi"]},{appName:"Nomad",iconKey:"nomad",names:["nomad"]},{appName:"Vault",iconKey:"vault",names:["vault"]},{appName:"Consul",iconKey:"consul",names:["consul"]},{appName:"Make",iconKey:"make",names:["make","gmake"]},{appName:"CMake",iconKey:"cmake",names:["cmake","ctest","cpack"]},{appName:"Ninja",iconKey:"ninja",names:["ninja"]},{appName:"Bazel",iconKey:"bazel",names:["bazel","bazelisk"]},{appName:"Buck",iconKey:"buck",names:["buck","buck2"]},{appName:"Clang",iconKey:"clang",names:["clang","clang++","clangd"]},{appName:"GCC",iconKey:"gcc",names:["gcc","g++","cc","c++"]},{appName:"LLDB",iconKey:"terminal",names:["lldb"]},{appName:"GDB",iconKey:"terminal",names:["gdb"]},{appName:"Swift",iconKey:"swift",names:["swift","swiftc","sourcekit-lsp"]},{appName:"Xcode",iconKey:"xcode",names:["xcodebuild","xcrun","simctl"]},{appName:"Zig",iconKey:"zig",names:["zig"]},{appName:"Lua",iconKey:"lua",names:["lua","luajit","lua-language-server"]},{appName:"Perl",iconKey:"perl",names:["perl"]},{appName:"R",iconKey:"r",names:["r","rscript","rserver","rsession"]},{appName:"Julia",iconKey:"julia",names:["julia"]},{appName:"Haskell",iconKey:"haskell",names:["ghc","ghci","cabal","stack","haskell-language-server-wrapper"]},{appName:"OCaml",iconKey:"ocaml",names:["ocaml","ocamlc","dune","opam"]},{appName:"F#",iconKey:"fsharp",names:["fsharpi","fsautocomplete"]},{appName:".NET",iconKey:"dotnet",names:["dotnet","csharp-ls","omnisharp"]},{appName:"PowerShell",iconKey:"powershell",names:["pwsh","powershell"]},{appName:"Bash",iconKey:"terminal",names:["bash"]},{appName:"Zsh",iconKey:"terminal",names:["zsh"]},{appName:"fish",iconKey:"terminal",names:["fish"]},{appName:"tmux",iconKey:"terminal",names:["tmux"]},{appName:"GNU Screen",iconKey:"terminal",names:["screen"]},{appName:"direnv",iconKey:"terminal",names:["direnv"]},{appName:"Nix",iconKey:"nix",names:["nix","nix-shell","nix-daemon","nix-build","nix develop"]},{appName:"Homebrew",iconKey:"homebrew",names:["brew"]},{appName:"mise",iconKey:"terminal",names:["mise"]},{appName:"asdf",iconKey:"terminal",names:["asdf"]},{appName:"Volta",iconKey:"volta",names:["volta"]},{appName:"fnm",iconKey:"nodejs",names:["fnm"]},{appName:"nvm",iconKey:"nodejs",names:["nvm"]},{appName:"curl",iconKey:"terminal",names:["curl"]},{appName:"HTTPie",iconKey:"httpie",names:["http","https","httpie"]},{appName:"wget",iconKey:"terminal",names:["wget"]},{appName:"jq",iconKey:"terminal",names:["jq"]},{appName:"ripgrep",iconKey:"terminal",names:["rg","ripgrep"]},{appName:"fd",iconKey:"terminal",names:["fd"]},{appName:"fzf",iconKey:"terminal",names:["fzf"]},{appName:"bat",iconKey:"terminal",names:["bat"]},{appName:"eza",iconKey:"terminal",names:["eza","exa"]},{appName:"htop",iconKey:"terminal",names:["htop","top","btop"]},{appName:"Vim",iconKey:"vim",names:["vim","view","vimdiff"]},{appName:"Neovim",iconKey:"neovim",names:["nvim","nvim-qt"]},{appName:"Emacs",iconKey:"emacs",names:["emacs","emacsclient"]},{appName:"Visual Studio Code",iconKey:"vscode",names:["code","code-insiders","vscode","visual studio code","visual studio code - insiders"]},{appName:"code-server",iconKey:"vscode",names:["code-server"]},{appName:"Cursor",iconKey:"cursor",names:["cursor"]},{appName:"Zed",iconKey:"zed",names:["zed"]},{appName:"Sublime Text",iconKey:"sublime-text",names:["subl","sublime_text","sublime text"]},{appName:"Atom",iconKey:"atom",names:["atom"]},{appName:"IntelliJ IDEA",iconKey:"intellij-idea",names:["idea","idea.sh","intellij idea","idea64.exe"]},{appName:"WebStorm",iconKey:"webstorm",names:["webstorm","webstorm.sh"]},{appName:"PyCharm",iconKey:"pycharm",names:["pycharm","pycharm.sh"]},{appName:"RubyMine",iconKey:"rubymine",names:["rubymine","rubymine.sh"]},{appName:"GoLand",iconKey:"goland",names:["goland","goland.sh"]},{appName:"CLion",iconKey:"clion",names:["clion","clion.sh"]},{appName:"DataGrip",iconKey:"datagrip",names:["datagrip","datagrip.sh"]},{appName:"Rider",iconKey:"rider",names:["rider","rider.sh"]},{appName:"Android Studio",iconKey:"android-studio",names:["studio","studio.sh","android studio"]},{appName:"Xcode",iconKey:"xcode",names:["xcode","xcode.app"]},{appName:"Postman",iconKey:"postman",names:["postman"]},{appName:"Insomnia",iconKey:"insomnia",names:["insomnia"]},{appName:"Hoppscotch",iconKey:"hoppscotch",names:["hoppscotch"]},{appName:"TablePlus",iconKey:"tableplus",names:["tableplus"]},{appName:"DBeaver",iconKey:"dbeaver",names:["dbeaver"]},{appName:"RedisInsight",iconKey:"redis",names:["redisinsight"]},{appName:"Prisma",iconKey:"prisma",names:["prisma"]},{appName:"Drizzle Kit",iconKey:"drizzle",names:["drizzle-kit"]},{appName:"Supabase",iconKey:"supabase",names:["supabase"]},{appName:"Firebase",iconKey:"firebase",names:["firebase"]},{appName:"Vercel",iconKey:"vercel",names:["vercel"]},{appName:"Netlify",iconKey:"netlify",names:["netlify","ntl"]},{appName:"Fly.io",iconKey:"fly",names:["fly","flyctl"]},{appName:"Heroku",iconKey:"heroku",names:["heroku"]},{appName:"Stripe CLI",iconKey:"stripe",names:["stripe"]},{appName:"Twilio CLI",iconKey:"twilio",names:["twilio"]},{appName:"Mailpit",iconKey:"mail",names:["mailpit"]},{appName:"MailHog",iconKey:"mail",names:["mailhog"]},{appName:"OpenSSL",iconKey:"openssl",names:["openssl"]},{appName:"mkcert",iconKey:"certificate",names:["mkcert"]},{appName:"mkdocs",iconKey:"markdown",names:["mkdocs"]},{appName:"Hugo",iconKey:"hugo",names:["hugo"]},{appName:"Jekyll",iconKey:"jekyll",names:["jekyll"]},{appName:"Eleventy",iconKey:"eleventy",names:["eleventy","11ty"]},{appName:"Docusaurus",iconKey:"docusaurus",names:["docusaurus"]},{appName:"Trunk",iconKey:"rust",names:["trunk"]},{appName:"wasm-pack",iconKey:"webassembly",names:["wasm-pack"]},{appName:"wasmtime",iconKey:"webassembly",names:["wasmtime"]},{appName:"Language Server",iconKey:"language-server",names:["lua-language-server","yaml-language-server","vscode-json-language-server","docker-langserver","bash-language-server","marksman","taplo"]}],Iv=new Map;for(let e of iM)for(let t of e.names)Iv.set(aM(t),{appName:e.appName,iconKey:e.iconKey});var jne=Iv.size;function oM(e){let t=e.toLowerCase();switch(!0){case t.endsWith(".app"):return e.slice(0,-4);case t.endsWith(".exe"):return e.slice(0,-4);case t.endsWith(".cmd"):case t.endsWith(".bat"):return e.slice(0,-4);default:return e}}function aM(e){return oM(e.trim().replaceAll("\\","/").toLowerCase())}var Pv=100,sM=100,Yc=20,dM=255,on=class extends Error{constructor(t){super(t),this.name="NativeModelCatalogInvalidResponseError"}},wn=e=>new on(e),Vo=e=>e!==""&&e.length<=dM;async function Ov(e){let t=[],n=new Set,i=new Set,r=[],o=null;for(let s=0;s<Yc;s+=1){let d=await e.request("model/list",{cursor:o,limit:sM,includeHidden:!1}),u=uM(d,"model/list"),l=_t(u.data);if(l===void 0)throw wn("model/list response did not include data");for(let f of l){let h=pe(f),y=V(h?.model)?.trim(),w=V(h?.displayName)?.trim(),g=_t(h?.supportedReasoningEfforts),v=V(h?.defaultReasoningEffort)?.trim();if(h===void 0||y===void 0||!Vo(y)||w===void 0||!Vo(w)||h.hidden!==!1||g===void 0||v===void 0||!Vo(v)||typeof h.isDefault!="boolean")throw wn("model/list included invalid visible model metadata");if(n.has(y))throw wn(`model/list repeated model ${y}`);let b=g.map(S=>{let T=pe(S),C=V(T?.reasoningEffort)?.trim();if(C===void 0||!Vo(C))throw wn(`model/list ${y} included invalid reasoning effort metadata`);return C});if(new Set(b).size!==b.length||!b.includes(v))throw wn(`model/list ${y} included inconsistent reasoning effort metadata`);if(n.add(y),t.push({id:y,displayName:w,reasoningEfforts:b,defaultReasoningEffort:v}),h.isDefault&&r.push(y),t.length>Pv)throw wn(`model/list exceeded ${Pv} visible models`)}let p=u.nextCursor;if(p===null)break;let m=V(p)?.trim();if(m===void 0||!Vo(m))throw wn("model/list included invalid pagination cursor");if(i.has(m))throw wn(`model/list repeated pagination cursor ${m}`);if(i.add(m),o=m,s===Yc-1)throw wn(`model/list exceeded ${Yc} pagination pages`)}if(t.length===0)return{type:"empty"};if(r.length!==1)throw wn("model/list did not advertise exactly one valid default model");let[a]=r;if(a===void 0)throw wn("model/list did not advertise exactly one valid default model");return{type:"ready",catalog:{defaultModel:a,models:t}}}function uM(e,t){if("error"in e)throw new Error(`${t} failed: ${e.error.message}`);let n=pe(e.result);if(n===void 0)throw new Error(`${t} response did not include an object result`);return n}var Ev=12e4;function lM(){let e=process.env.LINZUMI_CODEX_START_REQUEST_TIMEOUT_MS?.trim();if(e===void 0||e==="")return Ev;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:Ev}var Xc=class extends Error{constructor(t,n){super(`Codex ${t} did not reply within ${n}ms (start request timed out)`),this.name="CodexStartRequestTimeoutError"}};function cM(e,t,n=lM()){return pM(e,t,n,(i,r)=>new Xc(i,r))}function pM(e,t,n,i){return n>0?new Promise((r,o)=>{let a=setTimeout(()=>{o(i(e,n))},n);a.unref?.(),t.then(s=>{clearTimeout(a),r(s)},s=>{clearTimeout(a),o(s)})}):t}function Zo(e,t,n){return cM(t,e.request(t,n))}var fM=e=>/\bsession\b.+\bis archived\b/i.test(e),mM=e=>/^thread not found(?:\s*:|\b)/i.test(e.trim()),hM=e=>/\bno rollout found\b/i.test(e)||/\bsession not found\b[\s\S]*\brollout\b/i.test(e);async function Rv(e,t,n,i,r,o){o("kandan.reconnect_thread_unarchive_started",{codex_thread_id:t,discovered_by:i,message:r});try{let a=await Zo(e,"thread/unarchive",{threadId:t});if("error"in a)throw new Error(`thread/unarchive failed: ${a.error.message}`);let s=await Zo(e,"thread/resume",n);if("error"in s)throw new Error(`thread/resume after unarchive failed: ${s.error.message}`);return o("kandan.reconnect_thread_unarchive_resumed",{codex_thread_id:t,discovered_by:i}),{mode:"resumed"}}catch(a){let s=a instanceof Error?a.message:String(a);throw o("kandan.reconnect_thread_unarchive_failed",{codex_thread_id:t,discovered_by:i,archive_error:r,message:s}),new Error(i==="forced_inject_not_found"?`thread/inject_items failed: ${r}; archive recovery failed: ${s}`:s)}}async function Av(e){let{codex:t,codexThreadId:n,rehydration:i}=e,r={threadId:n,...e.resumeOverrides},o;if(i.forceRehydrate===!0)o="the server marked the durable engine session dead after an acknowledged-but-unexecuted turn";else{let s=await Zo(t,"thread/resume",r);if(!("error"in s))return{mode:"resumed"};if(fM(s.error.message))return await Rv(t,n,r,"resume_archived",s.error.message,i.log);if(e.rebuildWhen==="missing-rollout-only"&&!hM(s.error.message))throw i.log("linzumi.agent_thread_resume_failed_unrecoverable",{codex_thread_id:n,message:s.error.message,rehydrating:!1}),new Error(s.error.message);o=s.error.message}i.log(i.forceRehydrate===!0?"kandan.reconnect_thread_rehydrate_forced":"kandan.reconnect_thread_resume_failed",{codex_thread_id:n,message:o,forced:i.forceRehydrate===!0,rehydrating:!0});let a;try{let s;try{s=await i.buildRehydrationItems?.(o)}catch(l){i.log("kandan.reconnect_thread_rehydration_items_failed",{codex_thread_id:n,message:l instanceof Error?l.message:String(l)}),s=void 0}let d=s!==void 0&&s.length>0?[...s]:[{type:"agentMessage",text:await i.buildRehydrationText(o)}],u=await Zo(t,"thread/inject_items",{threadId:n,items:d});if("error"in u){if(i.forceRehydrate===!0&&mM(u.error.message))return await Rv(t,n,r,"forced_inject_not_found",u.error.message,i.log);a=`thread/inject_items failed: ${u.error.message}`}else{let l=await Zo(t,"thread/resume",r);"error"in l&&(a=`rehydrated thread/resume failed: ${l.error.message}`)}}catch(s){a=s instanceof Error?s.message:String(s)}if(a!==void 0)throw i.log("kandan.reconnect_thread_rehydration_failed",{codex_thread_id:n,resume_failure:o,rehydration_failure:a}),new Error(`could not resume this thread's engine session (${o}) and rebuilding a fresh session from the thread transcript also failed (${a})`);return i.log("kandan.reconnect_thread_rehydrated",{codex_thread_id:n,resume_failure:o}),{mode:"rehydrated",resumeFailure:o}}import{existsSync as Y8,readFileSync as X8,statSync as Wde}from"node:fs";import{homedir as uE}from"node:os";import{join as Mn,posix as uy,win32 as e7}from"node:path";var gM=[/(--token[=\s]+)\S+/gi,/(bearer\s+)[^\s,;"'\]\}]+/gi,/((?:access[_-]?token|api[_-]?key|auth[_-]?token|authorization|secret|password|refresh[_-]?token|session[_-]?token|jwt|token)["']?\s*[:=]\s*["']?)[^\s,;"'\]\}]+/gi,/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g];function $v(e){return typeof e!="string"||e===""?e:gM.reduce((t,n)=>n.source.startsWith("\\beyJ")?t.replace(n,"<redacted>"):t.replace(n,"$1<redacted>"),e)}var $oe=64*1024;var Moe=16*1024;function t7(){return["user","project","local"]}function n7(e){return[uy.join(e,".local","bin"),uy.join(e,".claude","local")]}function lE(e){return e instanceof Error&&e.message.includes("Native CLI binary for")&&e.message.includes("not found")}function r7(e){let t=e.env.LINZUMI_CLAUDE_CODE_EXECUTABLE?.trim();if(t!==void 0&&t!=="")return e.fileExists(t)?t:void 0;let n=e.platform==="win32",i=e.env.PATH??"",r=n?";":":",o=n?e7.join:uy.join,a=n?["claude.exe","claude.cmd","claude"]:["claude"],s=[...i.split(r),...!n&&e.homeDir!==void 0?n7(e.homeDir):[]];for(let d of s)if(d!=="")for(let u of a){let l=o(d,u);if(e.fileExists(l))return l}}var cE;var pE,i7="claude_code.probe_executable_fallback";function fE(e,t,n){let i=pE;pE=e,!(i!==void 0&&(i.kind==="sdk"?e.kind==="sdk":e.kind==="fallback"&&i.executable===e.executable))&&(e.kind==="sdk"&&i===void 0||n({severity:e.kind==="fallback"?"warning":"info",key:i7,message:t()}))}var mE=100,sy=255,o7=1e4;async function*a7(){}async function s7(e,t){let n;try{return await Promise.race([e.supportedModels(),new Promise((i,r)=>{n=setTimeout(()=>r(new Error("Claude model discovery timed out")),t),n.unref?.()})])}finally{n!==void 0&&clearTimeout(n)}}async function d7(e,t=o7){let n=e.query(a7()),i;try{i=await s7(n,t)}finally{await n.return(void 0)}if(i.length===0)return{type:"empty"};let r=[],o=new Set;for(let a of i){let s=a.value.trim(),d=a.displayName.trim(),u=(a.supportedEffortLevels??[]).map(l=>l.trim());if(s===""||s.length>sy||d===""||d.length>sy||o.has(s)||u.some(l=>l===""||l.length>sy)||new Set(u).size!==u.length||a.supportsEffort===!0&&u.length===0||a.supportsEffort===!1&&u.length>0)throw new on("Claude supportedModels included invalid model metadata");if(o.add(s),r.push({id:s,displayName:d,reasoningEfforts:u}),r.length>mE)throw new on(`Claude supportedModels exceeded ${mE} models`)}if(!o.has("default"))throw new on("Claude supportedModels did not advertise the runtime default model");return{type:"ready",catalog:{defaultModel:"default",models:r}}}async function hE(e){try{return await d7(e)}catch(t){let n=t instanceof on?"invalid_response":"discovery_failed";return Ye("claude_code.model_catalog_discovery_failed",{failure_code:n}),{type:"failed",failureCode:n}}}function gE(e){return e===void 0?{}:{pathToClaudeCodeExecutable:e}}function u7(e){return e!==void 0?e:(X_(),process.env)}function l7(e){return e instanceof Error&&e.message.includes("initialization did not complete within")}var c7=600;function p7(e){return $v(e).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,"<redacted>").replace(/(\/\/[^\s/:@]+):[^\s@]+@/g,"$1:<redacted>@")}function yE(e,t){let n=e instanceof Error?e.message:String(e),i=t.map(({executable:o,stderrTail:a})=>a===""?`${o}: (no stderr output from the claude subprocess)`:`${o}: stderr tail: ${a}`),r=t.length===0?"no claude subprocess was spawned":i.join(" | ");return p7(`${n} [probed ${r}]`.replace(/\s+/g," ").trim())}async function _E(e,t){let n=[],i=t?.reportNotice??Gc,r=o=>{let a={executable:o,stderrTail:""};return n.push(a),s=>{a.stderrTail=`${a.stderrTail}${s}`.slice(-c7)}};try{let o=u7(t?.env),a=t?.platform??process.platform,s=t?.fileExists??Y8,d=e.claudeBin===void 0?void 0:Mc(e.claudeBin,{env:o,platform:a,fileExists:s});if(e.claudeBin!==void 0&&d===void 0)return i({severity:"error",key:"claude_code.claude_bin_missing",message:`--claude-bin ${e.claudeBin} does not exist (checked the given path and the runner's search PATH). Claude Code stays disabled; fix the path or remove the flag.`}),{status:"binary_missing",transient:!1};if(d===void 0&&!f7(o,{cwd:e.cwd,homeDir:uE(),platform:a,fileExists:s,readTextFile:b7}))return{status:"not_logged_in",transient:!1};let u=t?.startup??(await Promise.resolve().then(()=>(dE(),sE))).startup,l={cwd:e.cwd,persistSession:!1,settingSources:t7(),tools:[],env:o},p=15e3,m;try{m=await u({options:{...l,...gE(d),stderr:r(d??"the SDK-bundled claude")},initializeTimeoutMs:p})}catch(f){let h=d??r7({env:o,platform:a,fileExists:s,homeDir:uE()});if(h===void 0||h===d)throw f;return fE({kind:"fallback",executable:h},()=>lE(f)?`claude agent SDK native binary is missing; retrying the availability probe with the user-installed claude executable at ${h}`:`claude agent SDK startup failed (${yE(f,n)}); retrying the availability probe with the user-installed claude executable at ${h}`,i),m=await u({options:{...l,...gE(h),stderr:r(h)},initializeTimeoutMs:p}),cE=h,{status:"logged_in",transient:!1,fallbackExecutable:h,modelCatalogDiscovery:await hE(m)}}return cE=d,d===void 0&&fE({kind:"sdk"},()=>"claude agent SDK startup recovered; the availability probe is using the SDK's own claude executable again",i),{status:"logged_in",transient:!1,modelCatalogDiscovery:await hE(m)}}catch(o){let a=lE(o),s=e.claudeBin===void 0?a?`The claude agent SDK's platform-native package (@anthropic-ai/claude-agent-sdk-${t?.platform??process.platform}-${process.arch}) is missing from this install, and no user-installed claude executable was found (checked PATH, ~/.local/bin, ~/.claude/local). Restart the runner on the current CLI (it rebuilds the worker-entry mirror with the native package at boot), or install Claude Code and pass --claude-bin "$(command -v claude)" when starting the runner.`:'If `claude` works in your terminal, pass --claude-bin "$(command -v claude)" when starting the runner, or set LINZUMI_CLAUDE_CODE_EXECUTABLE to the binary\'s absolute path.':`--claude-bin ${e.claudeBin} was found but Claude Code failed to start (an auth or startup error, not a missing binary). Check \`claude\` runs and is logged in, then restart the runner.`,d=yE(o,n),u=l7(o)?" The startup PROBE hit its deadline - this is a liveness verdict about the probe, not proof the binary is broken; the runner re-probes on credential changes without a restart (#2989).":"";return i({severity:"error",key:"claude_code.availability_probe_failed",message:`claude code availability probe failed: ${d}
|
|
264
|
+
Claude Code sessions stay disabled for this runner (Codex is unaffected).${u} ${s}`}),{status:a?"binary_missing":"probe_failed",transient:!a,detail:d}}}function f7(e,t){let n=e.CLAUDE_CONFIG_DIR??Mn(t.homeDir,".claude");return m7(e)||h7(e)||g7(n,t)||y7(n,t)||v7(t)}function dy(e){return e!==void 0&&e.trim()!==""}function As(e){let t=e?.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function m7(e){return dy(e.ANTHROPIC_API_KEY)||dy(e.ANTHROPIC_AUTH_TOKEN)||dy(e.CLAUDE_CODE_OAUTH_TOKEN)}function h7(e){return As(e.CLAUDE_CODE_USE_BEDROCK)||As(e.CLAUDE_CODE_USE_VERTEX)||As(e.CLAUDE_CODE_USE_FOUNDRY)||As(e.CLAUDE_CODE_USE_ANTHROPIC_AWS)||As(e.CLAUDE_CODE_USE_MANTLE)}function g7(e,t){return t.fileExists(Mn(e,".credentials.json"))||t.fileExists(Mn(e,".claude.json"))||t.fileExists(Mn(t.homeDir,".claude.json"))}function y7(e,t){return[Mn(e,"settings.json"),Mn(e,"settings.local.json"),Mn(t.cwd,".claude","settings.json"),Mn(t.cwd,".claude","settings.local.json")].some(n=>_7(n,t))}function _7(e,t){let n=t.readTextFile(e);if(n===void 0)return!1;try{let i=pe(JSON.parse(n));return w7(V(i?.apiKeyHelper))!==void 0}catch{return!1}}function v7(e){return e.platform!=="darwin"?!1:[Mn(e.homeDir,"Library","Application Support","claude-cli-nodejs"),Mn(e.homeDir,"Library","Application Support","Claude"),Mn(e.homeDir,"Library","Preferences","claude-cli-nodejs")].some(t=>e.fileExists(t))}function b7(e){try{return X8(e,"utf8")}catch{return}}function w7(e){if(e===void 0)return;let t=e.trim();return t.length===0?void 0:t}var ly={mcpAuthFileContents:"LINZUMI_CLOUD_MCP_AUTH_JSON",llmProxyToken:"LINZUMI_CLOUD_LLM_PROXY_TOKEN"};function vE(e){let t;try{t=JSON.parse(Buffer.from(e,"base64").toString("utf8"))}catch{throw new Error("invalid guest cloud turn config payload (not base64 JSON)")}if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("invalid guest cloud turn config payload");let n=t;for(let[i,r]of[["codexVersion",n.codexVersion],["sandbox",n.sandbox],["approvalPolicy",n.approvalPolicy],["kandanUrl",n.kandanUrl],["cwd",n.cwd]])if(typeof r!="string"||r==="")throw new Error(`invalid guest cloud turn config payload (${i} missing)`);if(!Array.isArray(n.input))throw new Error("invalid guest cloud turn config payload (input)");if(typeof n.appServerPort!="number"||!Number.isInteger(n.appServerPort))throw new Error("invalid guest cloud turn config payload (appServerPort)");return n}var ui="/home/agent",S7=`${ui}/.linzumi-provisioned`;var cy="/dev/shm/linzumi",wue=`${cy}/codex`,Sue=`${cy}/mcp-auth.json`;var kue=`${cy}/codex.env`;var Pue=`${ui}/cloud-supervisor.mjs`,bE=`${ui}/mcp-server.mjs`,py=`${ui}/.secrets`,fy=`${py}/mcp-auth.json`,Gl=`${ui}/.codex`,wE=`${Gl}/linzumi-thread-map.json`;var my=`${ui}/.turn-heartbeats`,SE=5e3,k7=/^[A-Za-z0-9-]{8,64}$/;function hy(e){if(!k7.test(e))throw new Error(`invalid cloud turn nonce: ${JSON.stringify(e.slice(0,80))}`)}var O7=3e4,A7=200,$7=18e4,kE="LINZUMI_GUEST_MODEL_CALL_LIVENESS_MS",M7=15*6e4,xE="LINZUMI_GUEST_ACTIVE_LOOP_BUDGET_MS",Zl=2147483647;function j7(e){let t=e[xE];if(t===void 0)return M7;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0||n>Zl)throw new Error(`${xE} must be an integer number of milliseconds between 1 and ${Zl}, got ${JSON.stringify(t)}`);return n}var yy=class extends Error{code="active_loop_budget_exceeded";budgetMs;constructor(t){super(`active_loop_budget_exceeded: guest turn exceeded the ${t}ms wall-clock budget; killed the guest turn`),this.name="GuestActiveLoopBudgetExceeded",this.budgetMs=t}};function N7(e){let t=e[kE];if(t===void 0)return $7;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0)throw new Error(`${kE} must be a positive integer number of milliseconds, got ${JSON.stringify(t)}`);return n}var _y=class extends Error{code="guest_turn_liveness_failure";windowMs;constructor(t){super(`guest_turn_liveness_failure: zero upstream model calls for ${t}ms; killed the guest turn`),this.name="GuestTurnLivenessFailure",this.windowMs=t}};function q7(e,t,n){if(e.method!=="thread/tokenUsage/updated")return;let i=pe(e.params)??{};if(V(i.threadId)!==t||V(i.turnId)!==n)return;let r=Qe(pe(pe(i.tokenUsage)?.total)?.totalTokens),o=Qe(pe(pe(i.tokenUsage)?.last)?.totalTokens);if(!(r===void 0||r<0))return{totalTokens:r,priorCallTotalTokens:o!==void 0&&o>=0&&o<=r?r-o:void 0}}function li(e){return e.replace(/\bsmk_[A-Za-z0-9._-]+/g,"smk_[REDACTED]").replace(/\b(sk|lz|tok|bearer)[-_][A-Za-z0-9._-]{8,}/gi,"$1_[REDACTED]")}var gy=64*1024;function D7(e,t){let n=t.now??Date.now,i=Buffer.alloc(0),r=null,o=null,a=s=>{let d=Buffer.isBuffer(s)?s:Buffer.from(s,"utf8");i=Buffer.concat([i,d]);let u=gy*2;i.byteLength>u&&(i=i.subarray(i.byteLength-u))};return e.stdout?.on("data",a),e.stderr?.on("data",a),e.once("exit",(s,d)=>{r=s,o=d??null}),{evidence:s=>{let d=Buffer.from(li(i.toString("utf8")),"utf8"),u=d.byteLength<=gy?d:d.subarray(d.byteLength-gy);return{marker:"guest_turn_failure_evidence",empty_output:i.byteLength===0,output_tail:u.toString("utf8"),exit_code:r,signal:o,duration_ms:Math.max(0,n()-t.startedAtMs),model_call_count:s}}}}var Ql;function L7(e){Ql=e;try{To(TE(e),{recursive:!0}),$s(e,"")}catch{Ql=void 0}}function Ut(e){let t=`${JSON.stringify(e)}
|
|
265
265
|
`;if(process.stdout.write(t),Ql!==void 0)try{I7(Ql,t)}catch{}}function Vl(e,t,n,i){Ut({phase:"exit",ok:e,reason:li(t),turnMs:n,...i===void 0?{}:{evidence:i}})}function U7(e){return{id:e.id,name:e.name,baseUrl:e.baseUrl,envKey:e.envKey,wireApi:e.wireApi,...e.httpHeaders===void 0?{}:{httpHeaders:{...e.httpHeaders}},...e.envHttpHeaders===void 0?{}:{envHttpHeaders:{...e.envHttpHeaders}}}}function F7(e){if(e.sandbox!=="read-only")throw new Error(`guest cloud turn requires sandbox "read-only", got ${JSON.stringify(e.sandbox)}`);if(e.approvalPolicy!=="never")throw new Error(`guest cloud turn requires approvalPolicy "never", got ${JSON.stringify(e.approvalPolicy)}`)}function z7(e,t=Gl){let n=tv({command:"node",argsPrefix:[bE],kandanUrl:e.kandanUrl,authFilePath:fy,ownerUsername:e.ownerUsername,operatingMode:"text",cwd:e.cwd,threadId:e.threadId,agentSession:!0});return Kc(`ws://127.0.0.1:${e.appServerPort}`,{model:e.model,reasoningEffort:e.reasoningEffort,mcpServers:[n],neverEquivalentGranularApprovalPolicy:!0,...e.modelProvider===void 0?{}:{modelProvider:U7(e.modelProvider)},env:{CODEX_HOME:t,...IE(e)}})}function IE(e){let t=process.env[ly.llmProxyToken];return e.modelProvider===void 0||t===void 0||t===""?{}:{[e.modelProvider.envKey]:t}}function B7(e,t){let n=process.env[ly.mcpAuthFileContents];if(n===void 0||n==="")throw new Error("guest cloud turn missing MCP auth-cache (LINZUMI_CLOUD_MCP_AUTH_JSON)");To(e,{recursive:!0,mode:448}),xo(e,448),$s(t,n,{mode:384}),xo(t,384)}function K7(e){try{ci(e,{recursive:!0,force:!0})}catch{}}var J7=64,W7=20,CE="My engine session for this thread was lost, so I rebuilt it from this thread's saved history at reduced fidelity. Tell me if I lost something important.";async function H7(e){if(e.config.threadId===void 0||e.config.threadId==="")throw new Error("guest thread rehydration requires the durable Linzumi thread id");let t=Ho(e.config.kandanUrl,e.mcpAuthPath);if(t===void 0)throw new Error("guest thread rehydration requires an agent token in the MCP auth file");let n=Wo({kandanUrl:e.config.kandanUrl,accessToken:t.accessToken,operatingMode:"text"}),i=[],r,o,a;for(let d=0;d<W7;d+=1){let u=await n.getThreadTranscript({thread_id:e.config.threadId,...a===void 0?{}:{cursor:a}}),l=Zc(u);if(l===void 0)throw new Error(`guest thread rehydration received a malformed durable transcript page ${d}`);if(i=[...l.nodes,...i],r=r??l.budget,o=o??l.threadTitle,!l.hasMore||l.cursor===void 0)break;a=l.cursor}if(i.length===0)throw new Error("guest thread rehydration durable transcript was empty");let s=Qc({nodes:i,budget:r,resumeFailure:e.resumeFailure,threadTitle:o,linzumiContext:void 0});if(s.items.length===0)throw new Error("guest thread rehydration compiled zero injection items");return s.items}async function G7(e){if(e.config.threadId===void 0||e.config.threadId==="")throw new Error("guest session rebuild notice requires a Linzumi thread id");let t=Ho(e.config.kandanUrl,e.mcpAuthPath);if(t===void 0)throw new Error("guest session rebuild notice requires an agent token in the MCP auth file");await Wo({kandanUrl:e.config.kandanUrl,accessToken:t.accessToken,operatingMode:"voice"}).sendThreadReply({thread_id:e.config.threadId,body:CE,client_message_id:e.notice.noticeId,payload:{structured:{kind:"agent_status_event",item_id:e.notice.noticeId,transcript_unit_id:`agent_status_event:${e.notice.noticeId}`,stream_state:"completed",event_kind:"status",title:"Rebuilt the agent session",body:CE,severity:"info",agent_provider:"codex",raw_provider_metadata:{provider_session_key:e.notice.threadId,resume_failure:e.notice.resumeFailure}}}})}function PE(e){try{let t=JSON.parse(pi(e,"utf8"));if(typeof t!="object"||t===null||Array.isArray(t))return{};let n={};for(let[i,r]of Object.entries(t))typeof r=="string"&&r!==""&&(n[i]=r);return n}catch{return{}}}function V7(e,t,n){try{let i=PE(e);delete i[t];let r=Object.entries(i),o=r.slice(Math.max(0,r.length-(J7-1)));o.push([t,n]),To(TE(e),{recursive:!0}),$s(e,JSON.stringify(Object.fromEntries(o)))}catch{}}var Z7=new Set(["turn/completed","turn/failed","turn/aborted"]),Q7=2e3;function EE(e){let t=pe(pe(e)?.item);if(t===void 0||V(t.type)!=="agentMessage")return"";let n=V(t.text);return n!==void 0&&n!==""?n:(_t(t.content)??[]).map(o=>{let a=pe(o);if(a===void 0)return;let s=V(a.type);if(!(s!=="text"&&s!=="output_text"&&s!=="input_text"))return V(a.text)??V(a.content)}).filter(o=>o!==void 0&&o!=="").join(`
|
|
266
266
|
|
|
267
267
|
`)}function Y7(e){let t=pe(pe(e)?.item);if(t===void 0)return!1;let n=V(t.type);if(n!=="mcpToolCall"&&n!=="dynamicToolCall"&&n!=="collabAgentToolCall"||V(t.status)!=="completed"||t.error!==void 0&&t.error!==null||t.success===!1)return!1;let i=V(t.tool)??"",r=i.split("__").pop()??i;return r==="linzumi_agent_reply"||r==="linzumi_decline_document_action"}var X7=15e3;function eQ(e){return/already_replied|no_active_asker_binding/i.test(e)}async function tQ(e){let t=e.body.trim();if(t==="")return"skipped";let n=Ho(e.kandanUrl,e.mcpAuthPath);if(n===void 0)throw new Error("reply relay: no agent token in the guest MCP auth file");let i=async(o,a)=>{let s=new AbortController,d=setTimeout(()=>s.abort(),X7);try{return await fetch(o,{...a,signal:s.signal})}finally{clearTimeout(d)}},r=Wo({kandanUrl:e.kandanUrl,accessToken:n.accessToken,operatingMode:"text",fetchImpl:i});try{return await r.agentReply({body:t}),"posted"}catch(o){let a=o instanceof Error?o.message:String(o);if(eQ(a))return"already";throw new Error(`reply relay failed: ${a}`)}}var nQ=900,rQ=1e4,iQ=3,oQ=8e3;function aQ(e){return/\bHTTP 4\d\d\b/.test(e)||/\b(forbidden|not_agent_session|no_active_asker_binding|invalid_agent_turn_progress_request|body_required|already_replied)\b/i.test(e)}function sQ(e){return async t=>{let n=Ho(e.kandanUrl,e.mcpAuthPath);if(n===void 0)throw new Error("turn progress: no agent token in the guest MCP auth file");let i=async(o,a)=>{let s=new AbortController,d=setTimeout(()=>s.abort(),rQ);try{return await fetch(o,{...a,signal:s.signal})}finally{clearTimeout(d)}};return Wo({kandanUrl:e.kandanUrl,accessToken:n.accessToken,operatingMode:"text",fetchImpl:i}).agentTurnProgress(t)}}function dQ(e){let t=Date.now,n=e.flushIntervalMs??nQ,i=e.log??Ut,r=e.post??sQ({kandanUrl:e.kandanUrl,mcpAuthPath:e.mcpAuthPath}),o=new Map,a=!1,s=0,d=0,u,l,p=!1,m=!1,f=(S,T)=>{let C=o.get(S);if(C!==void 0)return C;let _={kind:T,phase:"commentary",text:"",snapshotIndex:0,state:"streaming",dirty:!1,lastFlushMs:0,ackedState:void 0};return o.set(S,_),_},h=S=>S.state==="streaming"?S.lastFlushMs+n:0,y=async(S,T)=>{let C=T.text,_=T.state;T.dirty=!1,T.snapshotIndex+=1,T.lastFlushMs=t();try{return await r({stream_key:`${e.streamKeyPrefix}:${S}`,item_id:S,kind:T.kind,...T.kind==="codex_assistant_message"?{phase:T.phase}:{},body:C,stream_state:_,snapshot_index:T.snapshotIndex,...e.sourceSeq===void 0?{}:{source_seq:e.sourceSeq}}),d+=1,s=0,T.ackedState=_,!0}catch(k){s+=1;let I=k instanceof Error?k.message:String(k);return aQ(I)?(m=!0,a=!0,i({phase:"progress",outcome:"permanent_reject",message:li(I)}),!1):(i({phase:"progress",outcome:"post_failed",consecutive_failures:s,message:li(I)}),s>=iQ&&(a=!0,i({phase:"progress",outcome:"disabled"})),!1)}},w=async()=>{for(;;){if(a)return;let S=t(),T,C=!1;for(let[_,k]of o){if(!k.dirty||k.text===""||k.state!=="streaming"&&!p)continue;let I=h(k);I<=S?(await y(_,k),C=!0):T=T===void 0?I:Math.min(T,I)}if(!C){T!==void 0&&(clearTimeout(l),l=setTimeout(g,Math.max(10,T-t())),l.unref?.());return}}};function g(){a||p||u!==void 0||(u=w().catch(()=>{}).finally(()=>{u=void 0}))}return{onNotification:S=>{try{let T=pe(S.params)??{};if(S.method==="item/agentMessage/delta"){let C=Ic(T);if(C!==void 0){let _=f(C.itemKey,"codex_assistant_message");_.phase=C.phase,_.text+=C.delta,_.dirty=!0,g()}return}if(S.method==="item/reasoning/textDelta"){let C=Pc(T);if(C!==void 0){let _=f(C.itemKey,"codex_reasoning");_.text+=C.delta,_.dirty=!0,g()}return}if(S.method==="item/completed"){let C=pe(T.item),_=V(C?.type),k=V(C?.id);if(k===void 0)return;if(_==="agentMessage"){let I=EE(S.params),P=f(k,"codex_assistant_message");P.phase=Tc(C?.phase),I!==""&&(P.text=I),P.state="completed",P.dirty=!0,g()}else if(_==="reasoning"){let I=o.get(k);I!==void 0&&(I.state="completed",I.dirty=!0,g())}}}catch(T){i({phase:"progress",outcome:"notification_error",message:li(T instanceof Error?T.message:String(T))})}},finish:async S=>{try{let T=t()+(e.finishDeadlineMs??oQ),C=()=>new Promise(k=>setTimeout(k,Math.max(0,T-t())).unref?.());p=!0,clearTimeout(l),u!==void 0&&await Promise.race([u,C()]);for(let k of o.values())k.state==="streaming"&&k.text!==""&&(k.state=S);let _=250;for(;;){let k=[...o.entries()].filter(([,P])=>P.text!==""&&P.state!==P.ackedState);if(k.length===0||m||t()>=T)break;let I=!1;for(let[P,R]of k){if(m||t()>=T)break;await y(P,R)||(I=!0)}I&&!m&&t()<T&&await new Promise(P=>setTimeout(P,_))}i({phase:"progress",outcome:"finished",frames_posted:d,disabled:a})}catch(T){i({phase:"progress",outcome:"finish_error",message:li(T instanceof Error?T.message:String(T))})}}}}function uQ(e){if(e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval")return{decision:"decline"}}async function lQ(e,t,n){for(;;){if(n.exitCode!==null&&n.exitCode!==void 0)throw new Error(`codex app-server exited before it accepted a connection (code ${n.exitCode})`);try{return await Hc(e)}catch(i){if(Date.now()>=t)throw i;await new Promise(r=>setTimeout(r,A7))}}}var cQ=360*60*1e3;function pQ(e,t){try{for(let n of P7(e))try{let i=Jn(e,n);t-E7(i).mtimeMs>cQ&&R7(i)}catch{}}catch{}}function fQ(e,t,n=SE){hy(t);let i=Jn(e,`${t}.beat`),r=()=>{try{$s(i,`${Date.now()}
|