@skyramp/testbot-core 0.13.2-v3.519 → 0.13.2-v3.520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/data-safety-worker.js +6 -6
- package/dist/main.js +479 -479
- package/dist/post.js +45 -45
- package/dist/runner-client.cjs +97 -97
- package/dist/runner-client.d.cts +4 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ ${d(m)}\r
|
|
|
11
11
|
Content-Type: ${m.type||"application/octet-stream"}\r
|
|
12
12
|
\r
|
|
13
13
|
`);f.push(C,m,g),typeof m.size=="number"?o+=C.byteLength+m.size+g.byteLength:p=!0}let h=Zc.encode(`--${A}--\r
|
|
14
|
-
`);f.push(h),o+=h.byteLength,p&&(o=null),r=e,i=async function*(){for(let E of f)E.stream?yield*E.stream():yield E},s=`multipart/form-data; boundary=${A}`}else if(Ib(e))r=e,o=e.size,e.type&&(s=e.type);else if(typeof e[Symbol.asyncIterator]=="function"){if(t)throw new TypeError("keepalive");if(Ca.isDisturbed(e)||e.locked)throw new TypeError("Response body object should not be disturbed or locked");n=e instanceof ReadableStream?e:u1(e)}if((typeof r=="string"||Ca.isBuffer(r))&&(o=Buffer.byteLength(r)),i!=null){let A;n=new ReadableStream({async start(){A=i(e)[Symbol.asyncIterator]()},async pull(c){let{value:l,done:d}=await A.next();if(d)queueMicrotask(()=>{c.close(),c.byobRequest?.respond(0)});else if(!Bb(n)){let f=new Uint8Array(l);f.byteLength&&c.enqueue(f)}return c.desiredSize>0},async cancel(c){await A.return()},type:"bytes"})}return[{stream:n,source:r,length:o},s]}function Q1(e,t=!1){return e instanceof ReadableStream&&(Bp(!Ca.isDisturbed(e),"The body has already been consumed."),Bp(!e.locked,"The stream is locked.")),wb(e,t)}function v1(e,t){let[n,i]=t.stream.tee();return t.stream=n,{stream:i,length:t.length,source:t.source}}function w1(e){if(e.aborted)throw new DOMException("The operation was aborted.","AbortError")}function b1(e){return{blob(){return No(this,n=>{let i=yb(this);return i===null?i="":i&&(i=y1(i)),new m1([n],{type:i})},e)},arrayBuffer(){return No(this,n=>new Uint8Array(n).buffer,e)},text(){return No(this,Cb,e)},json(){return No(this,S1,e)},formData(){return No(this,n=>{let i=yb(this);if(i!==null)switch(i.essence){case"multipart/form-data":{let r=C1(n,i);if(r==="failure")throw new TypeError("Failed to parse body as FormData.");let o=new Eb;return o[Uo]=r,o}case"application/x-www-form-urlencoded":{let r=new URLSearchParams(n.toString()),o=new Eb;for(let[s,a]of r)o.append(s,a);return o}}throw new TypeError('Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".')},e)},bytes(){return No(this,n=>new Uint8Array(n),e)}}}function k1(e){Object.assign(e.prototype,b1(e))}async function No(e,t,n){if(h1.brandCheck(e,n),bb(e))throw new TypeError("Body is unusable: Body has already been read");w1(e[Uo]);let i=f1(),r=s=>i.reject(s),o=s=>{try{i.resolve(t(s))}catch(a){r(a)}};return e[Uo].body==null?(o(Buffer.allocUnsafe(0)),i.promise):(await g1(e[Uo].body,o,r),i.promise)}function bb(e){let t=e[Uo].body;return t!=null&&(t.stream.locked||Ca.isDisturbed(t.stream))}function S1(e){return JSON.parse(Cb(e))}function yb(e){let t=e[Uo].headersList,n=p1(t);return n==="failure"?null:n}kb.exports={extractBody:wb,safelyExtractBody:Q1,cloneBody:v1,mixinBody:k1,streamRegistry:vb,hasFinalizationRegistry:Qb,bodyUnusable:bb}});var Gb=k((r3,zb)=>{"use strict";var V=require("node:assert"),P=ie(),{channels:Sb}=Bo(),vp=op(),{RequestContentLengthMismatchError:yi,ResponseContentLengthMismatchError:xb,RequestAbortedError:Fb,InvalidArgumentError:x1,HeadersTimeoutError:R1,HeadersOverflowError:D1,SocketError:To,InformationalError:Ci,BodyTimeoutError:_1,HTTPParserError:N1,ResponseExceededMaxSizeError:U1}=ue(),{kUrl:Mb,kReset:pt,kClient:tu,kParser:Be,kBlocking:va,kRunning:Ue,kPending:Lb,kSize:Rb,kWriting:Cn,kQueue:or,kNoRef:Ba,kKeepAliveDefaultTimeout:$1,kHostHeader:T1,kPendingIdx:F1,kRunningIdx:Jt,kError:nt,kPipelining:ru,kSocket:Bi,kKeepAliveTimeoutValue:iu,kMaxHeadersSize:wp,kKeepAliveMaxTimeout:M1,kKeepAliveTimeoutThreshold:L1,kHeadersTimeout:P1,kBodyTimeout:O1,kStrictContentLength:Sp,kMaxRequests:Db,kCounter:z1,kMaxResponseSize:G1,kOnError:_b,kResume:en,kHTTPContext:Pb}=ve(),kt=vw(),Nb=Buffer.alloc(0),Kc=Buffer[Symbol.species],Xc=P.addListener,V1=P.removeAllListeners,Qi=Symbol("kIdleSocketValidation"),Fo=Symbol("kIdleSocketValidationTimeout"),_p=Symbol("kSocketUsed"),bp;async function J1(){let e=process.env.JEST_WORKER_ID?Ap():void 0,t;try{t=await WebAssembly.compile(kw())}catch{t=await WebAssembly.compile(e||Ap())}return await WebAssembly.instantiate(t,{env:{wasm_on_url:(n,i,r)=>0,wasm_on_status:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onStatus(new Kc(xr.buffer,o,r))||0},wasm_on_message_begin:n=>(V(Re.ptr===n),Re.onMessageBegin()||0),wasm_on_header_field:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onHeaderField(new Kc(xr.buffer,o,r))||0},wasm_on_header_value:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onHeaderValue(new Kc(xr.buffer,o,r))||0},wasm_on_headers_complete:(n,i,r,o)=>(V(Re.ptr===n),Re.onHeadersComplete(i,!!r,!!o)||0),wasm_on_body:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onBody(new Kc(xr.buffer,o,r))||0},wasm_on_message_complete:n=>(V(Re.ptr===n),Re.onMessageComplete()||0)}})}var kp=null,xp=J1();xp.catch();var Re=null,xr=null,eu=0,Rr=null,Y1=0,Qa=1,Mo=2|Qa,nu=4|Qa,Rp=8|Y1,Dp=class{constructor(t,n,{exports:i}){V(Number.isFinite(t[wp])&&t[wp]>0),this.llhttp=i,this.ptr=this.llhttp.llhttp_alloc(kt.TYPE.RESPONSE),this.client=t,this.socket=n,this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.statusCode=null,this.statusText="",this.upgrade=!1,this.headers=[],this.headersSize=0,this.headersMaxSize=t[wp],this.shouldKeepAlive=!1,this.paused=!1,this.resume=this.resume.bind(this),this.bytesRead=0,this.keepAlive="",this.contentLength="",this.connection="",this.maxResponseSize=t[G1]}setTimeout(t,n){t!==this.timeoutValue||n&Qa^this.timeoutType&Qa?(this.timeout&&(vp.clearTimeout(this.timeout),this.timeout=null),t&&(n&Qa?this.timeout=vp.setFastTimeout(Ub,t,new WeakRef(this)):(this.timeout=setTimeout(Ub,t,new WeakRef(this)),this.timeout.unref())),this.timeoutValue=t):this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.timeoutType=n}resume(){this.socket.destroyed||!this.paused||(V(this.ptr!=null),V(Re==null),this.llhttp.llhttp_resume(this.ptr),V(this.timeoutType===nu),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.paused=!1,this.execute(this.socket.read()||Nb),this.readMore())}readMore(){for(;!this.paused&&this.ptr;){let t=this.socket.read();if(t===null)break;this.execute(t)}}execute(t){V(this.ptr!=null),V(Re==null),V(!this.paused);let{socket:n,llhttp:i}=this;t.length>eu&&(Rr&&i.free(Rr),eu=Math.ceil(t.length/4096)*4096,Rr=i.malloc(eu)),new Uint8Array(i.memory.buffer,Rr,eu).set(t);try{let r;try{xr=t,Re=this,r=i.llhttp_execute(this.ptr,Rr,t.length)}catch(s){throw s}finally{Re=null,xr=null}let o=i.llhttp_get_error_pos(this.ptr)-Rr;if(r!==kt.ERROR.OK){let s=t.subarray(o);if(r===kt.ERROR.PAUSED_UPGRADE)this.onUpgrade(s);else if(r===kt.ERROR.PAUSED)this.paused=!0,n.unshift(s);else throw this.createError(r,s)}}catch(r){P.destroy(n,r)}}finish(){V(Re===null),V(this.ptr!=null),V(!this.paused);let{llhttp:t}=this,n;try{Re=this,n=t.llhttp_finish(this.ptr)}finally{Re=null}return n===kt.ERROR.OK?null:n===kt.ERROR.PAUSED||n===kt.ERROR.PAUSED_UPGRADE?(this.paused=!0,null):this.createError(n,Nb)}createError(t,n){let{llhttp:i,contentLength:r,bytesRead:o}=this;if(r&&o!==parseInt(r,10))return new xb;let s=i.llhttp_get_error_reason(this.ptr),a="";if(s){let A=new Uint8Array(i.memory.buffer,s).indexOf(0);a="Response does not match the HTTP/1.1 protocol ("+Buffer.from(i.memory.buffer,s,A).toString()+")"}return new N1(a,kt.ERROR[t],n)}destroy(){V(this.ptr!=null),V(Re==null),this.llhttp.llhttp_free(this.ptr),this.ptr=null,this.timeout&&vp.clearTimeout(this.timeout),this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.paused=!1}onStatus(t){this.statusText=t.toString()}onMessageBegin(){let{socket:t,client:n}=this;if(t.destroyed)return-1;if(n[Ue]===0)return P.destroy(t,new To("bad response",P.getSocketInfo(t))),-1;let i=n[or][n[Jt]];if(!i)return-1;i.onResponseStarted()}onHeaderField(t){let n=this.headers.length;(n&1)===0?this.headers.push(t):this.headers[n-1]=Buffer.concat([this.headers[n-1],t]),this.trackHeader(t.length)}onHeaderValue(t){let n=this.headers.length;(n&1)===1?(this.headers.push(t),n+=1):this.headers[n-1]=Buffer.concat([this.headers[n-1],t]);let i=this.headers[n-2];if(i.length===10){let r=P.bufferToLowerCasedHeaderName(i);r==="keep-alive"?this.keepAlive+=t.toString():r==="connection"&&(this.connection+=t.toString())}else i.length===14&&P.bufferToLowerCasedHeaderName(i)==="content-length"&&(this.contentLength+=t.toString());this.trackHeader(t.length)}trackHeader(t){this.headersSize+=t,this.headersSize>=this.headersMaxSize&&P.destroy(this.socket,new D1)}onUpgrade(t){let{upgrade:n,client:i,socket:r,headers:o,statusCode:s,statusText:a}=this;V(n),V(i[Bi]===r),V(!r.destroyed),V(!this.paused),V((o.length&1)===0);let A=i[or][i[Jt]];V(A),V(A.upgrade||A.method==="CONNECT"),this.statusCode=null,this.statusText="",this.shouldKeepAlive=null,this.headers=[],this.headersSize=0,r.unshift(t),r[Be].destroy(),r[Be]=null,r[tu]=null,r[nt]=null,V1(r),i[Bi]=null,i[Pb]=null,i[or][i[Jt]++]=null,i.emit("disconnect",i[Mb],[i],new Ci("upgrade"));try{A.onUpgrade(s,o,r,a)}catch(c){P.errorRequest(i,A,c),P.destroy(r,c)}i[en]()}onHeadersComplete(t,n,i){let{client:r,socket:o,headers:s,statusText:a}=this;if(o.destroyed)return-1;if(r[Ue]===0)return P.destroy(o,new To("bad response",P.getSocketInfo(o))),-1;let A=r[or][r[Jt]];if(!A)return-1;if(V(!this.upgrade),V(this.statusCode<200),t===100)return P.destroy(o,new To("bad response",P.getSocketInfo(o))),-1;if(n&&!A.upgrade)return P.destroy(o,new To("bad upgrade",P.getSocketInfo(o))),-1;if(V(this.timeoutType===Mo),this.statusCode=t,this.shouldKeepAlive=i||A.method==="HEAD"&&!o[pt]&&this.connection.toLowerCase()==="keep-alive",this.statusCode>=200){let l=A.bodyTimeout!=null?A.bodyTimeout:r[O1];this.setTimeout(l,nu)}else this.timeout&&this.timeout.refresh&&this.timeout.refresh();if(A.method==="CONNECT")return V(r[Ue]===1),this.upgrade=!0,2;if(n)return V(r[Ue]===1),this.upgrade=!0,2;if(V((this.headers.length&1)===0),this.headers=[],this.headersSize=0,this.shouldKeepAlive&&r[ru]){let l=this.keepAlive?P.parseKeepAliveTimeout(this.keepAlive):null;if(l!=null){let d=Math.min(l-r[L1],r[M1]);d<=0?o[pt]=!0:r[iu]=d}else r[iu]=r[$1]}else o[pt]=!0;let c=A.onHeaders(t,s,this.resume,a)===!1;return A.aborted?-1:A.method==="HEAD"||t<200?1:(o[va]&&(o[va]=!1,r[en]()),c?kt.ERROR.PAUSED:0)}onBody(t){let{client:n,socket:i,statusCode:r,maxResponseSize:o}=this;if(i.destroyed)return-1;let s=n[or][n[Jt]];if(V(s),V(this.timeoutType===nu),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),V(r>=200),o>-1&&this.bytesRead+t.length>o)return P.destroy(i,new U1),-1;if(this.bytesRead+=t.length,s.onData(t)===!1)return kt.ERROR.PAUSED}onMessageComplete(){let{client:t,socket:n,statusCode:i,upgrade:r,headers:o,contentLength:s,bytesRead:a,shouldKeepAlive:A}=this;if(n.destroyed&&(!i||A))return-1;if(r)return;V(i>=100),V((this.headers.length&1)===0);let c=t[or][t[Jt]];if(V(c),this.statusCode=null,this.statusText="",this.bytesRead=0,this.contentLength="",this.keepAlive="",this.connection="",this.headers=[],this.headersSize=0,!(i<200)){if(c.method!=="HEAD"&&s&&a!==parseInt(s,10))return P.destroy(n,new xb),-1;if(c.onComplete(o),t[or][t[Jt]++]=null,n[_p]=!0,n[Cn])return V(t[Ue]===0),P.destroy(n,new Ci("reset")),kt.ERROR.PAUSED;if(A){if(n[pt]&&t[Ue]===0)return P.destroy(n,new Ci("reset")),kt.ERROR.PAUSED;t[ru]==null||t[ru]===1?setImmediate(()=>t[en]()):t[en]()}else return P.destroy(n,new Ci("reset")),kt.ERROR.PAUSED}}};function Ub(e){let{socket:t,timeoutType:n,client:i,paused:r}=e.deref();n===Mo?(!t[Cn]||t.writableNeedDrain||i[Ue]>1)&&(V(!r,"cannot be paused while waiting for headers"),P.destroy(t,new R1)):n===nu?r||P.destroy(t,new _1):n===Rp&&(V(i[Ue]===0&&i[iu]),P.destroy(t,new Ci("socket idle timeout")))}async function j1(e,t){e[Bi]=t,kp||(kp=await xp,xp=null),t[Ba]=!1,t[Cn]=!1,t[pt]=!1,t[va]=!1,t[Qi]=0,t[Fo]=null,t[_p]=!1,t[Be]=new Dp(e,t,kp),Xc(t,"error",function(i){let r=this[Be];if(i.code==="ECONNRESET"&&r.statusCode&&!r.shouldKeepAlive){let o=r.finish();o&&(this[nt]=o,this[tu][_b](o));return}this[nt]=i,this[tu][_b](i)}),Xc(t,"readable",function(){let i=this[Be];i&&i.readMore()}),Xc(t,"end",function(){let i=this[Be];if(i.statusCode&&!i.shouldKeepAlive){let r=i.finish();r&&P.destroy(this,r);return}P.destroy(this,new To("other side closed",P.getSocketInfo(this)))}),Xc(t,"close",function(){let i=this[tu],r=this[Be];Ob(this),r&&(!this[nt]&&r.statusCode&&!r.shouldKeepAlive&&(this[nt]=r.finish()||this[nt]),this[Be].destroy(),this[Be]=null);let o=this[nt]||new To("closed",P.getSocketInfo(this));if(i[Bi]=null,i[Pb]=null,i.destroyed){V(i[Lb]===0);let s=i[or].splice(i[Jt]);for(let a=0;a<s.length;a++){let A=s[a];P.errorRequest(i,A,o)}}else if(i[Ue]>0&&o.code!=="UND_ERR_INFO"){let s=i[or][i[Jt]];i[or][i[Jt]++]=null,P.errorRequest(i,s,o)}i[F1]=i[Jt],V(i[Ue]===0),i.emit("disconnect",i[Mb],[i],o),i[en]()});let n=!1;return t.on("close",()=>{n=!0}),{version:"h1",defaultPipelining:1,write(...i){return Z1(e,...i)},resume(){q1(e)},destroy(i,r){n?queueMicrotask(r):t.destroy(i).on("close",r)},get destroyed(){return t.destroyed},busy(i){return!!(t[Cn]||t[pt]||t[va]||t[Qi]===1||i&&(e[Ue]>0&&!i.idempotent||e[Ue]>0&&(i.upgrade||i.method==="CONNECT")||e[Ue]>0&&P.bodyLength(i.body)!==0&&(P.isStream(i.body)||P.isAsyncIterable(i.body)||P.isFormDataLike(i.body))))}}}function Ob(e){e[Fo]&&(clearImmediate(e[Fo]),e[Fo]=null),e[Qi]=0}function H1(e,t){t[Qi]=1,t[Fo]=setImmediate(()=>{t[Fo]=null,t[Qi]=2,e[Bi]===t&&!t.destroyed&&e[en]()})}function q1(e){let t=e[Bi];if(t&&!t.destroyed){if(e[Rb]===0?!t[Ba]&&t.unref&&(t.unref(),t[Ba]=!0):t[Ba]&&t.ref&&(t.ref(),t[Ba]=!1),e[Ue]===0&&e[Lb]>0&&t[_p]){if(t[Qi]===0)return H1(e,t),t[Be].readMore(),t.destroyed,void 0;if(t[Qi]===1)return t[Be].readMore(),t.destroyed,void 0}if(e[Ue]===0&&(t[Be].readMore(),t.destroyed))return;if(e[Rb]===0)t[Be].timeoutType!==Rp&&t[Be].setTimeout(e[iu],Rp);else if(e[Ue]>0&&t[Be].statusCode<200&&t[Be].timeoutType!==Mo){let n=e[or][e[Jt]],i=n.headersTimeout!=null?n.headersTimeout:e[P1];t[Be].setTimeout(i,Mo)}}}function W1(e){return e!=="GET"&&e!=="HEAD"&&e!=="OPTIONS"&&e!=="TRACE"&&e!=="CONNECT"}function Z1(e,t){let{method:n,path:i,host:r,upgrade:o,blocking:s,reset:a}=t,{body:A,headers:c,contentLength:l}=t,d=n==="PUT"||n==="POST"||n==="PATCH"||n==="QUERY"||n==="PROPFIND"||n==="PROPPATCH";if(P.isFormDataLike(A)){bp||(bp=$o().extractBody);let[E,m]=bp(A);t.contentType==null&&c.push("content-type",m),A=E.stream,l=E.length}else if(P.isBlobLike(A)&&t.contentType==null){let E=A.type;if(E){let m=`${E}`;if(!P.isValidHeaderValue(m))return P.errorRequest(e,t,new x1("invalid content-type header")),!1;c.push("content-type",m)}}A&&typeof A.read=="function"&&A.read(0);let f=P.bodyLength(A);if(l=f??l,l===null&&(l=t.contentLength),l===0&&!d&&(l=null),W1(n)&&l>0&&t.contentLength!==null&&t.contentLength!==l){if(e[Sp])return P.errorRequest(e,t,new yi),!1;process.emitWarning(new yi)}let g=e[Bi];Ob(g);let p=E=>{if(!t.aborted){if(t.completed){(t.upgrade||t.method==="CONNECT")&&P.destroy(g,new Ci("aborted"));return}P.errorRequest(e,t,E||new Fb),P.destroy(A),P.destroy(g,new Ci("aborted"))}};try{t.onConnect(p)}catch(E){P.errorRequest(e,t,E)}if(t.aborted)return!1;n==="HEAD"&&(g[pt]=!0),(o||n==="CONNECT")&&(g[pt]=!0),a!=null&&(g[pt]=a),e[Db]&&g[z1]++>=e[Db]&&(g[pt]=!0),s&&(g[va]=!0);let h=`${n} ${i} HTTP/1.1\r
|
|
14
|
+
`);f.push(h),o+=h.byteLength,p&&(o=null),r=e,i=async function*(){for(let E of f)E.stream?yield*E.stream():yield E},s=`multipart/form-data; boundary=${A}`}else if(Ib(e))r=e,o=e.size,e.type&&(s=e.type);else if(typeof e[Symbol.asyncIterator]=="function"){if(t)throw new TypeError("keepalive");if(Ca.isDisturbed(e)||e.locked)throw new TypeError("Response body object should not be disturbed or locked");n=e instanceof ReadableStream?e:u1(e)}if((typeof r=="string"||Ca.isBuffer(r))&&(o=Buffer.byteLength(r)),i!=null){let A;n=new ReadableStream({async start(){A=i(e)[Symbol.asyncIterator]()},async pull(c){let{value:l,done:d}=await A.next();if(d)queueMicrotask(()=>{c.close(),c.byobRequest?.respond(0)});else if(!Bb(n)){let f=new Uint8Array(l);f.byteLength&&c.enqueue(f)}return c.desiredSize>0},async cancel(c){await A.return()},type:"bytes"})}return[{stream:n,source:r,length:o},s]}function Q1(e,t=!1){return e instanceof ReadableStream&&(Bp(!Ca.isDisturbed(e),"The body has already been consumed."),Bp(!e.locked,"The stream is locked.")),wb(e,t)}function v1(e,t){let[n,i]=t.stream.tee();return t.stream=n,{stream:i,length:t.length,source:t.source}}function w1(e){if(e.aborted)throw new DOMException("The operation was aborted.","AbortError")}function b1(e){return{blob(){return No(this,n=>{let i=yb(this);return i===null?i="":i&&(i=y1(i)),new m1([n],{type:i})},e)},arrayBuffer(){return No(this,n=>new Uint8Array(n).buffer,e)},text(){return No(this,Cb,e)},json(){return No(this,S1,e)},formData(){return No(this,n=>{let i=yb(this);if(i!==null)switch(i.essence){case"multipart/form-data":{let r=C1(n,i);if(r==="failure")throw new TypeError("Failed to parse body as FormData.");let o=new Eb;return o[Uo]=r,o}case"application/x-www-form-urlencoded":{let r=new URLSearchParams(n.toString()),o=new Eb;for(let[s,a]of r)o.append(s,a);return o}}throw new TypeError('Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".')},e)},bytes(){return No(this,n=>new Uint8Array(n),e)}}}function k1(e){Object.assign(e.prototype,b1(e))}async function No(e,t,n){if(h1.brandCheck(e,n),bb(e))throw new TypeError("Body is unusable: Body has already been read");w1(e[Uo]);let i=f1(),r=s=>i.reject(s),o=s=>{try{i.resolve(t(s))}catch(a){r(a)}};return e[Uo].body==null?(o(Buffer.allocUnsafe(0)),i.promise):(await g1(e[Uo].body,o,r),i.promise)}function bb(e){let t=e[Uo].body;return t!=null&&(t.stream.locked||Ca.isDisturbed(t.stream))}function S1(e){return JSON.parse(Cb(e))}function yb(e){let t=e[Uo].headersList,n=p1(t);return n==="failure"?null:n}kb.exports={extractBody:wb,safelyExtractBody:Q1,cloneBody:v1,mixinBody:k1,streamRegistry:vb,hasFinalizationRegistry:Qb,bodyUnusable:bb}});var Gb=k((r3,zb)=>{"use strict";var V=require("node:assert"),O=ie(),{channels:Sb}=Bo(),vp=op(),{RequestContentLengthMismatchError:yi,ResponseContentLengthMismatchError:xb,RequestAbortedError:Fb,InvalidArgumentError:x1,HeadersTimeoutError:R1,HeadersOverflowError:D1,SocketError:To,InformationalError:Ci,BodyTimeoutError:_1,HTTPParserError:N1,ResponseExceededMaxSizeError:U1}=ue(),{kUrl:Mb,kReset:pt,kClient:tu,kParser:Be,kBlocking:va,kRunning:Ue,kPending:Lb,kSize:Rb,kWriting:Cn,kQueue:or,kNoRef:Ba,kKeepAliveDefaultTimeout:$1,kHostHeader:T1,kPendingIdx:F1,kRunningIdx:Jt,kError:nt,kPipelining:ru,kSocket:Bi,kKeepAliveTimeoutValue:iu,kMaxHeadersSize:wp,kKeepAliveMaxTimeout:M1,kKeepAliveTimeoutThreshold:L1,kHeadersTimeout:P1,kBodyTimeout:O1,kStrictContentLength:Sp,kMaxRequests:Db,kCounter:z1,kMaxResponseSize:G1,kOnError:_b,kResume:en,kHTTPContext:Pb}=ve(),kt=vw(),Nb=Buffer.alloc(0),Kc=Buffer[Symbol.species],Xc=O.addListener,V1=O.removeAllListeners,Qi=Symbol("kIdleSocketValidation"),Fo=Symbol("kIdleSocketValidationTimeout"),_p=Symbol("kSocketUsed"),bp;async function J1(){let e=process.env.JEST_WORKER_ID?Ap():void 0,t;try{t=await WebAssembly.compile(kw())}catch{t=await WebAssembly.compile(e||Ap())}return await WebAssembly.instantiate(t,{env:{wasm_on_url:(n,i,r)=>0,wasm_on_status:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onStatus(new Kc(xr.buffer,o,r))||0},wasm_on_message_begin:n=>(V(Re.ptr===n),Re.onMessageBegin()||0),wasm_on_header_field:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onHeaderField(new Kc(xr.buffer,o,r))||0},wasm_on_header_value:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onHeaderValue(new Kc(xr.buffer,o,r))||0},wasm_on_headers_complete:(n,i,r,o)=>(V(Re.ptr===n),Re.onHeadersComplete(i,!!r,!!o)||0),wasm_on_body:(n,i,r)=>{V(Re.ptr===n);let o=i-Rr+xr.byteOffset;return Re.onBody(new Kc(xr.buffer,o,r))||0},wasm_on_message_complete:n=>(V(Re.ptr===n),Re.onMessageComplete()||0)}})}var kp=null,xp=J1();xp.catch();var Re=null,xr=null,eu=0,Rr=null,Y1=0,Qa=1,Mo=2|Qa,nu=4|Qa,Rp=8|Y1,Dp=class{constructor(t,n,{exports:i}){V(Number.isFinite(t[wp])&&t[wp]>0),this.llhttp=i,this.ptr=this.llhttp.llhttp_alloc(kt.TYPE.RESPONSE),this.client=t,this.socket=n,this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.statusCode=null,this.statusText="",this.upgrade=!1,this.headers=[],this.headersSize=0,this.headersMaxSize=t[wp],this.shouldKeepAlive=!1,this.paused=!1,this.resume=this.resume.bind(this),this.bytesRead=0,this.keepAlive="",this.contentLength="",this.connection="",this.maxResponseSize=t[G1]}setTimeout(t,n){t!==this.timeoutValue||n&Qa^this.timeoutType&Qa?(this.timeout&&(vp.clearTimeout(this.timeout),this.timeout=null),t&&(n&Qa?this.timeout=vp.setFastTimeout(Ub,t,new WeakRef(this)):(this.timeout=setTimeout(Ub,t,new WeakRef(this)),this.timeout.unref())),this.timeoutValue=t):this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.timeoutType=n}resume(){this.socket.destroyed||!this.paused||(V(this.ptr!=null),V(Re==null),this.llhttp.llhttp_resume(this.ptr),V(this.timeoutType===nu),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),this.paused=!1,this.execute(this.socket.read()||Nb),this.readMore())}readMore(){for(;!this.paused&&this.ptr;){let t=this.socket.read();if(t===null)break;this.execute(t)}}execute(t){V(this.ptr!=null),V(Re==null),V(!this.paused);let{socket:n,llhttp:i}=this;t.length>eu&&(Rr&&i.free(Rr),eu=Math.ceil(t.length/4096)*4096,Rr=i.malloc(eu)),new Uint8Array(i.memory.buffer,Rr,eu).set(t);try{let r;try{xr=t,Re=this,r=i.llhttp_execute(this.ptr,Rr,t.length)}catch(s){throw s}finally{Re=null,xr=null}let o=i.llhttp_get_error_pos(this.ptr)-Rr;if(r!==kt.ERROR.OK){let s=t.subarray(o);if(r===kt.ERROR.PAUSED_UPGRADE)this.onUpgrade(s);else if(r===kt.ERROR.PAUSED)this.paused=!0,n.unshift(s);else throw this.createError(r,s)}}catch(r){O.destroy(n,r)}}finish(){V(Re===null),V(this.ptr!=null),V(!this.paused);let{llhttp:t}=this,n;try{Re=this,n=t.llhttp_finish(this.ptr)}finally{Re=null}return n===kt.ERROR.OK?null:n===kt.ERROR.PAUSED||n===kt.ERROR.PAUSED_UPGRADE?(this.paused=!0,null):this.createError(n,Nb)}createError(t,n){let{llhttp:i,contentLength:r,bytesRead:o}=this;if(r&&o!==parseInt(r,10))return new xb;let s=i.llhttp_get_error_reason(this.ptr),a="";if(s){let A=new Uint8Array(i.memory.buffer,s).indexOf(0);a="Response does not match the HTTP/1.1 protocol ("+Buffer.from(i.memory.buffer,s,A).toString()+")"}return new N1(a,kt.ERROR[t],n)}destroy(){V(this.ptr!=null),V(Re==null),this.llhttp.llhttp_free(this.ptr),this.ptr=null,this.timeout&&vp.clearTimeout(this.timeout),this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.paused=!1}onStatus(t){this.statusText=t.toString()}onMessageBegin(){let{socket:t,client:n}=this;if(t.destroyed)return-1;if(n[Ue]===0)return O.destroy(t,new To("bad response",O.getSocketInfo(t))),-1;let i=n[or][n[Jt]];if(!i)return-1;i.onResponseStarted()}onHeaderField(t){let n=this.headers.length;(n&1)===0?this.headers.push(t):this.headers[n-1]=Buffer.concat([this.headers[n-1],t]),this.trackHeader(t.length)}onHeaderValue(t){let n=this.headers.length;(n&1)===1?(this.headers.push(t),n+=1):this.headers[n-1]=Buffer.concat([this.headers[n-1],t]);let i=this.headers[n-2];if(i.length===10){let r=O.bufferToLowerCasedHeaderName(i);r==="keep-alive"?this.keepAlive+=t.toString():r==="connection"&&(this.connection+=t.toString())}else i.length===14&&O.bufferToLowerCasedHeaderName(i)==="content-length"&&(this.contentLength+=t.toString());this.trackHeader(t.length)}trackHeader(t){this.headersSize+=t,this.headersSize>=this.headersMaxSize&&O.destroy(this.socket,new D1)}onUpgrade(t){let{upgrade:n,client:i,socket:r,headers:o,statusCode:s,statusText:a}=this;V(n),V(i[Bi]===r),V(!r.destroyed),V(!this.paused),V((o.length&1)===0);let A=i[or][i[Jt]];V(A),V(A.upgrade||A.method==="CONNECT"),this.statusCode=null,this.statusText="",this.shouldKeepAlive=null,this.headers=[],this.headersSize=0,r.unshift(t),r[Be].destroy(),r[Be]=null,r[tu]=null,r[nt]=null,V1(r),i[Bi]=null,i[Pb]=null,i[or][i[Jt]++]=null,i.emit("disconnect",i[Mb],[i],new Ci("upgrade"));try{A.onUpgrade(s,o,r,a)}catch(c){O.errorRequest(i,A,c),O.destroy(r,c)}i[en]()}onHeadersComplete(t,n,i){let{client:r,socket:o,headers:s,statusText:a}=this;if(o.destroyed)return-1;if(r[Ue]===0)return O.destroy(o,new To("bad response",O.getSocketInfo(o))),-1;let A=r[or][r[Jt]];if(!A)return-1;if(V(!this.upgrade),V(this.statusCode<200),t===100)return O.destroy(o,new To("bad response",O.getSocketInfo(o))),-1;if(n&&!A.upgrade)return O.destroy(o,new To("bad upgrade",O.getSocketInfo(o))),-1;if(V(this.timeoutType===Mo),this.statusCode=t,this.shouldKeepAlive=i||A.method==="HEAD"&&!o[pt]&&this.connection.toLowerCase()==="keep-alive",this.statusCode>=200){let l=A.bodyTimeout!=null?A.bodyTimeout:r[O1];this.setTimeout(l,nu)}else this.timeout&&this.timeout.refresh&&this.timeout.refresh();if(A.method==="CONNECT")return V(r[Ue]===1),this.upgrade=!0,2;if(n)return V(r[Ue]===1),this.upgrade=!0,2;if(V((this.headers.length&1)===0),this.headers=[],this.headersSize=0,this.shouldKeepAlive&&r[ru]){let l=this.keepAlive?O.parseKeepAliveTimeout(this.keepAlive):null;if(l!=null){let d=Math.min(l-r[L1],r[M1]);d<=0?o[pt]=!0:r[iu]=d}else r[iu]=r[$1]}else o[pt]=!0;let c=A.onHeaders(t,s,this.resume,a)===!1;return A.aborted?-1:A.method==="HEAD"||t<200?1:(o[va]&&(o[va]=!1,r[en]()),c?kt.ERROR.PAUSED:0)}onBody(t){let{client:n,socket:i,statusCode:r,maxResponseSize:o}=this;if(i.destroyed)return-1;let s=n[or][n[Jt]];if(V(s),V(this.timeoutType===nu),this.timeout&&this.timeout.refresh&&this.timeout.refresh(),V(r>=200),o>-1&&this.bytesRead+t.length>o)return O.destroy(i,new U1),-1;if(this.bytesRead+=t.length,s.onData(t)===!1)return kt.ERROR.PAUSED}onMessageComplete(){let{client:t,socket:n,statusCode:i,upgrade:r,headers:o,contentLength:s,bytesRead:a,shouldKeepAlive:A}=this;if(n.destroyed&&(!i||A))return-1;if(r)return;V(i>=100),V((this.headers.length&1)===0);let c=t[or][t[Jt]];if(V(c),this.statusCode=null,this.statusText="",this.bytesRead=0,this.contentLength="",this.keepAlive="",this.connection="",this.headers=[],this.headersSize=0,!(i<200)){if(c.method!=="HEAD"&&s&&a!==parseInt(s,10))return O.destroy(n,new xb),-1;if(c.onComplete(o),t[or][t[Jt]++]=null,n[_p]=!0,n[Cn])return V(t[Ue]===0),O.destroy(n,new Ci("reset")),kt.ERROR.PAUSED;if(A){if(n[pt]&&t[Ue]===0)return O.destroy(n,new Ci("reset")),kt.ERROR.PAUSED;t[ru]==null||t[ru]===1?setImmediate(()=>t[en]()):t[en]()}else return O.destroy(n,new Ci("reset")),kt.ERROR.PAUSED}}};function Ub(e){let{socket:t,timeoutType:n,client:i,paused:r}=e.deref();n===Mo?(!t[Cn]||t.writableNeedDrain||i[Ue]>1)&&(V(!r,"cannot be paused while waiting for headers"),O.destroy(t,new R1)):n===nu?r||O.destroy(t,new _1):n===Rp&&(V(i[Ue]===0&&i[iu]),O.destroy(t,new Ci("socket idle timeout")))}async function j1(e,t){e[Bi]=t,kp||(kp=await xp,xp=null),t[Ba]=!1,t[Cn]=!1,t[pt]=!1,t[va]=!1,t[Qi]=0,t[Fo]=null,t[_p]=!1,t[Be]=new Dp(e,t,kp),Xc(t,"error",function(i){let r=this[Be];if(i.code==="ECONNRESET"&&r.statusCode&&!r.shouldKeepAlive){let o=r.finish();o&&(this[nt]=o,this[tu][_b](o));return}this[nt]=i,this[tu][_b](i)}),Xc(t,"readable",function(){let i=this[Be];i&&i.readMore()}),Xc(t,"end",function(){let i=this[Be];if(i.statusCode&&!i.shouldKeepAlive){let r=i.finish();r&&O.destroy(this,r);return}O.destroy(this,new To("other side closed",O.getSocketInfo(this)))}),Xc(t,"close",function(){let i=this[tu],r=this[Be];Ob(this),r&&(!this[nt]&&r.statusCode&&!r.shouldKeepAlive&&(this[nt]=r.finish()||this[nt]),this[Be].destroy(),this[Be]=null);let o=this[nt]||new To("closed",O.getSocketInfo(this));if(i[Bi]=null,i[Pb]=null,i.destroyed){V(i[Lb]===0);let s=i[or].splice(i[Jt]);for(let a=0;a<s.length;a++){let A=s[a];O.errorRequest(i,A,o)}}else if(i[Ue]>0&&o.code!=="UND_ERR_INFO"){let s=i[or][i[Jt]];i[or][i[Jt]++]=null,O.errorRequest(i,s,o)}i[F1]=i[Jt],V(i[Ue]===0),i.emit("disconnect",i[Mb],[i],o),i[en]()});let n=!1;return t.on("close",()=>{n=!0}),{version:"h1",defaultPipelining:1,write(...i){return Z1(e,...i)},resume(){q1(e)},destroy(i,r){n?queueMicrotask(r):t.destroy(i).on("close",r)},get destroyed(){return t.destroyed},busy(i){return!!(t[Cn]||t[pt]||t[va]||t[Qi]===1||i&&(e[Ue]>0&&!i.idempotent||e[Ue]>0&&(i.upgrade||i.method==="CONNECT")||e[Ue]>0&&O.bodyLength(i.body)!==0&&(O.isStream(i.body)||O.isAsyncIterable(i.body)||O.isFormDataLike(i.body))))}}}function Ob(e){e[Fo]&&(clearImmediate(e[Fo]),e[Fo]=null),e[Qi]=0}function H1(e,t){t[Qi]=1,t[Fo]=setImmediate(()=>{t[Fo]=null,t[Qi]=2,e[Bi]===t&&!t.destroyed&&e[en]()})}function q1(e){let t=e[Bi];if(t&&!t.destroyed){if(e[Rb]===0?!t[Ba]&&t.unref&&(t.unref(),t[Ba]=!0):t[Ba]&&t.ref&&(t.ref(),t[Ba]=!1),e[Ue]===0&&e[Lb]>0&&t[_p]){if(t[Qi]===0)return H1(e,t),t[Be].readMore(),t.destroyed,void 0;if(t[Qi]===1)return t[Be].readMore(),t.destroyed,void 0}if(e[Ue]===0&&(t[Be].readMore(),t.destroyed))return;if(e[Rb]===0)t[Be].timeoutType!==Rp&&t[Be].setTimeout(e[iu],Rp);else if(e[Ue]>0&&t[Be].statusCode<200&&t[Be].timeoutType!==Mo){let n=e[or][e[Jt]],i=n.headersTimeout!=null?n.headersTimeout:e[P1];t[Be].setTimeout(i,Mo)}}}function W1(e){return e!=="GET"&&e!=="HEAD"&&e!=="OPTIONS"&&e!=="TRACE"&&e!=="CONNECT"}function Z1(e,t){let{method:n,path:i,host:r,upgrade:o,blocking:s,reset:a}=t,{body:A,headers:c,contentLength:l}=t,d=n==="PUT"||n==="POST"||n==="PATCH"||n==="QUERY"||n==="PROPFIND"||n==="PROPPATCH";if(O.isFormDataLike(A)){bp||(bp=$o().extractBody);let[E,m]=bp(A);t.contentType==null&&c.push("content-type",m),A=E.stream,l=E.length}else if(O.isBlobLike(A)&&t.contentType==null){let E=A.type;if(E){let m=`${E}`;if(!O.isValidHeaderValue(m))return O.errorRequest(e,t,new x1("invalid content-type header")),!1;c.push("content-type",m)}}A&&typeof A.read=="function"&&A.read(0);let f=O.bodyLength(A);if(l=f??l,l===null&&(l=t.contentLength),l===0&&!d&&(l=null),W1(n)&&l>0&&t.contentLength!==null&&t.contentLength!==l){if(e[Sp])return O.errorRequest(e,t,new yi),!1;process.emitWarning(new yi)}let g=e[Bi];Ob(g);let p=E=>{if(!t.aborted){if(t.completed){(t.upgrade||t.method==="CONNECT")&&O.destroy(g,new Ci("aborted"));return}O.errorRequest(e,t,E||new Fb),O.destroy(A),O.destroy(g,new Ci("aborted"))}};try{t.onConnect(p)}catch(E){O.errorRequest(e,t,E)}if(t.aborted)return!1;n==="HEAD"&&(g[pt]=!0),(o||n==="CONNECT")&&(g[pt]=!0),a!=null&&(g[pt]=a),e[Db]&&g[z1]++>=e[Db]&&(g[pt]=!0),s&&(g[va]=!0);let h=`${n} ${i} HTTP/1.1\r
|
|
15
15
|
`;if(typeof r=="string"?h+=`host: ${r}\r
|
|
16
16
|
`:h+=e[T1],o?h+=`connection: upgrade\r
|
|
17
17
|
upgrade: ${o}\r
|
|
@@ -19,7 +19,7 @@ upgrade: ${o}\r
|
|
|
19
19
|
`:h+=`connection: close\r
|
|
20
20
|
`,Array.isArray(c))for(let E=0;E<c.length;E+=2){let m=c[E+0],C=c[E+1];if(Array.isArray(C))for(let w=0;w<C.length;w++)h+=`${m}: ${C[w]}\r
|
|
21
21
|
`;else h+=`${m}: ${C}\r
|
|
22
|
-
`}return Sb.sendHeaders.hasSubscribers&&Sb.sendHeaders.publish({request:t,headers:h,socket:g}),!A||f===0?$b(p,null,e,t,g,l,h,d):
|
|
22
|
+
`}return Sb.sendHeaders.hasSubscribers&&Sb.sendHeaders.publish({request:t,headers:h,socket:g}),!A||f===0?$b(p,null,e,t,g,l,h,d):O.isBuffer(A)?$b(p,A,e,t,g,l,h,d):O.isBlobLike(A)?typeof A.stream=="function"?Tb(p,A.stream(),e,t,g,l,h,d):X1(p,A,e,t,g,l,h,d):O.isStream(A)?K1(p,A,e,t,g,l,h,d):O.isIterable(A)?Tb(p,A,e,t,g,l,h,d):V(!1),!0}function K1(e,t,n,i,r,o,s,a){V(o!==0||n[Ue]===0,"stream body cannot be pipelined");let A=!1,c=new ou({abort:e,socket:r,request:i,contentLength:o,client:n,expectsPayload:a,header:s}),l=function(p){if(!A)try{!c.write(p)&&this.pause&&this.pause()}catch(h){O.destroy(this,h)}},d=function(){A||t.resume&&t.resume()},f=function(){if(queueMicrotask(()=>{t.removeListener("error",g)}),!A){let p=new Fb;queueMicrotask(()=>g(p))}},g=function(p){if(!A){if(A=!0,V(r.destroyed||r[Cn]&&n[Ue]<=1),r.off("drain",d).off("error",g),t.removeListener("data",l).removeListener("end",g).removeListener("close",f),!p)try{c.end()}catch(h){p=h}c.destroy(p),p&&(p.code!=="UND_ERR_INFO"||p.message!=="reset")?O.destroy(t,p):O.destroy(t)}};t.on("data",l).on("end",g).on("error",g).on("close",f),t.resume&&t.resume(),r.on("drain",d).on("error",g),t.errorEmitted??t.errored?setImmediate(()=>g(t.errored)):(t.endEmitted??t.readableEnded)&&setImmediate(()=>g(null)),(t.closeEmitted??t.closed)&&setImmediate(f)}function $b(e,t,n,i,r,o,s,a){try{t?O.isBuffer(t)&&(V(o===t.byteLength,"buffer body must have content length"),r.cork(),r.write(`${s}content-length: ${o}\r
|
|
23
23
|
\r
|
|
24
24
|
`,"latin1"),r.write(t),r.uncork(),i.onBodySent(t),!a&&i.reset!==!1&&(r[pt]=!0)):o===0?r.write(`${s}content-length: 0\r
|
|
25
25
|
\r
|
|
@@ -42,7 +42,7 @@ ${c.toString(16)}\r
|
|
|
42
42
|
${i.count} ${i.noun} ${i.is} pending:
|
|
43
43
|
|
|
44
44
|
${t.format(n)}
|
|
45
|
-
`.trim())}};Dx.exports=Kh});var Ga=k((M3,Tx)=>{"use strict";var Nx=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:J2}=ue(),Y2=Vo();$x()===void 0&&Ux(new Y2);function Ux(e){if(!e||typeof e.dispatch!="function")throw new J2("Argument agent must implement Agent");Object.defineProperty(globalThis,Nx,{value:e,writable:!0,enumerable:!1,configurable:!1})}function $x(){return globalThis[Nx]}Tx.exports={setGlobalDispatcher:Ux,getGlobalDispatcher:$x}});var Nu=k((P3,Fx)=>{"use strict";Fx.exports=class{#e;constructor(t){if(typeof t!="object"||t===null)throw new TypeError("handler must be an object");this.#e=t}onConnect(...t){return this.#e.onConnect?.(...t)}onError(...t){return this.#e.onError?.(...t)}onUpgrade(...t){return this.#e.onUpgrade?.(...t)}onResponseStarted(...t){return this.#e.onResponseStarted?.(...t)}onHeaders(...t){return this.#e.onHeaders?.(...t)}onData(...t){return this.#e.onData?.(...t)}onComplete(...t){return this.#e.onComplete?.(...t)}onBodySent(...t){return this.#e.onBodySent?.(...t)}}});var Lx=k((O3,Mx)=>{"use strict";var j2=du();Mx.exports=e=>{let t=e?.maxRedirections;return n=>function(r,o){let{maxRedirections:s=t,...a}=r;if(!s)return n(r,o);let A=new j2(n,s,r,o);return n(a,A)}}});var Ox=k((z3,Px)=>{"use strict";var H2=Qu();Px.exports=e=>t=>function(i,r){return t(i,new H2({...i,retryOptions:{...e,...i.retryOptions}},{handler:r,dispatch:t}))}});var Gx=k((G3,zx)=>{"use strict";var q2=ie(),{InvalidArgumentError:W2,RequestAbortedError:Z2}=ue(),K2=Nu(),Xh=class extends K2{#e=1024*1024;#t=null;#r=!1;#i=!1;#o=0;#n=null;#s=null;constructor({maxSize:t},n){if(super(n),t!=null&&(!Number.isFinite(t)||t<1))throw new W2("maxSize must be a number greater than 0");this.#e=t??this.#e,this.#s=n}onConnect(t){this.#t=t,this.#s.onConnect(this.#a.bind(this))}#a(t){this.#i=!0,this.#n=t}onHeaders(t,n,i,r){let s=q2.parseHeaders(n)["content-length"];if(s!=null&&s>this.#e)throw new Z2(`Response size (${s}) larger than maxSize (${this.#e})`);return this.#i?!0:this.#s.onHeaders(t,n,i,r)}onError(t){this.#r||(t=this.#n??t,this.#s.onError(t))}onData(t){return this.#o=this.#o+t.length,this.#o>=this.#e&&(this.#r=!0,this.#i?this.#s.onError(this.#n):this.#s.onComplete([])),!0}onComplete(t){if(!this.#r){if(this.#i){this.#s.onError(this.reason);return}this.#s.onComplete(t)}}};function X2({maxSize:e}={maxSize:1024*1024}){return t=>function(i,r){let{dumpMaxSize:o=e}=i,s=new Xh({maxSize:o},r);return t(i,s)}}zx.exports=X2});var Yx=k((V3,Jx)=>{"use strict";var{isIP:eJ}=require("node:net"),{lookup:tJ}=require("node:dns"),rJ=Nu(),{InvalidArgumentError:Xo,InformationalError:nJ}=ue(),Vx=Math.pow(2,31)-1,em=class{#e=0;#t=0;#r=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(t){this.#e=t.maxTTL,this.#t=t.maxItems,this.dualStack=t.dualStack,this.affinity=t.affinity,this.lookup=t.lookup??this.#i,this.pick=t.pick??this.#o}get full(){return this.#r.size===this.#t}runLookup(t,n,i){let r=this.#r.get(t.hostname);if(r==null&&this.full){i(null,t.origin);return}let o={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...n.dns,maxTTL:this.#e,maxItems:this.#t};if(r==null)this.lookup(t,o,(s,a)=>{if(s||a==null||a.length===0){i(s??new nJ("No DNS entries found"));return}this.setRecords(t,a);let A=this.#r.get(t.hostname),c=this.pick(t,A,o.affinity),l;typeof c.port=="number"?l=`:${c.port}`:t.port!==""?l=`:${t.port}`:l="",i(null,`${t.protocol}//${c.family===6?`[${c.address}]`:c.address}${l}`)});else{let s=this.pick(t,r,o.affinity);if(s==null){this.#r.delete(t.hostname),this.runLookup(t,n,i);return}let a;typeof s.port=="number"?a=`:${s.port}`:t.port!==""?a=`:${t.port}`:a="",i(null,`${t.protocol}//${s.family===6?`[${s.address}]`:s.address}${a}`)}}#i(t,n,i){tJ(t.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(r,o)=>{if(r)return i(r);let s=new Map;for(let a of o)s.set(`${a.address}:${a.family}`,a);i(null,s.values())})}#o(t,n,i){let r=null,{records:o,offset:s}=n,a;if(this.dualStack?(i==null&&(s==null||s===Vx?(n.offset=0,i=4):(n.offset++,i=(n.offset&1)===1?6:4)),o[i]!=null&&o[i].ips.length>0?a=o[i]:a=o[i===4?6:4]):a=o[i],a==null||a.ips.length===0)return r;a.offset==null||a.offset===Vx?a.offset=0:a.offset++;let A=a.offset%a.ips.length;return r=a.ips[A]??null,r==null?r:Date.now()-r.timestamp>r.ttl?(a.ips.splice(A,1),this.pick(t,n,i)):r}setRecords(t,n){let i=Date.now(),r={records:{4:null,6:null}};for(let o of n){o.timestamp=i,typeof o.ttl=="number"?o.ttl=Math.min(o.ttl,this.#e):o.ttl=this.#e;let s=r.records[o.family]??{ips:[]};s.ips.push(o),r.records[o.family]=s}this.#r.set(t.hostname,r)}getHandler(t,n){return new tm(this,t,n)}},tm=class extends rJ{#e=null;#t=null;#r=null;#i=null;#o=null;constructor(t,{origin:n,handler:i,dispatch:r},o){super(i),this.#o=n,this.#i=i,this.#t={...o},this.#e=t,this.#r=r}onError(t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){this.#e.runLookup(this.#o,this.#t,(n,i)=>{if(n)return this.#i.onError(n);let r={...this.#t,origin:i};this.#r(r,this)});return}this.#i.onError(t);return}case"ENOTFOUND":this.#e.deleteRecord(this.#o);default:this.#i.onError(t);break}}};Jx.exports=e=>{if(e?.maxTTL!=null&&(typeof e?.maxTTL!="number"||e?.maxTTL<0))throw new Xo("Invalid maxTTL. Must be a positive number");if(e?.maxItems!=null&&(typeof e?.maxItems!="number"||e?.maxItems<1))throw new Xo("Invalid maxItems. Must be a positive number and greater than zero");if(e?.affinity!=null&&e?.affinity!==4&&e?.affinity!==6)throw new Xo("Invalid affinity. Must be either 4 or 6");if(e?.dualStack!=null&&typeof e?.dualStack!="boolean")throw new Xo("Invalid dualStack. Must be a boolean");if(e?.lookup!=null&&typeof e?.lookup!="function")throw new Xo("Invalid lookup. Must be a function");if(e?.pick!=null&&typeof e?.pick!="function")throw new Xo("Invalid pick. Must be a function");let t=e?.dualStack??!0,n;t?n=e?.affinity??null:n=e?.affinity??4;let i={maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:t,affinity:n,maxItems:e?.maxItems??1/0},r=new em(i);return o=>function(a,A){let c=a.origin.constructor===URL?a.origin:new URL(a.origin);return eJ(c.hostname)!==0?o(a,A):(r.runLookup(c,a,(l,d)=>{if(l)return A.onError(l);let f=null;f={...a,servername:c.hostname,origin:d,headers:{host:c.hostname,...a.headers}},o(f,r.getHandler({origin:c,dispatch:o,handler:A},a))}),!0)}}});var Ti=k((J3,Xx)=>{"use strict";var{kConstruct:iJ}=ve(),{kEnumerableProperty:es}=ie(),{iteratorMixin:oJ,isValidHeaderName:Va,isValidHeaderValue:Hx}=bt(),{webidl:ce}=Je(),rm=require("node:assert"),Uu=require("node:util"),$e=Symbol("headers map"),Rt=Symbol("headers map sorted");function jx(e){return e===10||e===13||e===9||e===32}function qx(e){let t=0,n=e.length;for(;n>t&&jx(e.charCodeAt(n-1));)--n;for(;n>t&&jx(e.charCodeAt(t));)++t;return t===0&&n===e.length?e:e.substring(t,n)}function Wx(e,t){if(Array.isArray(t))for(let n=0;n<t.length;++n){let i=t[n];if(i.length!==2)throw ce.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${i.length}.`});nm(e,i[0],i[1])}else if(typeof t=="object"&&t!==null){let n=Object.keys(t);for(let i=0;i<n.length;++i)nm(e,n[i],t[n[i]])}else throw ce.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function nm(e,t,n){if(n=qx(n),Va(t)){if(!Hx(n))throw ce.errors.invalidArgument({prefix:"Headers.append",value:n,type:"header value"})}else throw ce.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if(Kx(e)==="immutable")throw new TypeError("immutable");return im(e).append(t,n,!1)}function Zx(e,t){return e[0]<t[0]?-1:1}var $u=class e{cookies=null;constructor(t){t instanceof e?(this[$e]=new Map(t[$e]),this[Rt]=t[Rt],this.cookies=t.cookies===null?null:[...t.cookies]):(this[$e]=new Map(t),this[Rt]=null)}contains(t,n){return this[$e].has(n?t:t.toLowerCase())}clear(){this[$e].clear(),this[Rt]=null,this.cookies=null}append(t,n,i){this[Rt]=null;let r=i?t:t.toLowerCase(),o=this[$e].get(r);if(o){let s=r==="cookie"?"; ":", ";this[$e].set(r,{name:o.name,value:`${o.value}${s}${n}`})}else this[$e].set(r,{name:t,value:n});r==="set-cookie"&&(this.cookies??=[]).push(n)}set(t,n,i){this[Rt]=null;let r=i?t:t.toLowerCase();r==="set-cookie"&&(this.cookies=[n]),this[$e].set(r,{name:t,value:n})}delete(t,n){this[Rt]=null,n||(t=t.toLowerCase()),t==="set-cookie"&&(this.cookies=null),this[$e].delete(t)}get(t,n){return this[$e].get(n?t:t.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:t,1:{value:n}}of this[$e])yield[t,n]}get entries(){let t={};if(this[$e].size!==0)for(let{name:n,value:i}of this[$e].values())t[n]=i;return t}rawValues(){return this[$e].values()}get entriesList(){let t=[];if(this[$e].size!==0)for(let{0:n,1:{name:i,value:r}}of this[$e])if(n==="set-cookie")for(let o of this.cookies)t.push([i,o]);else t.push([i,r]);return t}toSortedArray(){let t=this[$e].size,n=new Array(t);if(t<=32){if(t===0)return n;let i=this[$e][Symbol.iterator](),r=i.next().value;n[0]=[r[0],r[1].value],rm(r[1].value!==null);for(let o=1,s=0,a=0,A=0,c=0,l,d;o<t;++o){for(d=i.next().value,l=n[o]=[d[0],d[1].value],rm(l[1]!==null),A=0,a=o;A<a;)c=A+(a-A>>1),n[c][0]<=l[0]?A=c+1:a=c;if(o!==c){for(s=o;s>A;)n[s]=n[--s];n[A]=l}}if(!i.next().done)throw new TypeError("Unreachable");return n}else{let i=0;for(let{0:r,1:{value:o}}of this[$e])n[i++]=[r,o],rm(o!==null);return n.sort(Zx)}}},lr=class e{#e;#t;constructor(t=void 0){ce.util.markAsUncloneable(this),t!==iJ&&(this.#t=new $u,this.#e="none",t!==void 0&&(t=ce.converters.HeadersInit(t,"Headers contructor","init"),Wx(this,t)))}append(t,n){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,2,"Headers.append");let i="Headers.append";return t=ce.converters.ByteString(t,i,"name"),n=ce.converters.ByteString(n,i,"value"),nm(this,t,n)}delete(t){if(ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,1,"Headers.delete"),t=ce.converters.ByteString(t,"Headers.delete","name"),!Va(t))throw ce.errors.invalidArgument({prefix:"Headers.delete",value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(t,!1)&&this.#t.delete(t,!1)}get(t){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,1,"Headers.get");let n="Headers.get";if(t=ce.converters.ByteString(t,n,"name"),!Va(t))throw ce.errors.invalidArgument({prefix:n,value:t,type:"header name"});return this.#t.get(t,!1)}has(t){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,1,"Headers.has");let n="Headers.has";if(t=ce.converters.ByteString(t,n,"name"),!Va(t))throw ce.errors.invalidArgument({prefix:n,value:t,type:"header name"});return this.#t.contains(t,!1)}set(t,n){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,2,"Headers.set");let i="Headers.set";if(t=ce.converters.ByteString(t,i,"name"),n=ce.converters.ByteString(n,i,"value"),n=qx(n),Va(t)){if(!Hx(n))throw ce.errors.invalidArgument({prefix:i,value:n,type:"header value"})}else throw ce.errors.invalidArgument({prefix:i,value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(t,n,!1)}getSetCookie(){ce.brandCheck(this,e);let t=this.#t.cookies;return t?[...t]:[]}get[Rt](){if(this.#t[Rt])return this.#t[Rt];let t=[],n=this.#t.toSortedArray(),i=this.#t.cookies;if(i===null||i.length===1)return this.#t[Rt]=n;for(let r=0;r<n.length;++r){let{0:o,1:s}=n[r];if(o==="set-cookie")for(let a=0;a<i.length;++a)t.push([o,i[a]]);else t.push([o,s])}return this.#t[Rt]=t}[Uu.inspect.custom](t,n){return n.depth??=t,`Headers ${Uu.formatWithOptions(n,this.#t.entries)}`}static getHeadersGuard(t){return t.#e}static setHeadersGuard(t,n){t.#e=n}static getHeadersList(t){return t.#t}static setHeadersList(t,n){t.#t=n}},{getHeadersGuard:Kx,setHeadersGuard:sJ,getHeadersList:im,setHeadersList:aJ}=lr;Reflect.deleteProperty(lr,"getHeadersGuard");Reflect.deleteProperty(lr,"setHeadersGuard");Reflect.deleteProperty(lr,"getHeadersList");Reflect.deleteProperty(lr,"setHeadersList");oJ("Headers",lr,Rt,0,1);Object.defineProperties(lr.prototype,{append:es,delete:es,get:es,has:es,set:es,getSetCookie:es,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Uu.inspect.custom]:{enumerable:!1}});ce.converters.HeadersInit=function(e,t,n){if(ce.util.Type(e)==="Object"){let i=Reflect.get(e,Symbol.iterator);if(!Uu.types.isProxy(e)&&i===lr.prototype.entries)try{return im(e).entriesList}catch{}return typeof i=="function"?ce.converters["sequence<sequence<ByteString>>"](e,t,n,i.bind(e)):ce.converters["record<ByteString, ByteString>"](e,t,n)}throw ce.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};Xx.exports={fill:Wx,compareHeaderName:Zx,Headers:lr,HeadersList:$u,getHeadersGuard:Kx,setHeadersGuard:sJ,setHeadersList:aJ,getHeadersList:im}});var Ya=k((Y3,lR)=>{"use strict";var{Headers:oR,HeadersList:eR,fill:AJ,getHeadersGuard:cJ,setHeadersGuard:sR,setHeadersList:aR}=Ti(),{extractBody:tR,cloneBody:uJ,mixinBody:lJ,hasFinalizationRegistry:AR,streamRegistry:cR,bodyUnusable:dJ}=$o(),om=ie(),rR=require("node:util"),{kEnumerableProperty:Dt}=om,{isValidReasonPhrase:fJ,isCancelled:gJ,isAborted:pJ,isBlobLike:hJ,serializeJavascriptValueToJSONString:mJ,isErrorLike:IJ,isomorphicEncode:EJ,environmentSettingsObject:yJ}=bt(),{redirectStatusSet:CJ,nullBodyStatus:BJ}=ga(),{kState:be,kHeaders:on}=yn(),{webidl:te}=Je(),{FormData:QJ}=ya(),{URLSerializer:nR}=gt(),{kConstruct:Fu}=ve(),sm=require("node:assert"),{types:vJ}=require("node:util"),wJ=new TextEncoder("utf-8"),Fi=class e{static error(){return Ja(Mu(),"immutable")}static json(t,n={}){te.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=te.converters.ResponseInit(n));let i=wJ.encode(mJ(t)),r=tR(i),o=Ja(ts({}),"response");return iR(o,n,{body:r[0],type:"application/json"}),o}static redirect(t,n=302){te.argumentLengthCheck(arguments,1,"Response.redirect"),t=te.converters.USVString(t),n=te.converters["unsigned short"](n);let i;try{i=new URL(t,yJ.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${t}`,{cause:s})}if(!CJ.has(n))throw new RangeError(`Invalid status code ${n}`);let r=Ja(ts({}),"immutable");r[be].status=n;let o=EJ(nR(i));return r[be].headersList.append("location",o,!0),r}constructor(t=null,n={}){if(te.util.markAsUncloneable(this),t===Fu)return;t!==null&&(t=te.converters.BodyInit(t)),n=te.converters.ResponseInit(n),this[be]=ts({}),this[on]=new oR(Fu),sR(this[on],"response"),aR(this[on],this[be].headersList);let i=null;if(t!=null){let[r,o]=tR(t);i={body:r,type:o}}iR(this,n,i)}get type(){return te.brandCheck(this,e),this[be].type}get url(){te.brandCheck(this,e);let t=this[be].urlList,n=t[t.length-1]??null;return n===null?"":nR(n,!0)}get redirected(){return te.brandCheck(this,e),this[be].urlList.length>1}get status(){return te.brandCheck(this,e),this[be].status}get ok(){return te.brandCheck(this,e),this[be].status>=200&&this[be].status<=299}get statusText(){return te.brandCheck(this,e),this[be].statusText}get headers(){return te.brandCheck(this,e),this[on]}get body(){return te.brandCheck(this,e),this[be].body?this[be].body.stream:null}get bodyUsed(){return te.brandCheck(this,e),!!this[be].body&&om.isDisturbed(this[be].body.stream)}clone(){if(te.brandCheck(this,e),dJ(this))throw te.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let t=am(this[be]);return AR&&this[be].body?.stream&&cR.register(this,new WeakRef(this[be].body.stream)),Ja(t,cJ(this[on]))}[rR.inspect.custom](t,n){n.depth===null&&(n.depth=2),n.colors??=!0;let i={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${rR.formatWithOptions(n,i)}`}};lJ(Fi);Object.defineProperties(Fi.prototype,{type:Dt,url:Dt,status:Dt,ok:Dt,redirected:Dt,statusText:Dt,headers:Dt,clone:Dt,body:Dt,bodyUsed:Dt,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(Fi,{json:Dt,redirect:Dt,error:Dt});function am(e){if(e.internalResponse)return uR(am(e.internalResponse),e.type);let t=ts({...e,body:null});return e.body!=null&&(t.body=uJ(t,e.body)),t}function ts(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new eR(e?.headersList):new eR,urlList:e?.urlList?[...e.urlList]:[]}}function Mu(e){let t=IJ(e);return ts({type:"error",status:0,error:t?e:new Error(e&&String(e)),aborted:e&&e.name==="AbortError"})}function bJ(e){return e.type==="error"&&e.status===0}function Tu(e,t){return t={internalResponse:e,...t},new Proxy(e,{get(n,i){return i in t?t[i]:n[i]},set(n,i,r){return sm(!(i in t)),n[i]=r,!0}})}function uR(e,t){if(t==="basic")return Tu(e,{type:"basic",headersList:e.headersList});if(t==="cors")return Tu(e,{type:"cors",headersList:e.headersList});if(t==="opaque")return Tu(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(t==="opaqueredirect")return Tu(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});sm(!1)}function kJ(e,t=null){return sm(gJ(e)),pJ(e)?Mu(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):Mu(Object.assign(new DOMException("Request was cancelled."),{cause:t}))}function iR(e,t,n){if(t.status!==null&&(t.status<200||t.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&t.statusText!=null&&!fJ(String(t.statusText)))throw new TypeError("Invalid statusText");if("status"in t&&t.status!=null&&(e[be].status=t.status),"statusText"in t&&t.statusText!=null&&(e[be].statusText=t.statusText),"headers"in t&&t.headers!=null&&AJ(e[on],t.headers),n){if(BJ.includes(e.status))throw te.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});e[be].body=n.body,n.type!=null&&!e[be].headersList.contains("content-type",!0)&&e[be].headersList.append("content-type",n.type,!0)}}function Ja(e,t){let n=new Fi(Fu);return n[be]=e,n[on]=new oR(Fu),aR(n[on],e.headersList),sR(n[on],t),AR&&e.body?.stream&&cR.register(n,new WeakRef(e.body.stream)),n}te.converters.ReadableStream=te.interfaceConverter(ReadableStream);te.converters.FormData=te.interfaceConverter(QJ);te.converters.URLSearchParams=te.interfaceConverter(URLSearchParams);te.converters.XMLHttpRequestBodyInit=function(e,t,n){return typeof e=="string"?te.converters.USVString(e,t,n):hJ(e)?te.converters.Blob(e,t,n,{strict:!1}):ArrayBuffer.isView(e)||vJ.isArrayBuffer(e)?te.converters.BufferSource(e,t,n):om.isFormDataLike(e)?te.converters.FormData(e,t,n,{strict:!1}):e instanceof URLSearchParams?te.converters.URLSearchParams(e,t,n):te.converters.DOMString(e,t,n)};te.converters.BodyInit=function(e,t,n){return e instanceof ReadableStream?te.converters.ReadableStream(e,t,n):e?.[Symbol.asyncIterator]?e:te.converters.XMLHttpRequestBodyInit(e,t,n)};te.converters.ResponseInit=te.dictionaryConverter([{key:"status",converter:te.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:te.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:te.converters.HeadersInit}]);lR.exports={isNetworkError:bJ,makeNetworkError:Mu,makeResponse:ts,makeAppropriateNetworkError:kJ,filterResponse:uR,Response:Fi,cloneResponse:am,fromInnerResponse:Ja}});var pR=k((j3,gR)=>{"use strict";var{kConnected:dR,kSize:fR}=ve(),Am=class{constructor(t){this.value=t}deref(){return this.value[dR]===0&&this.value[fR]===0?void 0:this.value}},cm=class{constructor(t){this.finalizer=t}register(t,n){t.on&&t.on("disconnect",()=>{t[dR]===0&&t[fR]===0&&this.finalizer(n)})}unregister(t){}};gR.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:Am,FinalizationRegistry:cm}):{WeakRef,FinalizationRegistry}}});var rs=k((H3,RR)=>{"use strict";var{extractBody:SJ,mixinBody:xJ,cloneBody:RJ,bodyUnusable:hR}=$o(),{Headers:wR,fill:DJ,HeadersList:zu,setHeadersGuard:lm,getHeadersGuard:_J,setHeadersList:bR,getHeadersList:mR}=Ti(),{FinalizationRegistry:NJ}=pR()(),Pu=ie(),IR=require("node:util"),{isValidHTTPToken:UJ,sameOrigin:ER,environmentSettingsObject:Lu}=bt(),{forbiddenMethodsSet:$J,corsSafeListedMethodsSet:TJ,referrerPolicy:FJ,requestRedirect:MJ,requestMode:LJ,requestCredentials:PJ,requestCache:OJ,requestDuplex:zJ}=ga(),{kEnumerableProperty:Te,normalizedMethodRecordsBase:GJ,normalizedMethodRecords:VJ}=Pu,{kHeaders:_t,kSignal:Ou,kState:Qe,kDispatcher:um}=yn(),{webidl:Y}=Je(),{URLSerializer:JJ}=gt(),{kConstruct:Gu}=ve(),YJ=require("node:assert"),{getMaxListeners:yR,setMaxListeners:CR,getEventListeners:jJ,defaultMaxListeners:BR}=require("node:events"),HJ=Symbol("abortController"),kR=new NJ(({signal:e,abort:t})=>{e.removeEventListener("abort",t)}),Vu=new WeakMap;function QR(e){return t;function t(){let n=e.deref();if(n!==void 0){kR.unregister(t),this.removeEventListener("abort",t),n.abort(this.reason);let i=Vu.get(n.signal);if(i!==void 0){if(i.size!==0){for(let r of i){let o=r.deref();o!==void 0&&o.abort(this.reason)}i.clear()}Vu.delete(n.signal)}}}}var vR=!1,Dn=class e{constructor(t,n={}){if(Y.util.markAsUncloneable(this),t===Gu)return;let i="Request constructor";Y.argumentLengthCheck(arguments,1,i),t=Y.converters.RequestInfo(t,i,"input"),n=Y.converters.RequestInit(n,i,"init");let r=null,o=null,s=Lu.settingsObject.baseUrl,a=null;if(typeof t=="string"){this[um]=n.dispatcher;let m;try{m=new URL(t,s)}catch(C){throw new TypeError("Failed to parse URL from "+t,{cause:C})}if(m.username||m.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+t);r=Ju({urlList:[m]}),o="cors"}else this[um]=n.dispatcher||t[um],YJ(t instanceof e),r=t[Qe],a=t[Ou];let A=Lu.settingsObject.origin,c="client";if(r.window?.constructor?.name==="EnvironmentSettingsObject"&&ER(r.window,A)&&(c=r.window),n.window!=null)throw new TypeError(`'window' option '${c}' must be null`);"window"in n&&(c="no-window"),r=Ju({method:r.method,headersList:r.headersList,unsafeRequest:r.unsafeRequest,client:Lu.settingsObject,window:c,priority:r.priority,origin:r.origin,referrer:r.referrer,referrerPolicy:r.referrerPolicy,mode:r.mode,credentials:r.credentials,cache:r.cache,redirect:r.redirect,integrity:r.integrity,keepalive:r.keepalive,reloadNavigation:r.reloadNavigation,historyNavigation:r.historyNavigation,urlList:[...r.urlList]});let l=Object.keys(n).length!==0;if(l&&(r.mode==="navigate"&&(r.mode="same-origin"),r.reloadNavigation=!1,r.historyNavigation=!1,r.origin="client",r.referrer="client",r.referrerPolicy="",r.url=r.urlList[r.urlList.length-1],r.urlList=[r.url]),n.referrer!==void 0){let m=n.referrer;if(m==="")r.referrer="no-referrer";else{let C;try{C=new URL(m,s)}catch(w){throw new TypeError(`Referrer "${m}" is not a valid URL.`,{cause:w})}C.protocol==="about:"&&C.hostname==="client"||A&&!ER(C,Lu.settingsObject.baseUrl)?r.referrer="client":r.referrer=C}}n.referrerPolicy!==void 0&&(r.referrerPolicy=n.referrerPolicy);let d;if(n.mode!==void 0?d=n.mode:d=o,d==="navigate")throw Y.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(d!=null&&(r.mode=d),n.credentials!==void 0&&(r.credentials=n.credentials),n.cache!==void 0&&(r.cache=n.cache),r.cache==="only-if-cached"&&r.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(n.redirect!==void 0&&(r.redirect=n.redirect),n.integrity!=null&&(r.integrity=String(n.integrity)),n.keepalive!==void 0&&(r.keepalive=!!n.keepalive),n.method!==void 0){let m=n.method,C=VJ[m];if(C!==void 0)r.method=C;else{if(!UJ(m))throw new TypeError(`'${m}' is not a valid HTTP method.`);let w=m.toUpperCase();if($J.has(w))throw new TypeError(`'${m}' HTTP method is unsupported.`);m=GJ[w]??m,r.method=m}!vR&&r.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),vR=!0)}n.signal!==void 0&&(a=n.signal),this[Qe]=r;let f=new AbortController;if(this[Ou]=f.signal,a!=null){if(!a||typeof a.aborted!="boolean"||typeof a.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(a.aborted)f.abort(a.reason);else{this[HJ]=f;let m=new WeakRef(f),C=QR(m);try{(typeof yR=="function"&&yR(a)===BR||jJ(a,"abort").length>=BR)&&CR(1500,a)}catch{}Pu.addAbortListener(a,C),kR.register(f,{signal:a,abort:C},C)}}if(this[_t]=new wR(Gu),bR(this[_t],r.headersList),lm(this[_t],"request"),d==="no-cors"){if(!TJ.has(r.method))throw new TypeError(`'${r.method} is unsupported in no-cors mode.`);lm(this[_t],"request-no-cors")}if(l){let m=mR(this[_t]),C=n.headers!==void 0?n.headers:new zu(m);if(m.clear(),C instanceof zu){for(let{name:w,value:b}of C.rawValues())m.append(w,b,!1);m.cookies=C.cookies}else DJ(this[_t],C)}let g=t instanceof e?t[Qe].body:null;if((n.body!=null||g!=null)&&(r.method==="GET"||r.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let p=null;if(n.body!=null){let[m,C]=SJ(n.body,r.keepalive);p=m,C&&!mR(this[_t]).contains("content-type",!0)&&this[_t].append("content-type",C)}let h=p??g;if(h!=null&&h.source==null){if(p!=null&&n.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(r.mode!=="same-origin"&&r.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');r.useCORSPreflightFlag=!0}let E=h;if(p==null&&g!=null){if(hR(t))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let m=new TransformStream;g.stream.pipeThrough(m),E={source:g.source,length:g.length,stream:m.readable}}this[Qe].body=E}get method(){return Y.brandCheck(this,e),this[Qe].method}get url(){return Y.brandCheck(this,e),JJ(this[Qe].url)}get headers(){return Y.brandCheck(this,e),this[_t]}get destination(){return Y.brandCheck(this,e),this[Qe].destination}get referrer(){return Y.brandCheck(this,e),this[Qe].referrer==="no-referrer"?"":this[Qe].referrer==="client"?"about:client":this[Qe].referrer.toString()}get referrerPolicy(){return Y.brandCheck(this,e),this[Qe].referrerPolicy}get mode(){return Y.brandCheck(this,e),this[Qe].mode}get credentials(){return this[Qe].credentials}get cache(){return Y.brandCheck(this,e),this[Qe].cache}get redirect(){return Y.brandCheck(this,e),this[Qe].redirect}get integrity(){return Y.brandCheck(this,e),this[Qe].integrity}get keepalive(){return Y.brandCheck(this,e),this[Qe].keepalive}get isReloadNavigation(){return Y.brandCheck(this,e),this[Qe].reloadNavigation}get isHistoryNavigation(){return Y.brandCheck(this,e),this[Qe].historyNavigation}get signal(){return Y.brandCheck(this,e),this[Ou]}get body(){return Y.brandCheck(this,e),this[Qe].body?this[Qe].body.stream:null}get bodyUsed(){return Y.brandCheck(this,e),!!this[Qe].body&&Pu.isDisturbed(this[Qe].body.stream)}get duplex(){return Y.brandCheck(this,e),"half"}clone(){if(Y.brandCheck(this,e),hR(this))throw new TypeError("unusable");let t=SR(this[Qe]),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let i=Vu.get(this.signal);i===void 0&&(i=new Set,Vu.set(this.signal,i));let r=new WeakRef(n);i.add(r),Pu.addAbortListener(n.signal,QR(r))}return xR(t,n.signal,_J(this[_t]))}[IR.inspect.custom](t,n){n.depth===null&&(n.depth=2),n.colors??=!0;let i={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${IR.formatWithOptions(n,i)}`}};xJ(Dn);function Ju(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new zu(e.headersList):new zu}}function SR(e){let t=Ju({...e,body:null});return e.body!=null&&(t.body=RJ(t,e.body)),t}function xR(e,t,n){let i=new Dn(Gu);return i[Qe]=e,i[Ou]=t,i[_t]=new wR(Gu),bR(i[_t],e.headersList),lm(i[_t],n),i}Object.defineProperties(Dn.prototype,{method:Te,url:Te,headers:Te,redirect:Te,clone:Te,signal:Te,duplex:Te,destination:Te,body:Te,bodyUsed:Te,isHistoryNavigation:Te,isReloadNavigation:Te,keepalive:Te,integrity:Te,cache:Te,credentials:Te,attribute:Te,referrerPolicy:Te,referrer:Te,mode:Te,[Symbol.toStringTag]:{value:"Request",configurable:!0}});Y.converters.Request=Y.interfaceConverter(Dn);Y.converters.RequestInfo=function(e,t,n){return typeof e=="string"?Y.converters.USVString(e,t,n):e instanceof Dn?Y.converters.Request(e,t,n):Y.converters.USVString(e,t,n)};Y.converters.AbortSignal=Y.interfaceConverter(AbortSignal);Y.converters.RequestInit=Y.dictionaryConverter([{key:"method",converter:Y.converters.ByteString},{key:"headers",converter:Y.converters.HeadersInit},{key:"body",converter:Y.nullableConverter(Y.converters.BodyInit)},{key:"referrer",converter:Y.converters.USVString},{key:"referrerPolicy",converter:Y.converters.DOMString,allowedValues:FJ},{key:"mode",converter:Y.converters.DOMString,allowedValues:LJ},{key:"credentials",converter:Y.converters.DOMString,allowedValues:PJ},{key:"cache",converter:Y.converters.DOMString,allowedValues:OJ},{key:"redirect",converter:Y.converters.DOMString,allowedValues:MJ},{key:"integrity",converter:Y.converters.DOMString},{key:"keepalive",converter:Y.converters.boolean},{key:"signal",converter:Y.nullableConverter(e=>Y.converters.AbortSignal(e,"RequestInit","signal",{strict:!1}))},{key:"window",converter:Y.converters.any},{key:"duplex",converter:Y.converters.DOMString,allowedValues:zJ},{key:"dispatcher",converter:Y.converters.any}]);RR.exports={Request:Dn,makeRequest:Ju,fromInnerRequest:xR,cloneRequest:SR}});var Ha=k((q3,JR)=>{"use strict";var{makeNetworkError:he,makeAppropriateNetworkError:Yu,filterResponse:dm,makeResponse:ju,fromInnerResponse:qJ}=Ya(),{HeadersList:DR}=Ti(),{Request:WJ,cloneRequest:ZJ}=rs(),_n=require("node:zlib"),{bytesMatch:KJ,makePolicyContainer:XJ,clonePolicyContainer:eY,requestBadPort:tY,TAOCheck:rY,appendRequestOriginHeader:nY,responseLocationURL:iY,requestCurrentURL:Fr,setRequestReferrerPolicyOnRedirect:oY,tryUpgradeRequestToAPotentiallyTrustworthyURL:sY,createOpaqueTimingInfo:mm,appendFetchMetadata:aY,corsCheck:AY,crossOriginResourcePolicyCheck:cY,determineRequestsReferrer:uY,coarsenedSharedCurrentTime:ja,createDeferredPromise:lY,isBlobLike:dY,sameOrigin:hm,isCancelled:Mi,isAborted:_R,isErrorLike:fY,fullyReadBody:gY,readableStreamClose:pY,isomorphicEncode:Hu,urlIsLocal:hY,urlIsHttpHttpsScheme:Im,urlHasHttpsScheme:mY,clampAndCoarsenConnectionTimingInfo:IY,simpleRangeHeaderValue:EY,buildContentRange:yY,createInflate:CY,extractMimeType:BY}=bt(),{kState:TR,kDispatcher:QY}=yn(),Li=require("node:assert"),{safelyExtractBody:Em,extractBody:NR}=$o(),{redirectStatusSet:FR,nullBodyStatus:MR,safeMethodsSet:vY,requestBodyHeader:wY,subresourceSet:bY}=ga(),kY=require("node:events"),{Readable:SY,pipeline:xY,finished:RY}=require("node:stream"),{addAbortListener:DY,isErrored:_Y,isReadable:qu,bufferToLowerCasedHeaderName:UR}=ie(),{dataURLProcessor:NY,serializeAMimeType:UY,minimizeSupportedMimeType:$Y}=gt(),{getGlobalDispatcher:TY}=Ga(),{webidl:FY}=Je(),{STATUS_CODES:MY}=require("node:http"),LY=["GET","HEAD"],PY=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",fm,Wu=class extends kY{constructor(t){super(),this.dispatcher=t,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(t){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(t),this.emit("terminated",t))}abort(t){this.state==="ongoing"&&(this.state="aborted",t||(t=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=t,this.connection?.destroy(t),this.emit("terminated",t))}};function OY(e){LR(e,"fetch")}function zY(e,t=void 0){FY.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=lY(),i;try{i=new WJ(e,t)}catch(l){return n.reject(l),n.promise}let r=i[TR];if(i.signal.aborted)return gm(n,r,null,i.signal.reason),n.promise;r.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(r.serviceWorkers="none");let s=null,a=!1,A=null;return DY(i.signal,()=>{a=!0,Li(A!=null),A.abort(i.signal.reason);let l=s?.deref();gm(n,r,l,i.signal.reason)}),A=OR({request:r,processResponseEndOfBody:OY,processResponse:l=>{if(!a){if(l.aborted){gm(n,r,s,A.serializedAbortReason);return}if(l.type==="error"){n.reject(new TypeError("fetch failed",{cause:l.error}));return}s=new WeakRef(qJ(l,"immutable")),n.resolve(s.deref()),n=null}},dispatcher:i[QY]}),n.promise}function LR(e,t="other"){if(e.type==="error"&&e.aborted||!e.urlList?.length)return;let n=e.urlList[0],i=e.timingInfo,r=e.cacheState;Im(n)&&i!==null&&(e.timingAllowPassed||(i=mm({startTime:i.startTime}),r=""),i.endTime=ja(),e.timingInfo=i,PR(i,n.href,t,globalThis,r))}var PR=performance.markResourceTiming;function gm(e,t,n,i){if(e&&e.reject(i),t.body!=null&&qu(t.body?.stream)&&t.body.stream.cancel(i).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),n==null)return;let r=n[TR];r.body!=null&&qu(r.body?.stream)&&r.body.stream.cancel(i).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o})}function OR({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:n,processResponse:i,processResponseEndOfBody:r,processResponseConsumeBody:o,useParallelQueue:s=!1,dispatcher:a=TY()}){Li(a);let A=null,c=!1;e.client!=null&&(A=e.client.globalObject,c=e.client.crossOriginIsolatedCapability);let l=ja(c),d=mm({startTime:l}),f={controller:new Wu(a),request:e,timingInfo:d,processRequestBodyChunkLength:t,processRequestEndOfBody:n,processResponse:i,processResponseConsumeBody:o,processResponseEndOfBody:r,taskDestination:A,crossOriginIsolatedCapability:c};return Li(!e.body||e.body.stream),e.window==="client"&&(e.window=e.client?.globalObject?.constructor?.name==="Window"?e.client:"no-window"),e.origin==="client"&&(e.origin=e.client.origin),e.policyContainer==="client"&&(e.client!=null?e.policyContainer=eY(e.client.policyContainer):e.policyContainer=XJ()),e.headersList.contains("accept",!0)||e.headersList.append("accept","*/*",!0),e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,bY.has(e.destination),zR(f).catch(g=>{f.controller.terminate(g)}),f.controller}async function zR(e,t=!1){let n=e.request,i=null;if(n.localURLsOnly&&!hY(Fr(n))&&(i=he("local URLs only")),sY(n),tY(n)==="blocked"&&(i=he("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=uY(n)),i===null&&(i=await(async()=>{let o=Fr(n);return hm(o,n.url)&&n.responseTainting==="basic"||o.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",await $R(e)):n.mode==="same-origin"?he('request mode cannot be "same-origin"'):n.mode==="no-cors"?n.redirect!=="follow"?he('redirect mode cannot be "follow" for "no-cors" request'):(n.responseTainting="opaque",await $R(e)):Im(Fr(n))?(n.responseTainting="cors",await GR(e)):he("URL scheme must be a HTTP(S) scheme")})()),t)return i;i.status!==0&&!i.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?i=dm(i,"basic"):n.responseTainting==="cors"?i=dm(i,"cors"):n.responseTainting==="opaque"?i=dm(i,"opaque"):Li(!1));let r=i.status===0?i:i.internalResponse;if(r.urlList.length===0&&r.urlList.push(...n.urlList),n.timingAllowFailed||(i.timingAllowPassed=!0),i.type==="opaque"&&r.status===206&&r.rangeRequested&&!n.headers.contains("range",!0)&&(i=r=he()),i.status!==0&&(n.method==="HEAD"||n.method==="CONNECT"||MR.includes(r.status))&&(r.body=null,e.controller.dump=!0),n.integrity){let o=a=>pm(e,he(a));if(n.responseTainting==="opaque"||i.body==null){o(i.error);return}let s=a=>{if(!KJ(a,n.integrity)){o("integrity mismatch");return}i.body=Em(a)[0],pm(e,i)};await gY(i.body,s,o)}else pm(e,i)}function $R(e){if(Mi(e)&&e.request.redirectCount===0)return Promise.resolve(Yu(e));let{request:t}=e,{protocol:n}=Fr(t);switch(n){case"about:":return Promise.resolve(he("about scheme is not supported"));case"blob:":{fm||(fm=require("node:buffer").resolveObjectURL);let i=Fr(t);if(i.search.length!==0)return Promise.resolve(he("NetworkError when attempting to fetch resource."));let r=fm(i.toString());if(t.method!=="GET"||!dY(r))return Promise.resolve(he("invalid method"));let o=ju(),s=r.size,a=Hu(`${s}`),A=r.type;if(t.headersList.contains("range",!0)){o.rangeRequested=!0;let c=t.headersList.get("range",!0),l=EY(c,!0);if(l==="failure")return Promise.resolve(he("failed to fetch the data URL"));let{rangeStartValue:d,rangeEndValue:f}=l;if(d===null)d=s-f,f=d+f-1;else{if(d>=s)return Promise.resolve(he("Range start is greater than the blob's size."));(f===null||f>=s)&&(f=s-1)}let g=r.slice(d,f,A),p=NR(g);o.body=p[0];let h=Hu(`${g.size}`),E=yY(d,f,s);o.status=206,o.statusText="Partial Content",o.headersList.set("content-length",h,!0),o.headersList.set("content-type",A,!0),o.headersList.set("content-range",E,!0)}else{let c=NR(r);o.statusText="OK",o.body=c[0],o.headersList.set("content-length",a,!0),o.headersList.set("content-type",A,!0)}return Promise.resolve(o)}case"data:":{let i=Fr(t),r=NY(i);if(r==="failure")return Promise.resolve(he("failed to fetch the data URL"));let o=UY(r.mimeType);return Promise.resolve(ju({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:o}]],body:Em(r.body)[0]}))}case"file:":return Promise.resolve(he("not implemented... yet..."));case"http:":case"https:":return GR(e).catch(i=>he(i));default:return Promise.resolve(he("unknown scheme"))}}function GY(e,t){e.request.done=!0,e.processResponseDone!=null&&queueMicrotask(()=>e.processResponseDone(t))}function pm(e,t){let n=e.timingInfo,i=()=>{let o=Date.now();e.request.destination==="document"&&(e.controller.fullTimingInfo=n),e.controller.reportTimingSteps=()=>{if(e.request.url.protocol!=="https:")return;n.endTime=o;let a=t.cacheState,A=t.bodyInfo;t.timingAllowPassed||(n=mm(n),a="");let c=0;if(e.request.mode!=="navigator"||!t.hasCrossOriginRedirects){c=t.status;let l=BY(t.headersList);l!=="failure"&&(A.contentType=$Y(l))}e.request.initiatorType!=null&&PR(n,e.request.url.href,e.request.initiatorType,globalThis,a,A,c)};let s=()=>{e.request.done=!0,e.processResponseEndOfBody!=null&&queueMicrotask(()=>e.processResponseEndOfBody(t)),e.request.initiatorType!=null&&e.controller.reportTimingSteps()};queueMicrotask(()=>s())};e.processResponse!=null&&queueMicrotask(()=>{e.processResponse(t),e.processResponse=null});let r=t.type==="error"?t:t.internalResponse??t;r.body==null?i():RY(r.body.stream,()=>{i()})}async function GR(e){let t=e.request,n=null,i=null,r=e.timingInfo;if(t.serviceWorkers,n===null){if(t.redirect==="follow"&&(t.serviceWorkers="none"),i=n=await VR(e),t.responseTainting==="cors"&&AY(t,n)==="failure")return he("cors failure");rY(t,n)==="failure"&&(t.timingAllowFailed=!0)}return(t.responseTainting==="opaque"||n.type==="opaque")&&cY(t.origin,t.client,t.destination,i)==="blocked"?he("blocked"):(FR.has(i.status)&&(t.redirect!=="manual"&&e.controller.connection.destroy(void 0,!1),t.redirect==="error"?n=he("unexpected redirect"):t.redirect==="manual"?n=i:t.redirect==="follow"?n=await VY(e,n):Li(!1)),n.timingInfo=r,n)}function VY(e,t){let n=e.request,i=t.internalResponse?t.internalResponse:t,r;try{if(r=iY(i,Fr(n).hash),r==null)return t}catch(s){return Promise.resolve(he(s))}if(!Im(r))return Promise.resolve(he("URL scheme must be a HTTP(S) scheme"));if(n.redirectCount===20)return Promise.resolve(he("redirect count exceeded"));if(n.redirectCount+=1,n.mode==="cors"&&(r.username||r.password)&&!hm(n,r))return Promise.resolve(he('cross origin not allowed for request mode "cors"'));if(n.responseTainting==="cors"&&(r.username||r.password))return Promise.resolve(he('URL cannot contain credentials for request mode "cors"'));if(i.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(he());if([301,302].includes(i.status)&&n.method==="POST"||i.status===303&&!LY.includes(n.method)){n.method="GET",n.body=null;for(let s of wY)n.headersList.delete(s)}hm(Fr(n),r)||(n.headersList.delete("authorization",!0),n.headersList.delete("proxy-authorization",!0),n.headersList.delete("cookie",!0),n.headersList.delete("host",!0)),n.body!=null&&(Li(n.body.source!=null),n.body=Em(n.body.source)[0]);let o=e.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=ja(e.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),n.urlList.push(r),oY(n,i),zR(e,!0)}async function VR(e,t=!1,n=!1){let i=e.request,r=null,o=null,s=null,a=null,A=!1;i.window==="no-window"&&i.redirect==="error"?(r=e,o=i):(o=ZJ(i),r={...e},r.request=o);let c=i.credentials==="include"||i.credentials==="same-origin"&&i.responseTainting==="basic",l=o.body?o.body.length:null,d=null;if(o.body==null&&["POST","PUT"].includes(o.method)&&(d="0"),l!=null&&(d=Hu(`${l}`)),d!=null&&o.headersList.append("content-length",d,!0),l!=null&&o.keepalive,o.referrer instanceof URL&&o.headersList.append("referer",Hu(o.referrer.href),!0),nY(o),aY(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",PY),o.cache==="default"&&(o.headersList.contains("if-modified-since",!0)||o.headersList.contains("if-none-match",!0)||o.headersList.contains("if-unmodified-since",!0)||o.headersList.contains("if-match",!0)||o.headersList.contains("if-range",!0))&&(o.cache="no-store"),o.cache==="no-cache"&&!o.preventNoCacheCacheControlHeaderModification&&!o.headersList.contains("cache-control",!0)&&o.headersList.append("cache-control","max-age=0",!0),(o.cache==="no-store"||o.cache==="reload")&&(o.headersList.contains("pragma",!0)||o.headersList.append("pragma","no-cache",!0),o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","no-cache",!0)),o.headersList.contains("range",!0)&&o.headersList.append("accept-encoding","identity",!0),o.headersList.contains("accept-encoding",!0)||(mY(Fr(o))?o.headersList.append("accept-encoding","br, gzip, deflate",!0):o.headersList.append("accept-encoding","gzip, deflate",!0)),o.headersList.delete("host",!0),a==null&&(o.cache="no-store"),o.cache!=="no-store"&&o.cache,s==null){if(o.cache==="only-if-cached")return he("only if cached");let f=await JY(r,c,n);!vY.has(o.method)&&f.status>=200&&f.status<=399,A&&f.status,s==null&&(s=f)}if(s.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=c,s.status===407)return i.window==="no-window"?he():Mi(e)?Yu(e):he("proxy authentication required");if(s.status===421&&!n&&(i.body==null||i.body.source!=null)){if(Mi(e))return Yu(e);e.controller.connection.destroy(),s=await VR(e,t,!0)}return s}async function JY(e,t=!1,n=!1){Li(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(p,h=!0){this.destroyed||(this.destroyed=!0,h&&this.abort?.(p??new DOMException("The operation was aborted.","AbortError")))}};let i=e.request,r=null,o=e.timingInfo;null==null&&(i.cache="no-store");let a=n?"yes":"no";i.mode;let A=null;if(i.body==null&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(i.body!=null){let p=async function*(m){Mi(e)||(yield m,e.processRequestBodyChunkLength?.(m.byteLength))},h=()=>{Mi(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},E=m=>{Mi(e)||(m.name==="AbortError"?e.controller.abort():e.controller.terminate(m))};A=(async function*(){try{for await(let m of i.body.stream)yield*p(m);h()}catch(m){E(m)}})()}try{let{body:p,status:h,statusText:E,headersList:m,socket:C}=await g({body:A});if(C)r=ju({status:h,statusText:E,headersList:m,socket:C});else{let w=p[Symbol.asyncIterator]();e.controller.next=()=>w.next(),r=ju({status:h,statusText:E,headersList:m})}}catch(p){return p.name==="AbortError"?(e.controller.connection.destroy(),Yu(e,p)):he(p)}let c=async()=>{await e.controller.resume()},l=p=>{Mi(e)||e.controller.abort(p)},d=new ReadableStream({async start(p){e.controller.controller=p},async pull(p){await c(p)},async cancel(p){await l(p)},type:"bytes"});r.body={stream:d,source:null,length:null},e.controller.resume||e.controller.on("terminated",f),e.controller.resume=async()=>{for(;;){let p,h;try{let{done:m,value:C}=await e.controller.next();if(_R(e))break;p=m?void 0:C}catch(m){e.controller.ended&&!o.encodedBodySize?p=void 0:(p=m,h=!0)}if(p===void 0){pY(e.controller.controller),GY(e,r);return}if(o.decodedBodySize+=p?.byteLength??0,h){e.controller.terminate(p);return}let E=new Uint8Array(p);if(E.byteLength&&e.controller.controller.enqueue(E),_Y(d)){e.controller.terminate();return}if(e.controller.controller.desiredSize<=0)return}};function f(p){_R(e)?(r.aborted=!0,qu(d)&&e.controller.controller.error(e.controller.serializedAbortReason)):qu(d)&&e.controller.controller.error(new TypeError("terminated",{cause:fY(p)?p:void 0})),e.controller.connection.destroy()}return r;function g({body:p}){let h=Fr(i),E=e.controller.dispatcher;return new Promise((m,C)=>E.dispatch({path:h.pathname+h.search,origin:h.origin,method:i.method,body:E.isMockActive?i.body&&(i.body.source||i.body.stream):p,headers:i.headersList.entries,maxRedirections:0,upgrade:i.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(w){let{connection:b}=e.controller;o.finalConnectionTimingInfo=IY(void 0,o.postRedirectStartTime,e.crossOriginIsolatedCapability),b.destroyed?w(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",w),this.abort=b.abort=w),o.finalNetworkRequestStartTime=ja(e.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=ja(e.crossOriginIsolatedCapability)},onHeaders(w,b,T,$){if(w<200)return;let K="",Se=new DR;for(let qe=0;qe<b.length;qe+=2)Se.append(UR(b[qe]),b[qe+1].toString("latin1"),!0);K=Se.get("location",!0);let Pt=[],Cr=K&&i.redirect==="follow"&&FR.has(w);if(i.method!=="HEAD"&&i.method!=="CONNECT"&&!MR.includes(w)&&!Cr){let qe=Se.get("content-encoding",!0),gn=qe?qe.toLowerCase().split(","):[],mc=5;if(gn.length>mc)return this.abort(new Error(`too many content-encodings in response: ${gn.length}, maximum allowed is ${mc}`)),!0;for(let Xn=gn.length-1;Xn>=0;--Xn){let Ic=gn[Xn].trim();if(Ic==="x-gzip"||Ic==="gzip")Pt.push(_n.createGunzip({flush:_n.constants.Z_SYNC_FLUSH,finishFlush:_n.constants.Z_SYNC_FLUSH}));else if(Ic==="deflate")Pt.push(CY({flush:_n.constants.Z_SYNC_FLUSH,finishFlush:_n.constants.Z_SYNC_FLUSH}));else if(Ic==="br")Pt.push(_n.createBrotliDecompress({flush:_n.constants.BROTLI_OPERATION_FLUSH,finishFlush:_n.constants.BROTLI_OPERATION_FLUSH}));else{Pt.length=0;break}}}this.body=new SY({read:T});let rr=this.onError.bind(this);return m({status:w,statusText:$,headersList:Se,body:Pt.length?xY(this.body,...Pt,qe=>{qe&&this.onError(qe)}).on("error",rr):this.body.on("error",rr)}),!0},onData(w){if(e.controller.dump)return;let b=w;return o.encodedBodySize+=b.byteLength,this.body.push(b)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.ended=!0,this.body.push(null)},onError(w){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(w),e.controller.terminate(w),C(w)},onUpgrade(w,b,T){if(w!==101)return;let $=new DR;for(let K=0;K<b.length;K+=2)$.append(UR(b[K]),b[K+1].toString("latin1"),!0);return m({status:w,statusText:MY[w],headersList:$,socket:T}),!0}}))}}JR.exports={fetch:zY,Fetch:Wu,fetching:OR,finalizeAndReportTiming:LR}});var ym=k((W3,YR)=>{"use strict";YR.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var HR=k((Z3,jR)=>{"use strict";var{webidl:Nt}=Je(),Zu=Symbol("ProgressEvent state"),Cm=class e extends Event{constructor(t,n={}){t=Nt.converters.DOMString(t,"ProgressEvent constructor","type"),n=Nt.converters.ProgressEventInit(n??{}),super(t,n),this[Zu]={lengthComputable:n.lengthComputable,loaded:n.loaded,total:n.total}}get lengthComputable(){return Nt.brandCheck(this,e),this[Zu].lengthComputable}get loaded(){return Nt.brandCheck(this,e),this[Zu].loaded}get total(){return Nt.brandCheck(this,e),this[Zu].total}};Nt.converters.ProgressEventInit=Nt.dictionaryConverter([{key:"lengthComputable",converter:Nt.converters.boolean,defaultValue:()=>!1},{key:"loaded",converter:Nt.converters["unsigned long long"],defaultValue:()=>0},{key:"total",converter:Nt.converters["unsigned long long"],defaultValue:()=>0},{key:"bubbles",converter:Nt.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:Nt.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:Nt.converters.boolean,defaultValue:()=>!1}]);jR.exports={ProgressEvent:Cm}});var WR=k((K3,qR)=>{"use strict";function YY(e){if(!e)return"failure";switch(e.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}qR.exports={getEncoding:YY}});var iD=k((X3,nD)=>{"use strict";var{kState:ns,kError:Bm,kResult:ZR,kAborted:qa,kLastProgressEventFired:Qm}=ym(),{ProgressEvent:jY}=HR(),{getEncoding:KR}=WR(),{serializeAMimeType:HY,parseMIMEType:XR}=gt(),{types:qY}=require("node:util"),{StringDecoder:eD}=require("string_decoder"),{btoa:tD}=require("node:buffer"),WY={enumerable:!0,writable:!1,configurable:!1};function ZY(e,t,n,i){if(e[ns]==="loading")throw new DOMException("Invalid state","InvalidStateError");e[ns]="loading",e[ZR]=null,e[Bm]=null;let o=t.stream().getReader(),s=[],a=o.read(),A=!0;(async()=>{for(;!e[qa];)try{let{done:c,value:l}=await a;if(A&&!e[qa]&&queueMicrotask(()=>{Nn("loadstart",e)}),A=!1,!c&&qY.isUint8Array(l))s.push(l),(e[Qm]===void 0||Date.now()-e[Qm]>=50)&&!e[qa]&&(e[Qm]=Date.now(),queueMicrotask(()=>{Nn("progress",e)})),a=o.read();else if(c){queueMicrotask(()=>{e[ns]="done";try{let d=KY(s,n,t.type,i);if(e[qa])return;e[ZR]=d,Nn("load",e)}catch(d){e[Bm]=d,Nn("error",e)}e[ns]!=="loading"&&Nn("loadend",e)});break}}catch(c){if(e[qa])return;queueMicrotask(()=>{e[ns]="done",e[Bm]=c,Nn("error",e),e[ns]!=="loading"&&Nn("loadend",e)});break}})()}function Nn(e,t){let n=new jY(e,{bubbles:!1,cancelable:!1});t.dispatchEvent(n)}function KY(e,t,n,i){switch(t){case"DataURL":{let r="data:",o=XR(n||"application/octet-stream");o!=="failure"&&(r+=HY(o)),r+=";base64,";let s=new eD("latin1");for(let a of e)r+=tD(s.write(a));return r+=tD(s.end()),r}case"Text":{let r="failure";if(i&&(r=KR(i)),r==="failure"&&n){let o=XR(n);o!=="failure"&&(r=KR(o.parameters.get("charset")))}return r==="failure"&&(r="UTF-8"),XY(e,r)}case"ArrayBuffer":return rD(e).buffer;case"BinaryString":{let r="",o=new eD("latin1");for(let s of e)r+=o.write(s);return r+=o.end(),r}}}function XY(e,t){let n=rD(e),i=ej(n),r=0;i!==null&&(t=i,r=i==="UTF-8"?3:2);let o=n.slice(r);return new TextDecoder(t).decode(o)}function ej(e){let[t,n,i]=e;return t===239&&n===187&&i===191?"UTF-8":t===254&&n===255?"UTF-16BE":t===255&&n===254?"UTF-16LE":null}function rD(e){let t=e.reduce((i,r)=>i+r.byteLength,0),n=0;return e.reduce((i,r)=>(i.set(r,n),n+=r.byteLength,i),new Uint8Array(t))}nD.exports={staticPropertyDescriptors:WY,readOperation:ZY,fireAProgressEvent:Nn}});var AD=k((e7,aD)=>{"use strict";var{staticPropertyDescriptors:is,readOperation:Ku,fireAProgressEvent:oD}=iD(),{kState:Pi,kError:sD,kResult:Xu,kEvents:le,kAborted:tj}=ym(),{webidl:Ee}=Je(),{kEnumerableProperty:mt}=ie(),dr=class e extends EventTarget{constructor(){super(),this[Pi]="empty",this[Xu]=null,this[sD]=null,this[le]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(t){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),t=Ee.converters.Blob(t,{strict:!1}),Ku(this,t,"ArrayBuffer")}readAsBinaryString(t){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),t=Ee.converters.Blob(t,{strict:!1}),Ku(this,t,"BinaryString")}readAsText(t,n=void 0){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsText"),t=Ee.converters.Blob(t,{strict:!1}),n!==void 0&&(n=Ee.converters.DOMString(n,"FileReader.readAsText","encoding")),Ku(this,t,"Text",n)}readAsDataURL(t){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),t=Ee.converters.Blob(t,{strict:!1}),Ku(this,t,"DataURL")}abort(){if(this[Pi]==="empty"||this[Pi]==="done"){this[Xu]=null;return}this[Pi]==="loading"&&(this[Pi]="done",this[Xu]=null),this[tj]=!0,oD("abort",this),this[Pi]!=="loading"&&oD("loadend",this)}get readyState(){switch(Ee.brandCheck(this,e),this[Pi]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return Ee.brandCheck(this,e),this[Xu]}get error(){return Ee.brandCheck(this,e),this[sD]}get onloadend(){return Ee.brandCheck(this,e),this[le].loadend}set onloadend(t){Ee.brandCheck(this,e),this[le].loadend&&this.removeEventListener("loadend",this[le].loadend),typeof t=="function"?(this[le].loadend=t,this.addEventListener("loadend",t)):this[le].loadend=null}get onerror(){return Ee.brandCheck(this,e),this[le].error}set onerror(t){Ee.brandCheck(this,e),this[le].error&&this.removeEventListener("error",this[le].error),typeof t=="function"?(this[le].error=t,this.addEventListener("error",t)):this[le].error=null}get onloadstart(){return Ee.brandCheck(this,e),this[le].loadstart}set onloadstart(t){Ee.brandCheck(this,e),this[le].loadstart&&this.removeEventListener("loadstart",this[le].loadstart),typeof t=="function"?(this[le].loadstart=t,this.addEventListener("loadstart",t)):this[le].loadstart=null}get onprogress(){return Ee.brandCheck(this,e),this[le].progress}set onprogress(t){Ee.brandCheck(this,e),this[le].progress&&this.removeEventListener("progress",this[le].progress),typeof t=="function"?(this[le].progress=t,this.addEventListener("progress",t)):this[le].progress=null}get onload(){return Ee.brandCheck(this,e),this[le].load}set onload(t){Ee.brandCheck(this,e),this[le].load&&this.removeEventListener("load",this[le].load),typeof t=="function"?(this[le].load=t,this.addEventListener("load",t)):this[le].load=null}get onabort(){return Ee.brandCheck(this,e),this[le].abort}set onabort(t){Ee.brandCheck(this,e),this[le].abort&&this.removeEventListener("abort",this[le].abort),typeof t=="function"?(this[le].abort=t,this.addEventListener("abort",t)):this[le].abort=null}};dr.EMPTY=dr.prototype.EMPTY=0;dr.LOADING=dr.prototype.LOADING=1;dr.DONE=dr.prototype.DONE=2;Object.defineProperties(dr.prototype,{EMPTY:is,LOADING:is,DONE:is,readAsArrayBuffer:mt,readAsBinaryString:mt,readAsText:mt,readAsDataURL:mt,abort:mt,readyState:mt,result:mt,error:mt,onloadstart:mt,onprogress:mt,onload:mt,onabort:mt,onerror:mt,onloadend:mt,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(dr,{EMPTY:is,LOADING:is,DONE:is});aD.exports={FileReader:dr}});var el=k((t7,cD)=>{"use strict";cD.exports={kConstruct:ve().kConstruct}});var dD=k((r7,lD)=>{"use strict";var rj=require("node:assert"),{URLSerializer:uD}=gt(),{isValidHeaderName:nj}=bt();function ij(e,t,n=!1){let i=uD(e,n),r=uD(t,n);return i===r}function oj(e){rj(e!==null);let t=[];for(let n of e.split(","))n=n.trim(),nj(n)&&t.push(n);return t}lD.exports={urlEquals:ij,getFieldValues:oj}});var pD=k((n7,gD)=>{"use strict";var{kConstruct:sj}=el(),{urlEquals:aj,getFieldValues:vm}=dD(),{kEnumerableProperty:Oi,isDisturbed:Aj}=ie(),{webidl:O}=Je(),{Response:cj,cloneResponse:uj,fromInnerResponse:lj}=Ya(),{Request:sn,fromInnerRequest:dj}=rs(),{kState:fr}=yn(),{fetching:fj}=Ha(),{urlIsHttpHttpsScheme:tl,createDeferredPromise:os,readAllBytes:gj}=bt(),wm=require("node:assert"),rl=class e{#e;constructor(){arguments[0]!==sj&&O.illegalConstructor(),O.util.markAsUncloneable(this),this.#e=arguments[1]}async match(t,n={}){O.brandCheck(this,e);let i="Cache.match";O.argumentLengthCheck(arguments,1,i),t=O.converters.RequestInfo(t,i,"request"),n=O.converters.CacheQueryOptions(n,i,"options");let r=this.#o(t,n,1);if(r.length!==0)return r[0]}async matchAll(t=void 0,n={}){O.brandCheck(this,e);let i="Cache.matchAll";return t!==void 0&&(t=O.converters.RequestInfo(t,i,"request")),n=O.converters.CacheQueryOptions(n,i,"options"),this.#o(t,n)}async add(t){O.brandCheck(this,e);let n="Cache.add";O.argumentLengthCheck(arguments,1,n),t=O.converters.RequestInfo(t,n,"request");let i=[t];return await this.addAll(i)}async addAll(t){O.brandCheck(this,e);let n="Cache.addAll";O.argumentLengthCheck(arguments,1,n);let i=[],r=[];for(let f of t){if(f===void 0)throw O.errors.conversionFailed({prefix:n,argument:"Argument 1",types:["undefined is not allowed"]});if(f=O.converters.RequestInfo(f),typeof f=="string")continue;let g=f[fr];if(!tl(g.url)||g.method!=="GET")throw O.errors.exception({header:n,message:"Expected http/s scheme when method is not GET."})}let o=[];for(let f of t){let g=new sn(f)[fr];if(!tl(g.url))throw O.errors.exception({header:n,message:"Expected http/s scheme."});g.initiator="fetch",g.destination="subresource",r.push(g);let p=os();o.push(fj({request:g,processResponse(h){if(h.type==="error"||h.status===206||h.status<200||h.status>299)p.reject(O.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(h.headersList.contains("vary")){let E=vm(h.headersList.get("vary"));for(let m of E)if(m==="*"){p.reject(O.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let C of o)C.abort();return}}},processResponseEndOfBody(h){if(h.aborted){p.reject(new DOMException("aborted","AbortError"));return}p.resolve(h)}})),i.push(p.promise)}let a=await Promise.all(i),A=[],c=0;for(let f of a){let g={type:"put",request:r[c],response:f};A.push(g),c++}let l=os(),d=null;try{this.#t(A)}catch(f){d=f}return queueMicrotask(()=>{d===null?l.resolve(void 0):l.reject(d)}),l.promise}async put(t,n){O.brandCheck(this,e);let i="Cache.put";O.argumentLengthCheck(arguments,2,i),t=O.converters.RequestInfo(t,i,"request"),n=O.converters.Response(n,i,"response");let r=null;if(t instanceof sn?r=t[fr]:r=new sn(t)[fr],!tl(r.url)||r.method!=="GET")throw O.errors.exception({header:i,message:"Expected an http/s scheme when method is not GET"});let o=n[fr];if(o.status===206)throw O.errors.exception({header:i,message:"Got 206 status"});if(o.headersList.contains("vary")){let g=vm(o.headersList.get("vary"));for(let p of g)if(p==="*")throw O.errors.exception({header:i,message:"Got * vary field value"})}if(o.body&&(Aj(o.body.stream)||o.body.stream.locked))throw O.errors.exception({header:i,message:"Response body is locked or disturbed"});let s=uj(o),a=os();if(o.body!=null){let p=o.body.stream.getReader();gj(p).then(a.resolve,a.reject)}else a.resolve(void 0);let A=[],c={type:"put",request:r,response:s};A.push(c);let l=await a.promise;s.body!=null&&(s.body.source=l);let d=os(),f=null;try{this.#t(A)}catch(g){f=g}return queueMicrotask(()=>{f===null?d.resolve():d.reject(f)}),d.promise}async delete(t,n={}){O.brandCheck(this,e);let i="Cache.delete";O.argumentLengthCheck(arguments,1,i),t=O.converters.RequestInfo(t,i,"request"),n=O.converters.CacheQueryOptions(n,i,"options");let r=null;if(t instanceof sn){if(r=t[fr],r.method!=="GET"&&!n.ignoreMethod)return!1}else wm(typeof t=="string"),r=new sn(t)[fr];let o=[],s={type:"delete",request:r,options:n};o.push(s);let a=os(),A=null,c;try{c=this.#t(o)}catch(l){A=l}return queueMicrotask(()=>{A===null?a.resolve(!!c?.length):a.reject(A)}),a.promise}async keys(t=void 0,n={}){O.brandCheck(this,e);let i="Cache.keys";t!==void 0&&(t=O.converters.RequestInfo(t,i,"request")),n=O.converters.CacheQueryOptions(n,i,"options");let r=null;if(t!==void 0)if(t instanceof sn){if(r=t[fr],r.method!=="GET"&&!n.ignoreMethod)return[]}else typeof t=="string"&&(r=new sn(t)[fr]);let o=os(),s=[];if(t===void 0)for(let a of this.#e)s.push(a[0]);else{let a=this.#r(r,n);for(let A of a)s.push(A[0])}return queueMicrotask(()=>{let a=[];for(let A of s){let c=dj(A,new AbortController().signal,"immutable");a.push(c)}o.resolve(Object.freeze(a))}),o.promise}#t(t){let n=this.#e,i=[...n],r=[],o=[];try{for(let s of t){if(s.type!=="delete"&&s.type!=="put")throw O.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw O.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#r(s.request,s.options,r).length)throw new DOMException("???","InvalidStateError");let a;if(s.type==="delete"){if(a=this.#r(s.request,s.options),a.length===0)return[];for(let A of a){let c=n.indexOf(A);wm(c!==-1),n.splice(c,1)}}else if(s.type==="put"){if(s.response==null)throw O.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let A=s.request;if(!tl(A.url))throw O.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(A.method!=="GET")throw O.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw O.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});a=this.#r(s.request);for(let c of a){let l=n.indexOf(c);wm(l!==-1),n.splice(l,1)}n.push([s.request,s.response]),r.push([s.request,s.response])}o.push([s.request,s.response])}return o}catch(s){throw this.#e.length=0,this.#e=i,s}}#r(t,n,i){let r=[],o=i??this.#e;for(let s of o){let[a,A]=s;this.#i(t,a,A,n)&&r.push(s)}return r}#i(t,n,i=null,r){let o=new URL(t.url),s=new URL(n.url);if(r?.ignoreSearch&&(s.search="",o.search=""),!aj(o,s,!0))return!1;if(i==null||r?.ignoreVary||!i.headersList.contains("vary"))return!0;let a=vm(i.headersList.get("vary"));for(let A of a){if(A==="*")return!1;let c=n.headersList.get(A),l=t.headersList.get(A);if(c!==l)return!1}return!0}#o(t,n,i=1/0){let r=null;if(t!==void 0)if(t instanceof sn){if(r=t[fr],r.method!=="GET"&&!n.ignoreMethod)return[]}else typeof t=="string"&&(r=new sn(t)[fr]);let o=[];if(t===void 0)for(let a of this.#e)o.push(a[1]);else{let a=this.#r(r,n);for(let A of a)o.push(A[1])}let s=[];for(let a of o){let A=lj(a,"immutable");if(s.push(A.clone()),s.length>=i)break}return Object.freeze(s)}};Object.defineProperties(rl.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:Oi,matchAll:Oi,add:Oi,addAll:Oi,put:Oi,delete:Oi,keys:Oi});var fD=[{key:"ignoreSearch",converter:O.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:O.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:O.converters.boolean,defaultValue:()=>!1}];O.converters.CacheQueryOptions=O.dictionaryConverter(fD);O.converters.MultiCacheQueryOptions=O.dictionaryConverter([...fD,{key:"cacheName",converter:O.converters.DOMString}]);O.converters.Response=O.interfaceConverter(cj);O.converters["sequence<RequestInfo>"]=O.sequenceConverter(O.converters.RequestInfo);gD.exports={Cache:rl}});var mD=k((i7,hD)=>{"use strict";var{kConstruct:Wa}=el(),{Cache:nl}=pD(),{webidl:Ke}=Je(),{kEnumerableProperty:Za}=ie(),il=class e{#e=new Map;constructor(){arguments[0]!==Wa&&Ke.illegalConstructor(),Ke.util.markAsUncloneable(this)}async match(t,n={}){if(Ke.brandCheck(this,e),Ke.argumentLengthCheck(arguments,1,"CacheStorage.match"),t=Ke.converters.RequestInfo(t),n=Ke.converters.MultiCacheQueryOptions(n),n.cacheName!=null){if(this.#e.has(n.cacheName)){let i=this.#e.get(n.cacheName);return await new nl(Wa,i).match(t,n)}}else for(let i of this.#e.values()){let o=await new nl(Wa,i).match(t,n);if(o!==void 0)return o}}async has(t){Ke.brandCheck(this,e);let n="CacheStorage.has";return Ke.argumentLengthCheck(arguments,1,n),t=Ke.converters.DOMString(t,n,"cacheName"),this.#e.has(t)}async open(t){Ke.brandCheck(this,e);let n="CacheStorage.open";if(Ke.argumentLengthCheck(arguments,1,n),t=Ke.converters.DOMString(t,n,"cacheName"),this.#e.has(t)){let r=this.#e.get(t);return new nl(Wa,r)}let i=[];return this.#e.set(t,i),new nl(Wa,i)}async delete(t){Ke.brandCheck(this,e);let n="CacheStorage.delete";return Ke.argumentLengthCheck(arguments,1,n),t=Ke.converters.DOMString(t,n,"cacheName"),this.#e.delete(t)}async keys(){return Ke.brandCheck(this,e),[...this.#e.keys()]}};Object.defineProperties(il.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Za,has:Za,open:Za,delete:Za,keys:Za});hD.exports={CacheStorage:il}});var ED=k((o7,ID)=>{"use strict";ID.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var Sm=k((s7,QD)=>{"use strict";function pj(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}function bm(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw new Error("Invalid cookie name")}}function km(e){let t=e.length,n=0;if(e[0]==='"'){if(t===1||e[t-1]!=='"')throw new Error("Invalid cookie value");--t,++n}for(;n<t;){let i=e.charCodeAt(n++);if(i<33||i>126||i===34||i===44||i===59||i===92)throw new Error("Invalid cookie value")}}function CD(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<32||n>126||n===59)throw new Error("Invalid cookie path")}}function yD(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function hj(e){if(e===" ")return;if(e.length>255)throw new Error("Invalid cookie domain");let t=0;for(let n=0;n<e.length;++n){let i=e.charCodeAt(n);if(i===46){if(t===0)throw new Error("Invalid cookie domain");if(e.charCodeAt(n-1)===45)throw new Error("Invalid cookie domain");t=0;continue}if(t===0&&!yD(i))throw new Error("Invalid cookie domain");if(!yD(i)&&i!==45)throw new Error("Invalid cookie domain");if(++t>63)throw new Error("Invalid cookie domain")}if(t===0||e.charCodeAt(e.length-1)===45)throw new Error("Invalid cookie domain")}var mj=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ij=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ol=Array(61).fill(0).map((e,t)=>t.toString().padStart(2,"0"));function BD(e){return typeof e=="number"&&(e=new Date(e)),`${mj[e.getUTCDay()]}, ${ol[e.getUTCDate()]} ${Ij[e.getUTCMonth()]} ${e.getUTCFullYear()} ${ol[e.getUTCHours()]}:${ol[e.getUTCMinutes()]}:${ol[e.getUTCSeconds()]} GMT`}function Ej(e){if(e<0)throw new Error("Invalid cookie max-age")}function yj(e){if(e.name.length===0)return null;bm(e.name),km(e.value);let t=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&t.push("Secure"),e.httpOnly&&t.push("HttpOnly"),typeof e.maxAge=="number"&&(Ej(e.maxAge),t.push(`Max-Age=${e.maxAge}`)),e.domain&&(hj(e.domain),t.push(`Domain=${e.domain}`)),e.path&&(CD(e.path),t.push(`Path=${e.path}`)),e.expires&&e.expires.toString()!=="Invalid Date"&&t.push(`Expires=${BD(e.expires)}`),e.sameSite&&t.push(`SameSite=${e.sameSite}`);for(let n of e.unparsed){if(!n.includes("="))throw new Error("Invalid unparsed");let[i,...r]=n.split("="),o=i.trim(),s=r.join("=");bm(o),km(s),t.push(`${o}=${s}`)}return t.join("; ")}QD.exports={isCTLExcludingHtab:pj,validateCookieName:bm,validateCookiePath:CD,validateCookieValue:km,toIMFDate:BD,stringify:yj}});var wD=k((a7,vD)=>{"use strict";var{maxNameValuePairSize:Cj,maxAttributeValueSize:Bj}=ED(),{isCTLExcludingHtab:Qj}=Sm(),{collectASequenceOfCodePointsFast:sl}=gt(),vj=require("node:assert");function wj(e){if(Qj(e))return null;let t="",n="",i="",r="";if(e.includes(";")){let o={position:0};t=sl(";",e,o),n=e.slice(o.position)}else t=e;if(!t.includes("="))r=t;else{let o={position:0};i=sl("=",t,o),r=t.slice(o.position+1)}return i=i.trim(),r=r.trim(),i.length+r.length>Cj?null:{name:i,value:r,...ss(n)}}function ss(e,t={}){if(e.length===0)return t;vj(e[0]===";"),e=e.slice(1);let n="";e.includes(";")?(n=sl(";",e,{position:0}),e=e.slice(n.length)):(n=e,e="");let i="",r="";if(n.includes("=")){let s={position:0};i=sl("=",n,s),r=n.slice(s.position+1)}else i=n;if(i=i.trim(),r=r.trim(),r.length>Bj)return ss(e,t);let o=i.toLowerCase();if(o==="expires"){let s=new Date(r);t.expires=s}else if(o==="max-age"){let s=r.charCodeAt(0);if((s<48||s>57)&&r[0]!=="-"||!/^\d+$/.test(r))return ss(e,t);let a=Number(r);t.maxAge=a}else if(o==="domain"){let s=r;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),t.domain=s}else if(o==="path"){let s="";r.length===0||r[0]!=="/"?s="/":s=r,t.path=s}else if(o==="secure")t.secure=!0;else if(o==="httponly")t.httpOnly=!0;else if(o==="samesite"){let s=r.toLowerCase();s==="none"?t.sameSite="None":s==="strict"?t.sameSite="Strict":s==="lax"&&(t.sameSite="Lax")}else t.unparsed??=[],t.unparsed.push(`${i}=${r}`);return ss(e,t)}vD.exports={parseSetCookie:wj,parseUnparsedAttributes:ss}});var SD=k((A7,kD)=>{"use strict";var{parseSetCookie:bj}=wD(),{stringify:kj}=Sm(),{webidl:Ae}=Je(),{Headers:al}=Ti();function Sj(e){Ae.argumentLengthCheck(arguments,1,"getCookies"),Ae.brandCheck(e,al,{strict:!1});let t=e.get("cookie"),n={};if(!t)return n;for(let i of t.split(";")){let[r,...o]=i.split("=");n[r.trim()]=o.join("=")}return n}function xj(e,t,n){Ae.brandCheck(e,al,{strict:!1});let i="deleteCookie";Ae.argumentLengthCheck(arguments,2,i),t=Ae.converters.DOMString(t,i,"name"),n=Ae.converters.DeleteCookieAttributes(n),bD(e,{name:t,value:"",expires:new Date(0),...n})}function Rj(e){Ae.argumentLengthCheck(arguments,1,"getSetCookies"),Ae.brandCheck(e,al,{strict:!1});let t=e.getSetCookie();return t?t.map(n=>bj(n)):[]}function bD(e,t){Ae.argumentLengthCheck(arguments,2,"setCookie"),Ae.brandCheck(e,al,{strict:!1}),t=Ae.converters.Cookie(t);let n=kj(t);n&&e.append("Set-Cookie",n)}Ae.converters.DeleteCookieAttributes=Ae.dictionaryConverter([{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"path",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"domain",defaultValue:()=>null}]);Ae.converters.Cookie=Ae.dictionaryConverter([{converter:Ae.converters.DOMString,key:"name"},{converter:Ae.converters.DOMString,key:"value"},{converter:Ae.nullableConverter(e=>typeof e=="number"?Ae.converters["unsigned long long"](e):new Date(e)),key:"expires",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"path",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.boolean),key:"secure",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:Ae.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:Ae.sequenceConverter(Ae.converters.DOMString),key:"unparsed",defaultValue:()=>new Array(0)}]);kD.exports={getCookies:Sj,deleteCookie:xj,getSetCookies:Rj,setCookie:bD}});var As=k((c7,RD)=>{"use strict";var{webidl:M}=Je(),{kEnumerableProperty:It}=ie(),{kConstruct:xD}=ve(),{MessagePort:Dj}=require("node:worker_threads"),as=class e extends Event{#e;constructor(t,n={}){if(t===xD){super(arguments[1],arguments[2]),M.util.markAsUncloneable(this);return}let i="MessageEvent constructor";M.argumentLengthCheck(arguments,1,i),t=M.converters.DOMString(t,i,"type"),n=M.converters.MessageEventInit(n,i,"eventInitDict"),super(t,n),this.#e=n,M.util.markAsUncloneable(this)}get data(){return M.brandCheck(this,e),this.#e.data}get origin(){return M.brandCheck(this,e),this.#e.origin}get lastEventId(){return M.brandCheck(this,e),this.#e.lastEventId}get source(){return M.brandCheck(this,e),this.#e.source}get ports(){return M.brandCheck(this,e),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(t,n=!1,i=!1,r=null,o="",s="",a=null,A=[]){return M.brandCheck(this,e),M.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new e(t,{bubbles:n,cancelable:i,data:r,origin:o,lastEventId:s,source:a,ports:A})}static createFastMessageEvent(t,n){let i=new e(xD,t,n);return i.#e=n,i.#e.data??=null,i.#e.origin??="",i.#e.lastEventId??="",i.#e.source??=null,i.#e.ports??=[],i}},{createFastMessageEvent:_j}=as;delete as.createFastMessageEvent;var Al=class e extends Event{#e;constructor(t,n={}){let i="CloseEvent constructor";M.argumentLengthCheck(arguments,1,i),t=M.converters.DOMString(t,i,"type"),n=M.converters.CloseEventInit(n),super(t,n),this.#e=n,M.util.markAsUncloneable(this)}get wasClean(){return M.brandCheck(this,e),this.#e.wasClean}get code(){return M.brandCheck(this,e),this.#e.code}get reason(){return M.brandCheck(this,e),this.#e.reason}},cl=class e extends Event{#e;constructor(t,n){let i="ErrorEvent constructor";M.argumentLengthCheck(arguments,1,i),super(t,n),M.util.markAsUncloneable(this),t=M.converters.DOMString(t,i,"type"),n=M.converters.ErrorEventInit(n??{}),this.#e=n}get message(){return M.brandCheck(this,e),this.#e.message}get filename(){return M.brandCheck(this,e),this.#e.filename}get lineno(){return M.brandCheck(this,e),this.#e.lineno}get colno(){return M.brandCheck(this,e),this.#e.colno}get error(){return M.brandCheck(this,e),this.#e.error}};Object.defineProperties(as.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:It,origin:It,lastEventId:It,source:It,ports:It,initMessageEvent:It});Object.defineProperties(Al.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:It,code:It,wasClean:It});Object.defineProperties(cl.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:It,filename:It,lineno:It,colno:It,error:It});M.converters.MessagePort=M.interfaceConverter(Dj);M.converters["sequence<MessagePort>"]=M.sequenceConverter(M.converters.MessagePort);var xm=[{key:"bubbles",converter:M.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:M.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:M.converters.boolean,defaultValue:()=>!1}];M.converters.MessageEventInit=M.dictionaryConverter([...xm,{key:"data",converter:M.converters.any,defaultValue:()=>null},{key:"origin",converter:M.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:M.converters.DOMString,defaultValue:()=>""},{key:"source",converter:M.nullableConverter(M.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:M.converters["sequence<MessagePort>"],defaultValue:()=>new Array(0)}]);M.converters.CloseEventInit=M.dictionaryConverter([...xm,{key:"wasClean",converter:M.converters.boolean,defaultValue:()=>!1},{key:"code",converter:M.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:M.converters.USVString,defaultValue:()=>""}]);M.converters.ErrorEventInit=M.dictionaryConverter([...xm,{key:"message",converter:M.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:M.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:M.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:M.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:M.converters.any}]);RD.exports={MessageEvent:as,CloseEvent:Al,ErrorEvent:cl,createFastMessageEvent:_j}});var zi=k((u7,DD)=>{"use strict";var Nj="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",Uj={enumerable:!0,writable:!1,configurable:!1},$j={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},Tj={NOT_SENT:0,PROCESSING:1,SENT:2},Fj={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},Mj=2**16-1,Lj={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},Pj=Buffer.allocUnsafe(0),Oj={string:1,typedArray:2,arrayBuffer:3,blob:4};DD.exports={uid:Nj,sentCloseFrameState:Tj,staticPropertyDescriptors:Uj,states:$j,opcodes:Fj,maxUnsigned16Bit:Mj,parserStates:Lj,emptyBuffer:Pj,sendHints:Oj}});var Ka=k((l7,_D)=>{"use strict";_D.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var tA=k((d7,OD)=>{"use strict";var{kReadyState:Xa,kController:zj,kResponse:Gj,kBinaryType:Vj,kWebSocketURL:Jj}=Ka(),{states:eA,opcodes:Un}=zi(),{ErrorEvent:Yj,createFastMessageEvent:jj}=As(),{isUtf8:Hj}=require("node:buffer"),{collectASequenceOfCodePointsFast:qj,removeHTTPWhitespace:ND}=gt();function Wj(e){return e[Xa]===eA.CONNECTING}function Zj(e){return e[Xa]===eA.OPEN}function Kj(e){return e[Xa]===eA.CLOSING}function Xj(e){return e[Xa]===eA.CLOSED}function Rm(e,t,n=(r,o)=>new Event(r,o),i={}){let r=n(e,i);t.dispatchEvent(r)}function eH(e,t,n){if(e[Xa]!==eA.OPEN)return;let i;if(t===Un.TEXT)try{i=PD(n)}catch{$D(e,"Received invalid UTF-8 in text frame.");return}else t===Un.BINARY&&(e[Vj]==="blob"?i=new Blob([n]):i=tH(n));Rm("message",e,jj,{origin:e[Jj].origin,data:i})}function tH(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function rH(e){if(e.length===0)return!1;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}function nH(e){return e>=1e3&&e<1015?e!==1004&&e!==1005&&e!==1006:e>=3e3&&e<=4999}function $D(e,t){let{[zj]:n,[Gj]:i}=e;n.abort(),i?.socket&&!i.socket.destroyed&&i.socket.destroy(),t&&Rm("error",e,(r,o)=>new Yj(r,o),{error:new Error(t),message:t})}function TD(e){return e===Un.CLOSE||e===Un.PING||e===Un.PONG}function FD(e){return e===Un.CONTINUATION}function MD(e){return e===Un.TEXT||e===Un.BINARY}function iH(e){return MD(e)||FD(e)||TD(e)}function oH(e){let t={position:0},n=new Map;for(;t.position<e.length;){let i=qj(";",e,t),[r,o=""]=i.split("=");n.set(ND(r,!0,!1),ND(o,!1,!0)),t.position++}return n}function sH(e){if(e.length===0)return!1;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i<48||i>57)return!1}let t=Number.parseInt(e,10);return t>=8&&t<=15}var LD=typeof process.versions.icu=="string",UD=LD?new TextDecoder("utf-8",{fatal:!0}):void 0,PD=LD?UD.decode.bind(UD):function(e){if(Hj(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};OD.exports={isConnecting:Wj,isEstablished:Zj,isClosing:Kj,isClosed:Xj,fireEvent:Rm,isValidSubprotocol:rH,isValidStatusCode:nH,failWebsocketConnection:$D,websocketMessageReceived:eH,utf8Decode:PD,isControlFrame:TD,isContinuationFrame:FD,isTextBinaryFrame:MD,isValidOpcode:iH,parseExtensions:oH,isValidClientWindowBits:sH}});var ll=k((f7,zD)=>{"use strict";var{maxUnsigned16Bit:aH}=zi(),ul=16386,Dm,rA=null,cs=ul;try{Dm=require("node:crypto")}catch{Dm={randomFillSync:function(t,n,i){for(let r=0;r<t.length;++r)t[r]=Math.random()*255|0;return t}}}function AH(){return cs===ul&&(cs=0,Dm.randomFillSync(rA??=Buffer.allocUnsafe(ul),0,ul)),[rA[cs++],rA[cs++],rA[cs++],rA[cs++]]}var _m=class{constructor(t){this.frameData=t}createFrame(t){let n=this.frameData,i=AH(),r=n?.byteLength??0,o=r,s=6;r>aH?(s+=8,o=127):r>125&&(s+=2,o=126);let a=Buffer.allocUnsafe(r+s);a[0]=a[1]=0,a[0]|=128,a[0]=(a[0]&240)+t;a[s-4]=i[0],a[s-3]=i[1],a[s-2]=i[2],a[s-1]=i[3],a[1]=o,o===126?a.writeUInt16BE(r,2):o===127&&(a[2]=a[3]=0,a.writeUIntBE(r,4,6)),a[1]|=128;for(let A=0;A<r;++A)a[s+A]=n[A]^i[A&3];return a}};zD.exports={WebsocketFrameSend:_m}});var Um=k((g7,qD)=>{"use strict";var{uid:cH,states:nA,sentCloseFrameState:dl,emptyBuffer:uH,opcodes:lH}=zi(),{kReadyState:iA,kSentClose:fl,kByteParser:VD,kReceivedClose:GD,kResponse:JD}=Ka(),{fireEvent:dH,failWebsocketConnection:$n,isClosing:fH,isClosed:gH,isEstablished:pH,parseExtensions:hH}=tA(),{channels:us}=Bo(),{CloseEvent:mH}=As(),{makeRequest:IH}=rs(),{fetching:EH}=Ha(),{Headers:yH,getHeadersList:CH}=Ti(),{getDecodeSplit:BH}=bt(),{WebsocketFrameSend:QH}=ll(),Nm;try{Nm=require("node:crypto")}catch{}function vH(e,t,n,i,r,o){let s=e;s.protocol=e.protocol==="ws:"?"http:":"https:";let a=IH({urlList:[s],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(o.headers){let d=CH(new yH(o.headers));a.headersList=d}let A=Nm.randomBytes(16).toString("base64");a.headersList.append("sec-websocket-key",A),a.headersList.append("sec-websocket-version","13");for(let d of t)a.headersList.append("sec-websocket-protocol",d);return a.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),EH({request:a,useParallelQueue:!0,dispatcher:o.dispatcher,processResponse(d){if(d.type==="error"||d.status!==101){$n(i,"Received network error or non-101 status code.");return}if(t.length!==0&&!d.headersList.get("Sec-WebSocket-Protocol")){$n(i,"Server did not respond with sent protocols.");return}if(d.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){$n(i,'Server did not set Upgrade header to "websocket".');return}if(d.headersList.get("Connection")?.toLowerCase()!=="upgrade"){$n(i,'Server did not set Connection header to "upgrade".');return}let f=d.headersList.get("Sec-WebSocket-Accept"),g=Nm.createHash("sha1").update(A+cH).digest("base64");if(f!==g){$n(i,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let p=d.headersList.get("Sec-WebSocket-Extensions"),h;if(p!==null&&(h=hH(p),!h.has("permessage-deflate"))){$n(i,"Sec-WebSocket-Extensions header does not match.");return}let E=d.headersList.get("Sec-WebSocket-Protocol");if(E!==null){let m=BH("sec-websocket-protocol",a.headersList);if(m===null||!m.includes(E)){$n(i,"Protocol was not set in the opening handshake.");return}}d.socket.on("data",YD),d.socket.on("close",jD),d.socket.on("error",HD),us.open.hasSubscribers&&us.open.publish({address:d.socket.address(),protocol:E,extensions:p}),r(d,h)}})}function wH(e,t,n,i){if(!(fH(e)||gH(e)))if(!pH(e))$n(e,"Connection was closed before it was established."),e[iA]=nA.CLOSING;else if(e[fl]===dl.NOT_SENT){e[fl]=dl.PROCESSING;let r=new QH;t!==void 0&&n===void 0?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(t,0)):t!==void 0&&n!==void 0?(r.frameData=Buffer.allocUnsafe(2+i),r.frameData.writeUInt16BE(t,0),r.frameData.write(n,2,"utf-8")):r.frameData=uH,e[JD].socket.write(r.createFrame(lH.CLOSE)),e[fl]=dl.SENT,e[iA]=nA.CLOSING}else e[iA]=nA.CLOSING}function YD(e){this.ws[VD].write(e)||this.pause()}function jD(){let{ws:e}=this,{[JD]:t}=e;t.socket.off("data",YD),t.socket.off("close",jD),t.socket.off("error",HD);let n=e[fl]===dl.SENT&&e[GD],i=1005,r="",o=e[VD].closingInfo;o&&!o.error?(i=o.code??1005,r=o.reason):e[GD]||(i=1006),e[iA]=nA.CLOSED,dH("close",e,(s,a)=>new mH(s,a),{wasClean:n,code:i,reason:r}),us.close.hasSubscribers&&us.close.publish({websocket:e,code:i,reason:r})}function HD(e){let{ws:t}=this;t[iA]=nA.CLOSING,us.socketError.hasSubscribers&&us.socketError.publish(e),this.destroy()}qD.exports={establishWebSocketConnection:vH,closeWebSocketConnection:wH}});var ZD=k((p7,WD)=>{"use strict";var{createInflateRaw:bH,Z_DEFAULT_WINDOWBITS:kH}=require("node:zlib"),{isValidClientWindowBits:SH}=tA(),{MessageSizeExceededError:xH}=ue(),RH=Buffer.from([0,0,255,255]),gl=Symbol("kBuffer"),oA=Symbol("kLength"),$m=class{#e;#t={};#r=0;constructor(t,n){this.#t.serverNoContextTakeover=t.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=t.get("server_max_window_bits"),this.#r=n.maxPayloadSize}decompress(t,n,i){if(!this.#e){let r=kH;if(this.#t.serverMaxWindowBits){if(!SH(this.#t.serverMaxWindowBits)){i(new Error("Invalid server_max_window_bits"));return}r=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=bH({windowBits:r})}catch(o){i(o);return}this.#e[gl]=[],this.#e[oA]=0,this.#e.on("data",o=>{if(this.#e[oA]+=o.length,this.#r>0&&this.#e[oA]>this.#r){i(new xH),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[gl].push(o)}),this.#e.on("error",o=>{this.#e=null,i(o)})}this.#e.write(t),n&&this.#e.write(RH),this.#e.flush(()=>{if(!this.#e)return;let r=Buffer.concat(this.#e[gl],this.#e[oA]);this.#e[gl].length=0,this.#e[oA]=0,i(null,r)})}};WD.exports={PerMessageDeflate:$m}});var s0=k((h7,o0)=>{"use strict";var{Writable:DH}=require("node:stream"),_H=require("node:assert"),{parserStates:Et,opcodes:ls,states:NH,emptyBuffer:KD,sentCloseFrameState:XD}=zi(),{kReadyState:UH,kSentClose:e0,kResponse:Tm,kReceivedClose:t0}=Ka(),{channels:pl}=Bo(),{isValidStatusCode:$H,isValidOpcode:TH,failWebsocketConnection:Ut,websocketMessageReceived:r0,utf8Decode:FH,isControlFrame:Fm,isTextBinaryFrame:Mm,isContinuationFrame:MH}=tA(),{WebsocketFrameSend:n0}=ll(),{closeWebSocketConnection:i0}=Um(),{PerMessageDeflate:LH}=ZD(),{MessageSizeExceededError:Lm}=ue();function sA(e,t,n){i0(e,t,n,Buffer.byteLength(n)),Ut(e,n)}var Pm=class extends DH{#e=[];#t=0;#r=0;#i=!1;#o=Et.INFO;#n={};#s=[];#a;#c;#A;constructor(t,n,i={}){super(),this.ws=t,this.#a=n??new Map,this.#c=i.maxFragments??0,this.#A=i.maxPayloadSize??0,this.#a.has("permessage-deflate")&&this.#a.set("permessage-deflate",new LH(n,i))}_write(t,n,i){this.#e.push(t),this.#r+=t.length,this.#i=!0,this.run(i)}#u(){return this.#A>0&&!Fm(this.#n.opcode)&&this.#n.payloadLength+this.#t>this.#A?(sA(this.ws,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(t){for(;this.#i;)if(this.#o===Et.INFO){if(this.#r<2)return t();let n=this.consume(2),i=(n[0]&128)!==0,r=n[0]&15,o=(n[1]&128)===128,s=!i&&r!==ls.CONTINUATION,a=n[1]&127,A=n[0]&64,c=n[0]&32,l=n[0]&16;if(!TH(r))return Ut(this.ws,"Invalid opcode received"),t();if(o)return Ut(this.ws,"Frame cannot be masked"),t();if(A!==0&&!this.#a.has("permessage-deflate")){Ut(this.ws,"Expected RSV1 to be clear.");return}if(c!==0||l!==0){Ut(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!Mm(r)){Ut(this.ws,"Invalid frame type was fragmented.");return}if(Mm(r)&&this.#s.length>0){Ut(this.ws,"Expected continuation frame");return}if(this.#n.fragmented&&s){Ut(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((a>125||s)&&Fm(r)){Ut(this.ws,"Control frame either too large or fragmented");return}if(MH(r)&&this.#s.length===0&&!this.#n.compressed){Ut(this.ws,"Unexpected continuation frame");return}if(a<=125){if(this.#n.payloadLength=a,this.#o=Et.READ_DATA,!this.#u())return}else a===126?this.#o=Et.PAYLOADLENGTH_16:a===127&&(this.#o=Et.PAYLOADLENGTH_64);Mm(r)&&(this.#n.binaryType=r,this.#n.compressed=A!==0),this.#n.opcode=r,this.#n.masked=o,this.#n.fin=i,this.#n.fragmented=s}else if(this.#o===Et.PAYLOADLENGTH_16){if(this.#r<2)return t();let n=this.consume(2);if(this.#n.payloadLength=n.readUInt16BE(0),this.#o=Et.READ_DATA,!this.#u())return}else if(this.#o===Et.PAYLOADLENGTH_64){if(this.#r<8)return t();let n=this.consume(8),i=n.readUInt32BE(0),r=n.readUInt32BE(4);if(i!==0||r>2**31-1){Ut(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#n.payloadLength=r,this.#o=Et.READ_DATA,!this.#u())return}else if(this.#o===Et.READ_DATA){if(this.#r<this.#n.payloadLength)return t();let n=this.consume(this.#n.payloadLength);if(Fm(this.#n.opcode)){this.#i=this.parseControlFrame(n),this.#o=Et.INFO;let i=this.ws[Tm].socket;if(this.#i&&i.writableNeedDrain){this.#i=!1,i.once("drain",()=>{this.destroyed||(this.#i=!0,this.run(t))});return}}else if(this.#n.compressed){this.#a.get("permessage-deflate").decompress(n,this.#n.fin,(i,r)=>{if(i){let o=i instanceof Lm?1009:1007;sA(this.ws,o,i.message);return}if(this.writeFragments(r)){if(this.#A>0&&this.#t>this.#A){sA(this.ws,1009,new Lm().message);return}if(!this.#n.fin){this.#o=Et.INFO,this.#i=!0,this.run(t);return}r0(this.ws,this.#n.binaryType,this.consumeFragments()),this.#i=!0,this.#o=Et.INFO,this.run(t)}}),this.#i=!1;break}else{if(!this.writeFragments(n))return;if(this.#A>0&&this.#t>this.#A){sA(this.ws,1009,new Lm().message);return}!this.#n.fragmented&&this.#n.fin&&r0(this.ws,this.#n.binaryType,this.consumeFragments()),this.#o=Et.INFO}}}consume(t){if(t>this.#r)throw new Error("Called consume() before buffers satiated.");if(t===0)return KD;if(this.#e[0].length===t)return this.#r-=this.#e[0].length,this.#e.shift();let n=Buffer.allocUnsafe(t),i=0;for(;i!==t;){let r=this.#e[0],{length:o}=r;if(o+i===t){n.set(this.#e.shift(),i);break}else if(o+i>t){n.set(r.subarray(0,t-i),i),this.#e[0]=r.subarray(t-i);break}else n.set(this.#e.shift(),i),i+=r.length}return this.#r-=t,n}writeFragments(t){return this.#c>0&&this.#s.length===this.#c?(sA(this.ws,1008,"Too many message fragments"),!1):(this.#t+=t.length,this.#s.push(t),!0)}consumeFragments(){let t=this.#s;if(t.length===1)return this.#t=0,t.shift();let n=Buffer.concat(t,this.#t);return this.#s=[],this.#t=0,n}parseCloseBody(t){_H(t.length!==1);let n;if(t.length>=2&&(n=t.readUInt16BE(0)),n!==void 0&&!$H(n))return{code:1002,reason:"Invalid status code",error:!0};let i=t.subarray(2);i[0]===239&&i[1]===187&&i[2]===191&&(i=i.subarray(3));try{i=FH(i)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:n,reason:i,error:!1}}parseControlFrame(t){let{opcode:n,payloadLength:i}=this.#n;if(n===ls.CLOSE){if(i===1)return Ut(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#n.closeInfo=this.parseCloseBody(t),this.#n.closeInfo.error){let{code:r,reason:o}=this.#n.closeInfo;return i0(this.ws,r,o,o.length),Ut(this.ws,o),!1}if(this.ws[e0]!==XD.SENT){let r=KD;this.#n.closeInfo.code&&(r=Buffer.allocUnsafe(2),r.writeUInt16BE(this.#n.closeInfo.code,0));let o=new n0(r);this.ws[Tm].socket.write(o.createFrame(ls.CLOSE),s=>{s||(this.ws[e0]=XD.SENT)})}return this.ws[UH]=NH.CLOSING,this.ws[t0]=!0,!1}else if(n===ls.PING){if(!this.ws[t0]){let r=new n0(t);this.ws[Tm].socket.write(r.createFrame(ls.PONG)),pl.ping.hasSubscribers&&pl.ping.publish({payload:t})}}else n===ls.PONG&&pl.pong.hasSubscribers&&pl.pong.publish({payload:t});return!0}get closingInfo(){return this.#n.closeInfo}};o0.exports={ByteParser:Pm}});var l0=k((m7,u0)=>{"use strict";var{WebsocketFrameSend:PH}=ll(),{opcodes:a0,sendHints:ds}=zi(),OH=Jp(),A0=Buffer[Symbol.species],Om=class{#e=new OH;#t=!1;#r;constructor(t){this.#r=t}add(t,n,i){if(i!==ds.blob){let o=c0(t,i);if(!this.#t)this.#r.write(o,n);else{let s={promise:null,callback:n,frame:o};this.#e.push(s)}return}let r={promise:t.arrayBuffer().then(o=>{r.promise=null,r.frame=c0(o,i)}),callback:n,frame:null};this.#e.push(r),this.#t||this.#i()}async#i(){this.#t=!0;let t=this.#e;for(;!t.isEmpty();){let n=t.shift();n.promise!==null&&await n.promise,this.#r.write(n.frame,n.callback),n.callback=n.frame=null}this.#t=!1}};function c0(e,t){return new PH(zH(e,t)).createFrame(t===ds.string?a0.TEXT:a0.BINARY)}function zH(e,t){switch(t){case ds.string:return Buffer.from(e);case ds.arrayBuffer:case ds.blob:return new A0(e);case ds.typedArray:return new A0(e.buffer,e.byteOffset,e.byteLength)}}u0.exports={SendQueue:Om}});var C0=k((I7,y0)=>{"use strict";var{webidl:W}=Je(),{URLSerializer:GH}=gt(),{environmentSettingsObject:d0}=bt(),{staticPropertyDescriptors:Tn,states:aA,sentCloseFrameState:VH,sendHints:hl}=zi(),{kWebSocketURL:f0,kReadyState:zm,kController:g0,kBinaryType:ml,kResponse:p0,kSentClose:JH,kByteParser:YH}=Ka(),{isConnecting:jH,isEstablished:HH,isClosing:qH,isValidSubprotocol:WH,fireEvent:h0}=tA(),{establishWebSocketConnection:ZH,closeWebSocketConnection:m0}=Um(),{ByteParser:KH}=s0(),{kEnumerableProperty:Ht,isBlobLike:I0}=ie(),{getGlobalDispatcher:XH}=Ga(),{types:E0}=require("node:util"),{ErrorEvent:e4,CloseEvent:t4}=As(),{SendQueue:r4}=l0(),$t=class e extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#r="";#i="";#o;constructor(t,n=[]){super(),W.util.markAsUncloneable(this);let i="WebSocket constructor";W.argumentLengthCheck(arguments,1,i);let r=W.converters["DOMString or sequence<DOMString> or WebSocketInit"](n,i,"options");t=W.converters.USVString(t,i,"url"),n=r.protocols;let o=d0.settingsObject.baseUrl,s;try{s=new URL(t,o)}catch(A){throw new DOMException(A,"SyntaxError")}if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${s.protocol}`,"SyntaxError");if(s.hash||s.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof n=="string"&&(n=[n]),n.length!==new Set(n.map(A=>A.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(n.length>0&&!n.every(A=>WH(A)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[f0]=new URL(s.href);let a=d0.settingsObject;this[g0]=ZH(s,n,a,this,(A,c)=>this.#n(A,c),r),this[zm]=e.CONNECTING,this[JH]=VH.NOT_SENT,this[ml]="blob"}close(t=void 0,n=void 0){W.brandCheck(this,e);let i="WebSocket.close";if(t!==void 0&&(t=W.converters["unsigned short"](t,i,"code",{clamp:!0})),n!==void 0&&(n=W.converters.USVString(n,i,"reason")),t!==void 0&&t!==1e3&&(t<3e3||t>4999))throw new DOMException("invalid code","InvalidAccessError");let r=0;if(n!==void 0&&(r=Buffer.byteLength(n),r>123))throw new DOMException(`Reason must be less than 123 bytes; received ${r}`,"SyntaxError");m0(this,t,n,r)}send(t){W.brandCheck(this,e);let n="WebSocket.send";if(W.argumentLengthCheck(arguments,1,n),t=W.converters.WebSocketSendData(t,n,"data"),jH(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!HH(this)||qH(this)))if(typeof t=="string"){let i=Buffer.byteLength(t);this.#t+=i,this.#o.add(t,()=>{this.#t-=i},hl.string)}else E0.isArrayBuffer(t)?(this.#t+=t.byteLength,this.#o.add(t,()=>{this.#t-=t.byteLength},hl.arrayBuffer)):ArrayBuffer.isView(t)?(this.#t+=t.byteLength,this.#o.add(t,()=>{this.#t-=t.byteLength},hl.typedArray)):I0(t)&&(this.#t+=t.size,this.#o.add(t,()=>{this.#t-=t.size},hl.blob))}get readyState(){return W.brandCheck(this,e),this[zm]}get bufferedAmount(){return W.brandCheck(this,e),this.#t}get url(){return W.brandCheck(this,e),GH(this[f0])}get extensions(){return W.brandCheck(this,e),this.#i}get protocol(){return W.brandCheck(this,e),this.#r}get onopen(){return W.brandCheck(this,e),this.#e.open}set onopen(t){W.brandCheck(this,e),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof t=="function"?(this.#e.open=t,this.addEventListener("open",t)):this.#e.open=null}get onerror(){return W.brandCheck(this,e),this.#e.error}set onerror(t){W.brandCheck(this,e),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof t=="function"?(this.#e.error=t,this.addEventListener("error",t)):this.#e.error=null}get onclose(){return W.brandCheck(this,e),this.#e.close}set onclose(t){W.brandCheck(this,e),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof t=="function"?(this.#e.close=t,this.addEventListener("close",t)):this.#e.close=null}get onmessage(){return W.brandCheck(this,e),this.#e.message}set onmessage(t){W.brandCheck(this,e),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof t=="function"?(this.#e.message=t,this.addEventListener("message",t)):this.#e.message=null}get binaryType(){return W.brandCheck(this,e),this[ml]}set binaryType(t){W.brandCheck(this,e),t!=="blob"&&t!=="arraybuffer"?this[ml]="blob":this[ml]=t}#n(t,n){this[p0]=t;let i=this[g0]?.dispatcher?.webSocketOptions,r=i?.maxFragments,o=i?.maxPayloadSize,s=new KH(this,n,{maxFragments:r,maxPayloadSize:o});s.on("drain",n4),s.on("error",i4.bind(this)),t.socket.ws=this,this[YH]=s,this.#o=new r4(t.socket),this[zm]=aA.OPEN;let a=t.headersList.get("sec-websocket-extensions");a!==null&&(this.#i=a);let A=t.headersList.get("sec-websocket-protocol");A!==null&&(this.#r=A),h0("open",this)}};$t.CONNECTING=$t.prototype.CONNECTING=aA.CONNECTING;$t.OPEN=$t.prototype.OPEN=aA.OPEN;$t.CLOSING=$t.prototype.CLOSING=aA.CLOSING;$t.CLOSED=$t.prototype.CLOSED=aA.CLOSED;Object.defineProperties($t.prototype,{CONNECTING:Tn,OPEN:Tn,CLOSING:Tn,CLOSED:Tn,url:Ht,readyState:Ht,bufferedAmount:Ht,onopen:Ht,onerror:Ht,onclose:Ht,close:Ht,onmessage:Ht,binaryType:Ht,send:Ht,extensions:Ht,protocol:Ht,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties($t,{CONNECTING:Tn,OPEN:Tn,CLOSING:Tn,CLOSED:Tn});W.converters["sequence<DOMString>"]=W.sequenceConverter(W.converters.DOMString);W.converters["DOMString or sequence<DOMString>"]=function(e,t,n){return W.util.Type(e)==="Object"&&Symbol.iterator in e?W.converters["sequence<DOMString>"](e):W.converters.DOMString(e,t,n)};W.converters.WebSocketInit=W.dictionaryConverter([{key:"protocols",converter:W.converters["DOMString or sequence<DOMString>"],defaultValue:()=>new Array(0)},{key:"dispatcher",converter:W.converters.any,defaultValue:()=>XH()},{key:"headers",converter:W.nullableConverter(W.converters.HeadersInit)}]);W.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return W.util.Type(e)==="Object"&&!(Symbol.iterator in e)?W.converters.WebSocketInit(e):{protocols:W.converters["DOMString or sequence<DOMString>"](e)}};W.converters.WebSocketSendData=function(e){if(W.util.Type(e)==="Object"){if(I0(e))return W.converters.Blob(e,{strict:!1});if(ArrayBuffer.isView(e)||E0.isArrayBuffer(e))return W.converters.BufferSource(e)}return W.converters.USVString(e)};function n4(){this.ws[p0].socket.resume()}function i4(e){let t,n;e instanceof t4?(t=e.reason,n=e.code):t=e.message,h0("error",this,()=>new e4("error",{error:e,message:t})),m0(this,n)}y0.exports={WebSocket:$t}});var Gm=k((E7,B0)=>{"use strict";function o4(e){return e.indexOf("\0")===-1}function s4(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)<48||e.charCodeAt(t)>57)return!1;return!0}function a4(e){return new Promise(t=>{setTimeout(t,e).unref()})}B0.exports={isValidLastEventId:o4,isASCIINumber:s4,delay:a4}});var v0=k((y7,Q0)=>{"use strict";var A4=require("node:buffer"),{Transform:c4}=require("node:stream"),{isASCIINumber:u4,isValidLastEventId:l4}=Gm(),fs=[239,187,191],Il=10,AA=13,d4=58,f4=32,g4=A4.kStringMaxLength,p4=Buffer.from("data"),h4=Buffer.from("event"),m4=Buffer.from("id"),I4=Buffer.from("retry"),E4=1024,y4=131072,C4=128;function B4(e,t){if(t>=e.length)return!1;for(let n=t;n<e.length;n++)if(e[n]<48||e[n]>57)return!1;return!0}function Q4(e,t){for(let n=t;n<e.length;n++)if(e[n]===0)return!1;return!0}function El(e,t,n){if(t!==n.length)return!1;for(let i=0;i<t;i++)if(e[i]!==n[i])return!1;return!0}function yl(){let e=new Error("EventSource message size exceeded");return e.aborted=!1,e}var Vm=class extends c4{state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;lineLength=0;eventSize=0;eventFieldSizes={data:0,event:0,id:0,retry:0};dataLineCount=0;maxEventSize;maxDataLines;maxBufferedChunks;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(t={}){t.readableObjectMode=!0,super(t),this.state=t.eventSourceSettings||{},this.maxEventSize=t.maxEventSize??g4;let n=this.maxEventSize>0?Math.min(y4,Math.max(E4,Math.floor(this.maxEventSize/C4))):0;this.maxDataLines=n,this.maxBufferedChunks=n,t.push&&(this.push=t.push)}_transform(t,n,i){if(t.length===0){i();return}if(this.maxEventSize>0&&this.chunks.length>=this.maxBufferedChunks&&t[0]!==Il&&t[0]!==AA){i(yl());return}if(this.chunks.push(t),this.checkBOM&&this.handleBOM()){i();return}for(;this.hasCurrentByte();){let r=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(r===Il){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(r===Il||r===AA){r===AA&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(r===Il||r===AA){r===AA&&(this.crlfCheck=!0);try{this.parseLine(this.readLine(),this.event)}catch(o){i(o);return}this.consumeCurrentByte(),this.eventEndCheck=!0;continue}if(this.maxEventSize>0&&++this.lineLength>this.maxEventSize+7){i(yl());return}this.advanceCursor()}i()}_destroy(t,n){this.chunks.length=0,this.clearEvent(),super._destroy(t,n)}parseLine(t,n){if(t.length===0)return;let i=t.indexOf(d4);if(i===0)return;let r=t.length,o=t.length;if(i!==-1&&(r=i,o=i+1,t[o]===f4&&++o),El(t,r,p4)){if(this.maxEventSize>0&&this.dataLineCount>=this.maxDataLines)throw yl();let s=t.length-o,a=this.eventFieldSizes.data+(n.data===void 0?0:1)+s;this.setEventFieldSize("data",a);let A=t.toString("utf8",o);n.data===void 0?n.data=A:n.data+=`
|
|
45
|
+
`.trim())}};Dx.exports=Kh});var Ga=k((M3,Tx)=>{"use strict";var Nx=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:J2}=ue(),Y2=Vo();$x()===void 0&&Ux(new Y2);function Ux(e){if(!e||typeof e.dispatch!="function")throw new J2("Argument agent must implement Agent");Object.defineProperty(globalThis,Nx,{value:e,writable:!0,enumerable:!1,configurable:!1})}function $x(){return globalThis[Nx]}Tx.exports={setGlobalDispatcher:Ux,getGlobalDispatcher:$x}});var Nu=k((P3,Fx)=>{"use strict";Fx.exports=class{#e;constructor(t){if(typeof t!="object"||t===null)throw new TypeError("handler must be an object");this.#e=t}onConnect(...t){return this.#e.onConnect?.(...t)}onError(...t){return this.#e.onError?.(...t)}onUpgrade(...t){return this.#e.onUpgrade?.(...t)}onResponseStarted(...t){return this.#e.onResponseStarted?.(...t)}onHeaders(...t){return this.#e.onHeaders?.(...t)}onData(...t){return this.#e.onData?.(...t)}onComplete(...t){return this.#e.onComplete?.(...t)}onBodySent(...t){return this.#e.onBodySent?.(...t)}}});var Lx=k((O3,Mx)=>{"use strict";var j2=du();Mx.exports=e=>{let t=e?.maxRedirections;return n=>function(r,o){let{maxRedirections:s=t,...a}=r;if(!s)return n(r,o);let A=new j2(n,s,r,o);return n(a,A)}}});var Ox=k((z3,Px)=>{"use strict";var H2=Qu();Px.exports=e=>t=>function(i,r){return t(i,new H2({...i,retryOptions:{...e,...i.retryOptions}},{handler:r,dispatch:t}))}});var Gx=k((G3,zx)=>{"use strict";var q2=ie(),{InvalidArgumentError:W2,RequestAbortedError:Z2}=ue(),K2=Nu(),Xh=class extends K2{#e=1024*1024;#t=null;#r=!1;#i=!1;#o=0;#n=null;#s=null;constructor({maxSize:t},n){if(super(n),t!=null&&(!Number.isFinite(t)||t<1))throw new W2("maxSize must be a number greater than 0");this.#e=t??this.#e,this.#s=n}onConnect(t){this.#t=t,this.#s.onConnect(this.#a.bind(this))}#a(t){this.#i=!0,this.#n=t}onHeaders(t,n,i,r){let s=q2.parseHeaders(n)["content-length"];if(s!=null&&s>this.#e)throw new Z2(`Response size (${s}) larger than maxSize (${this.#e})`);return this.#i?!0:this.#s.onHeaders(t,n,i,r)}onError(t){this.#r||(t=this.#n??t,this.#s.onError(t))}onData(t){return this.#o=this.#o+t.length,this.#o>=this.#e&&(this.#r=!0,this.#i?this.#s.onError(this.#n):this.#s.onComplete([])),!0}onComplete(t){if(!this.#r){if(this.#i){this.#s.onError(this.reason);return}this.#s.onComplete(t)}}};function X2({maxSize:e}={maxSize:1024*1024}){return t=>function(i,r){let{dumpMaxSize:o=e}=i,s=new Xh({maxSize:o},r);return t(i,s)}}zx.exports=X2});var Yx=k((V3,Jx)=>{"use strict";var{isIP:eJ}=require("node:net"),{lookup:tJ}=require("node:dns"),rJ=Nu(),{InvalidArgumentError:Xo,InformationalError:nJ}=ue(),Vx=Math.pow(2,31)-1,em=class{#e=0;#t=0;#r=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(t){this.#e=t.maxTTL,this.#t=t.maxItems,this.dualStack=t.dualStack,this.affinity=t.affinity,this.lookup=t.lookup??this.#i,this.pick=t.pick??this.#o}get full(){return this.#r.size===this.#t}runLookup(t,n,i){let r=this.#r.get(t.hostname);if(r==null&&this.full){i(null,t.origin);return}let o={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...n.dns,maxTTL:this.#e,maxItems:this.#t};if(r==null)this.lookup(t,o,(s,a)=>{if(s||a==null||a.length===0){i(s??new nJ("No DNS entries found"));return}this.setRecords(t,a);let A=this.#r.get(t.hostname),c=this.pick(t,A,o.affinity),l;typeof c.port=="number"?l=`:${c.port}`:t.port!==""?l=`:${t.port}`:l="",i(null,`${t.protocol}//${c.family===6?`[${c.address}]`:c.address}${l}`)});else{let s=this.pick(t,r,o.affinity);if(s==null){this.#r.delete(t.hostname),this.runLookup(t,n,i);return}let a;typeof s.port=="number"?a=`:${s.port}`:t.port!==""?a=`:${t.port}`:a="",i(null,`${t.protocol}//${s.family===6?`[${s.address}]`:s.address}${a}`)}}#i(t,n,i){tJ(t.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(r,o)=>{if(r)return i(r);let s=new Map;for(let a of o)s.set(`${a.address}:${a.family}`,a);i(null,s.values())})}#o(t,n,i){let r=null,{records:o,offset:s}=n,a;if(this.dualStack?(i==null&&(s==null||s===Vx?(n.offset=0,i=4):(n.offset++,i=(n.offset&1)===1?6:4)),o[i]!=null&&o[i].ips.length>0?a=o[i]:a=o[i===4?6:4]):a=o[i],a==null||a.ips.length===0)return r;a.offset==null||a.offset===Vx?a.offset=0:a.offset++;let A=a.offset%a.ips.length;return r=a.ips[A]??null,r==null?r:Date.now()-r.timestamp>r.ttl?(a.ips.splice(A,1),this.pick(t,n,i)):r}setRecords(t,n){let i=Date.now(),r={records:{4:null,6:null}};for(let o of n){o.timestamp=i,typeof o.ttl=="number"?o.ttl=Math.min(o.ttl,this.#e):o.ttl=this.#e;let s=r.records[o.family]??{ips:[]};s.ips.push(o),r.records[o.family]=s}this.#r.set(t.hostname,r)}getHandler(t,n){return new tm(this,t,n)}},tm=class extends rJ{#e=null;#t=null;#r=null;#i=null;#o=null;constructor(t,{origin:n,handler:i,dispatch:r},o){super(i),this.#o=n,this.#i=i,this.#t={...o},this.#e=t,this.#r=r}onError(t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){this.#e.runLookup(this.#o,this.#t,(n,i)=>{if(n)return this.#i.onError(n);let r={...this.#t,origin:i};this.#r(r,this)});return}this.#i.onError(t);return}case"ENOTFOUND":this.#e.deleteRecord(this.#o);default:this.#i.onError(t);break}}};Jx.exports=e=>{if(e?.maxTTL!=null&&(typeof e?.maxTTL!="number"||e?.maxTTL<0))throw new Xo("Invalid maxTTL. Must be a positive number");if(e?.maxItems!=null&&(typeof e?.maxItems!="number"||e?.maxItems<1))throw new Xo("Invalid maxItems. Must be a positive number and greater than zero");if(e?.affinity!=null&&e?.affinity!==4&&e?.affinity!==6)throw new Xo("Invalid affinity. Must be either 4 or 6");if(e?.dualStack!=null&&typeof e?.dualStack!="boolean")throw new Xo("Invalid dualStack. Must be a boolean");if(e?.lookup!=null&&typeof e?.lookup!="function")throw new Xo("Invalid lookup. Must be a function");if(e?.pick!=null&&typeof e?.pick!="function")throw new Xo("Invalid pick. Must be a function");let t=e?.dualStack??!0,n;t?n=e?.affinity??null:n=e?.affinity??4;let i={maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:t,affinity:n,maxItems:e?.maxItems??1/0},r=new em(i);return o=>function(a,A){let c=a.origin.constructor===URL?a.origin:new URL(a.origin);return eJ(c.hostname)!==0?o(a,A):(r.runLookup(c,a,(l,d)=>{if(l)return A.onError(l);let f=null;f={...a,servername:c.hostname,origin:d,headers:{host:c.hostname,...a.headers}},o(f,r.getHandler({origin:c,dispatch:o,handler:A},a))}),!0)}}});var Ti=k((J3,Xx)=>{"use strict";var{kConstruct:iJ}=ve(),{kEnumerableProperty:es}=ie(),{iteratorMixin:oJ,isValidHeaderName:Va,isValidHeaderValue:Hx}=bt(),{webidl:ce}=Je(),rm=require("node:assert"),Uu=require("node:util"),$e=Symbol("headers map"),Rt=Symbol("headers map sorted");function jx(e){return e===10||e===13||e===9||e===32}function qx(e){let t=0,n=e.length;for(;n>t&&jx(e.charCodeAt(n-1));)--n;for(;n>t&&jx(e.charCodeAt(t));)++t;return t===0&&n===e.length?e:e.substring(t,n)}function Wx(e,t){if(Array.isArray(t))for(let n=0;n<t.length;++n){let i=t[n];if(i.length!==2)throw ce.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${i.length}.`});nm(e,i[0],i[1])}else if(typeof t=="object"&&t!==null){let n=Object.keys(t);for(let i=0;i<n.length;++i)nm(e,n[i],t[n[i]])}else throw ce.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function nm(e,t,n){if(n=qx(n),Va(t)){if(!Hx(n))throw ce.errors.invalidArgument({prefix:"Headers.append",value:n,type:"header value"})}else throw ce.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if(Kx(e)==="immutable")throw new TypeError("immutable");return im(e).append(t,n,!1)}function Zx(e,t){return e[0]<t[0]?-1:1}var $u=class e{cookies=null;constructor(t){t instanceof e?(this[$e]=new Map(t[$e]),this[Rt]=t[Rt],this.cookies=t.cookies===null?null:[...t.cookies]):(this[$e]=new Map(t),this[Rt]=null)}contains(t,n){return this[$e].has(n?t:t.toLowerCase())}clear(){this[$e].clear(),this[Rt]=null,this.cookies=null}append(t,n,i){this[Rt]=null;let r=i?t:t.toLowerCase(),o=this[$e].get(r);if(o){let s=r==="cookie"?"; ":", ";this[$e].set(r,{name:o.name,value:`${o.value}${s}${n}`})}else this[$e].set(r,{name:t,value:n});r==="set-cookie"&&(this.cookies??=[]).push(n)}set(t,n,i){this[Rt]=null;let r=i?t:t.toLowerCase();r==="set-cookie"&&(this.cookies=[n]),this[$e].set(r,{name:t,value:n})}delete(t,n){this[Rt]=null,n||(t=t.toLowerCase()),t==="set-cookie"&&(this.cookies=null),this[$e].delete(t)}get(t,n){return this[$e].get(n?t:t.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:t,1:{value:n}}of this[$e])yield[t,n]}get entries(){let t={};if(this[$e].size!==0)for(let{name:n,value:i}of this[$e].values())t[n]=i;return t}rawValues(){return this[$e].values()}get entriesList(){let t=[];if(this[$e].size!==0)for(let{0:n,1:{name:i,value:r}}of this[$e])if(n==="set-cookie")for(let o of this.cookies)t.push([i,o]);else t.push([i,r]);return t}toSortedArray(){let t=this[$e].size,n=new Array(t);if(t<=32){if(t===0)return n;let i=this[$e][Symbol.iterator](),r=i.next().value;n[0]=[r[0],r[1].value],rm(r[1].value!==null);for(let o=1,s=0,a=0,A=0,c=0,l,d;o<t;++o){for(d=i.next().value,l=n[o]=[d[0],d[1].value],rm(l[1]!==null),A=0,a=o;A<a;)c=A+(a-A>>1),n[c][0]<=l[0]?A=c+1:a=c;if(o!==c){for(s=o;s>A;)n[s]=n[--s];n[A]=l}}if(!i.next().done)throw new TypeError("Unreachable");return n}else{let i=0;for(let{0:r,1:{value:o}}of this[$e])n[i++]=[r,o],rm(o!==null);return n.sort(Zx)}}},lr=class e{#e;#t;constructor(t=void 0){ce.util.markAsUncloneable(this),t!==iJ&&(this.#t=new $u,this.#e="none",t!==void 0&&(t=ce.converters.HeadersInit(t,"Headers contructor","init"),Wx(this,t)))}append(t,n){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,2,"Headers.append");let i="Headers.append";return t=ce.converters.ByteString(t,i,"name"),n=ce.converters.ByteString(n,i,"value"),nm(this,t,n)}delete(t){if(ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,1,"Headers.delete"),t=ce.converters.ByteString(t,"Headers.delete","name"),!Va(t))throw ce.errors.invalidArgument({prefix:"Headers.delete",value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(t,!1)&&this.#t.delete(t,!1)}get(t){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,1,"Headers.get");let n="Headers.get";if(t=ce.converters.ByteString(t,n,"name"),!Va(t))throw ce.errors.invalidArgument({prefix:n,value:t,type:"header name"});return this.#t.get(t,!1)}has(t){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,1,"Headers.has");let n="Headers.has";if(t=ce.converters.ByteString(t,n,"name"),!Va(t))throw ce.errors.invalidArgument({prefix:n,value:t,type:"header name"});return this.#t.contains(t,!1)}set(t,n){ce.brandCheck(this,e),ce.argumentLengthCheck(arguments,2,"Headers.set");let i="Headers.set";if(t=ce.converters.ByteString(t,i,"name"),n=ce.converters.ByteString(n,i,"value"),n=qx(n),Va(t)){if(!Hx(n))throw ce.errors.invalidArgument({prefix:i,value:n,type:"header value"})}else throw ce.errors.invalidArgument({prefix:i,value:t,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(t,n,!1)}getSetCookie(){ce.brandCheck(this,e);let t=this.#t.cookies;return t?[...t]:[]}get[Rt](){if(this.#t[Rt])return this.#t[Rt];let t=[],n=this.#t.toSortedArray(),i=this.#t.cookies;if(i===null||i.length===1)return this.#t[Rt]=n;for(let r=0;r<n.length;++r){let{0:o,1:s}=n[r];if(o==="set-cookie")for(let a=0;a<i.length;++a)t.push([o,i[a]]);else t.push([o,s])}return this.#t[Rt]=t}[Uu.inspect.custom](t,n){return n.depth??=t,`Headers ${Uu.formatWithOptions(n,this.#t.entries)}`}static getHeadersGuard(t){return t.#e}static setHeadersGuard(t,n){t.#e=n}static getHeadersList(t){return t.#t}static setHeadersList(t,n){t.#t=n}},{getHeadersGuard:Kx,setHeadersGuard:sJ,getHeadersList:im,setHeadersList:aJ}=lr;Reflect.deleteProperty(lr,"getHeadersGuard");Reflect.deleteProperty(lr,"setHeadersGuard");Reflect.deleteProperty(lr,"getHeadersList");Reflect.deleteProperty(lr,"setHeadersList");oJ("Headers",lr,Rt,0,1);Object.defineProperties(lr.prototype,{append:es,delete:es,get:es,has:es,set:es,getSetCookie:es,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Uu.inspect.custom]:{enumerable:!1}});ce.converters.HeadersInit=function(e,t,n){if(ce.util.Type(e)==="Object"){let i=Reflect.get(e,Symbol.iterator);if(!Uu.types.isProxy(e)&&i===lr.prototype.entries)try{return im(e).entriesList}catch{}return typeof i=="function"?ce.converters["sequence<sequence<ByteString>>"](e,t,n,i.bind(e)):ce.converters["record<ByteString, ByteString>"](e,t,n)}throw ce.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};Xx.exports={fill:Wx,compareHeaderName:Zx,Headers:lr,HeadersList:$u,getHeadersGuard:Kx,setHeadersGuard:sJ,setHeadersList:aJ,getHeadersList:im}});var Ya=k((Y3,lR)=>{"use strict";var{Headers:oR,HeadersList:eR,fill:AJ,getHeadersGuard:cJ,setHeadersGuard:sR,setHeadersList:aR}=Ti(),{extractBody:tR,cloneBody:uJ,mixinBody:lJ,hasFinalizationRegistry:AR,streamRegistry:cR,bodyUnusable:dJ}=$o(),om=ie(),rR=require("node:util"),{kEnumerableProperty:Dt}=om,{isValidReasonPhrase:fJ,isCancelled:gJ,isAborted:pJ,isBlobLike:hJ,serializeJavascriptValueToJSONString:mJ,isErrorLike:IJ,isomorphicEncode:EJ,environmentSettingsObject:yJ}=bt(),{redirectStatusSet:CJ,nullBodyStatus:BJ}=ga(),{kState:be,kHeaders:on}=yn(),{webidl:te}=Je(),{FormData:QJ}=ya(),{URLSerializer:nR}=gt(),{kConstruct:Fu}=ve(),sm=require("node:assert"),{types:vJ}=require("node:util"),wJ=new TextEncoder("utf-8"),Fi=class e{static error(){return Ja(Mu(),"immutable")}static json(t,n={}){te.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=te.converters.ResponseInit(n));let i=wJ.encode(mJ(t)),r=tR(i),o=Ja(ts({}),"response");return iR(o,n,{body:r[0],type:"application/json"}),o}static redirect(t,n=302){te.argumentLengthCheck(arguments,1,"Response.redirect"),t=te.converters.USVString(t),n=te.converters["unsigned short"](n);let i;try{i=new URL(t,yJ.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${t}`,{cause:s})}if(!CJ.has(n))throw new RangeError(`Invalid status code ${n}`);let r=Ja(ts({}),"immutable");r[be].status=n;let o=EJ(nR(i));return r[be].headersList.append("location",o,!0),r}constructor(t=null,n={}){if(te.util.markAsUncloneable(this),t===Fu)return;t!==null&&(t=te.converters.BodyInit(t)),n=te.converters.ResponseInit(n),this[be]=ts({}),this[on]=new oR(Fu),sR(this[on],"response"),aR(this[on],this[be].headersList);let i=null;if(t!=null){let[r,o]=tR(t);i={body:r,type:o}}iR(this,n,i)}get type(){return te.brandCheck(this,e),this[be].type}get url(){te.brandCheck(this,e);let t=this[be].urlList,n=t[t.length-1]??null;return n===null?"":nR(n,!0)}get redirected(){return te.brandCheck(this,e),this[be].urlList.length>1}get status(){return te.brandCheck(this,e),this[be].status}get ok(){return te.brandCheck(this,e),this[be].status>=200&&this[be].status<=299}get statusText(){return te.brandCheck(this,e),this[be].statusText}get headers(){return te.brandCheck(this,e),this[on]}get body(){return te.brandCheck(this,e),this[be].body?this[be].body.stream:null}get bodyUsed(){return te.brandCheck(this,e),!!this[be].body&&om.isDisturbed(this[be].body.stream)}clone(){if(te.brandCheck(this,e),dJ(this))throw te.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let t=am(this[be]);return AR&&this[be].body?.stream&&cR.register(this,new WeakRef(this[be].body.stream)),Ja(t,cJ(this[on]))}[rR.inspect.custom](t,n){n.depth===null&&(n.depth=2),n.colors??=!0;let i={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${rR.formatWithOptions(n,i)}`}};lJ(Fi);Object.defineProperties(Fi.prototype,{type:Dt,url:Dt,status:Dt,ok:Dt,redirected:Dt,statusText:Dt,headers:Dt,clone:Dt,body:Dt,bodyUsed:Dt,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(Fi,{json:Dt,redirect:Dt,error:Dt});function am(e){if(e.internalResponse)return uR(am(e.internalResponse),e.type);let t=ts({...e,body:null});return e.body!=null&&(t.body=uJ(t,e.body)),t}function ts(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new eR(e?.headersList):new eR,urlList:e?.urlList?[...e.urlList]:[]}}function Mu(e){let t=IJ(e);return ts({type:"error",status:0,error:t?e:new Error(e&&String(e)),aborted:e&&e.name==="AbortError"})}function bJ(e){return e.type==="error"&&e.status===0}function Tu(e,t){return t={internalResponse:e,...t},new Proxy(e,{get(n,i){return i in t?t[i]:n[i]},set(n,i,r){return sm(!(i in t)),n[i]=r,!0}})}function uR(e,t){if(t==="basic")return Tu(e,{type:"basic",headersList:e.headersList});if(t==="cors")return Tu(e,{type:"cors",headersList:e.headersList});if(t==="opaque")return Tu(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(t==="opaqueredirect")return Tu(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});sm(!1)}function kJ(e,t=null){return sm(gJ(e)),pJ(e)?Mu(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):Mu(Object.assign(new DOMException("Request was cancelled."),{cause:t}))}function iR(e,t,n){if(t.status!==null&&(t.status<200||t.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&t.statusText!=null&&!fJ(String(t.statusText)))throw new TypeError("Invalid statusText");if("status"in t&&t.status!=null&&(e[be].status=t.status),"statusText"in t&&t.statusText!=null&&(e[be].statusText=t.statusText),"headers"in t&&t.headers!=null&&AJ(e[on],t.headers),n){if(BJ.includes(e.status))throw te.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});e[be].body=n.body,n.type!=null&&!e[be].headersList.contains("content-type",!0)&&e[be].headersList.append("content-type",n.type,!0)}}function Ja(e,t){let n=new Fi(Fu);return n[be]=e,n[on]=new oR(Fu),aR(n[on],e.headersList),sR(n[on],t),AR&&e.body?.stream&&cR.register(n,new WeakRef(e.body.stream)),n}te.converters.ReadableStream=te.interfaceConverter(ReadableStream);te.converters.FormData=te.interfaceConverter(QJ);te.converters.URLSearchParams=te.interfaceConverter(URLSearchParams);te.converters.XMLHttpRequestBodyInit=function(e,t,n){return typeof e=="string"?te.converters.USVString(e,t,n):hJ(e)?te.converters.Blob(e,t,n,{strict:!1}):ArrayBuffer.isView(e)||vJ.isArrayBuffer(e)?te.converters.BufferSource(e,t,n):om.isFormDataLike(e)?te.converters.FormData(e,t,n,{strict:!1}):e instanceof URLSearchParams?te.converters.URLSearchParams(e,t,n):te.converters.DOMString(e,t,n)};te.converters.BodyInit=function(e,t,n){return e instanceof ReadableStream?te.converters.ReadableStream(e,t,n):e?.[Symbol.asyncIterator]?e:te.converters.XMLHttpRequestBodyInit(e,t,n)};te.converters.ResponseInit=te.dictionaryConverter([{key:"status",converter:te.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:te.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:te.converters.HeadersInit}]);lR.exports={isNetworkError:bJ,makeNetworkError:Mu,makeResponse:ts,makeAppropriateNetworkError:kJ,filterResponse:uR,Response:Fi,cloneResponse:am,fromInnerResponse:Ja}});var pR=k((j3,gR)=>{"use strict";var{kConnected:dR,kSize:fR}=ve(),Am=class{constructor(t){this.value=t}deref(){return this.value[dR]===0&&this.value[fR]===0?void 0:this.value}},cm=class{constructor(t){this.finalizer=t}register(t,n){t.on&&t.on("disconnect",()=>{t[dR]===0&&t[fR]===0&&this.finalizer(n)})}unregister(t){}};gR.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:Am,FinalizationRegistry:cm}):{WeakRef,FinalizationRegistry}}});var rs=k((H3,RR)=>{"use strict";var{extractBody:SJ,mixinBody:xJ,cloneBody:RJ,bodyUnusable:hR}=$o(),{Headers:wR,fill:DJ,HeadersList:zu,setHeadersGuard:lm,getHeadersGuard:_J,setHeadersList:bR,getHeadersList:mR}=Ti(),{FinalizationRegistry:NJ}=pR()(),Pu=ie(),IR=require("node:util"),{isValidHTTPToken:UJ,sameOrigin:ER,environmentSettingsObject:Lu}=bt(),{forbiddenMethodsSet:$J,corsSafeListedMethodsSet:TJ,referrerPolicy:FJ,requestRedirect:MJ,requestMode:LJ,requestCredentials:PJ,requestCache:OJ,requestDuplex:zJ}=ga(),{kEnumerableProperty:Te,normalizedMethodRecordsBase:GJ,normalizedMethodRecords:VJ}=Pu,{kHeaders:_t,kSignal:Ou,kState:Qe,kDispatcher:um}=yn(),{webidl:Y}=Je(),{URLSerializer:JJ}=gt(),{kConstruct:Gu}=ve(),YJ=require("node:assert"),{getMaxListeners:yR,setMaxListeners:CR,getEventListeners:jJ,defaultMaxListeners:BR}=require("node:events"),HJ=Symbol("abortController"),kR=new NJ(({signal:e,abort:t})=>{e.removeEventListener("abort",t)}),Vu=new WeakMap;function QR(e){return t;function t(){let n=e.deref();if(n!==void 0){kR.unregister(t),this.removeEventListener("abort",t),n.abort(this.reason);let i=Vu.get(n.signal);if(i!==void 0){if(i.size!==0){for(let r of i){let o=r.deref();o!==void 0&&o.abort(this.reason)}i.clear()}Vu.delete(n.signal)}}}}var vR=!1,Dn=class e{constructor(t,n={}){if(Y.util.markAsUncloneable(this),t===Gu)return;let i="Request constructor";Y.argumentLengthCheck(arguments,1,i),t=Y.converters.RequestInfo(t,i,"input"),n=Y.converters.RequestInit(n,i,"init");let r=null,o=null,s=Lu.settingsObject.baseUrl,a=null;if(typeof t=="string"){this[um]=n.dispatcher;let m;try{m=new URL(t,s)}catch(C){throw new TypeError("Failed to parse URL from "+t,{cause:C})}if(m.username||m.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+t);r=Ju({urlList:[m]}),o="cors"}else this[um]=n.dispatcher||t[um],YJ(t instanceof e),r=t[Qe],a=t[Ou];let A=Lu.settingsObject.origin,c="client";if(r.window?.constructor?.name==="EnvironmentSettingsObject"&&ER(r.window,A)&&(c=r.window),n.window!=null)throw new TypeError(`'window' option '${c}' must be null`);"window"in n&&(c="no-window"),r=Ju({method:r.method,headersList:r.headersList,unsafeRequest:r.unsafeRequest,client:Lu.settingsObject,window:c,priority:r.priority,origin:r.origin,referrer:r.referrer,referrerPolicy:r.referrerPolicy,mode:r.mode,credentials:r.credentials,cache:r.cache,redirect:r.redirect,integrity:r.integrity,keepalive:r.keepalive,reloadNavigation:r.reloadNavigation,historyNavigation:r.historyNavigation,urlList:[...r.urlList]});let l=Object.keys(n).length!==0;if(l&&(r.mode==="navigate"&&(r.mode="same-origin"),r.reloadNavigation=!1,r.historyNavigation=!1,r.origin="client",r.referrer="client",r.referrerPolicy="",r.url=r.urlList[r.urlList.length-1],r.urlList=[r.url]),n.referrer!==void 0){let m=n.referrer;if(m==="")r.referrer="no-referrer";else{let C;try{C=new URL(m,s)}catch(w){throw new TypeError(`Referrer "${m}" is not a valid URL.`,{cause:w})}C.protocol==="about:"&&C.hostname==="client"||A&&!ER(C,Lu.settingsObject.baseUrl)?r.referrer="client":r.referrer=C}}n.referrerPolicy!==void 0&&(r.referrerPolicy=n.referrerPolicy);let d;if(n.mode!==void 0?d=n.mode:d=o,d==="navigate")throw Y.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(d!=null&&(r.mode=d),n.credentials!==void 0&&(r.credentials=n.credentials),n.cache!==void 0&&(r.cache=n.cache),r.cache==="only-if-cached"&&r.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(n.redirect!==void 0&&(r.redirect=n.redirect),n.integrity!=null&&(r.integrity=String(n.integrity)),n.keepalive!==void 0&&(r.keepalive=!!n.keepalive),n.method!==void 0){let m=n.method,C=VJ[m];if(C!==void 0)r.method=C;else{if(!UJ(m))throw new TypeError(`'${m}' is not a valid HTTP method.`);let w=m.toUpperCase();if($J.has(w))throw new TypeError(`'${m}' HTTP method is unsupported.`);m=GJ[w]??m,r.method=m}!vR&&r.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),vR=!0)}n.signal!==void 0&&(a=n.signal),this[Qe]=r;let f=new AbortController;if(this[Ou]=f.signal,a!=null){if(!a||typeof a.aborted!="boolean"||typeof a.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(a.aborted)f.abort(a.reason);else{this[HJ]=f;let m=new WeakRef(f),C=QR(m);try{(typeof yR=="function"&&yR(a)===BR||jJ(a,"abort").length>=BR)&&CR(1500,a)}catch{}Pu.addAbortListener(a,C),kR.register(f,{signal:a,abort:C},C)}}if(this[_t]=new wR(Gu),bR(this[_t],r.headersList),lm(this[_t],"request"),d==="no-cors"){if(!TJ.has(r.method))throw new TypeError(`'${r.method} is unsupported in no-cors mode.`);lm(this[_t],"request-no-cors")}if(l){let m=mR(this[_t]),C=n.headers!==void 0?n.headers:new zu(m);if(m.clear(),C instanceof zu){for(let{name:w,value:b}of C.rawValues())m.append(w,b,!1);m.cookies=C.cookies}else DJ(this[_t],C)}let g=t instanceof e?t[Qe].body:null;if((n.body!=null||g!=null)&&(r.method==="GET"||r.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let p=null;if(n.body!=null){let[m,C]=SJ(n.body,r.keepalive);p=m,C&&!mR(this[_t]).contains("content-type",!0)&&this[_t].append("content-type",C)}let h=p??g;if(h!=null&&h.source==null){if(p!=null&&n.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(r.mode!=="same-origin"&&r.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');r.useCORSPreflightFlag=!0}let E=h;if(p==null&&g!=null){if(hR(t))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let m=new TransformStream;g.stream.pipeThrough(m),E={source:g.source,length:g.length,stream:m.readable}}this[Qe].body=E}get method(){return Y.brandCheck(this,e),this[Qe].method}get url(){return Y.brandCheck(this,e),JJ(this[Qe].url)}get headers(){return Y.brandCheck(this,e),this[_t]}get destination(){return Y.brandCheck(this,e),this[Qe].destination}get referrer(){return Y.brandCheck(this,e),this[Qe].referrer==="no-referrer"?"":this[Qe].referrer==="client"?"about:client":this[Qe].referrer.toString()}get referrerPolicy(){return Y.brandCheck(this,e),this[Qe].referrerPolicy}get mode(){return Y.brandCheck(this,e),this[Qe].mode}get credentials(){return this[Qe].credentials}get cache(){return Y.brandCheck(this,e),this[Qe].cache}get redirect(){return Y.brandCheck(this,e),this[Qe].redirect}get integrity(){return Y.brandCheck(this,e),this[Qe].integrity}get keepalive(){return Y.brandCheck(this,e),this[Qe].keepalive}get isReloadNavigation(){return Y.brandCheck(this,e),this[Qe].reloadNavigation}get isHistoryNavigation(){return Y.brandCheck(this,e),this[Qe].historyNavigation}get signal(){return Y.brandCheck(this,e),this[Ou]}get body(){return Y.brandCheck(this,e),this[Qe].body?this[Qe].body.stream:null}get bodyUsed(){return Y.brandCheck(this,e),!!this[Qe].body&&Pu.isDisturbed(this[Qe].body.stream)}get duplex(){return Y.brandCheck(this,e),"half"}clone(){if(Y.brandCheck(this,e),hR(this))throw new TypeError("unusable");let t=SR(this[Qe]),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let i=Vu.get(this.signal);i===void 0&&(i=new Set,Vu.set(this.signal,i));let r=new WeakRef(n);i.add(r),Pu.addAbortListener(n.signal,QR(r))}return xR(t,n.signal,_J(this[_t]))}[IR.inspect.custom](t,n){n.depth===null&&(n.depth=2),n.colors??=!0;let i={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${IR.formatWithOptions(n,i)}`}};xJ(Dn);function Ju(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new zu(e.headersList):new zu}}function SR(e){let t=Ju({...e,body:null});return e.body!=null&&(t.body=RJ(t,e.body)),t}function xR(e,t,n){let i=new Dn(Gu);return i[Qe]=e,i[Ou]=t,i[_t]=new wR(Gu),bR(i[_t],e.headersList),lm(i[_t],n),i}Object.defineProperties(Dn.prototype,{method:Te,url:Te,headers:Te,redirect:Te,clone:Te,signal:Te,duplex:Te,destination:Te,body:Te,bodyUsed:Te,isHistoryNavigation:Te,isReloadNavigation:Te,keepalive:Te,integrity:Te,cache:Te,credentials:Te,attribute:Te,referrerPolicy:Te,referrer:Te,mode:Te,[Symbol.toStringTag]:{value:"Request",configurable:!0}});Y.converters.Request=Y.interfaceConverter(Dn);Y.converters.RequestInfo=function(e,t,n){return typeof e=="string"?Y.converters.USVString(e,t,n):e instanceof Dn?Y.converters.Request(e,t,n):Y.converters.USVString(e,t,n)};Y.converters.AbortSignal=Y.interfaceConverter(AbortSignal);Y.converters.RequestInit=Y.dictionaryConverter([{key:"method",converter:Y.converters.ByteString},{key:"headers",converter:Y.converters.HeadersInit},{key:"body",converter:Y.nullableConverter(Y.converters.BodyInit)},{key:"referrer",converter:Y.converters.USVString},{key:"referrerPolicy",converter:Y.converters.DOMString,allowedValues:FJ},{key:"mode",converter:Y.converters.DOMString,allowedValues:LJ},{key:"credentials",converter:Y.converters.DOMString,allowedValues:PJ},{key:"cache",converter:Y.converters.DOMString,allowedValues:OJ},{key:"redirect",converter:Y.converters.DOMString,allowedValues:MJ},{key:"integrity",converter:Y.converters.DOMString},{key:"keepalive",converter:Y.converters.boolean},{key:"signal",converter:Y.nullableConverter(e=>Y.converters.AbortSignal(e,"RequestInit","signal",{strict:!1}))},{key:"window",converter:Y.converters.any},{key:"duplex",converter:Y.converters.DOMString,allowedValues:zJ},{key:"dispatcher",converter:Y.converters.any}]);RR.exports={Request:Dn,makeRequest:Ju,fromInnerRequest:xR,cloneRequest:SR}});var Ha=k((q3,JR)=>{"use strict";var{makeNetworkError:he,makeAppropriateNetworkError:Yu,filterResponse:dm,makeResponse:ju,fromInnerResponse:qJ}=Ya(),{HeadersList:DR}=Ti(),{Request:WJ,cloneRequest:ZJ}=rs(),_n=require("node:zlib"),{bytesMatch:KJ,makePolicyContainer:XJ,clonePolicyContainer:eY,requestBadPort:tY,TAOCheck:rY,appendRequestOriginHeader:nY,responseLocationURL:iY,requestCurrentURL:Fr,setRequestReferrerPolicyOnRedirect:oY,tryUpgradeRequestToAPotentiallyTrustworthyURL:sY,createOpaqueTimingInfo:mm,appendFetchMetadata:aY,corsCheck:AY,crossOriginResourcePolicyCheck:cY,determineRequestsReferrer:uY,coarsenedSharedCurrentTime:ja,createDeferredPromise:lY,isBlobLike:dY,sameOrigin:hm,isCancelled:Mi,isAborted:_R,isErrorLike:fY,fullyReadBody:gY,readableStreamClose:pY,isomorphicEncode:Hu,urlIsLocal:hY,urlIsHttpHttpsScheme:Im,urlHasHttpsScheme:mY,clampAndCoarsenConnectionTimingInfo:IY,simpleRangeHeaderValue:EY,buildContentRange:yY,createInflate:CY,extractMimeType:BY}=bt(),{kState:TR,kDispatcher:QY}=yn(),Li=require("node:assert"),{safelyExtractBody:Em,extractBody:NR}=$o(),{redirectStatusSet:FR,nullBodyStatus:MR,safeMethodsSet:vY,requestBodyHeader:wY,subresourceSet:bY}=ga(),kY=require("node:events"),{Readable:SY,pipeline:xY,finished:RY}=require("node:stream"),{addAbortListener:DY,isErrored:_Y,isReadable:qu,bufferToLowerCasedHeaderName:UR}=ie(),{dataURLProcessor:NY,serializeAMimeType:UY,minimizeSupportedMimeType:$Y}=gt(),{getGlobalDispatcher:TY}=Ga(),{webidl:FY}=Je(),{STATUS_CODES:MY}=require("node:http"),LY=["GET","HEAD"],PY=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",fm,Wu=class extends kY{constructor(t){super(),this.dispatcher=t,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(t){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(t),this.emit("terminated",t))}abort(t){this.state==="ongoing"&&(this.state="aborted",t||(t=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=t,this.connection?.destroy(t),this.emit("terminated",t))}};function OY(e){LR(e,"fetch")}function zY(e,t=void 0){FY.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=lY(),i;try{i=new WJ(e,t)}catch(l){return n.reject(l),n.promise}let r=i[TR];if(i.signal.aborted)return gm(n,r,null,i.signal.reason),n.promise;r.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(r.serviceWorkers="none");let s=null,a=!1,A=null;return DY(i.signal,()=>{a=!0,Li(A!=null),A.abort(i.signal.reason);let l=s?.deref();gm(n,r,l,i.signal.reason)}),A=OR({request:r,processResponseEndOfBody:OY,processResponse:l=>{if(!a){if(l.aborted){gm(n,r,s,A.serializedAbortReason);return}if(l.type==="error"){n.reject(new TypeError("fetch failed",{cause:l.error}));return}s=new WeakRef(qJ(l,"immutable")),n.resolve(s.deref()),n=null}},dispatcher:i[QY]}),n.promise}function LR(e,t="other"){if(e.type==="error"&&e.aborted||!e.urlList?.length)return;let n=e.urlList[0],i=e.timingInfo,r=e.cacheState;Im(n)&&i!==null&&(e.timingAllowPassed||(i=mm({startTime:i.startTime}),r=""),i.endTime=ja(),e.timingInfo=i,PR(i,n.href,t,globalThis,r))}var PR=performance.markResourceTiming;function gm(e,t,n,i){if(e&&e.reject(i),t.body!=null&&qu(t.body?.stream)&&t.body.stream.cancel(i).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),n==null)return;let r=n[TR];r.body!=null&&qu(r.body?.stream)&&r.body.stream.cancel(i).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o})}function OR({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:n,processResponse:i,processResponseEndOfBody:r,processResponseConsumeBody:o,useParallelQueue:s=!1,dispatcher:a=TY()}){Li(a);let A=null,c=!1;e.client!=null&&(A=e.client.globalObject,c=e.client.crossOriginIsolatedCapability);let l=ja(c),d=mm({startTime:l}),f={controller:new Wu(a),request:e,timingInfo:d,processRequestBodyChunkLength:t,processRequestEndOfBody:n,processResponse:i,processResponseConsumeBody:o,processResponseEndOfBody:r,taskDestination:A,crossOriginIsolatedCapability:c};return Li(!e.body||e.body.stream),e.window==="client"&&(e.window=e.client?.globalObject?.constructor?.name==="Window"?e.client:"no-window"),e.origin==="client"&&(e.origin=e.client.origin),e.policyContainer==="client"&&(e.client!=null?e.policyContainer=eY(e.client.policyContainer):e.policyContainer=XJ()),e.headersList.contains("accept",!0)||e.headersList.append("accept","*/*",!0),e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,bY.has(e.destination),zR(f).catch(g=>{f.controller.terminate(g)}),f.controller}async function zR(e,t=!1){let n=e.request,i=null;if(n.localURLsOnly&&!hY(Fr(n))&&(i=he("local URLs only")),sY(n),tY(n)==="blocked"&&(i=he("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=uY(n)),i===null&&(i=await(async()=>{let o=Fr(n);return hm(o,n.url)&&n.responseTainting==="basic"||o.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",await $R(e)):n.mode==="same-origin"?he('request mode cannot be "same-origin"'):n.mode==="no-cors"?n.redirect!=="follow"?he('redirect mode cannot be "follow" for "no-cors" request'):(n.responseTainting="opaque",await $R(e)):Im(Fr(n))?(n.responseTainting="cors",await GR(e)):he("URL scheme must be a HTTP(S) scheme")})()),t)return i;i.status!==0&&!i.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?i=dm(i,"basic"):n.responseTainting==="cors"?i=dm(i,"cors"):n.responseTainting==="opaque"?i=dm(i,"opaque"):Li(!1));let r=i.status===0?i:i.internalResponse;if(r.urlList.length===0&&r.urlList.push(...n.urlList),n.timingAllowFailed||(i.timingAllowPassed=!0),i.type==="opaque"&&r.status===206&&r.rangeRequested&&!n.headers.contains("range",!0)&&(i=r=he()),i.status!==0&&(n.method==="HEAD"||n.method==="CONNECT"||MR.includes(r.status))&&(r.body=null,e.controller.dump=!0),n.integrity){let o=a=>pm(e,he(a));if(n.responseTainting==="opaque"||i.body==null){o(i.error);return}let s=a=>{if(!KJ(a,n.integrity)){o("integrity mismatch");return}i.body=Em(a)[0],pm(e,i)};await gY(i.body,s,o)}else pm(e,i)}function $R(e){if(Mi(e)&&e.request.redirectCount===0)return Promise.resolve(Yu(e));let{request:t}=e,{protocol:n}=Fr(t);switch(n){case"about:":return Promise.resolve(he("about scheme is not supported"));case"blob:":{fm||(fm=require("node:buffer").resolveObjectURL);let i=Fr(t);if(i.search.length!==0)return Promise.resolve(he("NetworkError when attempting to fetch resource."));let r=fm(i.toString());if(t.method!=="GET"||!dY(r))return Promise.resolve(he("invalid method"));let o=ju(),s=r.size,a=Hu(`${s}`),A=r.type;if(t.headersList.contains("range",!0)){o.rangeRequested=!0;let c=t.headersList.get("range",!0),l=EY(c,!0);if(l==="failure")return Promise.resolve(he("failed to fetch the data URL"));let{rangeStartValue:d,rangeEndValue:f}=l;if(d===null)d=s-f,f=d+f-1;else{if(d>=s)return Promise.resolve(he("Range start is greater than the blob's size."));(f===null||f>=s)&&(f=s-1)}let g=r.slice(d,f,A),p=NR(g);o.body=p[0];let h=Hu(`${g.size}`),E=yY(d,f,s);o.status=206,o.statusText="Partial Content",o.headersList.set("content-length",h,!0),o.headersList.set("content-type",A,!0),o.headersList.set("content-range",E,!0)}else{let c=NR(r);o.statusText="OK",o.body=c[0],o.headersList.set("content-length",a,!0),o.headersList.set("content-type",A,!0)}return Promise.resolve(o)}case"data:":{let i=Fr(t),r=NY(i);if(r==="failure")return Promise.resolve(he("failed to fetch the data URL"));let o=UY(r.mimeType);return Promise.resolve(ju({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:o}]],body:Em(r.body)[0]}))}case"file:":return Promise.resolve(he("not implemented... yet..."));case"http:":case"https:":return GR(e).catch(i=>he(i));default:return Promise.resolve(he("unknown scheme"))}}function GY(e,t){e.request.done=!0,e.processResponseDone!=null&&queueMicrotask(()=>e.processResponseDone(t))}function pm(e,t){let n=e.timingInfo,i=()=>{let o=Date.now();e.request.destination==="document"&&(e.controller.fullTimingInfo=n),e.controller.reportTimingSteps=()=>{if(e.request.url.protocol!=="https:")return;n.endTime=o;let a=t.cacheState,A=t.bodyInfo;t.timingAllowPassed||(n=mm(n),a="");let c=0;if(e.request.mode!=="navigator"||!t.hasCrossOriginRedirects){c=t.status;let l=BY(t.headersList);l!=="failure"&&(A.contentType=$Y(l))}e.request.initiatorType!=null&&PR(n,e.request.url.href,e.request.initiatorType,globalThis,a,A,c)};let s=()=>{e.request.done=!0,e.processResponseEndOfBody!=null&&queueMicrotask(()=>e.processResponseEndOfBody(t)),e.request.initiatorType!=null&&e.controller.reportTimingSteps()};queueMicrotask(()=>s())};e.processResponse!=null&&queueMicrotask(()=>{e.processResponse(t),e.processResponse=null});let r=t.type==="error"?t:t.internalResponse??t;r.body==null?i():RY(r.body.stream,()=>{i()})}async function GR(e){let t=e.request,n=null,i=null,r=e.timingInfo;if(t.serviceWorkers,n===null){if(t.redirect==="follow"&&(t.serviceWorkers="none"),i=n=await VR(e),t.responseTainting==="cors"&&AY(t,n)==="failure")return he("cors failure");rY(t,n)==="failure"&&(t.timingAllowFailed=!0)}return(t.responseTainting==="opaque"||n.type==="opaque")&&cY(t.origin,t.client,t.destination,i)==="blocked"?he("blocked"):(FR.has(i.status)&&(t.redirect!=="manual"&&e.controller.connection.destroy(void 0,!1),t.redirect==="error"?n=he("unexpected redirect"):t.redirect==="manual"?n=i:t.redirect==="follow"?n=await VY(e,n):Li(!1)),n.timingInfo=r,n)}function VY(e,t){let n=e.request,i=t.internalResponse?t.internalResponse:t,r;try{if(r=iY(i,Fr(n).hash),r==null)return t}catch(s){return Promise.resolve(he(s))}if(!Im(r))return Promise.resolve(he("URL scheme must be a HTTP(S) scheme"));if(n.redirectCount===20)return Promise.resolve(he("redirect count exceeded"));if(n.redirectCount+=1,n.mode==="cors"&&(r.username||r.password)&&!hm(n,r))return Promise.resolve(he('cross origin not allowed for request mode "cors"'));if(n.responseTainting==="cors"&&(r.username||r.password))return Promise.resolve(he('URL cannot contain credentials for request mode "cors"'));if(i.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(he());if([301,302].includes(i.status)&&n.method==="POST"||i.status===303&&!LY.includes(n.method)){n.method="GET",n.body=null;for(let s of wY)n.headersList.delete(s)}hm(Fr(n),r)||(n.headersList.delete("authorization",!0),n.headersList.delete("proxy-authorization",!0),n.headersList.delete("cookie",!0),n.headersList.delete("host",!0)),n.body!=null&&(Li(n.body.source!=null),n.body=Em(n.body.source)[0]);let o=e.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=ja(e.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),n.urlList.push(r),oY(n,i),zR(e,!0)}async function VR(e,t=!1,n=!1){let i=e.request,r=null,o=null,s=null,a=null,A=!1;i.window==="no-window"&&i.redirect==="error"?(r=e,o=i):(o=ZJ(i),r={...e},r.request=o);let c=i.credentials==="include"||i.credentials==="same-origin"&&i.responseTainting==="basic",l=o.body?o.body.length:null,d=null;if(o.body==null&&["POST","PUT"].includes(o.method)&&(d="0"),l!=null&&(d=Hu(`${l}`)),d!=null&&o.headersList.append("content-length",d,!0),l!=null&&o.keepalive,o.referrer instanceof URL&&o.headersList.append("referer",Hu(o.referrer.href),!0),nY(o),aY(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",PY),o.cache==="default"&&(o.headersList.contains("if-modified-since",!0)||o.headersList.contains("if-none-match",!0)||o.headersList.contains("if-unmodified-since",!0)||o.headersList.contains("if-match",!0)||o.headersList.contains("if-range",!0))&&(o.cache="no-store"),o.cache==="no-cache"&&!o.preventNoCacheCacheControlHeaderModification&&!o.headersList.contains("cache-control",!0)&&o.headersList.append("cache-control","max-age=0",!0),(o.cache==="no-store"||o.cache==="reload")&&(o.headersList.contains("pragma",!0)||o.headersList.append("pragma","no-cache",!0),o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","no-cache",!0)),o.headersList.contains("range",!0)&&o.headersList.append("accept-encoding","identity",!0),o.headersList.contains("accept-encoding",!0)||(mY(Fr(o))?o.headersList.append("accept-encoding","br, gzip, deflate",!0):o.headersList.append("accept-encoding","gzip, deflate",!0)),o.headersList.delete("host",!0),a==null&&(o.cache="no-store"),o.cache!=="no-store"&&o.cache,s==null){if(o.cache==="only-if-cached")return he("only if cached");let f=await JY(r,c,n);!vY.has(o.method)&&f.status>=200&&f.status<=399,A&&f.status,s==null&&(s=f)}if(s.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=c,s.status===407)return i.window==="no-window"?he():Mi(e)?Yu(e):he("proxy authentication required");if(s.status===421&&!n&&(i.body==null||i.body.source!=null)){if(Mi(e))return Yu(e);e.controller.connection.destroy(),s=await VR(e,t,!0)}return s}async function JY(e,t=!1,n=!1){Li(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(p,h=!0){this.destroyed||(this.destroyed=!0,h&&this.abort?.(p??new DOMException("The operation was aborted.","AbortError")))}};let i=e.request,r=null,o=e.timingInfo;null==null&&(i.cache="no-store");let a=n?"yes":"no";i.mode;let A=null;if(i.body==null&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(i.body!=null){let p=async function*(m){Mi(e)||(yield m,e.processRequestBodyChunkLength?.(m.byteLength))},h=()=>{Mi(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},E=m=>{Mi(e)||(m.name==="AbortError"?e.controller.abort():e.controller.terminate(m))};A=(async function*(){try{for await(let m of i.body.stream)yield*p(m);h()}catch(m){E(m)}})()}try{let{body:p,status:h,statusText:E,headersList:m,socket:C}=await g({body:A});if(C)r=ju({status:h,statusText:E,headersList:m,socket:C});else{let w=p[Symbol.asyncIterator]();e.controller.next=()=>w.next(),r=ju({status:h,statusText:E,headersList:m})}}catch(p){return p.name==="AbortError"?(e.controller.connection.destroy(),Yu(e,p)):he(p)}let c=async()=>{await e.controller.resume()},l=p=>{Mi(e)||e.controller.abort(p)},d=new ReadableStream({async start(p){e.controller.controller=p},async pull(p){await c(p)},async cancel(p){await l(p)},type:"bytes"});r.body={stream:d,source:null,length:null},e.controller.resume||e.controller.on("terminated",f),e.controller.resume=async()=>{for(;;){let p,h;try{let{done:m,value:C}=await e.controller.next();if(_R(e))break;p=m?void 0:C}catch(m){e.controller.ended&&!o.encodedBodySize?p=void 0:(p=m,h=!0)}if(p===void 0){pY(e.controller.controller),GY(e,r);return}if(o.decodedBodySize+=p?.byteLength??0,h){e.controller.terminate(p);return}let E=new Uint8Array(p);if(E.byteLength&&e.controller.controller.enqueue(E),_Y(d)){e.controller.terminate();return}if(e.controller.controller.desiredSize<=0)return}};function f(p){_R(e)?(r.aborted=!0,qu(d)&&e.controller.controller.error(e.controller.serializedAbortReason)):qu(d)&&e.controller.controller.error(new TypeError("terminated",{cause:fY(p)?p:void 0})),e.controller.connection.destroy()}return r;function g({body:p}){let h=Fr(i),E=e.controller.dispatcher;return new Promise((m,C)=>E.dispatch({path:h.pathname+h.search,origin:h.origin,method:i.method,body:E.isMockActive?i.body&&(i.body.source||i.body.stream):p,headers:i.headersList.entries,maxRedirections:0,upgrade:i.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(w){let{connection:b}=e.controller;o.finalConnectionTimingInfo=IY(void 0,o.postRedirectStartTime,e.crossOriginIsolatedCapability),b.destroyed?w(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",w),this.abort=b.abort=w),o.finalNetworkRequestStartTime=ja(e.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=ja(e.crossOriginIsolatedCapability)},onHeaders(w,b,T,$){if(w<200)return;let K="",Se=new DR;for(let qe=0;qe<b.length;qe+=2)Se.append(UR(b[qe]),b[qe+1].toString("latin1"),!0);K=Se.get("location",!0);let Pt=[],Cr=K&&i.redirect==="follow"&&FR.has(w);if(i.method!=="HEAD"&&i.method!=="CONNECT"&&!MR.includes(w)&&!Cr){let qe=Se.get("content-encoding",!0),gn=qe?qe.toLowerCase().split(","):[],mc=5;if(gn.length>mc)return this.abort(new Error(`too many content-encodings in response: ${gn.length}, maximum allowed is ${mc}`)),!0;for(let Xn=gn.length-1;Xn>=0;--Xn){let Ic=gn[Xn].trim();if(Ic==="x-gzip"||Ic==="gzip")Pt.push(_n.createGunzip({flush:_n.constants.Z_SYNC_FLUSH,finishFlush:_n.constants.Z_SYNC_FLUSH}));else if(Ic==="deflate")Pt.push(CY({flush:_n.constants.Z_SYNC_FLUSH,finishFlush:_n.constants.Z_SYNC_FLUSH}));else if(Ic==="br")Pt.push(_n.createBrotliDecompress({flush:_n.constants.BROTLI_OPERATION_FLUSH,finishFlush:_n.constants.BROTLI_OPERATION_FLUSH}));else{Pt.length=0;break}}}this.body=new SY({read:T});let rr=this.onError.bind(this);return m({status:w,statusText:$,headersList:Se,body:Pt.length?xY(this.body,...Pt,qe=>{qe&&this.onError(qe)}).on("error",rr):this.body.on("error",rr)}),!0},onData(w){if(e.controller.dump)return;let b=w;return o.encodedBodySize+=b.byteLength,this.body.push(b)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.ended=!0,this.body.push(null)},onError(w){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(w),e.controller.terminate(w),C(w)},onUpgrade(w,b,T){if(w!==101)return;let $=new DR;for(let K=0;K<b.length;K+=2)$.append(UR(b[K]),b[K+1].toString("latin1"),!0);return m({status:w,statusText:MY[w],headersList:$,socket:T}),!0}}))}}JR.exports={fetch:zY,Fetch:Wu,fetching:OR,finalizeAndReportTiming:LR}});var ym=k((W3,YR)=>{"use strict";YR.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var HR=k((Z3,jR)=>{"use strict";var{webidl:Nt}=Je(),Zu=Symbol("ProgressEvent state"),Cm=class e extends Event{constructor(t,n={}){t=Nt.converters.DOMString(t,"ProgressEvent constructor","type"),n=Nt.converters.ProgressEventInit(n??{}),super(t,n),this[Zu]={lengthComputable:n.lengthComputable,loaded:n.loaded,total:n.total}}get lengthComputable(){return Nt.brandCheck(this,e),this[Zu].lengthComputable}get loaded(){return Nt.brandCheck(this,e),this[Zu].loaded}get total(){return Nt.brandCheck(this,e),this[Zu].total}};Nt.converters.ProgressEventInit=Nt.dictionaryConverter([{key:"lengthComputable",converter:Nt.converters.boolean,defaultValue:()=>!1},{key:"loaded",converter:Nt.converters["unsigned long long"],defaultValue:()=>0},{key:"total",converter:Nt.converters["unsigned long long"],defaultValue:()=>0},{key:"bubbles",converter:Nt.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:Nt.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:Nt.converters.boolean,defaultValue:()=>!1}]);jR.exports={ProgressEvent:Cm}});var WR=k((K3,qR)=>{"use strict";function YY(e){if(!e)return"failure";switch(e.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}qR.exports={getEncoding:YY}});var iD=k((X3,nD)=>{"use strict";var{kState:ns,kError:Bm,kResult:ZR,kAborted:qa,kLastProgressEventFired:Qm}=ym(),{ProgressEvent:jY}=HR(),{getEncoding:KR}=WR(),{serializeAMimeType:HY,parseMIMEType:XR}=gt(),{types:qY}=require("node:util"),{StringDecoder:eD}=require("string_decoder"),{btoa:tD}=require("node:buffer"),WY={enumerable:!0,writable:!1,configurable:!1};function ZY(e,t,n,i){if(e[ns]==="loading")throw new DOMException("Invalid state","InvalidStateError");e[ns]="loading",e[ZR]=null,e[Bm]=null;let o=t.stream().getReader(),s=[],a=o.read(),A=!0;(async()=>{for(;!e[qa];)try{let{done:c,value:l}=await a;if(A&&!e[qa]&&queueMicrotask(()=>{Nn("loadstart",e)}),A=!1,!c&&qY.isUint8Array(l))s.push(l),(e[Qm]===void 0||Date.now()-e[Qm]>=50)&&!e[qa]&&(e[Qm]=Date.now(),queueMicrotask(()=>{Nn("progress",e)})),a=o.read();else if(c){queueMicrotask(()=>{e[ns]="done";try{let d=KY(s,n,t.type,i);if(e[qa])return;e[ZR]=d,Nn("load",e)}catch(d){e[Bm]=d,Nn("error",e)}e[ns]!=="loading"&&Nn("loadend",e)});break}}catch(c){if(e[qa])return;queueMicrotask(()=>{e[ns]="done",e[Bm]=c,Nn("error",e),e[ns]!=="loading"&&Nn("loadend",e)});break}})()}function Nn(e,t){let n=new jY(e,{bubbles:!1,cancelable:!1});t.dispatchEvent(n)}function KY(e,t,n,i){switch(t){case"DataURL":{let r="data:",o=XR(n||"application/octet-stream");o!=="failure"&&(r+=HY(o)),r+=";base64,";let s=new eD("latin1");for(let a of e)r+=tD(s.write(a));return r+=tD(s.end()),r}case"Text":{let r="failure";if(i&&(r=KR(i)),r==="failure"&&n){let o=XR(n);o!=="failure"&&(r=KR(o.parameters.get("charset")))}return r==="failure"&&(r="UTF-8"),XY(e,r)}case"ArrayBuffer":return rD(e).buffer;case"BinaryString":{let r="",o=new eD("latin1");for(let s of e)r+=o.write(s);return r+=o.end(),r}}}function XY(e,t){let n=rD(e),i=ej(n),r=0;i!==null&&(t=i,r=i==="UTF-8"?3:2);let o=n.slice(r);return new TextDecoder(t).decode(o)}function ej(e){let[t,n,i]=e;return t===239&&n===187&&i===191?"UTF-8":t===254&&n===255?"UTF-16BE":t===255&&n===254?"UTF-16LE":null}function rD(e){let t=e.reduce((i,r)=>i+r.byteLength,0),n=0;return e.reduce((i,r)=>(i.set(r,n),n+=r.byteLength,i),new Uint8Array(t))}nD.exports={staticPropertyDescriptors:WY,readOperation:ZY,fireAProgressEvent:Nn}});var AD=k((e7,aD)=>{"use strict";var{staticPropertyDescriptors:is,readOperation:Ku,fireAProgressEvent:oD}=iD(),{kState:Pi,kError:sD,kResult:Xu,kEvents:le,kAborted:tj}=ym(),{webidl:Ee}=Je(),{kEnumerableProperty:mt}=ie(),dr=class e extends EventTarget{constructor(){super(),this[Pi]="empty",this[Xu]=null,this[sD]=null,this[le]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(t){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),t=Ee.converters.Blob(t,{strict:!1}),Ku(this,t,"ArrayBuffer")}readAsBinaryString(t){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),t=Ee.converters.Blob(t,{strict:!1}),Ku(this,t,"BinaryString")}readAsText(t,n=void 0){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsText"),t=Ee.converters.Blob(t,{strict:!1}),n!==void 0&&(n=Ee.converters.DOMString(n,"FileReader.readAsText","encoding")),Ku(this,t,"Text",n)}readAsDataURL(t){Ee.brandCheck(this,e),Ee.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),t=Ee.converters.Blob(t,{strict:!1}),Ku(this,t,"DataURL")}abort(){if(this[Pi]==="empty"||this[Pi]==="done"){this[Xu]=null;return}this[Pi]==="loading"&&(this[Pi]="done",this[Xu]=null),this[tj]=!0,oD("abort",this),this[Pi]!=="loading"&&oD("loadend",this)}get readyState(){switch(Ee.brandCheck(this,e),this[Pi]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return Ee.brandCheck(this,e),this[Xu]}get error(){return Ee.brandCheck(this,e),this[sD]}get onloadend(){return Ee.brandCheck(this,e),this[le].loadend}set onloadend(t){Ee.brandCheck(this,e),this[le].loadend&&this.removeEventListener("loadend",this[le].loadend),typeof t=="function"?(this[le].loadend=t,this.addEventListener("loadend",t)):this[le].loadend=null}get onerror(){return Ee.brandCheck(this,e),this[le].error}set onerror(t){Ee.brandCheck(this,e),this[le].error&&this.removeEventListener("error",this[le].error),typeof t=="function"?(this[le].error=t,this.addEventListener("error",t)):this[le].error=null}get onloadstart(){return Ee.brandCheck(this,e),this[le].loadstart}set onloadstart(t){Ee.brandCheck(this,e),this[le].loadstart&&this.removeEventListener("loadstart",this[le].loadstart),typeof t=="function"?(this[le].loadstart=t,this.addEventListener("loadstart",t)):this[le].loadstart=null}get onprogress(){return Ee.brandCheck(this,e),this[le].progress}set onprogress(t){Ee.brandCheck(this,e),this[le].progress&&this.removeEventListener("progress",this[le].progress),typeof t=="function"?(this[le].progress=t,this.addEventListener("progress",t)):this[le].progress=null}get onload(){return Ee.brandCheck(this,e),this[le].load}set onload(t){Ee.brandCheck(this,e),this[le].load&&this.removeEventListener("load",this[le].load),typeof t=="function"?(this[le].load=t,this.addEventListener("load",t)):this[le].load=null}get onabort(){return Ee.brandCheck(this,e),this[le].abort}set onabort(t){Ee.brandCheck(this,e),this[le].abort&&this.removeEventListener("abort",this[le].abort),typeof t=="function"?(this[le].abort=t,this.addEventListener("abort",t)):this[le].abort=null}};dr.EMPTY=dr.prototype.EMPTY=0;dr.LOADING=dr.prototype.LOADING=1;dr.DONE=dr.prototype.DONE=2;Object.defineProperties(dr.prototype,{EMPTY:is,LOADING:is,DONE:is,readAsArrayBuffer:mt,readAsBinaryString:mt,readAsText:mt,readAsDataURL:mt,abort:mt,readyState:mt,result:mt,error:mt,onloadstart:mt,onprogress:mt,onload:mt,onabort:mt,onerror:mt,onloadend:mt,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(dr,{EMPTY:is,LOADING:is,DONE:is});aD.exports={FileReader:dr}});var el=k((t7,cD)=>{"use strict";cD.exports={kConstruct:ve().kConstruct}});var dD=k((r7,lD)=>{"use strict";var rj=require("node:assert"),{URLSerializer:uD}=gt(),{isValidHeaderName:nj}=bt();function ij(e,t,n=!1){let i=uD(e,n),r=uD(t,n);return i===r}function oj(e){rj(e!==null);let t=[];for(let n of e.split(","))n=n.trim(),nj(n)&&t.push(n);return t}lD.exports={urlEquals:ij,getFieldValues:oj}});var pD=k((n7,gD)=>{"use strict";var{kConstruct:sj}=el(),{urlEquals:aj,getFieldValues:vm}=dD(),{kEnumerableProperty:Oi,isDisturbed:Aj}=ie(),{webidl:z}=Je(),{Response:cj,cloneResponse:uj,fromInnerResponse:lj}=Ya(),{Request:sn,fromInnerRequest:dj}=rs(),{kState:fr}=yn(),{fetching:fj}=Ha(),{urlIsHttpHttpsScheme:tl,createDeferredPromise:os,readAllBytes:gj}=bt(),wm=require("node:assert"),rl=class e{#e;constructor(){arguments[0]!==sj&&z.illegalConstructor(),z.util.markAsUncloneable(this),this.#e=arguments[1]}async match(t,n={}){z.brandCheck(this,e);let i="Cache.match";z.argumentLengthCheck(arguments,1,i),t=z.converters.RequestInfo(t,i,"request"),n=z.converters.CacheQueryOptions(n,i,"options");let r=this.#o(t,n,1);if(r.length!==0)return r[0]}async matchAll(t=void 0,n={}){z.brandCheck(this,e);let i="Cache.matchAll";return t!==void 0&&(t=z.converters.RequestInfo(t,i,"request")),n=z.converters.CacheQueryOptions(n,i,"options"),this.#o(t,n)}async add(t){z.brandCheck(this,e);let n="Cache.add";z.argumentLengthCheck(arguments,1,n),t=z.converters.RequestInfo(t,n,"request");let i=[t];return await this.addAll(i)}async addAll(t){z.brandCheck(this,e);let n="Cache.addAll";z.argumentLengthCheck(arguments,1,n);let i=[],r=[];for(let f of t){if(f===void 0)throw z.errors.conversionFailed({prefix:n,argument:"Argument 1",types:["undefined is not allowed"]});if(f=z.converters.RequestInfo(f),typeof f=="string")continue;let g=f[fr];if(!tl(g.url)||g.method!=="GET")throw z.errors.exception({header:n,message:"Expected http/s scheme when method is not GET."})}let o=[];for(let f of t){let g=new sn(f)[fr];if(!tl(g.url))throw z.errors.exception({header:n,message:"Expected http/s scheme."});g.initiator="fetch",g.destination="subresource",r.push(g);let p=os();o.push(fj({request:g,processResponse(h){if(h.type==="error"||h.status===206||h.status<200||h.status>299)p.reject(z.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(h.headersList.contains("vary")){let E=vm(h.headersList.get("vary"));for(let m of E)if(m==="*"){p.reject(z.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let C of o)C.abort();return}}},processResponseEndOfBody(h){if(h.aborted){p.reject(new DOMException("aborted","AbortError"));return}p.resolve(h)}})),i.push(p.promise)}let a=await Promise.all(i),A=[],c=0;for(let f of a){let g={type:"put",request:r[c],response:f};A.push(g),c++}let l=os(),d=null;try{this.#t(A)}catch(f){d=f}return queueMicrotask(()=>{d===null?l.resolve(void 0):l.reject(d)}),l.promise}async put(t,n){z.brandCheck(this,e);let i="Cache.put";z.argumentLengthCheck(arguments,2,i),t=z.converters.RequestInfo(t,i,"request"),n=z.converters.Response(n,i,"response");let r=null;if(t instanceof sn?r=t[fr]:r=new sn(t)[fr],!tl(r.url)||r.method!=="GET")throw z.errors.exception({header:i,message:"Expected an http/s scheme when method is not GET"});let o=n[fr];if(o.status===206)throw z.errors.exception({header:i,message:"Got 206 status"});if(o.headersList.contains("vary")){let g=vm(o.headersList.get("vary"));for(let p of g)if(p==="*")throw z.errors.exception({header:i,message:"Got * vary field value"})}if(o.body&&(Aj(o.body.stream)||o.body.stream.locked))throw z.errors.exception({header:i,message:"Response body is locked or disturbed"});let s=uj(o),a=os();if(o.body!=null){let p=o.body.stream.getReader();gj(p).then(a.resolve,a.reject)}else a.resolve(void 0);let A=[],c={type:"put",request:r,response:s};A.push(c);let l=await a.promise;s.body!=null&&(s.body.source=l);let d=os(),f=null;try{this.#t(A)}catch(g){f=g}return queueMicrotask(()=>{f===null?d.resolve():d.reject(f)}),d.promise}async delete(t,n={}){z.brandCheck(this,e);let i="Cache.delete";z.argumentLengthCheck(arguments,1,i),t=z.converters.RequestInfo(t,i,"request"),n=z.converters.CacheQueryOptions(n,i,"options");let r=null;if(t instanceof sn){if(r=t[fr],r.method!=="GET"&&!n.ignoreMethod)return!1}else wm(typeof t=="string"),r=new sn(t)[fr];let o=[],s={type:"delete",request:r,options:n};o.push(s);let a=os(),A=null,c;try{c=this.#t(o)}catch(l){A=l}return queueMicrotask(()=>{A===null?a.resolve(!!c?.length):a.reject(A)}),a.promise}async keys(t=void 0,n={}){z.brandCheck(this,e);let i="Cache.keys";t!==void 0&&(t=z.converters.RequestInfo(t,i,"request")),n=z.converters.CacheQueryOptions(n,i,"options");let r=null;if(t!==void 0)if(t instanceof sn){if(r=t[fr],r.method!=="GET"&&!n.ignoreMethod)return[]}else typeof t=="string"&&(r=new sn(t)[fr]);let o=os(),s=[];if(t===void 0)for(let a of this.#e)s.push(a[0]);else{let a=this.#r(r,n);for(let A of a)s.push(A[0])}return queueMicrotask(()=>{let a=[];for(let A of s){let c=dj(A,new AbortController().signal,"immutable");a.push(c)}o.resolve(Object.freeze(a))}),o.promise}#t(t){let n=this.#e,i=[...n],r=[],o=[];try{for(let s of t){if(s.type!=="delete"&&s.type!=="put")throw z.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw z.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#r(s.request,s.options,r).length)throw new DOMException("???","InvalidStateError");let a;if(s.type==="delete"){if(a=this.#r(s.request,s.options),a.length===0)return[];for(let A of a){let c=n.indexOf(A);wm(c!==-1),n.splice(c,1)}}else if(s.type==="put"){if(s.response==null)throw z.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let A=s.request;if(!tl(A.url))throw z.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(A.method!=="GET")throw z.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw z.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});a=this.#r(s.request);for(let c of a){let l=n.indexOf(c);wm(l!==-1),n.splice(l,1)}n.push([s.request,s.response]),r.push([s.request,s.response])}o.push([s.request,s.response])}return o}catch(s){throw this.#e.length=0,this.#e=i,s}}#r(t,n,i){let r=[],o=i??this.#e;for(let s of o){let[a,A]=s;this.#i(t,a,A,n)&&r.push(s)}return r}#i(t,n,i=null,r){let o=new URL(t.url),s=new URL(n.url);if(r?.ignoreSearch&&(s.search="",o.search=""),!aj(o,s,!0))return!1;if(i==null||r?.ignoreVary||!i.headersList.contains("vary"))return!0;let a=vm(i.headersList.get("vary"));for(let A of a){if(A==="*")return!1;let c=n.headersList.get(A),l=t.headersList.get(A);if(c!==l)return!1}return!0}#o(t,n,i=1/0){let r=null;if(t!==void 0)if(t instanceof sn){if(r=t[fr],r.method!=="GET"&&!n.ignoreMethod)return[]}else typeof t=="string"&&(r=new sn(t)[fr]);let o=[];if(t===void 0)for(let a of this.#e)o.push(a[1]);else{let a=this.#r(r,n);for(let A of a)o.push(A[1])}let s=[];for(let a of o){let A=lj(a,"immutable");if(s.push(A.clone()),s.length>=i)break}return Object.freeze(s)}};Object.defineProperties(rl.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:Oi,matchAll:Oi,add:Oi,addAll:Oi,put:Oi,delete:Oi,keys:Oi});var fD=[{key:"ignoreSearch",converter:z.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:z.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:z.converters.boolean,defaultValue:()=>!1}];z.converters.CacheQueryOptions=z.dictionaryConverter(fD);z.converters.MultiCacheQueryOptions=z.dictionaryConverter([...fD,{key:"cacheName",converter:z.converters.DOMString}]);z.converters.Response=z.interfaceConverter(cj);z.converters["sequence<RequestInfo>"]=z.sequenceConverter(z.converters.RequestInfo);gD.exports={Cache:rl}});var mD=k((i7,hD)=>{"use strict";var{kConstruct:Wa}=el(),{Cache:nl}=pD(),{webidl:Ke}=Je(),{kEnumerableProperty:Za}=ie(),il=class e{#e=new Map;constructor(){arguments[0]!==Wa&&Ke.illegalConstructor(),Ke.util.markAsUncloneable(this)}async match(t,n={}){if(Ke.brandCheck(this,e),Ke.argumentLengthCheck(arguments,1,"CacheStorage.match"),t=Ke.converters.RequestInfo(t),n=Ke.converters.MultiCacheQueryOptions(n),n.cacheName!=null){if(this.#e.has(n.cacheName)){let i=this.#e.get(n.cacheName);return await new nl(Wa,i).match(t,n)}}else for(let i of this.#e.values()){let o=await new nl(Wa,i).match(t,n);if(o!==void 0)return o}}async has(t){Ke.brandCheck(this,e);let n="CacheStorage.has";return Ke.argumentLengthCheck(arguments,1,n),t=Ke.converters.DOMString(t,n,"cacheName"),this.#e.has(t)}async open(t){Ke.brandCheck(this,e);let n="CacheStorage.open";if(Ke.argumentLengthCheck(arguments,1,n),t=Ke.converters.DOMString(t,n,"cacheName"),this.#e.has(t)){let r=this.#e.get(t);return new nl(Wa,r)}let i=[];return this.#e.set(t,i),new nl(Wa,i)}async delete(t){Ke.brandCheck(this,e);let n="CacheStorage.delete";return Ke.argumentLengthCheck(arguments,1,n),t=Ke.converters.DOMString(t,n,"cacheName"),this.#e.delete(t)}async keys(){return Ke.brandCheck(this,e),[...this.#e.keys()]}};Object.defineProperties(il.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Za,has:Za,open:Za,delete:Za,keys:Za});hD.exports={CacheStorage:il}});var ED=k((o7,ID)=>{"use strict";ID.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var Sm=k((s7,QD)=>{"use strict";function pj(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}function bm(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw new Error("Invalid cookie name")}}function km(e){let t=e.length,n=0;if(e[0]==='"'){if(t===1||e[t-1]!=='"')throw new Error("Invalid cookie value");--t,++n}for(;n<t;){let i=e.charCodeAt(n++);if(i<33||i>126||i===34||i===44||i===59||i===92)throw new Error("Invalid cookie value")}}function CD(e){for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<32||n>126||n===59)throw new Error("Invalid cookie path")}}function yD(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function hj(e){if(e===" ")return;if(e.length>255)throw new Error("Invalid cookie domain");let t=0;for(let n=0;n<e.length;++n){let i=e.charCodeAt(n);if(i===46){if(t===0)throw new Error("Invalid cookie domain");if(e.charCodeAt(n-1)===45)throw new Error("Invalid cookie domain");t=0;continue}if(t===0&&!yD(i))throw new Error("Invalid cookie domain");if(!yD(i)&&i!==45)throw new Error("Invalid cookie domain");if(++t>63)throw new Error("Invalid cookie domain")}if(t===0||e.charCodeAt(e.length-1)===45)throw new Error("Invalid cookie domain")}var mj=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ij=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ol=Array(61).fill(0).map((e,t)=>t.toString().padStart(2,"0"));function BD(e){return typeof e=="number"&&(e=new Date(e)),`${mj[e.getUTCDay()]}, ${ol[e.getUTCDate()]} ${Ij[e.getUTCMonth()]} ${e.getUTCFullYear()} ${ol[e.getUTCHours()]}:${ol[e.getUTCMinutes()]}:${ol[e.getUTCSeconds()]} GMT`}function Ej(e){if(e<0)throw new Error("Invalid cookie max-age")}function yj(e){if(e.name.length===0)return null;bm(e.name),km(e.value);let t=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&t.push("Secure"),e.httpOnly&&t.push("HttpOnly"),typeof e.maxAge=="number"&&(Ej(e.maxAge),t.push(`Max-Age=${e.maxAge}`)),e.domain&&(hj(e.domain),t.push(`Domain=${e.domain}`)),e.path&&(CD(e.path),t.push(`Path=${e.path}`)),e.expires&&e.expires.toString()!=="Invalid Date"&&t.push(`Expires=${BD(e.expires)}`),e.sameSite&&t.push(`SameSite=${e.sameSite}`);for(let n of e.unparsed){if(!n.includes("="))throw new Error("Invalid unparsed");let[i,...r]=n.split("="),o=i.trim(),s=r.join("=");bm(o),km(s),t.push(`${o}=${s}`)}return t.join("; ")}QD.exports={isCTLExcludingHtab:pj,validateCookieName:bm,validateCookiePath:CD,validateCookieValue:km,toIMFDate:BD,stringify:yj}});var wD=k((a7,vD)=>{"use strict";var{maxNameValuePairSize:Cj,maxAttributeValueSize:Bj}=ED(),{isCTLExcludingHtab:Qj}=Sm(),{collectASequenceOfCodePointsFast:sl}=gt(),vj=require("node:assert");function wj(e){if(Qj(e))return null;let t="",n="",i="",r="";if(e.includes(";")){let o={position:0};t=sl(";",e,o),n=e.slice(o.position)}else t=e;if(!t.includes("="))r=t;else{let o={position:0};i=sl("=",t,o),r=t.slice(o.position+1)}return i=i.trim(),r=r.trim(),i.length+r.length>Cj?null:{name:i,value:r,...ss(n)}}function ss(e,t={}){if(e.length===0)return t;vj(e[0]===";"),e=e.slice(1);let n="";e.includes(";")?(n=sl(";",e,{position:0}),e=e.slice(n.length)):(n=e,e="");let i="",r="";if(n.includes("=")){let s={position:0};i=sl("=",n,s),r=n.slice(s.position+1)}else i=n;if(i=i.trim(),r=r.trim(),r.length>Bj)return ss(e,t);let o=i.toLowerCase();if(o==="expires"){let s=new Date(r);t.expires=s}else if(o==="max-age"){let s=r.charCodeAt(0);if((s<48||s>57)&&r[0]!=="-"||!/^\d+$/.test(r))return ss(e,t);let a=Number(r);t.maxAge=a}else if(o==="domain"){let s=r;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),t.domain=s}else if(o==="path"){let s="";r.length===0||r[0]!=="/"?s="/":s=r,t.path=s}else if(o==="secure")t.secure=!0;else if(o==="httponly")t.httpOnly=!0;else if(o==="samesite"){let s=r.toLowerCase();s==="none"?t.sameSite="None":s==="strict"?t.sameSite="Strict":s==="lax"&&(t.sameSite="Lax")}else t.unparsed??=[],t.unparsed.push(`${i}=${r}`);return ss(e,t)}vD.exports={parseSetCookie:wj,parseUnparsedAttributes:ss}});var SD=k((A7,kD)=>{"use strict";var{parseSetCookie:bj}=wD(),{stringify:kj}=Sm(),{webidl:Ae}=Je(),{Headers:al}=Ti();function Sj(e){Ae.argumentLengthCheck(arguments,1,"getCookies"),Ae.brandCheck(e,al,{strict:!1});let t=e.get("cookie"),n={};if(!t)return n;for(let i of t.split(";")){let[r,...o]=i.split("=");n[r.trim()]=o.join("=")}return n}function xj(e,t,n){Ae.brandCheck(e,al,{strict:!1});let i="deleteCookie";Ae.argumentLengthCheck(arguments,2,i),t=Ae.converters.DOMString(t,i,"name"),n=Ae.converters.DeleteCookieAttributes(n),bD(e,{name:t,value:"",expires:new Date(0),...n})}function Rj(e){Ae.argumentLengthCheck(arguments,1,"getSetCookies"),Ae.brandCheck(e,al,{strict:!1});let t=e.getSetCookie();return t?t.map(n=>bj(n)):[]}function bD(e,t){Ae.argumentLengthCheck(arguments,2,"setCookie"),Ae.brandCheck(e,al,{strict:!1}),t=Ae.converters.Cookie(t);let n=kj(t);n&&e.append("Set-Cookie",n)}Ae.converters.DeleteCookieAttributes=Ae.dictionaryConverter([{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"path",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"domain",defaultValue:()=>null}]);Ae.converters.Cookie=Ae.dictionaryConverter([{converter:Ae.converters.DOMString,key:"name"},{converter:Ae.converters.DOMString,key:"value"},{converter:Ae.nullableConverter(e=>typeof e=="number"?Ae.converters["unsigned long long"](e):new Date(e)),key:"expires",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.DOMString),key:"path",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.boolean),key:"secure",defaultValue:()=>null},{converter:Ae.nullableConverter(Ae.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:Ae.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:Ae.sequenceConverter(Ae.converters.DOMString),key:"unparsed",defaultValue:()=>new Array(0)}]);kD.exports={getCookies:Sj,deleteCookie:xj,getSetCookies:Rj,setCookie:bD}});var As=k((c7,RD)=>{"use strict";var{webidl:L}=Je(),{kEnumerableProperty:It}=ie(),{kConstruct:xD}=ve(),{MessagePort:Dj}=require("node:worker_threads"),as=class e extends Event{#e;constructor(t,n={}){if(t===xD){super(arguments[1],arguments[2]),L.util.markAsUncloneable(this);return}let i="MessageEvent constructor";L.argumentLengthCheck(arguments,1,i),t=L.converters.DOMString(t,i,"type"),n=L.converters.MessageEventInit(n,i,"eventInitDict"),super(t,n),this.#e=n,L.util.markAsUncloneable(this)}get data(){return L.brandCheck(this,e),this.#e.data}get origin(){return L.brandCheck(this,e),this.#e.origin}get lastEventId(){return L.brandCheck(this,e),this.#e.lastEventId}get source(){return L.brandCheck(this,e),this.#e.source}get ports(){return L.brandCheck(this,e),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(t,n=!1,i=!1,r=null,o="",s="",a=null,A=[]){return L.brandCheck(this,e),L.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new e(t,{bubbles:n,cancelable:i,data:r,origin:o,lastEventId:s,source:a,ports:A})}static createFastMessageEvent(t,n){let i=new e(xD,t,n);return i.#e=n,i.#e.data??=null,i.#e.origin??="",i.#e.lastEventId??="",i.#e.source??=null,i.#e.ports??=[],i}},{createFastMessageEvent:_j}=as;delete as.createFastMessageEvent;var Al=class e extends Event{#e;constructor(t,n={}){let i="CloseEvent constructor";L.argumentLengthCheck(arguments,1,i),t=L.converters.DOMString(t,i,"type"),n=L.converters.CloseEventInit(n),super(t,n),this.#e=n,L.util.markAsUncloneable(this)}get wasClean(){return L.brandCheck(this,e),this.#e.wasClean}get code(){return L.brandCheck(this,e),this.#e.code}get reason(){return L.brandCheck(this,e),this.#e.reason}},cl=class e extends Event{#e;constructor(t,n){let i="ErrorEvent constructor";L.argumentLengthCheck(arguments,1,i),super(t,n),L.util.markAsUncloneable(this),t=L.converters.DOMString(t,i,"type"),n=L.converters.ErrorEventInit(n??{}),this.#e=n}get message(){return L.brandCheck(this,e),this.#e.message}get filename(){return L.brandCheck(this,e),this.#e.filename}get lineno(){return L.brandCheck(this,e),this.#e.lineno}get colno(){return L.brandCheck(this,e),this.#e.colno}get error(){return L.brandCheck(this,e),this.#e.error}};Object.defineProperties(as.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:It,origin:It,lastEventId:It,source:It,ports:It,initMessageEvent:It});Object.defineProperties(Al.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:It,code:It,wasClean:It});Object.defineProperties(cl.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:It,filename:It,lineno:It,colno:It,error:It});L.converters.MessagePort=L.interfaceConverter(Dj);L.converters["sequence<MessagePort>"]=L.sequenceConverter(L.converters.MessagePort);var xm=[{key:"bubbles",converter:L.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:L.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:L.converters.boolean,defaultValue:()=>!1}];L.converters.MessageEventInit=L.dictionaryConverter([...xm,{key:"data",converter:L.converters.any,defaultValue:()=>null},{key:"origin",converter:L.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:L.converters.DOMString,defaultValue:()=>""},{key:"source",converter:L.nullableConverter(L.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:L.converters["sequence<MessagePort>"],defaultValue:()=>new Array(0)}]);L.converters.CloseEventInit=L.dictionaryConverter([...xm,{key:"wasClean",converter:L.converters.boolean,defaultValue:()=>!1},{key:"code",converter:L.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:L.converters.USVString,defaultValue:()=>""}]);L.converters.ErrorEventInit=L.dictionaryConverter([...xm,{key:"message",converter:L.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:L.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:L.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:L.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:L.converters.any}]);RD.exports={MessageEvent:as,CloseEvent:Al,ErrorEvent:cl,createFastMessageEvent:_j}});var zi=k((u7,DD)=>{"use strict";var Nj="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",Uj={enumerable:!0,writable:!1,configurable:!1},$j={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},Tj={NOT_SENT:0,PROCESSING:1,SENT:2},Fj={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},Mj=2**16-1,Lj={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},Pj=Buffer.allocUnsafe(0),Oj={string:1,typedArray:2,arrayBuffer:3,blob:4};DD.exports={uid:Nj,sentCloseFrameState:Tj,staticPropertyDescriptors:Uj,states:$j,opcodes:Fj,maxUnsigned16Bit:Mj,parserStates:Lj,emptyBuffer:Pj,sendHints:Oj}});var Ka=k((l7,_D)=>{"use strict";_D.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var tA=k((d7,OD)=>{"use strict";var{kReadyState:Xa,kController:zj,kResponse:Gj,kBinaryType:Vj,kWebSocketURL:Jj}=Ka(),{states:eA,opcodes:Un}=zi(),{ErrorEvent:Yj,createFastMessageEvent:jj}=As(),{isUtf8:Hj}=require("node:buffer"),{collectASequenceOfCodePointsFast:qj,removeHTTPWhitespace:ND}=gt();function Wj(e){return e[Xa]===eA.CONNECTING}function Zj(e){return e[Xa]===eA.OPEN}function Kj(e){return e[Xa]===eA.CLOSING}function Xj(e){return e[Xa]===eA.CLOSED}function Rm(e,t,n=(r,o)=>new Event(r,o),i={}){let r=n(e,i);t.dispatchEvent(r)}function eH(e,t,n){if(e[Xa]!==eA.OPEN)return;let i;if(t===Un.TEXT)try{i=PD(n)}catch{$D(e,"Received invalid UTF-8 in text frame.");return}else t===Un.BINARY&&(e[Vj]==="blob"?i=new Blob([n]):i=tH(n));Rm("message",e,jj,{origin:e[Jj].origin,data:i})}function tH(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function rH(e){if(e.length===0)return!1;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}function nH(e){return e>=1e3&&e<1015?e!==1004&&e!==1005&&e!==1006:e>=3e3&&e<=4999}function $D(e,t){let{[zj]:n,[Gj]:i}=e;n.abort(),i?.socket&&!i.socket.destroyed&&i.socket.destroy(),t&&Rm("error",e,(r,o)=>new Yj(r,o),{error:new Error(t),message:t})}function TD(e){return e===Un.CLOSE||e===Un.PING||e===Un.PONG}function FD(e){return e===Un.CONTINUATION}function MD(e){return e===Un.TEXT||e===Un.BINARY}function iH(e){return MD(e)||FD(e)||TD(e)}function oH(e){let t={position:0},n=new Map;for(;t.position<e.length;){let i=qj(";",e,t),[r,o=""]=i.split("=");n.set(ND(r,!0,!1),ND(o,!1,!0)),t.position++}return n}function sH(e){if(e.length===0)return!1;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i<48||i>57)return!1}let t=Number.parseInt(e,10);return t>=8&&t<=15}var LD=typeof process.versions.icu=="string",UD=LD?new TextDecoder("utf-8",{fatal:!0}):void 0,PD=LD?UD.decode.bind(UD):function(e){if(Hj(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};OD.exports={isConnecting:Wj,isEstablished:Zj,isClosing:Kj,isClosed:Xj,fireEvent:Rm,isValidSubprotocol:rH,isValidStatusCode:nH,failWebsocketConnection:$D,websocketMessageReceived:eH,utf8Decode:PD,isControlFrame:TD,isContinuationFrame:FD,isTextBinaryFrame:MD,isValidOpcode:iH,parseExtensions:oH,isValidClientWindowBits:sH}});var ll=k((f7,zD)=>{"use strict";var{maxUnsigned16Bit:aH}=zi(),ul=16386,Dm,rA=null,cs=ul;try{Dm=require("node:crypto")}catch{Dm={randomFillSync:function(t,n,i){for(let r=0;r<t.length;++r)t[r]=Math.random()*255|0;return t}}}function AH(){return cs===ul&&(cs=0,Dm.randomFillSync(rA??=Buffer.allocUnsafe(ul),0,ul)),[rA[cs++],rA[cs++],rA[cs++],rA[cs++]]}var _m=class{constructor(t){this.frameData=t}createFrame(t){let n=this.frameData,i=AH(),r=n?.byteLength??0,o=r,s=6;r>aH?(s+=8,o=127):r>125&&(s+=2,o=126);let a=Buffer.allocUnsafe(r+s);a[0]=a[1]=0,a[0]|=128,a[0]=(a[0]&240)+t;a[s-4]=i[0],a[s-3]=i[1],a[s-2]=i[2],a[s-1]=i[3],a[1]=o,o===126?a.writeUInt16BE(r,2):o===127&&(a[2]=a[3]=0,a.writeUIntBE(r,4,6)),a[1]|=128;for(let A=0;A<r;++A)a[s+A]=n[A]^i[A&3];return a}};zD.exports={WebsocketFrameSend:_m}});var Um=k((g7,qD)=>{"use strict";var{uid:cH,states:nA,sentCloseFrameState:dl,emptyBuffer:uH,opcodes:lH}=zi(),{kReadyState:iA,kSentClose:fl,kByteParser:VD,kReceivedClose:GD,kResponse:JD}=Ka(),{fireEvent:dH,failWebsocketConnection:$n,isClosing:fH,isClosed:gH,isEstablished:pH,parseExtensions:hH}=tA(),{channels:us}=Bo(),{CloseEvent:mH}=As(),{makeRequest:IH}=rs(),{fetching:EH}=Ha(),{Headers:yH,getHeadersList:CH}=Ti(),{getDecodeSplit:BH}=bt(),{WebsocketFrameSend:QH}=ll(),Nm;try{Nm=require("node:crypto")}catch{}function vH(e,t,n,i,r,o){let s=e;s.protocol=e.protocol==="ws:"?"http:":"https:";let a=IH({urlList:[s],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(o.headers){let d=CH(new yH(o.headers));a.headersList=d}let A=Nm.randomBytes(16).toString("base64");a.headersList.append("sec-websocket-key",A),a.headersList.append("sec-websocket-version","13");for(let d of t)a.headersList.append("sec-websocket-protocol",d);return a.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),EH({request:a,useParallelQueue:!0,dispatcher:o.dispatcher,processResponse(d){if(d.type==="error"||d.status!==101){$n(i,"Received network error or non-101 status code.");return}if(t.length!==0&&!d.headersList.get("Sec-WebSocket-Protocol")){$n(i,"Server did not respond with sent protocols.");return}if(d.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){$n(i,'Server did not set Upgrade header to "websocket".');return}if(d.headersList.get("Connection")?.toLowerCase()!=="upgrade"){$n(i,'Server did not set Connection header to "upgrade".');return}let f=d.headersList.get("Sec-WebSocket-Accept"),g=Nm.createHash("sha1").update(A+cH).digest("base64");if(f!==g){$n(i,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let p=d.headersList.get("Sec-WebSocket-Extensions"),h;if(p!==null&&(h=hH(p),!h.has("permessage-deflate"))){$n(i,"Sec-WebSocket-Extensions header does not match.");return}let E=d.headersList.get("Sec-WebSocket-Protocol");if(E!==null){let m=BH("sec-websocket-protocol",a.headersList);if(m===null||!m.includes(E)){$n(i,"Protocol was not set in the opening handshake.");return}}d.socket.on("data",YD),d.socket.on("close",jD),d.socket.on("error",HD),us.open.hasSubscribers&&us.open.publish({address:d.socket.address(),protocol:E,extensions:p}),r(d,h)}})}function wH(e,t,n,i){if(!(fH(e)||gH(e)))if(!pH(e))$n(e,"Connection was closed before it was established."),e[iA]=nA.CLOSING;else if(e[fl]===dl.NOT_SENT){e[fl]=dl.PROCESSING;let r=new QH;t!==void 0&&n===void 0?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(t,0)):t!==void 0&&n!==void 0?(r.frameData=Buffer.allocUnsafe(2+i),r.frameData.writeUInt16BE(t,0),r.frameData.write(n,2,"utf-8")):r.frameData=uH,e[JD].socket.write(r.createFrame(lH.CLOSE)),e[fl]=dl.SENT,e[iA]=nA.CLOSING}else e[iA]=nA.CLOSING}function YD(e){this.ws[VD].write(e)||this.pause()}function jD(){let{ws:e}=this,{[JD]:t}=e;t.socket.off("data",YD),t.socket.off("close",jD),t.socket.off("error",HD);let n=e[fl]===dl.SENT&&e[GD],i=1005,r="",o=e[VD].closingInfo;o&&!o.error?(i=o.code??1005,r=o.reason):e[GD]||(i=1006),e[iA]=nA.CLOSED,dH("close",e,(s,a)=>new mH(s,a),{wasClean:n,code:i,reason:r}),us.close.hasSubscribers&&us.close.publish({websocket:e,code:i,reason:r})}function HD(e){let{ws:t}=this;t[iA]=nA.CLOSING,us.socketError.hasSubscribers&&us.socketError.publish(e),this.destroy()}qD.exports={establishWebSocketConnection:vH,closeWebSocketConnection:wH}});var ZD=k((p7,WD)=>{"use strict";var{createInflateRaw:bH,Z_DEFAULT_WINDOWBITS:kH}=require("node:zlib"),{isValidClientWindowBits:SH}=tA(),{MessageSizeExceededError:xH}=ue(),RH=Buffer.from([0,0,255,255]),gl=Symbol("kBuffer"),oA=Symbol("kLength"),$m=class{#e;#t={};#r=0;constructor(t,n){this.#t.serverNoContextTakeover=t.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=t.get("server_max_window_bits"),this.#r=n.maxPayloadSize}decompress(t,n,i){if(!this.#e){let r=kH;if(this.#t.serverMaxWindowBits){if(!SH(this.#t.serverMaxWindowBits)){i(new Error("Invalid server_max_window_bits"));return}r=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=bH({windowBits:r})}catch(o){i(o);return}this.#e[gl]=[],this.#e[oA]=0,this.#e.on("data",o=>{if(this.#e[oA]+=o.length,this.#r>0&&this.#e[oA]>this.#r){i(new xH),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[gl].push(o)}),this.#e.on("error",o=>{this.#e=null,i(o)})}this.#e.write(t),n&&this.#e.write(RH),this.#e.flush(()=>{if(!this.#e)return;let r=Buffer.concat(this.#e[gl],this.#e[oA]);this.#e[gl].length=0,this.#e[oA]=0,i(null,r)})}};WD.exports={PerMessageDeflate:$m}});var s0=k((h7,o0)=>{"use strict";var{Writable:DH}=require("node:stream"),_H=require("node:assert"),{parserStates:Et,opcodes:ls,states:NH,emptyBuffer:KD,sentCloseFrameState:XD}=zi(),{kReadyState:UH,kSentClose:e0,kResponse:Tm,kReceivedClose:t0}=Ka(),{channels:pl}=Bo(),{isValidStatusCode:$H,isValidOpcode:TH,failWebsocketConnection:Ut,websocketMessageReceived:r0,utf8Decode:FH,isControlFrame:Fm,isTextBinaryFrame:Mm,isContinuationFrame:MH}=tA(),{WebsocketFrameSend:n0}=ll(),{closeWebSocketConnection:i0}=Um(),{PerMessageDeflate:LH}=ZD(),{MessageSizeExceededError:Lm}=ue();function sA(e,t,n){i0(e,t,n,Buffer.byteLength(n)),Ut(e,n)}var Pm=class extends DH{#e=[];#t=0;#r=0;#i=!1;#o=Et.INFO;#n={};#s=[];#a;#c;#A;constructor(t,n,i={}){super(),this.ws=t,this.#a=n??new Map,this.#c=i.maxFragments??0,this.#A=i.maxPayloadSize??0,this.#a.has("permessage-deflate")&&this.#a.set("permessage-deflate",new LH(n,i))}_write(t,n,i){this.#e.push(t),this.#r+=t.length,this.#i=!0,this.run(i)}#u(){return this.#A>0&&!Fm(this.#n.opcode)&&this.#n.payloadLength+this.#t>this.#A?(sA(this.ws,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(t){for(;this.#i;)if(this.#o===Et.INFO){if(this.#r<2)return t();let n=this.consume(2),i=(n[0]&128)!==0,r=n[0]&15,o=(n[1]&128)===128,s=!i&&r!==ls.CONTINUATION,a=n[1]&127,A=n[0]&64,c=n[0]&32,l=n[0]&16;if(!TH(r))return Ut(this.ws,"Invalid opcode received"),t();if(o)return Ut(this.ws,"Frame cannot be masked"),t();if(A!==0&&!this.#a.has("permessage-deflate")){Ut(this.ws,"Expected RSV1 to be clear.");return}if(c!==0||l!==0){Ut(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!Mm(r)){Ut(this.ws,"Invalid frame type was fragmented.");return}if(Mm(r)&&this.#s.length>0){Ut(this.ws,"Expected continuation frame");return}if(this.#n.fragmented&&s){Ut(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((a>125||s)&&Fm(r)){Ut(this.ws,"Control frame either too large or fragmented");return}if(MH(r)&&this.#s.length===0&&!this.#n.compressed){Ut(this.ws,"Unexpected continuation frame");return}if(a<=125){if(this.#n.payloadLength=a,this.#o=Et.READ_DATA,!this.#u())return}else a===126?this.#o=Et.PAYLOADLENGTH_16:a===127&&(this.#o=Et.PAYLOADLENGTH_64);Mm(r)&&(this.#n.binaryType=r,this.#n.compressed=A!==0),this.#n.opcode=r,this.#n.masked=o,this.#n.fin=i,this.#n.fragmented=s}else if(this.#o===Et.PAYLOADLENGTH_16){if(this.#r<2)return t();let n=this.consume(2);if(this.#n.payloadLength=n.readUInt16BE(0),this.#o=Et.READ_DATA,!this.#u())return}else if(this.#o===Et.PAYLOADLENGTH_64){if(this.#r<8)return t();let n=this.consume(8),i=n.readUInt32BE(0),r=n.readUInt32BE(4);if(i!==0||r>2**31-1){Ut(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#n.payloadLength=r,this.#o=Et.READ_DATA,!this.#u())return}else if(this.#o===Et.READ_DATA){if(this.#r<this.#n.payloadLength)return t();let n=this.consume(this.#n.payloadLength);if(Fm(this.#n.opcode)){this.#i=this.parseControlFrame(n),this.#o=Et.INFO;let i=this.ws[Tm].socket;if(this.#i&&i.writableNeedDrain){this.#i=!1,i.once("drain",()=>{this.destroyed||(this.#i=!0,this.run(t))});return}}else if(this.#n.compressed){this.#a.get("permessage-deflate").decompress(n,this.#n.fin,(i,r)=>{if(i){let o=i instanceof Lm?1009:1007;sA(this.ws,o,i.message);return}if(this.writeFragments(r)){if(this.#A>0&&this.#t>this.#A){sA(this.ws,1009,new Lm().message);return}if(!this.#n.fin){this.#o=Et.INFO,this.#i=!0,this.run(t);return}r0(this.ws,this.#n.binaryType,this.consumeFragments()),this.#i=!0,this.#o=Et.INFO,this.run(t)}}),this.#i=!1;break}else{if(!this.writeFragments(n))return;if(this.#A>0&&this.#t>this.#A){sA(this.ws,1009,new Lm().message);return}!this.#n.fragmented&&this.#n.fin&&r0(this.ws,this.#n.binaryType,this.consumeFragments()),this.#o=Et.INFO}}}consume(t){if(t>this.#r)throw new Error("Called consume() before buffers satiated.");if(t===0)return KD;if(this.#e[0].length===t)return this.#r-=this.#e[0].length,this.#e.shift();let n=Buffer.allocUnsafe(t),i=0;for(;i!==t;){let r=this.#e[0],{length:o}=r;if(o+i===t){n.set(this.#e.shift(),i);break}else if(o+i>t){n.set(r.subarray(0,t-i),i),this.#e[0]=r.subarray(t-i);break}else n.set(this.#e.shift(),i),i+=r.length}return this.#r-=t,n}writeFragments(t){return this.#c>0&&this.#s.length===this.#c?(sA(this.ws,1008,"Too many message fragments"),!1):(this.#t+=t.length,this.#s.push(t),!0)}consumeFragments(){let t=this.#s;if(t.length===1)return this.#t=0,t.shift();let n=Buffer.concat(t,this.#t);return this.#s=[],this.#t=0,n}parseCloseBody(t){_H(t.length!==1);let n;if(t.length>=2&&(n=t.readUInt16BE(0)),n!==void 0&&!$H(n))return{code:1002,reason:"Invalid status code",error:!0};let i=t.subarray(2);i[0]===239&&i[1]===187&&i[2]===191&&(i=i.subarray(3));try{i=FH(i)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:n,reason:i,error:!1}}parseControlFrame(t){let{opcode:n,payloadLength:i}=this.#n;if(n===ls.CLOSE){if(i===1)return Ut(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#n.closeInfo=this.parseCloseBody(t),this.#n.closeInfo.error){let{code:r,reason:o}=this.#n.closeInfo;return i0(this.ws,r,o,o.length),Ut(this.ws,o),!1}if(this.ws[e0]!==XD.SENT){let r=KD;this.#n.closeInfo.code&&(r=Buffer.allocUnsafe(2),r.writeUInt16BE(this.#n.closeInfo.code,0));let o=new n0(r);this.ws[Tm].socket.write(o.createFrame(ls.CLOSE),s=>{s||(this.ws[e0]=XD.SENT)})}return this.ws[UH]=NH.CLOSING,this.ws[t0]=!0,!1}else if(n===ls.PING){if(!this.ws[t0]){let r=new n0(t);this.ws[Tm].socket.write(r.createFrame(ls.PONG)),pl.ping.hasSubscribers&&pl.ping.publish({payload:t})}}else n===ls.PONG&&pl.pong.hasSubscribers&&pl.pong.publish({payload:t});return!0}get closingInfo(){return this.#n.closeInfo}};o0.exports={ByteParser:Pm}});var l0=k((m7,u0)=>{"use strict";var{WebsocketFrameSend:PH}=ll(),{opcodes:a0,sendHints:ds}=zi(),OH=Jp(),A0=Buffer[Symbol.species],Om=class{#e=new OH;#t=!1;#r;constructor(t){this.#r=t}add(t,n,i){if(i!==ds.blob){let o=c0(t,i);if(!this.#t)this.#r.write(o,n);else{let s={promise:null,callback:n,frame:o};this.#e.push(s)}return}let r={promise:t.arrayBuffer().then(o=>{r.promise=null,r.frame=c0(o,i)}),callback:n,frame:null};this.#e.push(r),this.#t||this.#i()}async#i(){this.#t=!0;let t=this.#e;for(;!t.isEmpty();){let n=t.shift();n.promise!==null&&await n.promise,this.#r.write(n.frame,n.callback),n.callback=n.frame=null}this.#t=!1}};function c0(e,t){return new PH(zH(e,t)).createFrame(t===ds.string?a0.TEXT:a0.BINARY)}function zH(e,t){switch(t){case ds.string:return Buffer.from(e);case ds.arrayBuffer:case ds.blob:return new A0(e);case ds.typedArray:return new A0(e.buffer,e.byteOffset,e.byteLength)}}u0.exports={SendQueue:Om}});var C0=k((I7,y0)=>{"use strict";var{webidl:W}=Je(),{URLSerializer:GH}=gt(),{environmentSettingsObject:d0}=bt(),{staticPropertyDescriptors:Tn,states:aA,sentCloseFrameState:VH,sendHints:hl}=zi(),{kWebSocketURL:f0,kReadyState:zm,kController:g0,kBinaryType:ml,kResponse:p0,kSentClose:JH,kByteParser:YH}=Ka(),{isConnecting:jH,isEstablished:HH,isClosing:qH,isValidSubprotocol:WH,fireEvent:h0}=tA(),{establishWebSocketConnection:ZH,closeWebSocketConnection:m0}=Um(),{ByteParser:KH}=s0(),{kEnumerableProperty:Ht,isBlobLike:I0}=ie(),{getGlobalDispatcher:XH}=Ga(),{types:E0}=require("node:util"),{ErrorEvent:e4,CloseEvent:t4}=As(),{SendQueue:r4}=l0(),$t=class e extends EventTarget{#e={open:null,error:null,close:null,message:null};#t=0;#r="";#i="";#o;constructor(t,n=[]){super(),W.util.markAsUncloneable(this);let i="WebSocket constructor";W.argumentLengthCheck(arguments,1,i);let r=W.converters["DOMString or sequence<DOMString> or WebSocketInit"](n,i,"options");t=W.converters.USVString(t,i,"url"),n=r.protocols;let o=d0.settingsObject.baseUrl,s;try{s=new URL(t,o)}catch(A){throw new DOMException(A,"SyntaxError")}if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${s.protocol}`,"SyntaxError");if(s.hash||s.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof n=="string"&&(n=[n]),n.length!==new Set(n.map(A=>A.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(n.length>0&&!n.every(A=>WH(A)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[f0]=new URL(s.href);let a=d0.settingsObject;this[g0]=ZH(s,n,a,this,(A,c)=>this.#n(A,c),r),this[zm]=e.CONNECTING,this[JH]=VH.NOT_SENT,this[ml]="blob"}close(t=void 0,n=void 0){W.brandCheck(this,e);let i="WebSocket.close";if(t!==void 0&&(t=W.converters["unsigned short"](t,i,"code",{clamp:!0})),n!==void 0&&(n=W.converters.USVString(n,i,"reason")),t!==void 0&&t!==1e3&&(t<3e3||t>4999))throw new DOMException("invalid code","InvalidAccessError");let r=0;if(n!==void 0&&(r=Buffer.byteLength(n),r>123))throw new DOMException(`Reason must be less than 123 bytes; received ${r}`,"SyntaxError");m0(this,t,n,r)}send(t){W.brandCheck(this,e);let n="WebSocket.send";if(W.argumentLengthCheck(arguments,1,n),t=W.converters.WebSocketSendData(t,n,"data"),jH(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!HH(this)||qH(this)))if(typeof t=="string"){let i=Buffer.byteLength(t);this.#t+=i,this.#o.add(t,()=>{this.#t-=i},hl.string)}else E0.isArrayBuffer(t)?(this.#t+=t.byteLength,this.#o.add(t,()=>{this.#t-=t.byteLength},hl.arrayBuffer)):ArrayBuffer.isView(t)?(this.#t+=t.byteLength,this.#o.add(t,()=>{this.#t-=t.byteLength},hl.typedArray)):I0(t)&&(this.#t+=t.size,this.#o.add(t,()=>{this.#t-=t.size},hl.blob))}get readyState(){return W.brandCheck(this,e),this[zm]}get bufferedAmount(){return W.brandCheck(this,e),this.#t}get url(){return W.brandCheck(this,e),GH(this[f0])}get extensions(){return W.brandCheck(this,e),this.#i}get protocol(){return W.brandCheck(this,e),this.#r}get onopen(){return W.brandCheck(this,e),this.#e.open}set onopen(t){W.brandCheck(this,e),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof t=="function"?(this.#e.open=t,this.addEventListener("open",t)):this.#e.open=null}get onerror(){return W.brandCheck(this,e),this.#e.error}set onerror(t){W.brandCheck(this,e),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof t=="function"?(this.#e.error=t,this.addEventListener("error",t)):this.#e.error=null}get onclose(){return W.brandCheck(this,e),this.#e.close}set onclose(t){W.brandCheck(this,e),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof t=="function"?(this.#e.close=t,this.addEventListener("close",t)):this.#e.close=null}get onmessage(){return W.brandCheck(this,e),this.#e.message}set onmessage(t){W.brandCheck(this,e),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof t=="function"?(this.#e.message=t,this.addEventListener("message",t)):this.#e.message=null}get binaryType(){return W.brandCheck(this,e),this[ml]}set binaryType(t){W.brandCheck(this,e),t!=="blob"&&t!=="arraybuffer"?this[ml]="blob":this[ml]=t}#n(t,n){this[p0]=t;let i=this[g0]?.dispatcher?.webSocketOptions,r=i?.maxFragments,o=i?.maxPayloadSize,s=new KH(this,n,{maxFragments:r,maxPayloadSize:o});s.on("drain",n4),s.on("error",i4.bind(this)),t.socket.ws=this,this[YH]=s,this.#o=new r4(t.socket),this[zm]=aA.OPEN;let a=t.headersList.get("sec-websocket-extensions");a!==null&&(this.#i=a);let A=t.headersList.get("sec-websocket-protocol");A!==null&&(this.#r=A),h0("open",this)}};$t.CONNECTING=$t.prototype.CONNECTING=aA.CONNECTING;$t.OPEN=$t.prototype.OPEN=aA.OPEN;$t.CLOSING=$t.prototype.CLOSING=aA.CLOSING;$t.CLOSED=$t.prototype.CLOSED=aA.CLOSED;Object.defineProperties($t.prototype,{CONNECTING:Tn,OPEN:Tn,CLOSING:Tn,CLOSED:Tn,url:Ht,readyState:Ht,bufferedAmount:Ht,onopen:Ht,onerror:Ht,onclose:Ht,close:Ht,onmessage:Ht,binaryType:Ht,send:Ht,extensions:Ht,protocol:Ht,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties($t,{CONNECTING:Tn,OPEN:Tn,CLOSING:Tn,CLOSED:Tn});W.converters["sequence<DOMString>"]=W.sequenceConverter(W.converters.DOMString);W.converters["DOMString or sequence<DOMString>"]=function(e,t,n){return W.util.Type(e)==="Object"&&Symbol.iterator in e?W.converters["sequence<DOMString>"](e):W.converters.DOMString(e,t,n)};W.converters.WebSocketInit=W.dictionaryConverter([{key:"protocols",converter:W.converters["DOMString or sequence<DOMString>"],defaultValue:()=>new Array(0)},{key:"dispatcher",converter:W.converters.any,defaultValue:()=>XH()},{key:"headers",converter:W.nullableConverter(W.converters.HeadersInit)}]);W.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return W.util.Type(e)==="Object"&&!(Symbol.iterator in e)?W.converters.WebSocketInit(e):{protocols:W.converters["DOMString or sequence<DOMString>"](e)}};W.converters.WebSocketSendData=function(e){if(W.util.Type(e)==="Object"){if(I0(e))return W.converters.Blob(e,{strict:!1});if(ArrayBuffer.isView(e)||E0.isArrayBuffer(e))return W.converters.BufferSource(e)}return W.converters.USVString(e)};function n4(){this.ws[p0].socket.resume()}function i4(e){let t,n;e instanceof t4?(t=e.reason,n=e.code):t=e.message,h0("error",this,()=>new e4("error",{error:e,message:t})),m0(this,n)}y0.exports={WebSocket:$t}});var Gm=k((E7,B0)=>{"use strict";function o4(e){return e.indexOf("\0")===-1}function s4(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)<48||e.charCodeAt(t)>57)return!1;return!0}function a4(e){return new Promise(t=>{setTimeout(t,e).unref()})}B0.exports={isValidLastEventId:o4,isASCIINumber:s4,delay:a4}});var v0=k((y7,Q0)=>{"use strict";var A4=require("node:buffer"),{Transform:c4}=require("node:stream"),{isASCIINumber:u4,isValidLastEventId:l4}=Gm(),fs=[239,187,191],Il=10,AA=13,d4=58,f4=32,g4=A4.kStringMaxLength,p4=Buffer.from("data"),h4=Buffer.from("event"),m4=Buffer.from("id"),I4=Buffer.from("retry"),E4=1024,y4=131072,C4=128;function B4(e,t){if(t>=e.length)return!1;for(let n=t;n<e.length;n++)if(e[n]<48||e[n]>57)return!1;return!0}function Q4(e,t){for(let n=t;n<e.length;n++)if(e[n]===0)return!1;return!0}function El(e,t,n){if(t!==n.length)return!1;for(let i=0;i<t;i++)if(e[i]!==n[i])return!1;return!0}function yl(){let e=new Error("EventSource message size exceeded");return e.aborted=!1,e}var Vm=class extends c4{state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;lineLength=0;eventSize=0;eventFieldSizes={data:0,event:0,id:0,retry:0};dataLineCount=0;maxEventSize;maxDataLines;maxBufferedChunks;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(t={}){t.readableObjectMode=!0,super(t),this.state=t.eventSourceSettings||{},this.maxEventSize=t.maxEventSize??g4;let n=this.maxEventSize>0?Math.min(y4,Math.max(E4,Math.floor(this.maxEventSize/C4))):0;this.maxDataLines=n,this.maxBufferedChunks=n,t.push&&(this.push=t.push)}_transform(t,n,i){if(t.length===0){i();return}if(this.maxEventSize>0&&this.chunks.length>=this.maxBufferedChunks&&t[0]!==Il&&t[0]!==AA){i(yl());return}if(this.chunks.push(t),this.checkBOM&&this.handleBOM()){i();return}for(;this.hasCurrentByte();){let r=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(r===Il){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(r===Il||r===AA){r===AA&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(r===Il||r===AA){r===AA&&(this.crlfCheck=!0);try{this.parseLine(this.readLine(),this.event)}catch(o){i(o);return}this.consumeCurrentByte(),this.eventEndCheck=!0;continue}if(this.maxEventSize>0&&++this.lineLength>this.maxEventSize+7){i(yl());return}this.advanceCursor()}i()}_destroy(t,n){this.chunks.length=0,this.clearEvent(),super._destroy(t,n)}parseLine(t,n){if(t.length===0)return;let i=t.indexOf(d4);if(i===0)return;let r=t.length,o=t.length;if(i!==-1&&(r=i,o=i+1,t[o]===f4&&++o),El(t,r,p4)){if(this.maxEventSize>0&&this.dataLineCount>=this.maxDataLines)throw yl();let s=t.length-o,a=this.eventFieldSizes.data+(n.data===void 0?0:1)+s;this.setEventFieldSize("data",a);let A=t.toString("utf8",o);n.data===void 0?n.data=A:n.data+=`
|
|
46
46
|
${A}`,this.dataLineCount++;return}if(El(t,r,I4)){B4(t,o)&&(this.setEventFieldSize("retry",t.length-o),n.retry=t.toString("utf8",o));return}if(El(t,r,m4)){Q4(t,o)&&(this.setEventFieldSize("id",t.length-o),n.id=t.toString("utf8",o));return}El(t,r,h4)&&o<t.length&&(this.setEventFieldSize("event",t.length-o),n.event=t.toString("utf8",o))}setEventFieldSize(t,n){let i=this.eventSize-this.eventFieldSizes[t]+n;if(this.maxEventSize>0&&i>this.maxEventSize)throw yl();this.eventSize=i,this.eventFieldSizes[t]=n}processEvent(t){t.retry&&u4(t.retry)&&(this.state.reconnectionTime=parseInt(t.retry,10)),t.id&&l4(t.id)&&(this.state.lastEventId=t.id),t.data!==void 0&&this.push({type:t.event||"message",options:{data:t.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event.data=void 0,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0,this.eventSize=0,this.dataLineCount=0,this.eventFieldSizes.data=0,this.eventFieldSizes.event=0,this.eventFieldSizes.id=0,this.eventFieldSizes.retry=0}hasPendingEvent(){return this.event.data!==void 0||this.event.event!==void 0||this.event.id!==void 0||this.event.retry!==void 0}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.lineLength=0,this.dropConsumedChunks()}dropConsumedChunks(){if(this.lineChunkIndex>0){let t=this.lineChunkIndex;this.chunks.splice(0,t),this.lineChunkIndex=0,this.chunkIndex-=t}this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let t=[],n=0;for(let i=this.lineChunkIndex;i<=this.chunkIndex;i++){let r=this.chunks[i],o=i===this.lineChunkIndex?this.linePos:0,s=i===this.chunkIndex?this.pos:r.length,a=r.subarray(o,s);n+=a.length,t.push(a)}return Buffer.concat(t,n)}peekBufferedByte(t){let n=this.lineChunkIndex,i=this.linePos;for(;n<this.chunks.length;){let r=this.chunks[n],o=r.length-i;if(t<o)return r[i+t];t-=o,n++,i=0}}discardLeadingBytes(t){for(;t>0&&this.lineChunkIndex<this.chunks.length;){let i=this.chunks[this.lineChunkIndex].length-this.linePos;t<i?(this.linePos+=t,t=0):(t-=i,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let t=this.peekBufferedByte(0),n=this.peekBufferedByte(1),i=this.peekBufferedByte(2);return n===void 0?(t===fs[0]||(this.checkBOM=!1),!0):i===void 0?t===fs[0]&&n===fs[1]?!0:(this.checkBOM=!1,!1):(t===fs[0]&&n===fs[1]&&i===fs[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};Q0.exports={EventSourceStream:Vm}});var _0=k((C7,D0)=>{"use strict";var{pipeline:v4}=require("node:stream"),{fetching:w4}=Ha(),{makeRequest:b4}=rs(),{webidl:an}=Je(),{EventSourceStream:k4}=v0(),{parseMIMEType:S4}=gt(),{createFastMessageEvent:x4}=As(),{isNetworkError:w0}=Ya(),{delay:R4}=Gm(),{kEnumerableProperty:Gi}=ie(),{environmentSettingsObject:b0}=bt(),{getGlobalDispatcher:D4}=Ga(),k0=!1,S0=3e3,cA=0,x0=1,uA=2,_4="anonymous",N4="use-credentials",gs=class e extends EventTarget{#e={open:null,error:null,message:null};#t=null;#r=!1;#i=cA;#o=null;#n=null;#s;#a;constructor(t,n={}){super(),an.util.markAsUncloneable(this);let i="EventSource constructor";an.argumentLengthCheck(arguments,1,i),k0||(k0=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),t=an.converters.USVString(t,i,"url"),n=an.converters.EventSourceInitDict(n,i,"eventSourceInitDict"),this.#s=n.dispatcher,this.#a={lastEventId:"",reconnectionTime:S0};let r=b0,o;try{o=new URL(t,r.settingsObject.baseUrl),this.#a.origin=o.origin}catch(A){throw new DOMException(A,"SyntaxError")}this.#t=o.href;let s=_4;n.withCredentials&&(s=N4,this.#r=!0);let a={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};a.client=b0.settingsObject,a.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],a.cache="no-store",a.initiator="other",a.urlList=[new URL(this.#t)],this.#o=b4(a),this.#c()}get readyState(){return this.#i}get url(){return this.#t}get withCredentials(){return this.#r}#c(){if(this.#i===uA)return;this.#i=cA;let t={request:this.#o,dispatcher:this.#s},n=i=>{w0(i)&&(this.dispatchEvent(new Event("error")),this.close()),this.#A()};t.processResponseEndOfBody=n,t.processResponse=i=>{if(w0(i))if(i.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#A();return}let r=i.headersList.get("content-type",!0),o=r!==null?S4(r):"failure",s=o!=="failure"&&o.essence==="text/event-stream";if(i.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#i=x0,this.dispatchEvent(new Event("open")),this.#a.origin=i.urlList[i.urlList.length-1].origin;let a=new k4({eventSourceSettings:this.#a,maxEventSize:this.#s.eventSourceOptions?.maxEventSize,push:A=>{this.dispatchEvent(x4(A.type,A.options))}});v4(i.body.stream,a,A=>{A?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#n=w4(t)}async#A(){this.#i!==uA&&(this.#i=cA,this.dispatchEvent(new Event("error")),await R4(this.#a.reconnectionTime),this.#i===cA&&(this.#a.lastEventId.length&&this.#o.headersList.set("last-event-id",this.#a.lastEventId,!0),this.#c()))}close(){an.brandCheck(this,e),this.#i!==uA&&(this.#i=uA,this.#n.abort(),this.#o=null)}get onopen(){return this.#e.open}set onopen(t){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof t=="function"?(this.#e.open=t,this.addEventListener("open",t)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(t){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof t=="function"?(this.#e.message=t,this.addEventListener("message",t)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(t){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof t=="function"?(this.#e.error=t,this.addEventListener("error",t)):this.#e.error=null}},R0={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:cA,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:x0,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:uA,writable:!1}};Object.defineProperties(gs,R0);Object.defineProperties(gs.prototype,R0);Object.defineProperties(gs.prototype,{close:Gi,onerror:Gi,onmessage:Gi,onopen:Gi,readyState:Gi,url:Gi,withCredentials:Gi});an.converters.EventSourceInitDict=an.dictionaryConverter([{key:"withCredentials",converter:an.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:an.converters.any,defaultValue:()=>D4()}]);D0.exports={EventSource:gs,defaultReconnectionTime:S0}});var T0=k((B7,H)=>{"use strict";var U4=zo(),N0=la(),$4=Go(),T4=Nk(),F4=Vo(),M4=lh(),L4=nS(),P4=uS(),U0=ue(),Bl=ie(),{InvalidArgumentError:Cl}=U0,ps=WS(),O4=fa(),z4=Yh(),G4=_x(),V4=qh(),J4=Nh(),Y4=Qu(),{getGlobalDispatcher:$0,setGlobalDispatcher:j4}=Ga(),H4=Nu(),q4=du(),W4=fu();Object.assign(N0.prototype,ps);H.exports.Dispatcher=N0;H.exports.Client=U4;H.exports.Pool=$4;H.exports.BalancedPool=T4;H.exports.Agent=F4;H.exports.ProxyAgent=M4;H.exports.EnvHttpProxyAgent=L4;H.exports.RetryAgent=P4;H.exports.RetryHandler=Y4;H.exports.DecoratorHandler=H4;H.exports.RedirectHandler=q4;H.exports.createRedirectInterceptor=W4;H.exports.interceptors={redirect:Lx(),retry:Ox(),dump:Gx(),dns:Yx()};H.exports.buildConnector=O4;H.exports.errors=U0;H.exports.util={parseHeaders:Bl.parseHeaders,headerNameToString:Bl.headerNameToString};function lA(e){return(t,n,i)=>{if(typeof n=="function"&&(i=n,n=null),!t||typeof t!="string"&&typeof t!="object"&&!(t instanceof URL))throw new Cl("invalid url");if(n!=null&&typeof n!="object")throw new Cl("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new Cl("invalid opts.path");let s=n.path;n.path.startsWith("/")||(s=`/${s}`),t=new URL(Bl.parseOrigin(t).origin+s)}else n||(n=typeof t=="object"?t:{}),t=Bl.parseURL(t);let{agent:r,dispatcher:o=$0()}=n;if(r)throw new Cl("unsupported opts.agent. Did you mean opts.client?");return e.call(o,{...n,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:n.method||(n.body?"PUT":"GET")},i)}}H.exports.setGlobalDispatcher=j4;H.exports.getGlobalDispatcher=$0;var Z4=Ha().fetch;H.exports.fetch=async function(t,n=void 0){try{return await Z4(t,n)}catch(i){throw i&&typeof i=="object"&&Error.captureStackTrace(i),i}};H.exports.Headers=Ti().Headers;H.exports.Response=Ya().Response;H.exports.Request=rs().Request;H.exports.FormData=ya().FormData;H.exports.File=globalThis.File??require("node:buffer").File;H.exports.FileReader=AD().FileReader;var{setGlobalOrigin:K4,getGlobalOrigin:X4}=up();H.exports.setGlobalOrigin=K4;H.exports.getGlobalOrigin=X4;var{CacheStorage:eq}=mD(),{kConstruct:tq}=el();H.exports.caches=new eq(tq);var{deleteCookie:rq,getCookies:nq,getSetCookies:iq,setCookie:oq}=SD();H.exports.deleteCookie=rq;H.exports.getCookies=nq;H.exports.getSetCookies=iq;H.exports.setCookie=oq;var{parseMIMEType:sq,serializeAMimeType:aq}=gt();H.exports.parseMIMEType=sq;H.exports.serializeAMimeType=aq;var{CloseEvent:Aq,ErrorEvent:cq,MessageEvent:uq}=As();H.exports.WebSocket=C0().WebSocket;H.exports.CloseEvent=Aq;H.exports.ErrorEvent=cq;H.exports.MessageEvent=uq;H.exports.request=lA(ps.request);H.exports.stream=lA(ps.stream);H.exports.pipeline=lA(ps.pipeline);H.exports.connect=lA(ps.connect);H.exports.upgrade=lA(ps.upgrade);H.exports.MockClient=z4;H.exports.MockPool=V4;H.exports.MockAgent=G4;H.exports.mockErrors=J4;var{EventSource:lq}=_0();H.exports.EventSource=lq});var fn=lt(require("fs")),hc=lt(require("path")),iF=require("crypto");var LQ="1.58.0",PQ="1.66.0",MQ=e=>{let t=/^(\d+)\.(\d+)\./.exec(e.trim());return t?[Number(t[1]),Number(t[2])]:void 0};var yX=`"use strict";
|
|
47
47
|
(() => {
|
|
48
48
|
try {
|
|
@@ -124,7 +124,7 @@ ${A}`,this.dataLineCount++;return}if(El(t,r,I4)){B4(t,o)&&(this.setEventFieldSiz
|
|
|
124
124
|
};
|
|
125
125
|
} catch { /* never break the command */ }
|
|
126
126
|
})();
|
|
127
|
-
`;var CX=`${LQ} up to, not including, ${PQ}`;var u={};Br(u,{BRAND:()=>TF,DIRTY:()=>ei,EMPTY_PATH:()=>gF,INVALID:()=>J,NEVER:()=>yM,OK:()=>We,ParseStatus:()=>Ge,Schema:()=>ne,ZodAny:()=>mn,ZodArray:()=>jr,ZodBigInt:()=>ri,ZodBoolean:()=>ni,ZodBranded:()=>ia,ZodCatch:()=>gi,ZodDate:()=>ii,ZodDefault:()=>fi,ZodDiscriminatedUnion:()=>Cc,ZodEffects:()=>Gt,ZodEnum:()=>li,ZodError:()=>dt,ZodFirstPartyTypeKind:()=>j,ZodFunction:()=>Qc,ZodIntersection:()=>Ai,ZodIssueCode:()=>S,ZodLazy:()=>ci,ZodLiteral:()=>ui,ZodMap:()=>ho,ZodNaN:()=>Io,ZodNativeEnum:()=>di,ZodNever:()=>nr,ZodNull:()=>si,ZodNullable:()=>wr,ZodNumber:()=>ti,ZodObject:()=>ft,ZodOptional:()=>Ot,ZodParsedType:()=>U,ZodPipeline:()=>oa,ZodPromise:()=>In,ZodReadonly:()=>pi,ZodRecord:()=>Bc,ZodSchema:()=>ne,ZodSet:()=>mo,ZodString:()=>hn,ZodSymbol:()=>go,ZodTransformer:()=>Gt,ZodTuple:()=>vr,ZodType:()=>ne,ZodUndefined:()=>oi,ZodUnion:()=>ai,ZodUnknown:()=>Yr,ZodVoid:()=>po,addIssueToContext:()=>_,any:()=>JF,array:()=>qF,bigint:()=>PF,boolean:()=>ZQ,coerce:()=>EM,custom:()=>HQ,date:()=>OF,datetimeRegex:()=>YQ,defaultErrorMap:()=>Vr,discriminatedUnion:()=>XF,effect:()=>lM,enum:()=>AM,function:()=>oM,getErrorMap:()=>uo,getParsedType:()=>Qr,instanceof:()=>MF,intersection:()=>eM,isAborted:()=>Ec,isAsync:()=>lo,isDirty:()=>yc,isValid:()=>pn,late:()=>FF,lazy:()=>sM,literal:()=>aM,makeIssue:()=>na,map:()=>nM,nan:()=>LF,nativeEnum:()=>cM,never:()=>jF,null:()=>VF,nullable:()=>fM,number:()=>WQ,object:()=>WF,objectUtil:()=>Zf,oboolean:()=>IM,onumber:()=>mM,optional:()=>dM,ostring:()=>hM,pipeline:()=>pM,preprocess:()=>gM,promise:()=>uM,quotelessJson:()=>lF,record:()=>rM,set:()=>iM,setErrorMap:()=>fF,strictObject:()=>ZF,string:()=>qQ,symbol:()=>zF,transformer:()=>lM,tuple:()=>tM,undefined:()=>GF,union:()=>KF,unknown:()=>YF,util:()=>se,void:()=>HF});var se;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let s of r)o[s]=s;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),s={};for(let a of o)s[a]=r[a];return e.objectValues(s)},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 s in r)Object.prototype.hasOwnProperty.call(r,s)&&o.push(s);return o},e.find=(r,o)=>{for(let s of r)if(o(s))return s},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(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(se||(se={}));var Zf;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Zf||(Zf={}));var U=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qr=e=>{switch(typeof e){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(e)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(e)?U.array:e===null?U.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?U.promise:typeof Map<"u"&&e instanceof Map?U.map:typeof Set<"u"&&e instanceof Set?U.set:typeof Date<"u"&&e instanceof Date?U.date:U.object;default:return U.unknown}};var S=se.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"]),lF=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),dt=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 s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(n(s));else{let a=i,A=0;for(;A<s.path.length;){let c=s.path[A],l=A===s.path.length-1;if(c==="_errors"){l&&a._errors.push(n(s)),A++;continue}Object.prototype.hasOwnProperty.call(a,c)||(c==="__proto__"?Object.defineProperty(a,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[c]={_errors:[]}),a=a[c],l&&a._errors.push(n(s)),A++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),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()}};dt.create=e=>new dt(e);var dF=(e,t)=>{let n;switch(e.code){case S.invalid_type:e.received===U.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case S.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,se.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:n=`Unrecognized key(s) in object: ${se.joinValues(e.keys,", ")}`;break;case S.invalid_union:n="Invalid input";break;case S.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${se.joinValues(e.options)}`;break;case S.invalid_enum_value:n=`Invalid enum value. Expected ${se.joinValues(e.options)}, received '${e.received}'`;break;case S.invalid_arguments:n="Invalid function arguments";break;case S.invalid_return_type:n="Invalid function return type";break;case S.invalid_date:n="Invalid date";break;case S.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}"`:se.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case S.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 S.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 S.custom:n="Invalid input";break;case S.invalid_intersection_types:n="Intersection results could not be merged";break;case S.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case S.not_finite:n="Number must be finite";break;default:n=t.defaultError,se.assertNever(e)}return{message:n}},Vr=dF;var OQ=Vr;function fF(e){OQ=e}function uo(){return OQ}var na=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],s={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let a="",A=i.filter(c=>!!c).slice().reverse();for(let c of A)a=c(s,{data:t,defaultError:a}).message;return{...r,path:o,message:a}},gF=[];function _(e,t){let n=uo(),i=na({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Vr?void 0:Vr].filter(r=>!!r)});e.common.issues.push(i)}var Ge=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 J;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,s=await r.value;i.push({key:o,value:s})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:s}=r;if(o.status==="aborted"||s.status==="aborted")return J;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[o.value]=s.value)}return{status:t.value,value:i}}},J=Object.freeze({status:"aborted"}),ei=e=>({status:"dirty",value:e}),We=e=>({status:"valid",value:e}),Ec=e=>e.status==="aborted",yc=e=>e.status==="dirty",pn=e=>e.status==="valid",lo=e=>typeof Promise<"u"&&e instanceof Promise;var F;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(F||(F={}));var zt=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}},zQ=(e,t)=>{if(pn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new dt(e.common.issues);return this._error=n,this._error}}};function X(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(s,a)=>{let{message:A}=e;return s.code==="invalid_enum_value"?{message:A??a.defaultError}:typeof a.data>"u"?{message:A??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:A??n??a.defaultError}},description:r}}var ne=class{get description(){return this._def.description}_getType(t){return Qr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Qr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ge,ctx:{common:t.parent.common,data:t.data,parsedType:Qr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(lo(n))throw new 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:Qr(t)},r=this._parseSync({data:t,path:i.path,parent:i});return zQ(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qr(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return pn(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=>pn(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:Qr(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(lo(r)?r:Promise.resolve(r));return zQ(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 s=t(r),a=()=>o.addIssue({code:S.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(A=>A?!0:(a(),!1)):s?!0:(a(),!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 Gt({schema:this,typeName:j.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 Ot.create(this,this._def)}nullable(){return wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jr.create(this)}promise(){return In.create(this,this._def)}or(t){return ai.create([this,t],this._def)}and(t){return Ai.create(this,t,this._def)}transform(t){return new Gt({...X(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new fi({...X(this._def),innerType:this,defaultValue:n,typeName:j.ZodDefault})}brand(){return new ia({typeName:j.ZodBranded,type:this,...X(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new gi({...X(this._def),innerType:this,catchValue:n,typeName:j.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return oa.create(this,t)}readonly(){return pi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pF=/^c[^\s-]{8,}$/i,hF=/^[0-9a-z]+$/,mF=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IF=/^[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,EF=/^[a-z0-9_-]{21}$/i,yF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,CF=/^[-+]?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)?)??$/,BF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,QF="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Kf,vF=/^(?:(?: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])$/,wF=/^(?:(?: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])$/,bF=/^(([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]))$/,kF=/^(([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])$/,SF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VQ="((\\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])))",RF=new RegExp(`^${VQ}$`);function JQ(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function DF(e){return new RegExp(`^${JQ(e)}$`)}function YQ(e){let t=`${VQ}T${JQ(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function _F(e,t){return!!((t==="v4"||!t)&&vF.test(e)||(t==="v6"||!t)&&bF.test(e))}function NF(e,t){if(!yF.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function UF(e,t){return!!((t==="v4"||!t)&&wF.test(e)||(t==="v6"||!t)&&kF.test(e))}var hn=class e extends ne{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==U.string){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_type,expected:U.string,received:o.parsedType}),J}let i=new Ge,r;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(r=this._getOrReturnCtx(t,r),s?_(r,{code:S.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&_(r,{code:S.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")BF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"email",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")Kf||(Kf=new RegExp(QF,"u")),Kf.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"emoji",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")IF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"uuid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")EF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"nanoid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")pF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")hF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid2",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")mF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ulid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),_(r,{validation:"url",code:S.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"regex",code:S.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?YQ(o).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?RF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?DF(o).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?CF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"duration",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?_F(t.data,o.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ip",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?NF(t.data,o.alg)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"jwt",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?UF(t.data,o.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cidr",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?SF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?xF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64url",code:S.invalid_string,message:o.message}),i.dirty()):se.assertNever(o);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:S.invalid_string,...F.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...F.errToObj(t)})}url(t){return this._addCheck({kind:"url",...F.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...F.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...F.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...F.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...F.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...F.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...F.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...F.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...F.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...F.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...F.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...F.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,...F.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,...F.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...F.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...F.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...F.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...F.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...F.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...F.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...F.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...F.errToObj(n)})}nonempty(t){return this.min(1,F.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}};hn.create=e=>new hn({checks:[],typeName:j.ZodString,coerce:e?.coerce??!1,...X(e)});function $F(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(e.toFixed(r).replace(".","")),s=Number.parseInt(t.toFixed(r).replace(".",""));return o%s/10**r}var ti=class e extends ne{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)!==U.number){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_type,expected:U.number,received:o.parsedType}),J}let i,r=new Ge;for(let o of this._def.checks)o.kind==="int"?se.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),_(i,{code:S.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="multipleOf"?$F(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),_(i,{code:S.not_finite,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,F.toString(n))}gt(t,n){return this.setLimit("min",t,!1,F.toString(n))}lte(t,n){return this.setLimit("max",t,!0,F.toString(n))}lt(t,n){return this.setLimit("max",t,!1,F.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:F.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:F.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:F.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:F.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.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"&&se.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)}};ti.create=e=>new ti({checks:[],typeName:j.ZodNumber,coerce:e?.coerce||!1,...X(e)});var ri=class e extends ne{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)!==U.bigint)return this._getInvalidInput(t);let i,r=new Ge;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return _(n,{code:S.invalid_type,expected:U.bigint,received:n.parsedType}),J}gte(t,n){return this.setLimit("min",t,!0,F.toString(n))}gt(t,n){return this.setLimit("min",t,!1,F.toString(n))}lte(t,n){return this.setLimit("max",t,!0,F.toString(n))}lt(t,n){return this.setLimit("max",t,!1,F.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:F.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:F.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:F.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}};ri.create=e=>new ri({checks:[],typeName:j.ZodBigInt,coerce:e?.coerce??!1,...X(e)});var ni=class extends ne{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==U.boolean){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.boolean,received:i.parsedType}),J}return We(t.data)}};ni.create=e=>new ni({typeName:j.ZodBoolean,coerce:e?.coerce||!1,...X(e)});var ii=class e extends ne{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==U.date){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_type,expected:U.date,received:o.parsedType}),J}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_date}),J}let i=new Ge,r;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):se.assertNever(o);return{status:i.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:F.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:F.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}};ii.create=e=>new ii({checks:[],coerce:e?.coerce||!1,typeName:j.ZodDate,...X(e)});var go=class extends ne{_parse(t){if(this._getType(t)!==U.symbol){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.symbol,received:i.parsedType}),J}return We(t.data)}};go.create=e=>new go({typeName:j.ZodSymbol,...X(e)});var oi=class extends ne{_parse(t){if(this._getType(t)!==U.undefined){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.undefined,received:i.parsedType}),J}return We(t.data)}};oi.create=e=>new oi({typeName:j.ZodUndefined,...X(e)});var si=class extends ne{_parse(t){if(this._getType(t)!==U.null){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.null,received:i.parsedType}),J}return We(t.data)}};si.create=e=>new si({typeName:j.ZodNull,...X(e)});var mn=class extends ne{constructor(){super(...arguments),this._any=!0}_parse(t){return We(t.data)}};mn.create=e=>new mn({typeName:j.ZodAny,...X(e)});var Yr=class extends ne{constructor(){super(...arguments),this._unknown=!0}_parse(t){return We(t.data)}};Yr.create=e=>new Yr({typeName:j.ZodUnknown,...X(e)});var nr=class extends ne{_parse(t){let n=this._getOrReturnCtx(t);return _(n,{code:S.invalid_type,expected:U.never,received:n.parsedType}),J}};nr.create=e=>new nr({typeName:j.ZodNever,...X(e)});var po=class extends ne{_parse(t){if(this._getType(t)!==U.undefined){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.void,received:i.parsedType}),J}return We(t.data)}};po.create=e=>new po({typeName:j.ZodVoid,...X(e)});var jr=class e extends ne{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==U.array)return _(n,{code:S.invalid_type,expected:U.array,received:n.parsedType}),J;if(r.exactLength!==null){let s=n.data.length>r.exactLength.value,a=n.data.length<r.exactLength.value;(s||a)&&(_(n,{code:s?S.too_big:S.too_small,minimum:a?r.exactLength.value:void 0,maximum:s?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&&(_(n,{code:S.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&&(_(n,{code:S.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((s,a)=>r.type._parseAsync(new zt(n,s,n.path,a)))).then(s=>Ge.mergeArray(i,s));let o=[...n.data].map((s,a)=>r.type._parseSync(new zt(n,s,n.path,a)));return Ge.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:F.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:F.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:F.toString(n)}})}nonempty(t){return this.min(1,t)}};jr.create=(e,t)=>new jr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...X(t)});function fo(e){if(e instanceof ft){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=Ot.create(fo(i))}return new ft({...e._def,shape:()=>t})}else return e instanceof jr?new jr({...e._def,type:fo(e.element)}):e instanceof Ot?Ot.create(fo(e.unwrap())):e instanceof wr?wr.create(fo(e.unwrap())):e instanceof vr?vr.create(e.items.map(t=>fo(t))):e}var ft=class e extends ne{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=se.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==U.object){let c=this._getOrReturnCtx(t);return _(c,{code:S.invalid_type,expected:U.object,received:c.parsedType}),J}let{status:i,ctx:r}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof nr&&this._def.unknownKeys==="strip"))for(let c in r.data)s.includes(c)||a.push(c);let A=[];for(let c of s){let l=o[c],d=r.data[c];A.push({key:{status:"valid",value:c},value:l._parse(new zt(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof nr){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of a)A.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(c==="strict")a.length>0&&(_(r,{code:S.unrecognized_keys,keys:a}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of a){let d=r.data[l];A.push({key:{status:"valid",value:l},value:c._parse(new zt(r,d,r.path,l)),alwaysSet:l in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of A){let d=await l.key,f=await l.value;c.push({key:d,value:f,alwaysSet:l.alwaysSet})}return c}).then(c=>Ge.mergeObjectSync(i,c)):Ge.mergeObjectSync(i,A)}get shape(){return this._def.shape()}strict(t){return F.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:F.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:j.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 se.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 se.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return fo(this)}partial(t){let n={};for(let i of se.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 se.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof Ot;)o=o._def.innerType;n[i]=o}return new e({...this._def,shape:()=>n})}keyof(){return jQ(se.objectKeys(this.shape))}};ft.create=(e,t)=>new ft({shape:()=>e,unknownKeys:"strip",catchall:nr.create(),typeName:j.ZodObject,...X(t)});ft.strictCreate=(e,t)=>new ft({shape:()=>e,unknownKeys:"strict",catchall:nr.create(),typeName:j.ZodObject,...X(t)});ft.lazycreate=(e,t)=>new ft({shape:e,unknownKeys:"strip",catchall:nr.create(),typeName:j.ZodObject,...X(t)});var ai=class extends ne{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new dt(a.ctx.common.issues));return _(n,{code:S.invalid_union,unionErrors:s}),J}if(n.common.async)return Promise.all(i.map(async o=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(r);{let o,s=[];for(let A of i){let c={...n,common:{...n.common,issues:[]},parent:null},l=A._parseSync({data:n.data,path:n.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(A=>new dt(A));return _(n,{code:S.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}};ai.create=(e,t)=>new ai({options:e,typeName:j.ZodUnion,...X(t)});var Jr=e=>e instanceof ci?Jr(e.schema):e instanceof Gt?Jr(e.innerType()):e instanceof ui?[e.value]:e instanceof li?e.options:e instanceof di?se.objectValues(e.enum):e instanceof fi?Jr(e._def.innerType):e instanceof oi?[void 0]:e instanceof si?[null]:e instanceof Ot?[void 0,...Jr(e.unwrap())]:e instanceof wr?[null,...Jr(e.unwrap())]:e instanceof ia||e instanceof pi?Jr(e.unwrap()):e instanceof gi?Jr(e._def.innerType):[],Cc=class e extends ne{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==U.object)return _(n,{code:S.invalid_type,expected:U.object,received:n.parsedType}),J;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}):(_(n,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),J)}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 s=Jr(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,o)}}return new e({typeName:j.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...X(i)})}};function Xf(e,t){let n=Qr(e),i=Qr(t);if(e===t)return{valid:!0,data:e};if(n===U.object&&i===U.object){let r=se.objectKeys(t),o=se.objectKeys(e).filter(a=>r.indexOf(a)!==-1),s={...e,...t};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let a of o){if(a==="__proto__")continue;let A=Xf(e[a],t[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(n===U.array&&i===U.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],A=Xf(s,a);if(!A.valid)return{valid:!1};r.push(A.data)}return{valid:!0,data:r}}else return n===U.date&&i===U.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ai=class extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,s)=>{if(Ec(o)||Ec(s))return J;let a=Xf(o.value,s.value);return a.valid?((yc(o)||yc(s))&&n.dirty(),{status:n.value,value:a.data}):(_(i,{code:S.invalid_intersection_types}),J)};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,s])=>r(o,s)):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}))}};Ai.create=(e,t,n)=>new Ai({left:e,right:t,typeName:j.ZodIntersection,...X(n)});var vr=class e extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==U.array)return _(i,{code:S.invalid_type,expected:U.array,received:i.parsedType}),J;if(i.data.length<this._def.items.length)return _(i,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J;!this._def.rest&&i.data.length>this._def.items.length&&(_(i,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...i.data].map((s,a)=>{let A=this._def.items[a]||this._def.rest;return A?A._parse(new zt(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>Ge.mergeArray(n,s)):Ge.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};vr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vr({items:e,typeName:j.ZodTuple,rest:null,...X(t)})};var Bc=class e extends ne{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!==U.object)return _(i,{code:S.invalid_type,expected:U.object,received:i.parsedType}),J;let r=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)r.push({key:o._parse(new zt(i,a,i.path,a)),value:s._parse(new zt(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Ge.mergeObjectAsync(n,r):Ge.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof ne?new e({keyType:t,valueType:n,typeName:j.ZodRecord,...X(i)}):new e({keyType:hn.create(),valueType:t,typeName:j.ZodRecord,...X(n)})}},ho=class extends ne{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!==U.map)return _(i,{code:S.invalid_type,expected:U.map,received:i.parsedType}),J;let r=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,A],c)=>({key:r._parse(new zt(i,a,i.path,[c,"key"])),value:o._parse(new zt(i,A,i.path,[c,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let A of s){let c=await A.key,l=await A.value;if(c.status==="aborted"||l.status==="aborted")return J;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let A of s){let c=A.key,l=A.value;if(c.status==="aborted"||l.status==="aborted")return J;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}}}};ho.create=(e,t,n)=>new ho({valueType:t,keyType:e,typeName:j.ZodMap,...X(n)});var mo=class e extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==U.set)return _(i,{code:S.invalid_type,expected:U.set,received:i.parsedType}),J;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(_(i,{code:S.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&&(_(i,{code:S.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function s(A){let c=new Set;for(let l of A){if(l.status==="aborted")return J;l.status==="dirty"&&n.dirty(),c.add(l.value)}return{status:n.value,value:c}}let a=[...i.data.values()].map((A,c)=>o._parse(new zt(i,A,i.path,c)));return i.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:F.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:F.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};mo.create=(e,t)=>new mo({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...X(t)});var Qc=class e extends ne{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==U.function)return _(n,{code:S.invalid_type,expected:U.function,received:n.parsedType}),J;function i(a,A){return na({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,uo(),Vr].filter(c=>!!c),issueData:{code:S.invalid_arguments,argumentsError:A}})}function r(a,A){return na({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,uo(),Vr].filter(c=>!!c),issueData:{code:S.invalid_return_type,returnTypeError:A}})}let o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof In){let a=this;return We(async function(...A){let c=new dt([]),l=await a._def.args.parseAsync(A,o).catch(g=>{throw c.addIssue(i(A,g)),c}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(g=>{throw c.addIssue(r(d,g)),c})})}else{let a=this;return We(function(...A){let c=a._def.args.safeParse(A,o);if(!c.success)throw new dt([i(A,c.error)]);let l=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new dt([r(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:vr.create(t).rest(Yr.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||vr.create([]).rest(Yr.create()),returns:n||Yr.create(),typeName:j.ZodFunction,...X(i)})}},ci=class extends ne{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})}};ci.create=(e,t)=>new ci({getter:e,typeName:j.ZodLazy,...X(t)});var ui=class extends ne{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return _(n,{received:n.data,code:S.invalid_literal,expected:this._def.value}),J}return{status:"valid",value:t.data}}get value(){return this._def.value}};ui.create=(e,t)=>new ui({value:e,typeName:j.ZodLiteral,...X(t)});function jQ(e,t){return new li({values:e,typeName:j.ZodEnum,...X(t)})}var li=class e extends ne{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return _(n,{expected:se.joinValues(i),received:n.parsedType,code:S.invalid_type}),J}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 _(n,{received:n.data,code:S.invalid_enum_value,options:i}),J}return We(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})}};li.create=jQ;var di=class extends ne{_parse(t){let n=se.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==U.string&&i.parsedType!==U.number){let r=se.objectValues(n);return _(i,{expected:se.joinValues(r),received:i.parsedType,code:S.invalid_type}),J}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=se.objectValues(n);return _(i,{received:i.data,code:S.invalid_enum_value,options:r}),J}return We(t.data)}get enum(){return this._def.values}};di.create=(e,t)=>new di({values:e,typeName:j.ZodNativeEnum,...X(t)});var In=class extends ne{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==U.promise&&n.common.async===!1)return _(n,{code:S.invalid_type,expected:U.promise,received:n.parsedType}),J;let i=n.parsedType===U.promise?n.data:Promise.resolve(n.data);return We(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};In.create=(e,t)=>new In({type:e,typeName:j.ZodPromise,...X(t)});var Gt=class extends ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.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:s=>{_(i,s),s.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let s=r.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return J;let A=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return A.status==="aborted"?J:A.status==="dirty"?ei(A.value):n.value==="dirty"?ei(A.value):A});{if(n.value==="aborted")return J;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?J:a.status==="dirty"?ei(a.value):n.value==="dirty"?ei(a.value):a}}if(r.type==="refinement"){let s=a=>{let A=r.refinement(a,o);if(i.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?J:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?J:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!pn(s))return J;let a=r.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>pn(s)?Promise.resolve(r.transform(s.value,o)).then(a=>({status:n.value,value:a})):J);se.assertNever(r)}};Gt.create=(e,t,n)=>new Gt({schema:e,typeName:j.ZodEffects,effect:t,...X(n)});Gt.createWithPreprocess=(e,t,n)=>new Gt({schema:t,effect:{type:"preprocess",transform:e},typeName:j.ZodEffects,...X(n)});var Ot=class extends ne{_parse(t){return this._getType(t)===U.undefined?We(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ot.create=(e,t)=>new Ot({innerType:e,typeName:j.ZodOptional,...X(t)});var wr=class extends ne{_parse(t){return this._getType(t)===U.null?We(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};wr.create=(e,t)=>new wr({innerType:e,typeName:j.ZodNullable,...X(t)});var fi=class extends ne{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===U.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};fi.create=(e,t)=>new fi({innerType:e,typeName:j.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});var gi=class extends ne{_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 lo(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new dt(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new dt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};gi.create=(e,t)=>new gi({innerType:e,typeName:j.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});var Io=class extends ne{_parse(t){if(this._getType(t)!==U.nan){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.nan,received:i.parsedType}),J}return{status:"valid",value:t.data}}};Io.create=e=>new Io({typeName:j.ZodNaN,...X(e)});var TF=Symbol("zod_brand"),ia=class extends ne{_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}},oa=class e extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?J:o.status==="dirty"?(n.dirty(),ei(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?J: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:j.ZodPipeline})}},pi=class extends ne{_parse(t){let n=this._def.innerType._parse(t),i=r=>(pn(r)&&(r.value=Object.freeze(r.value)),r);return lo(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};pi.create=(e,t)=>new pi({innerType:e,typeName:j.ZodReadonly,...X(t)});function GQ(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function HQ(e,t={},n){return e?mn.create().superRefine((i,r)=>{let o=e(i);if(o instanceof Promise)return o.then(s=>{if(!s){let a=GQ(t,i),A=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:A})}});if(!o){let s=GQ(t,i),a=s.fatal??n??!0;r.addIssue({code:"custom",...s,fatal:a})}}):mn.create()}var FF={object:ft.lazycreate},j;(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"})(j||(j={}));var MF=(e,t={message:`Input not instance of ${e.name}`})=>HQ(n=>n instanceof e,t),qQ=hn.create,WQ=ti.create,LF=Io.create,PF=ri.create,ZQ=ni.create,OF=ii.create,zF=go.create,GF=oi.create,VF=si.create,JF=mn.create,YF=Yr.create,jF=nr.create,HF=po.create,qF=jr.create,WF=ft.create,ZF=ft.strictCreate,KF=ai.create,XF=Cc.create,eM=Ai.create,tM=vr.create,rM=Bc.create,nM=ho.create,iM=mo.create,oM=Qc.create,sM=ci.create,aM=ui.create,AM=li.create,cM=di.create,uM=In.create,lM=Gt.create,dM=Ot.create,fM=wr.create,gM=Gt.createWithPreprocess,pM=oa.create,hM=()=>qQ().optional(),mM=()=>WQ().optional(),IM=()=>ZQ().optional(),EM={string:(e=>hn.create({...e,coerce:!0})),number:(e=>ti.create({...e,coerce:!0})),boolean:(e=>ni.create({...e,coerce:!0})),bigint:(e=>ri.create({...e,coerce:!0})),date:(e=>ii.create({...e,coerce:!0}))};var yM=J;var eg=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(eg||{}),tg=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(tg||{});var rg=300,xe=u.string().trim().min(1),CM=u.object({action:u.enum(["start","run","wait"]),text:xe,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:xe.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),ng=/^[A-Za-z_][A-Za-z0-9_]*$/,ir=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,sa=(s=>(s.VersionEndpoint="version_endpoint",s.DeployWorkflow="deploy_workflow",s.KubernetesLabels="kubernetes_labels",s.Command="command",s.Api="api",s.NotTracked="not_tracked",s))(sa||{}),Hr="shared",BM=xe.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),Eo=u.object({address:BM,readyWhen:xe.nullable(),credentials:u.array(u.string().regex(ir)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(sa),detail:xe.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(xe).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),ig={steps:u.array(CM).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:xe,service:xe.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(ng)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},QM=u.object({name:xe,repository:xe.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:u.boolean(),...ig,deployed:xe.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),vM=u.object({name:u.string().regex(ir).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:u.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:u.boolean().describe("false only when the SUT starts without it, with less working"),how:xe.max(rg).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),wM=u.object({component:xe,problem:xe,evidence:xe.describe("the exact command and output that shows it"),fix:xe.describe("what the user must provide, and where")}),bM=u.object({framework:xe,file:xe.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),kM=u.object({input:xe.describe("the part of the user's SUT input, as given"),reason:xe}),i5=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(tg).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:u.array(QM),suites:u.array(bM).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(xe).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:xe.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:xe.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(kM).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one the repositories or the app show is wrong, such as a file, command, port, route or setting that is not there. Something outside them that does not answer is not one: that is a blocker"),blockers:u.array(wM).describe("required (non-empty) when status is blocked"),inputs:u.array(vM).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),environment:Eo.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var og=64*1024,sg=512*1024,KQ=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var c5=new TextDecoder("utf-8",{fatal:!0});var aa=(o=>(o.NotFound="not_found",o.NoAccess="no_access",o.Unavailable="unavailable",o.AccessLost="access_lost",o.CannotOpen="cannot_open",o))(aa||{});var XQ=e=>`${e.source}:${e.site??""}:${e.key}`;var vc=/^pasted-[0-9a-f]{16}$/,wc=/^file-[0-9a-f]{16}$/,bc=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(bc||{});var ag=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(ag||{}),Ag=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(Ag||{}),cg=(m=>(m.RelatedChangeConflict="related_change_conflict",m.ReferenceOutsideTarget="reference_outside_target",m.SourceAccessLost="source_access_lost",m.ConfigurationIncomplete="configuration_incomplete",m.CredentialUnavailable="credential_unavailable",m.WorkflowBindingUnverified="workflow_binding_unverified",m.WorkflowRefUnprotected="workflow_ref_unprotected",m.BedrockWorkflowRequired="bedrock_workflow_required",m.DeploymentReview="deployment_review",m.SutRevisionMismatch="sut_revision_mismatch",m.IsolationUnavailable="isolation_unavailable",m.EvidenceInsufficient="evidence_insufficient",m.ConfigurationUnresolved="configuration_unresolved",m.ModelProviderDenied="model_provider_denied",m.ModelProviderUnavailable="model_provider_unavailable",m.RunnerProviderNotReady="runner_provider_not_ready",m.MergeConflict="merge_conflict",m))(cg||{}),Aa=(o=>(o.CiCheck="ci_check",o.TestReport="test_report",o.StaticAnalysis="static_analysis",o.CodeReview="code_review",o.Other="other",o))(Aa||{}),ug=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(ug||{}),lg=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(lg||{});var dg=(n=>(n.Probe="probe",n.Agent="agent",n))(dg||{}),fg=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(fg||{}),gg=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(gg||{});var ev=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(ev||{}),br=u.string().trim().min(1),SM=u.object({case:br.describe("recommend id this assertion enforces"),evidence:br.describe("the exact assertion line from the file that checks that case's observable")});var xM=u.object({route:u.literal("persistence"),url:u.string().url()}).strict(),pg=u.object({kind:u.nativeEnum(fg).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:br.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(gg).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:br.describe("what it sets up"),worker:br.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:xM.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:br.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:br.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),RM=u.object({file:br.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(ev),language:br,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(SM).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(pg).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),g5=u.object({schemaVersion:u.literal(1),tests:u.array(RM),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:br.describe("one paragraph")});var tv=(s=>(s.Place="place",s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s.None="none",s))(tv||{}),rv=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(rv||{}),tt=u.string().trim().min(1),nv=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(nv||{}),DM=u.object({kind:u.nativeEnum(nv),reason:tt.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),hg=u.array(u.string().url().max(2048).regex(/^https?:\/\//i)).max(50),_M=u.object({case:tt.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(rv),runtimeTargets:hg.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:tt.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:u.boolean().optional(),testProblem:DM.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:u.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:u.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),NM=u.object({started:u.boolean().optional().describe("with exit null: true if the test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:u.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(_M).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),UM=u.object({context:u.array(pg).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:u.string().optional().describe("staged path \u2014 required for placements"),file:tt.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:tt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(tv),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:tt.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:tt.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:NM,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:u.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:u.array(tt).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:u.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),iv=(n=>(n.Junit="junit",n.Converter="converter",n))(iv||{}),$M=tt.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),TM=u.object({results:tt.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(iv),run:tt.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(tt).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:tt.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:tt.describe("the covers id it realizes"),file:$M})).describe("map each reported test name to the case it covers")}),FM=u.object({suites:u.array(TM).min(1)}),I5=u.object({schemaVersion:u.literal(1),items:u.array(UM),runnerResults:FM.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:tt.describe("one paragraph")});var Ql=lt(lv(),1),dq=lt(T0(),1);var Mr;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(Mr||(Mr={}));var F0;(function(e){e.Accept="accept",e.ContentType="content-type"})(F0||(F0={}));var M0;(function(e){e.ApplicationJson="application/json"})(M0||(M0={}));var v7=[Mr.MovedPermanently,Mr.ResourceMoved,Mr.SeeOther,Mr.TemporaryRedirect,Mr.PermanentRedirect],w7=[Mr.BadGateway,Mr.ServiceUnavailable,Mr.GatewayTimeout];var P0=require("os"),dA=require("fs"),Jm=function(e,t,n,i){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(l){try{c(i.next(l))}catch(d){s(d)}}function A(l){try{c(i.throw(l))}catch(d){s(d)}}function c(l){l.done?o(l.value):r(l.value).then(a,A)}c((i=i.apply(e,t||[])).next())})},{access:gq,appendFile:pq,writeFile:hq}=dA.promises,L0="GITHUB_STEP_SUMMARY";var Ym=class{constructor(){this._buffer=""}filePath(){return Jm(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let t=process.env[L0];if(!t)throw new Error(`Unable to find environment variable for $${L0}. Check if your runtime environment supports job summaries.`);try{yield gq(t,dA.constants.R_OK|dA.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}return this._filePath=t,this._filePath})}wrap(t,n,i={}){let r=Object.entries(i).map(([o,s])=>` ${o}="${s}"`).join("");return n?`<${t}${r}>${n}</${t}>`:`<${t}${r}>`}write(t){return Jm(this,void 0,void 0,function*(){let n=!!t?.overwrite,i=yield this.filePath();return yield(n?hq:pq)(i,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Jm(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(t,n=!1){return this._buffer+=t,n?this.addEOL():this}addEOL(){return this.addRaw(P0.EOL)}addCodeBlock(t,n){let i=Object.assign({},n&&{lang:n}),r=this.wrap("pre",this.wrap("code",t),i);return this.addRaw(r).addEOL()}addList(t,n=!1){let i=n?"ol":"ul",r=t.map(s=>this.wrap("li",s)).join(""),o=this.wrap(i,r);return this.addRaw(o).addEOL()}addTable(t){let n=t.map(r=>{let o=r.map(s=>{if(typeof s=="string")return this.wrap("td",s);let{header:a,data:A,colspan:c,rowspan:l}=s,d=a?"th":"td",f=Object.assign(Object.assign({},c&&{colspan:c}),l&&{rowspan:l});return this.wrap(d,A,f)}).join("");return this.wrap("tr",o)}).join(""),i=this.wrap("table",n);return this.addRaw(i).addEOL()}addDetails(t,n){let i=this.wrap("details",this.wrap("summary",t)+n);return this.addRaw(i).addEOL()}addImage(t,n,i){let{width:r,height:o}=i||{},s=Object.assign(Object.assign({},r&&{width:r}),o&&{height:o}),a=this.wrap("img",null,Object.assign({src:t,alt:n},s));return this.addRaw(a).addEOL()}addHeading(t,n){let i=`h${n}`,r=["h1","h2","h3","h4","h5","h6"].includes(i)?i:"h1",o=this.wrap(r,t);return this.addRaw(o).addEOL()}addSeparator(){let t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){let t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,n){let i=Object.assign({},n&&{cite:n}),r=this.wrap("blockquote",t,i);return this.addRaw(r).addEOL()}addLink(t,n){let i=this.wrap("a",t,{href:n});return this.addRaw(i).addEOL()}},$7=new Ym;var jm=lt(require("os"),1);var vl=lt(require("fs"),1);var{chmod:mq,copyFile:Iq,lstat:Eq,mkdir:yq,open:M7,readdir:Cq,rename:Bq,rm:Qq,rmdir:L7,stat:vq,symlink:wq,unlink:bq}=vl.promises,kq=process.platform==="win32";var P7=vl.constants.O_RDONLY;var J7=process.platform==="win32";var q7=jm.default.platform(),W7=jm.default.arch();var G0;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(G0||(G0={}));function J0(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}var Y0=lt(require("path"));var Hm=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Hm||{}),gr=u.string().trim().min(1),Nq=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:gr.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),Uq=u.array(u.object({component:gr.describe("a shared component listed above"),url:gr.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:gr.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),$q=u.object({name:gr.describe("the credential's environment variable name, as listed above; never its value"),component:gr.describe("the component that refused it"),status:u.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:gr.describe("the request or command you tested it with and what came back, never the value")}),Bee=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:Nq.optional(),teardown:gr.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(Hm).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:gr,output:gr}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:u.boolean(),startedAt:gr.describe("ISO timestamp"),revisions:Uq.optional(),missingSecrets:u.array(u.string().regex(ng)).optional().describe("bringup-failed only: each secret the app cannot start without that this run has no value for, by its environment variable name; never a value"),credentialsRefused:u.array($q).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:u.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Ye=u.string().trim().min(1),wl=Ye,qm=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(qm||{}),Wm=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],j0=u.object({schemaVersion:u.literal(1),type:u.nativeEnum(qm).optional(),repository:wl.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:u.enum(["ready","blocked"]),environment:Eo.optional(),components:u.array(u.object({name:Ye,repository:Ye.describe(`owner/repo, or "${Hr}" for a customer-deployed component no repository builds`),healthy:u.boolean(),url:u.string().min(1).nullable(),...ig,credentials:u.array(u.string().regex(ir)).max(50).optional(),deployed:Ye.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:u.array(u.object({framework:Ye,file:Ye,result:u.enum(["pass","fail","error"])}).strict()),inputsUsed:u.array(Ye),inputsUsedHow:u.array(u.object({input:Ye,how:Ye}).strict()).optional(),inputsNotUsed:u.array(u.object({input:Ye,reason:Ye}).strict()),blockers:u.array(u.object({component:Ye,problem:Ye,evidence:Ye,fix:Ye}).strict()),replay:u.object({outcome:Ye,durationSeconds:u.number().nonnegative().nullable()}).strict().nullable(),files:u.array(u.object({path:Ye,content:u.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,o)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:u.ZodIssueCode.custom,path:["inputsUsedHow",o,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,o)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:u.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,o)=>{r.components.forEach((s,a)=>{i.has(s)||t.addIssue({code:u.ZodIssueCode.custom,path:["environment","revisionSources",o,"components",a],message:"not one of components"})})}),e.components.forEach((r,o)=>{r.deployed!==void 0!==n&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===Hr&&!n&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"repository"],message:`only a customer_deployed component is ${Hr}`})}),n&&(e.components.forEach((r,o)=>{e.components.findIndex(s=>s.name===r.name)!==o&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:u.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,o)=>{Wm.includes(r.path)&&t.addIssue({code:u.ZodIssueCode.custom,path:["files",o,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(o=>o.components));e.components.forEach((o,s)=>{o.repository!==Hr&&!r.has(o.name)&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",s,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var See=["clean","recipe-drift"];function bl(e){let t=Y0.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}var H0=u.string().uuid(),kl=u.object({environmentId:u.string().uuid(),allowed:u.boolean(),revision:H0,updatedAt:u.string().datetime(),updatedBy:u.string().uuid()}).strict();var q0=(s=>(s.NoEnvironment="no_environment",s.NoRecordedGrant="no_recorded_grant",s.Unavailable="unavailable",s.Changed="changed",s.Denied="denied",s.OutOfScope="out_of_scope",s))(q0||{});var _ee=u.object({environmentId:u.string().uuid(),environmentAddress:u.string().url(),revision:H0}).strict(),Nee=u.object({refusal:u.nativeEnum(q0)}).strict();var l_=u.unknown().optional();var gA=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(gA||{}),eI=(o=>(o.Trigger="TRIGGER",o.Baseline="BASELINE",o.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",o.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",o.ManualOverride="MANUAL_OVERRIDE",o))(eI||{}),d_=(s=>(s.PullRequest="pull_request",s.ReadyForReview="ready_for_review",s.Schedule="schedule",s.Manual="manual",s.SutSetup="sut_setup",s.RevisionRead="revision_read",s))(d_||{}),Mq=["sut_setup"],Lq=["sut_setup","schedule","revision_read"];var f_=(t=>(t.PullRequest="pull_request",t))(f_||{}),g_=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(g_||{}),W0=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var p_=(o=>(o.ReportUploaded="report_uploaded",o.NoReport="no_report",o.Cancelled="cancelled",o.RecipeUploaded="recipe_uploaded",o.RevisionsUploaded="revisions_uploaded",o))(p_||{}),h_=(n=>(n.Running="running",n.Ended="ended",n))(h_||{}),m_=(f=>(f.TimedOut="timed_out",f.AgentFailed="agent_failed",f.SetupFailed="setup_failed",f.CredentialMissing="credential_missing",f.RunnerLost="runner_lost",f.CheckoutFailed="checkout_failed",f.EnvironmentUnverified="environment_unverified",f.ModelProviderDenied="model_provider_denied",f.ModelProviderUnavailable="model_provider_unavailable",f.RunnerProviderNotReady="runner_provider_not_ready",f.MergeConflict="merge_conflict",f.EnvironmentUnavailable="environment_unavailable",f))(m_||{}),I_=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(I_||{}),tI=(n=>(n.Started="started",n.Finished="finished",n))(tI||{}),E_=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(E_||{});var y_=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(y_||{});var C_=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(C_||{}),rI=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(rI||{}),Km=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(Km||{});var nI=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(nI||{}),qt=u.string().regex(/^[1-9][0-9]{0,18}$/),Wt=u.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Xm=u.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),B_=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;var Xe=u.string().regex(B_),ot=u.string().regex(/^[0-9a-f]{64}$/),Dl=u.object({id:Xe,revision:qt}).strict(),Nl={provider:u.literal("github"),providerAccountId:qt,providerRepositoryId:qt},Ul={provider:u.literal("azure-devops"),providerAccountId:Xe,providerRepositoryId:Xe},pr=u.discriminatedUnion("provider",[u.object(Nl).strict(),u.object(Ul).strict()]),zee=u.discriminatedUnion("provider",[u.object(Nl).passthrough(),u.object(Ul).passthrough()]),_l=e=>`${e.provider}:${e.providerRepositoryId}`,Z0={namespace:u.string().min(1),name:u.string().min(1)},Q_=u.discriminatedUnion("provider",[u.object({...Nl,...Z0}).strict(),u.object({...Ul,...Z0}).strict()]),K0=u.object({ref:u.string().min(1),revision:Wt}).strict(),Pq=u.object({kind:u.nativeEnum(g_),number:qt.optional(),ref:u.string().min(1),revision:Wt,reason:u.nativeEnum(eI)}).strict(),Oq=u.object({repository:Q_,revision:Wt,ref:u.string().nullable(),reason:u.nativeEnum(eI),change:u.object({kind:u.nativeEnum(f_),number:qt,base:K0.optional()}).strict().nullable(),compareWith:K0.optional(),merge:u.array(Pq).min(2).optional()}).strict();function zq(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,i=new Set;for(let[o,s]of t.entries()){if(s.kind==="pull_request"!=(s.number!==void 0))return{path:["merge",o,"number"],message:"a pull request names its number, and a branch none"};if(!W0.includes(s.reason))return{path:["merge",o,"reason"],message:`${s.reason} does not select a merged revision`};if(s.kind==="branch"&&s.reason!=="MANUAL_OVERRIDE")return{path:["merge",o,"reason"],message:"only a person chooses a branch to merge"};if(s.ref===e.ref)return{path:["merge",o,"ref"],message:"the baseline branch is what the source merges onto"};if(s.number!==void 0&&n.has(s.number)||i.has(s.ref))return{path:["merge",o],message:"names a revision the source already merges"};s.number!==void 0&&n.add(s.number),i.add(s.ref)}let r=W0.find(o=>t.some(s=>s.reason===o));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}function Gq(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(c=>c!=null).length>1)return"a run compares with one baseline";let o=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return o?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let s=new Set(e.sources.map(c=>_l(c.repository))),a=new Set(r.map(c=>_l(c.repository)));return a.size===r.length&&a.size===s.size&&[...a].every(c=>s.has(c))?null:"names every source of the snapshot, once"}var v_=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,w_=/^[1-9][0-9]{0,18}$/,X0=new RegExp(`${v_.source}|${w_.source}`),e_=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,Vq=u.union([u.object({source:u.literal("jira"),site:u.string().regex(e_),key:u.string().regex(v_),updated:u.string().datetime(),contentHash:ot}).strict(),u.object({source:u.literal("confluence"),site:u.string().regex(e_),key:u.string().regex(w_),version:u.number().int().positive(),contentHash:ot}).strict(),u.object({source:u.literal("other"),key:u.string().regex(vc),contentHash:ot}).strict(),u.object({source:u.literal("other"),key:u.string().regex(wc),contentHash:ot,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(bc)}).strict()]),t_=u.union([u.literal("jira"),u.literal("confluence")]),Gee=u.object({schemaVersion:u.literal(1),items:u.array(u.union([u.object({source:t_,site:u.string(),key:u.string().regex(X0),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:t_,site:u.string(),key:u.string().regex(X0),state:u.literal("not_read"),reason:u.nativeEnum(aa)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(vc),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:u.literal("other"),key:u.string().regex(vc),state:u.literal("not_read"),reason:u.nativeEnum(aa)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(wc),state:u.literal("read"),version:ot,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(bc)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(wc),state:u.literal("not_read"),reason:u.nativeEnum(aa)}).strict()])),instructions:u.array(u.string()).optional()}).strict(),Jq=u.object({resultId:u.string().min(1),repository:u.string().min(1),testType:u.string().min(1),path:u.string(),finding:u.string().min(1)}).strict(),Yq=u.object({schemaVersion:u.literal(1),runId:Xe,skyrampOrgId:Xe,target:Dl,policy:Dl.nullable(),trigger:u.object({kind:u.nativeEnum(d_),requestedAt:u.string().datetime()}).strict(),configuration:u.object({captureId:Xe,revision:qt.nullable(),hash:ot}).strict(),baseline:u.object({confirmedRunId:Xe.nullable(),initialBaselineId:Xe.optional(),comparisonBaselineId:Xe.optional(),knownFailures:u.array(Jq).optional(),sources:u.array(u.object({repository:pr,revision:Wt}).strict()).optional()}).strict().optional(),sources:u.array(Oq).min(1).max(1e3),execution:u.object({provider:u.nativeEnum(gA),repository:Q_,workflowPath:u.string(),ref:u.string()}).strict(),credentials:u.array(u.object({name:u.string(),purpose:u.nativeEnum(eg),required:u.boolean()}).strict()),requirements:u.array(Vq).min(1).optional(),instructions:u.object({contentHash:ot}).strict().optional(),deployedRevisions:u.array(u.object({repository:pr,revision:Wt}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((A,c)=>{let l="fileName"in A?"file":"pasted";A.source==="other"&&A.key!==`${l}-${A.contentHash.slice(0,16)}`&&t.addIssue({code:u.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",c,"key"]});let d=XQ({source:A.source,key:A.key});n.has(d)&&t.addIssue({code:u.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",c,"key"]}),n.add(d)});let i=e.trigger.kind,r=Mq.includes(i);r!==(e.policy===null)&&t.addIssue({code:u.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:u.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let o=Gq(e);o&&t.addIssue({code:u.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:o}),Lq.includes(i)&&e.sources.forEach((A,c)=>{A.reason!=="BASELINE"&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let s=new Set(e.sources.map(A=>_l(A.repository))),a=new Set;(e.deployedRevisions??[]).forEach((A,c)=>{let l=_l(A.repository);s.has(l)?a.has(l)&&t.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",c,"repository"],message:"repository appears twice"}):t.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",c,"repository"],message:"names a repository outside the snapshot"}),a.add(l)}),e.sources.forEach((A,c)=>{A.compareWith&&(A.reason!=="MANUAL_OVERRIDE"||A.change)&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(A.change?.base||A.compareWith||A.merge)&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let l=zq(A);l&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c,...l.path],message:l.message})})});var b_=(n=>(n.Person="person",n.Policy="policy",n))(b_||{}),jq=u.object({kind:u.nativeEnum(b_),name:u.string().min(1).max(256)}).strict(),Hq=u.object({mcp:u.discriminatedUnion("source",[u.object({source:u.literal("npm"),version:u.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),u.object({source:u.literal("github"),ref:u.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:u.object({region:u.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:u.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Vee=u.object({schemaVersion:u.literal(1),attempt:u.object({id:Xe,number:u.number().int().positive(),deadlineAt:u.string().datetime()}).strict(),manifest:Yq,manifestHash:ot,entitlements:u.array(u.string()).optional(),runToken:u.string().min(1).optional(),requestedBy:jq.nullable().optional(),writeAllowed:u.boolean().optional(),claudeCodeVersion:u.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:u.array(u.object({repository:pr,revision:Wt}).strict()).optional(),statedRevisions:u.array(u.object({repository:pr,revision:Wt}).strict()).optional(),runSettings:Hq.optional()}).strict(),r_={providerRunAttempt:u.number().int().positive(),workflowRef:u.string().min(1)},qq=u.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),Jee=u.object({schemaVersion:u.literal(1),runId:Xe,execution:u.discriminatedUnion("provider",[u.object({...r_,provider:u.literal("github"),repository:u.object(Nl).strict(),providerRunId:qt}).strict(),u.object({...r_,provider:u.literal("azure-devops"),repository:u.object(Ul).strict(),providerRunId:qq}).strict()]),requester:u.literal(!0).optional(),writeCheck:u.literal(!0).optional(),claudeCodePin:u.literal(!0).optional(),deployedPins:u.literal(!0).optional(),statedPins:u.literal(!0).optional(),runSettings:u.literal(!0).optional(),credentialKinds:u.literal(!0).optional()}).strict(),n_=u.object({repository:pr,number:qt,commitSha:Wt.optional()}).strict(),Sl=u.array(u.object({repository:pr,reason:u.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),Wq=u.object({branch:Xm.optional(),commitSha:Wt.optional()}).strict(),k_=4096,Zq=u.array(u.object({file:u.string().max(4096).regex(/\S/),dependsOn:u.array(u.string().max(2048).regex(/\S/)).max(100)}).strict()).min(1).max(500),i_=u.object({repository:pr,message:u.string().max(k_),...Wq.shape,heldBack:Zq.optional()}).strict(),Kq=u.discriminatedUnion("status",[u.object({status:u.literal("none"),noTests:Sl}).strict(),u.object({status:u.literal("delivered"),noTests:Sl,pullRequests:u.array(n_).min(1)}).strict(),u.object({status:u.literal("partial"),noTests:Sl,pullRequests:u.array(n_).min(1),failures:u.array(i_).min(1)}).strict(),u.object({status:u.literal("failed"),message:u.string().max(k_),noTests:Sl,failures:u.array(i_).min(1).optional()}).strict()]),Yee=1024*1024,jee=16*1024*1024,fA={id:4096,text:16384,businessCase:65536},Xq={id:fA.id,statement:fA.text,rows:1e3},o_=u.string().min(1).max(fA.id),Rl=u.string().max(fA.text),xl=(e,t)=>u.array(u.object({[e]:Rl}).strict()).max(t).optional(),eW=u.object({language:u.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:u.string().max(fA.businessCase),validation:u.object({rationale:Rl.min(1),gaps:u.array(u.string().min(1).max(4096)).max(200)}).strict().optional(),changes:u.array(u.object({id:o_,text:Rl}).strict()).max(1e3).optional(),requirements:u.array(u.object({id:o_,statement:Rl}).strict()).max(Xq.rows).optional(),issuesFound:xl("description",5e3),newTestsCreated:xl("description",5e3),testResults:xl("details",5e3),caveats:xl("text",100)}).strict(),tW=u.object({blockedPreflight:u.object({file:u.string().min(1),repository:u.string().min(1).optional(),reason:u.string().min(1).max(300),evidence:u.string().min(1).max(400)}).strict().optional(),sufficiency:u.nativeEnum(Ag),rationale:u.string().min(1),gaps:u.array(u.string().min(1)),acceptedEvidence:u.array(u.object({kind:u.nativeEnum(Aa),repository:u.string().min(1),revision:Wt,reference:u.string().min(1),summary:u.string().min(1)}).strict()),actionRequired:u.array(u.nativeEnum(cg))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:u.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Zm=500,rW=2048,nW=1e3,iW=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,s_=e=>e.length>0&&e.length<=64&&e===e.trim()&&!iW.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),S_=e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&s_(n)&&s_(i)},oW=u.object({testResults:u.array(u.object({resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:u.string().refine(S_,"Invalid"),testType:u.string(),runtimeTargets:hg.optional(),endpoint:u.string(),status:u.enum(["Pass","Fail","Skipped"]),details:u.string(),fileName:u.string().optional(),testId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:u.object({kind:u.nativeEnum(ug),family:u.nativeEnum(lg).optional()}).strict().optional(),origin:u.nativeEnum(ag).optional()}).strict()),validation:tW,changes:u.array(u.object({id:u.string().min(1).max(512),text:u.string().max(16384),source:u.string().max(rW),testedBy:u.array(u.string().min(1).max(1024)).max(Zm),writtenBy:u.array(u.string().min(1).max(1024)).max(Zm),maintainedBy:u.array(u.string().min(1).max(1024)).max(Zm)}).strict()).max(nW).optional(),traceVersion:u.literal(1),display:eW.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let o of["issuesFound","newTestsCreated","testResults","caveats"]){let s=n?.[o];s&&s.length!==(Array.isArray(i[o])?i[o].length:0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["display",o],message:`has not one row per ${o} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((o,s)=>{let a=o.failureCause;a&&o.status==="Pass"&&t.addIssue({code:u.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),a&&a.kind==="environment"!=(a.family!==void 0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let A=["testResults",s,"resultId"],c=o.resultId.slice(`${o.repository}:${o.testType}:`.length);(!o.resultId.startsWith(`${o.repository}:${o.testType}:`)||c===""||c.startsWith("/")||c.startsWith("#"))&&t.addIssue({code:u.ZodIssueCode.custom,path:A,message:"is not repository:testType:path for this result"}),r.has(o.resultId)&&t.addIssue({code:u.ZodIssueCode.custom,path:A,message:"stable identity repeated"}),r.add(o.resultId)})});var sW=50,aW=u.discriminatedUnion("kind",[u.object({kind:u.literal("branch_pushed"),repository:pr,branch:Xm,commit:Wt}).strict(),u.object({kind:u.enum(["pull_request_opened","pull_request_edited"]),repository:pr,number:qt,branch:Xm}).strict()]),AW=100,cW=2048,Hee=u.object({records:u.array(u.string().regex(/^https?:\/\/[^\s/?#@]+(\/[^\s?#]*)?$/).max(cW)).max(AW),unlisted:u.number().int().nonnegative()}).strict().refine(e=>e.records.length+e.unlisted>0,"names at least one create"),uW=u.object({schemaVersion:u.literal(1),run:u.object({runId:Xe,attemptNumber:u.number().int().positive(),manifestHash:ot}).strict(),target:Dl,policy:Dl,provenance:u.object({sources:u.array(u.object({repository:pr,revision:Wt}).strict()),firstQualification:u.literal(!0).optional()}).strict(),delivery:u.object({generatedTests:Kq}).strict(),producer:u.object({testbot:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:oW,githubWrites:u.array(aW).max(sW).optional()}).strict(),x_=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(x_||{}),lW=200,dW=u.object({cause:u.nativeEnum(x_),credential:u.string().regex(ir).optional(),reason:u.string().trim().min(1).max(lW).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),fW=u.object({name:u.string().regex(ir),purpose:u.enum(["sut_access","other"]),required:u.boolean(),how:u.string().trim().min(1).max(rg)}).strict(),qee=uW.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:j0,check:dW.optional(),inputs:u.array(fW).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=(o,s)=>t.addIssue({code:u.ZodIssueCode.custom,path:["recipe",...o],message:s});e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((o,s)=>{bl(o.path)||n(["files",s,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),i.has(o.path)&&n(["files",s,"path"],"file repeated"),i.add(o.path),KQ.test(o.content)&&n(["files",s,"content"],"is not text");let a=Buffer.byteLength(o.content,"utf8");r+=a,a>og&&n(["files",s,"content"],`larger than ${og} bytes`)}),r>sg&&n(["files"],`recipe text over ${sg} bytes in total`)}),Wee=u.object({components:u.array(u.object({name:u.string().min(1),repository:u.string().refine(S_,"Invalid"),observedRevision:u.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:u.nativeEnum(dg),evidence:u.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Zee=u.object({schemaVersion:u.literal(1),stage:u.nativeEnum(I_),event:u.nativeEnum(tI),status:u.nativeEnum(E_).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),$l=100,gW=5e3,Vi=2e3,a_=100,R_=/^[A-Za-z0-9_-]{1,64}$/,pW=20,hW=200,mW=100,IW=100,EW=200,A_="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",yW=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${A_}/${A_})$`),CW=500,c_=50,BW=10,QW=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,D_=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Tt=e=>u.string().max(e).refine(t=>t.trim().length>0&&!D_.test(t),"blank, or not text"),Lr={sequence:u.number().int().min(1).max(gW),at:u.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},__=u.object({...Lr,kind:u.literal("reply"),to:u.string().uuid(),outcome:u.nativeEnum(C_),accepted:u.boolean(),text:Tt(Vi),note:u.object({source:u.enum(["target","environment"]),quote:Tt(Vi)}).strict().optional(),kept:Tt(Vi).optional()}).strict();function N_(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:u.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:u.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:u.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}var vW=u.discriminatedUnion("kind",[u.object({...Lr,kind:u.literal("log"),phase:u.nativeEnum(rI),text:Tt(Vi)}).strict(),u.object({...Lr,kind:u.literal("component"),name:Tt(a_),repository:Tt(EW).refine(e=>yW.test(e)||e===Hr,"not owner/name"),file:Tt(CW).nullable(),status:u.nativeEnum(nI),version:Tt(IW).optional()}).strict(),__,u.object({...Lr,kind:u.literal("question"),id:u.string().regex(R_),type:u.nativeEnum(y_),text:Tt(Vi),component:Tt(a_).nullable(),choices:u.array(Tt(hW)).max(pW),placeholder:Tt(mW).optional()}).strict(),u.object({...Lr,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max($l)}).strict(),u.object({...Lr,kind:u.literal("credentials"),names:u.array(u.string().regex(ir)).min(1).max(c_),logins:u.array(u.object({key:u.string().regex(QW),usernameVariable:u.string().regex(ir),passwordVariable:u.string().regex(ir)}).strict()).min(1).max(BW).optional(),variables:u.array(u.string().regex(ir)).min(1).max(c_).optional()}).strict()]).superRefine((e,t)=>{if(N_(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>J0(i.key));new Set(n).size!==n.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let o of["usernameVariable","passwordVariable"])e.names.includes(i[o])||t.addIssue({code:u.ZodIssueCode.custom,path:["logins",r,o],message:"not one of the names"})})}e.kind==="credentials"&&e.variables&&(new Set(e.variables).size!==e.variables.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["variables"],message:"a name twice"}),e.variables.forEach((n,i)=>{e.names.includes(n)||t.addIssue({code:u.ZodIssueCode.custom,path:["variables",i],message:"not one of the names"})})),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Kee=u.object({schemaVersion:u.literal(1),events:u.array(vW).max($l)}).strict(),wW=u.discriminatedUnion("kind",[u.object({...Lr,kind:u.literal("log"),stage:u.nativeEnum(Km),text:Tt(Vi)}).strict(),__,u.object({...Lr,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max($l)}).strict(),u.object({...Lr,kind:u.literal("stage"),stage:u.nativeEnum(Km),event:u.nativeEnum(tI)}).strict(),u.object({...Lr,kind:u.literal("test"),resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:u.enum(["Pass","Fail","Skipped"]),details:u.string().max(Vi).refine(e=>!D_.test(e),"not text")}).strict()]).superRefine(N_),Xee=u.object({schemaVersion:u.literal(1),events:u.array(wW).max($l)}).strict(),u_={id:u.string().uuid(),text:u.string(),by:u.string().nullable(),at:u.string(),replied:u.literal(!0).optional()},U_=u.discriminatedUnion("kind",[u.object({...u_,kind:u.literal("instruction"),question:u.null()}),u.object({...u_,kind:u.literal("answer"),question:u.string().regex(R_)})]),$_=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),bW=u.object({id:u.string().uuid(),revision:u.string(),by:u.string().nullable(),at:u.string(),target:u.string(),own:u.object({source:u.enum(["policy","test_environment"]),text:u.string()}).nullable()}),ete=u.object({schemaVersion:u.literal(1),leftOut:u.array(u.string()),messages:u.array(U_).optional(),stop:u.object({key:$_}).optional(),notes:bW.optional()}),tte=u.object({schemaVersion:u.literal(1),messages:u.array(U_).optional()});var kW=500*1024*1024,T_=u.object({id:qt,name:u.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:qt,expiresAt:u.string().datetime()}).strict(),rte=u.object({schemaVersion:u.literal(1),artifact:T_,sessionId:Xe,contentHash:ot,bytes:u.number().int().min(1).max(kW)}).strict(),nte=u.object({schemaVersion:u.literal(1),checkpoint:u.object({artifact:T_,repository:u.object({namespace:u.string().min(1),name:u.string().min(1)}).strict(),sessionId:Xe,contentHash:ot,key:$_}).strict().nullable()}).strict(),SW=200,hs=100,F_=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(F_||{}),xW=u.object({kind:u.nativeEnum(F_),setup:u.object({runId:Xe,endedAt:u.string().nullable(),outcome:u.string().nullable()}).strict(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1),status:u.nativeEnum(nI)}).strict()).max(hs),credentials:u.array(u.string().min(1)).max(hs),answers:u.array(u.object({question:u.string(),answer:u.string().nullable()}).strict()).max(hs),instructions:u.array(u.object({text:u.string(),reply:u.string().nullable()}).strict()).max(hs),log:u.array(u.object({phase:u.nativeEnum(rI),text:u.string()}).strict()).max(SW),recipe:u.object({files:u.array(u.object({path:u.string().min(1),content:u.string()}).strict()).max(hs),blockers:u.array(u.object({component:u.string(),problem:u.string(),evidence:u.string(),fix:u.string()}).strict()).max(hs)}).strict().optional()}).strict(),ite=u.object({schemaVersion:u.literal(1),context:xW.nullable()}).strict(),ote=u.object({schemaVersion:u.literal(1),configuration:u.object({captureId:Xe,revision:qt.nullable(),hash:ot}).strict(),capture:u.object({schemaVersion:u.literal(1),settings:u.object({target:u.object({environment:u.unknown()}).passthrough(),timeoutMinutes:u.number().int().positive(),answerWaitMinutes:u.number().int().positive().optional(),testEnvironment:u.object({name:u.string().min(1),address:u.string().min(1).optional(),readyWhen:u.string().min(1).optional(),environmentId:u.string().uuid().optional(),persistentDataPolicy:l_}).passthrough().optional()}).passthrough(),provenance:u.object({}).passthrough(),hash:ot}).strict()}).strict(),ste=u.object({schemaVersion:u.literal(1),environmentId:u.string().uuid().nullable(),environmentAddress:u.string().url().nullable(),persistentDataPolicy:kl.nullable()}).strict(),RW=Eo.extend({environmentId:u.string().uuid().optional(),persistentDataPolicy:l_,version:u.number().int().positive(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1)}).strict()),contentHash:ot.optional(),files:u.array(u.object({path:u.string().refine(e=>bl(e)&&!Wm.includes(e),"not a file of a customer_deployed plan"),content:u.string()}).strict()).optional()}).strict(),ate=u.object({schemaVersion:u.literal(1),testEnvironment:RW.nullable().optional(),runtimePlan:u.object({version:u.number().int().positive(),contentHash:ot,files:u.array(u.object({path:u.string().refine(bl,"not a recipe file path"),content:u.string()}).strict()).min(1),repository:wl.optional(),recipeRepository:wl.optional(),recipe:u.record(u.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),Ate=u.object({schemaVersion:u.literal(1),state:u.nativeEnum(h_),ending:u.nativeEnum(p_).nullable(),cause:u.nativeEnum(m_).nullable(),deadlineAt:u.string().datetime()}).strict();var DW=50,cte=u.object({repository:pr,revisions:u.array(u.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:u.array(u.string().min(1)).min(1).max(DW)}).strict();var NW=".skyramp/sut/deployed-revisions.sh",M_=(n=>(n.Running="running",n.Requested="requested",n))(M_||{});var yte=new Set(Object.values(M_));var Cte=`Fix ${NW} so it prints the full commit each component runs, then set it up again.`;var $W=/^(login|logout|signin|sign-in|signup|sign-up|auth|oauth|token|session)$/i,TW=/^(login|logout|signin|sign-in|signup|sign-up|auth|oauth|token|sessions?)$/i,FW=/(^|\/)(graphql(\.json)?|gql)(\/|$)/i,MW=["id","uuid","_id","pk"],LW=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,PW=/^[0-9a-f]{24}$/i,O_=/^\d+$/,OW=/^(token|jwt|(access|refresh|id|session)[-_]?token)$/i;function iI(e,t){if(e.toUpperCase()!=="POST")return!1;let n;try{n=new URL(t)}catch{return!1}let i=n.pathname.split("/").filter(Boolean),r=i.pop();return!!r&&!$W.test(r)&&!i.some(o=>TW.test(o))&&!FW.test(n.pathname)}function z_(e){if(typeof e=="number")return Number.isSafeInteger(e)&&e>=0?e:void 0;if(typeof e=="string"&&(O_.test(e)||LW.test(e)||PW.test(e)))return e}function zW(e,t){let n=String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`(^|[^A-Za-z0-9])${n}($|[^A-Za-z0-9])`,"i");for(let[r,o]of Object.entries(t)){let s=r.toLowerCase();if(s==="location"||s==="content-location"||o===void 0)continue;let a=s==="set-cookie";if(!(!a&&O_.test(String(e))))for(let A of Array.isArray(o)?o:[o]){let c=a?A.split(";")[0].split("=").slice(1).join("="):A;if(i.test(c))return!0}}return!1}function G_(e,t,n,i,r){if(!iI(e,t)||n!==201)return{kind:"not-a-create"};let o={};try{let f=r===null||r.trim()===""?{}:JSON.parse(r);f&&typeof f=="object"&&!Array.isArray(f)&&(o=f)}catch{}if(Object.keys(o).some(f=>OW.test(f)))return{kind:"sign-in"};let s=new URL(t);s.search="",s.hash="";let a=s.toString().replace(/\/+$/,""),A=typeof i.location=="string"?GW(a,i.location):void 0,c=MW.find(f=>o[f]!==void 0),l=c?z_(o[c]):void 0,d=A??(l===void 0?void 0:{entityUrl:`${a}/${l}`,id:l});return d?zW(d.id,i)?{kind:"sign-in"}:{kind:"record",record:d}:i["set-cookie"]===void 0?{kind:"unnamed"}:{kind:"sign-in"}}function GW(e,t){let n;try{n=new URL(t,`${e}/`)}catch{return}let i=new URL(e);if(n.origin!==i.origin)return;let r=n.pathname.replace(/\/+$/,"");if(!r.startsWith(`${i.pathname}/`))return;let o=r.slice(i.pathname.length+1),s=o.includes("/")?void 0:z_(o);return s===void 0?void 0:{entityUrl:`${e}/${s}`,id:s}}function Tl(e){try{let t=new URL(e);return t.origin+t.pathname.replace(/\/+$/,"")}catch{return}}function V_(e,t){let n=Tl(t);return!!n&&e.some(i=>n===i||n.startsWith(`${i}/`))}var Zn=lt(require("fs")),Wn=lt(require("http")),q8=lt(require("https")),Yf=lt(require("dns")),KT=require("module"),Le=lt(require("net"));var jf=lt(require("path")),Hf=require("stream"),XT=require("stream/promises"),TQ=require("timers/promises"),Kn=lt(require("tls"));var z={};Br(z,{$brand:()=>II,$input:()=>Vy,$output:()=>Gy,INVALID:()=>At,NEVER:()=>mI,TimePrecision:()=>rC,ZodAny:()=>GB,ZodArray:()=>jB,ZodBase64:()=>Nf,ZodBase64URL:()=>Uf,ZodBigInt:()=>ea,ZodBigIntFormat:()=>Ff,ZodBoolean:()=>Xs,ZodCIDRv4:()=>Df,ZodCIDRv6:()=>_f,ZodCUID:()=>vf,ZodCUID2:()=>wf,ZodCatch:()=>gQ,ZodCodec:()=>cc,ZodCompileAsyncError:()=>mr,ZodCompileUnsupportedError:()=>oe,ZodCreditCard:()=>$B,ZodCustom:()=>uc,ZodCustomStringFormat:()=>ao,ZodDate:()=>nc,ZodDefault:()=>AQ,ZodDiscriminatedUnion:()=>qB,ZodE164:()=>$f,ZodEmail:()=>yf,ZodEmoji:()=>Bf,ZodEnum:()=>Ws,ZodError:()=>A8,ZodExactOptional:()=>Of,ZodFile:()=>iQ,ZodFirstPartyTypeKind:()=>SQ,ZodFunction:()=>vQ,ZodGUID:()=>Cf,ZodIBAN:()=>TB,ZodIPv4:()=>xf,ZodIPv6:()=>Rf,ZodISODate:()=>jn,ZodISODateTime:()=>Yn,ZodISODuration:()=>qn,ZodISOTime:()=>Hn,ZodInstanceOf:()=>kQ,ZodIntersection:()=>WB,ZodIssueCode:()=>l8,ZodJWT:()=>Tf,ZodKSUID:()=>Sf,ZodLazy:()=>CQ,ZodLiteral:()=>nQ,ZodMAC:()=>UB,ZodMap:()=>tQ,ZodNaN:()=>hQ,ZodNanoID:()=>Qf,ZodNever:()=>JB,ZodNonOptional:()=>zf,ZodNull:()=>OB,ZodNullable:()=>aQ,ZodNumber:()=>Ks,ZodNumberFormat:()=>Ao,ZodObject:()=>oc,ZodOptional:()=>ac,ZodPipe:()=>Ac,ZodPrefault:()=>uQ,ZodPreprocess:()=>mQ,ZodPromise:()=>QQ,ZodReadonly:()=>IQ,ZodRealError:()=>vt,ZodRecord:()=>qs,ZodSet:()=>rQ,ZodString:()=>Zs,ZodStringFormat:()=>me,ZodSuccess:()=>fQ,ZodSymbol:()=>LB,ZodTemplateLiteral:()=>yQ,ZodTransform:()=>oQ,ZodTuple:()=>KB,ZodType:()=>ee,ZodULID:()=>bf,ZodURL:()=>rc,ZodUUID:()=>Gr,ZodUndefined:()=>PB,ZodUnion:()=>sc,ZodUnknown:()=>VB,ZodVoid:()=>YB,ZodXID:()=>kf,ZodXor:()=>HB,_ZodString:()=>Ef,_default:()=>cQ,_function:()=>vT,any:()=>tT,array:()=>ic,base64:()=>$$,base64url:()=>T$,bigint:()=>W$,boolean:()=>MB,catch:()=>pQ,check:()=>wT,cidrv4:()=>N$,cidrv6:()=>U$,clone:()=>fe,codec:()=>yT,coerce:()=>RQ,compile:()=>Hy,config:()=>De,core:()=>dn,creditCard:()=>M$,cuid:()=>w$,cuid2:()=>b$,currencyCode:()=>V$,custom:()=>bT,date:()=>nT,decode:()=>kB,decodeAsync:()=>xB,deepPartial:()=>LT,describe:()=>kT,discriminatedUnion:()=>cT,e164:()=>F$,email:()=>p$,emoji:()=>Q$,encode:()=>bB,encodeAsync:()=>SB,endsWith:()=>Ms,enum:()=>Lf,exactOptional:()=>sQ,file:()=>hT,flattenError:()=>wA,float32:()=>Y$,float64:()=>j$,formatError:()=>bA,fromJSONSchema:()=>FT,function:()=>vT,getDiscriminatedOption:()=>my,getErrorMap:()=>f8,globalRegistry:()=>He,gt:()=>Or,gte:()=>Mt,guid:()=>h$,hash:()=>J$,hex:()=>G$,hostname:()=>z$,httpUrl:()=>B$,iban:()=>L$,includes:()=>Ts,input:()=>OT,instanceof:()=>xT,int:()=>mf,int32:()=>H$,int64:()=>Z$,intersection:()=>ZB,invertCodec:()=>CT,ipv4:()=>R$,ipv6:()=>_$,iso:()=>lc,json:()=>DT,jwt:()=>P$,keyof:()=>iT,ksuid:()=>x$,lazy:()=>BQ,length:()=>ro,literal:()=>pT,locales:()=>YA,looseObject:()=>aT,looseRecord:()=>lT,lowercase:()=>Us,lt:()=>Pr,lte:()=>Ft,mac:()=>D$,map:()=>dT,maxLength:()=>to,maxSize:()=>zn,memoizer:()=>VA,meta:()=>ST,mime:()=>Ps,minLength:()=>ln,minSize:()=>zr,multipleOf:()=>On,nan:()=>ET,nanoid:()=>v$,nativeEnum:()=>gT,negative:()=>sf,never:()=>Mf,nonnegative:()=>Af,nonoptional:()=>dQ,nonpositive:()=>af,normalize:()=>Os,null:()=>zB,nullable:()=>tc,nullish:()=>mT,number:()=>FB,object:()=>oT,optional:()=>oo,output:()=>zT,overwrite:()=>Ir,parse:()=>BB,parseAsync:()=>QB,partialRecord:()=>uT,pipe:()=>If,positive:()=>of,prefault:()=>lQ,preprocess:()=>_T,prettifyError:()=>QI,promise:()=>QT,properties:()=>Ls,property:()=>cf,readonly:()=>EQ,record:()=>eQ,refine:()=>wQ,regex:()=>Ns,regexes:()=>Xt,registry:()=>Nd,safeDecode:()=>DB,safeDecodeAsync:()=>NB,safeEncode:()=>RB,safeEncodeAsync:()=>_B,safeParse:()=>vB,safeParseAsync:()=>wB,set:()=>fT,setErrorMap:()=>d8,size:()=>eo,slugify:()=>Js,startsWith:()=>Fs,strictObject:()=>sT,string:()=>ec,stringFormat:()=>O$,stringbool:()=>RT,success:()=>IT,superRefine:()=>bQ,symbol:()=>X$,templateLiteral:()=>BT,toJSONSchema:()=>ff,toLowerCase:()=>Gs,toUpperCase:()=>Vs,toZod:()=>pA,transform:()=>Pf,treeifyError:()=>BI,trim:()=>zs,tuple:()=>XB,uint32:()=>q$,uint64:()=>K$,ulid:()=>k$,undefined:()=>eT,union:()=>ta,unknown:()=>io,uppercase:()=>$s,url:()=>C$,util:()=>B,uuid:()=>m$,uuidv4:()=>I$,uuidv6:()=>E$,uuidv7:()=>y$,validate:()=>kA,validateAsync:()=>SA,void:()=>rT,withParser:()=>Ud,xid:()=>S$,xor:()=>AT});var dn={};Br(dn,{$ZodAny:()=>Ay,$ZodArray:()=>gy,$ZodAsyncError:()=>Bt,$ZodBase64:()=>WE,$ZodBase64URL:()=>ZE,$ZodBigInt:()=>Ed,$ZodBigIntFormat:()=>iy,$ZodBoolean:()=>MA,$ZodCIDRv4:()=>HE,$ZodCIDRv6:()=>qE,$ZodCUID:()=>TE,$ZodCUID2:()=>FE,$ZodCatch:()=>Ny,$ZodCheck:()=>ye,$ZodCheckBigIntFormat:()=>cE,$ZodCheckEndsWith:()=>CE,$ZodCheckGreaterThan:()=>nd,$ZodCheckIncludes:()=>EE,$ZodCheckLengthEquals:()=>pE,$ZodCheckLessThan:()=>rd,$ZodCheckLowerCase:()=>mE,$ZodCheckMaxLength:()=>fE,$ZodCheckMaxSize:()=>uE,$ZodCheckMimeType:()=>vE,$ZodCheckMinLength:()=>gE,$ZodCheckMinSize:()=>lE,$ZodCheckMultipleOf:()=>aE,$ZodCheckNumberFormat:()=>AE,$ZodCheckOverwrite:()=>wE,$ZodCheckProperties:()=>QE,$ZodCheckProperty:()=>BE,$ZodCheckRegex:()=>hE,$ZodCheckSizeEquals:()=>dE,$ZodCheckStartsWith:()=>yE,$ZodCheckStringFormat:()=>Ss,$ZodCheckUpperCase:()=>IE,$ZodCodec:()=>PA,$ZodCreditCard:()=>XE,$ZodCustom:()=>Py,$ZodCustomStringFormat:()=>ry,$ZodCyclicError:()=>bd,$ZodDate:()=>dy,$ZodDefault:()=>xy,$ZodDiscriminatedUnion:()=>Iy,$ZodE164:()=>KE,$ZodEmail:()=>RE,$ZodEmoji:()=>UE,$ZodEncodeError:()=>Ln,$ZodEnum:()=>Qy,$ZodError:()=>CI,$ZodExactOptional:()=>ky,$ZodFile:()=>wy,$ZodFunction:()=>My,$ZodGUID:()=>SE,$ZodIBAN:()=>ey,$ZodIPv4:()=>JE,$ZodIPv6:()=>YE,$ZodISODate:()=>zE,$ZodISODateTime:()=>OE,$ZodISODuration:()=>VE,$ZodISOTime:()=>GE,$ZodIntersection:()=>Ey,$ZodJWT:()=>ty,$ZodKSUID:()=>PE,$ZodLazy:()=>OA,$ZodLiteral:()=>vy,$ZodMAC:()=>jE,$ZodMap:()=>Cy,$ZodNaN:()=>Uy,$ZodNanoID:()=>$E,$ZodNever:()=>uy,$ZodNonOptional:()=>Dy,$ZodNull:()=>ay,$ZodNullable:()=>Sy,$ZodNumber:()=>Id,$ZodNumberFormat:()=>ny,$ZodObject:()=>wN,$ZodObjectJIT:()=>py,$ZodOptional:()=>Cd,$ZodPipe:()=>Bd,$ZodPrefault:()=>Ry,$ZodPreprocess:()=>$y,$ZodPromise:()=>Ly,$ZodReadonly:()=>Ty,$ZodRealError:()=>Qt,$ZodRecord:()=>yy,$ZodRegistry:()=>_d,$ZodSet:()=>By,$ZodString:()=>Wi,$ZodStringFormat:()=>ge,$ZodSuccess:()=>_y,$ZodSymbol:()=>oy,$ZodTemplateLiteral:()=>Fy,$ZodTransform:()=>by,$ZodTuple:()=>yd,$ZodType:()=>Z,$ZodULID:()=>ME,$ZodURL:()=>NE,$ZodUUID:()=>xE,$ZodUndefined:()=>sy,$ZodUnion:()=>LA,$ZodUnknown:()=>cy,$ZodVoid:()=>ly,$ZodXID:()=>LE,$ZodXor:()=>hy,$brand:()=>II,$constructor:()=>I,$input:()=>Vy,$output:()=>Gy,Doc:()=>qi,INVALID:()=>At,JSONSchema:()=>d$,JSONSchemaGenerator:()=>gf,NEVER:()=>mI,TimePrecision:()=>rC,URL_BAD_FORMAT:()=>DE,URL_UNPARSEABLE:()=>NA,ZodCompileAsyncError:()=>mr,ZodCompileUnsupportedError:()=>oe,_any:()=>EC,_array:()=>bC,_base64:()=>ef,_base64url:()=>tf,_bigint:()=>dC,_boolean:()=>uC,_catch:()=>WK,_check:()=>WU,_cidrv4:()=>Kd,_cidrv6:()=>Xd,_coercedBigint:()=>fC,_coercedBoolean:()=>lC,_coercedDate:()=>vC,_coercedNumber:()=>iC,_coercedString:()=>Ky,_creditCard:()=>eC,_cuid:()=>Jd,_cuid2:()=>Yd,_custom:()=>SC,_date:()=>QC,_decode:()=>Jl,_decodeAsync:()=>jl,_default:()=>jK,_discriminatedUnion:()=>$K,_e164:()=>rf,_email:()=>Fd,_emoji:()=>Gd,_encode:()=>Vl,_encodeAsync:()=>Yl,_endsWith:()=>Ms,_enum:()=>OK,_file:()=>kC,_float32:()=>sC,_float64:()=>aC,_gt:()=>Or,_gte:()=>Mt,_guid:()=>Md,_iban:()=>tC,_includes:()=>Ts,_int:()=>oC,_int32:()=>AC,_int64:()=>gC,_intersection:()=>TK,_ipv4:()=>Wd,_ipv6:()=>Zd,_isoDate:()=>qA,_isoDateTime:()=>HA,_isoDuration:()=>ZA,_isoTime:()=>WA,_jwt:()=>nf,_ksuid:()=>qd,_lazy:()=>e8,_length:()=>ro,_literal:()=>GK,_lowercase:()=>Us,_lt:()=>Pr,_lte:()=>Ft,_mac:()=>Xy,_map:()=>LK,_max:()=>Ft,_maxLength:()=>to,_maxSize:()=>zn,_mime:()=>Ps,_min:()=>Mt,_minLength:()=>ln,_minSize:()=>zr,_multipleOf:()=>On,_nan:()=>wC,_nanoid:()=>Vd,_nativeEnum:()=>zK,_negative:()=>sf,_never:()=>CC,_nonnegative:()=>Af,_nonoptional:()=>HK,_nonpositive:()=>af,_normalize:()=>Os,_null:()=>IC,_nullable:()=>YK,_number:()=>nC,_optional:()=>JK,_overwrite:()=>Ir,_parse:()=>vs,_parseAsync:()=>ws,_pipe:()=>ZK,_positive:()=>of,_promise:()=>t8,_properties:()=>Ls,_property:()=>cf,_readonly:()=>KK,_record:()=>MK,_refine:()=>xC,_regex:()=>Ns,_safeDecode:()=>ql,_safeDecodeAsync:()=>Zl,_safeEncode:()=>Hl,_safeEncodeAsync:()=>Wl,_safeParse:()=>bs,_safeParseAsync:()=>ks,_set:()=>PK,_size:()=>eo,_slugify:()=>Js,_startsWith:()=>Fs,_string:()=>Zy,_stringFormat:()=>no,_stringbool:()=>NC,_success:()=>qK,_superRefine:()=>RC,_symbol:()=>hC,_templateLiteral:()=>XK,_toLowerCase:()=>Gs,_toUpperCase:()=>Vs,_transform:()=>VK,_trim:()=>zs,_tuple:()=>FK,_uint32:()=>cC,_uint64:()=>pC,_ulid:()=>jd,_undefined:()=>mC,_union:()=>NK,_unknown:()=>yC,_uppercase:()=>$s,_url:()=>jA,_uuid:()=>Ld,_uuidv4:()=>Pd,_uuidv6:()=>Od,_uuidv7:()=>zd,_void:()=>BC,_xid:()=>Hd,_xor:()=>UK,base64Charset:()=>fd,base64urlCharset:()=>FA,canParseURL:()=>_E,clone:()=>fe,compile:()=>Hy,compileFn:()=>$d,config:()=>De,createStandardJSONSchemaMethod:()=>Ys,createToJSONSchemaMethod:()=>$C,decode:()=>UZ,decodeAsync:()=>TZ,describe:()=>DC,encode:()=>NZ,encodeAsync:()=>$Z,extractDefs:()=>Vn,finalize:()=>Jn,flattenError:()=>wA,formatError:()=>bA,getDiscriminatedOption:()=>my,globalConfig:()=>ze,globalRegistry:()=>He,handleUnrepresentable:()=>Fe,initializeContext:()=>Gn,isBackEdge:()=>Sd,isRecursiveSchema:()=>kd,isValidBase64:()=>TA,isValidBase64URL:()=>gd,isValidCIDRv6:()=>dd,isValidCreditCard:()=>pd,isValidIBAN:()=>hd,isValidIPv6:()=>$A,isValidJWT:()=>md,locales:()=>YA,memoizer:()=>VA,mergeValues:()=>xs,meta:()=>_C,parse:()=>zl,parseAsync:()=>Gl,parseURLObject:()=>BN,prettifyError:()=>QI,process:()=>pe,processSchema:()=>pe,regexes:()=>Xt,registry:()=>Nd,safeDecode:()=>MZ,safeDecodeAsync:()=>PZ,safeEncode:()=>FZ,safeEncodeAsync:()=>LZ,safeParse:()=>SZ,safeParseAsync:()=>xZ,standardProps:()=>Ad,stripTabAndNewline:()=>UA,toDotPath:()=>tN,toJSONSchema:()=>ff,toZod:()=>pA,treeifyError:()=>BI,urlHostnameOk:()=>ud,urlProtocolOk:()=>ld,util:()=>B,validate:()=>kA,validateAsync:()=>SA,validateURL:()=>cd,version:()=>bE,withParser:()=>Ud});var B={};Br(B,{BIGINT_FORMAT_RANGES:()=>yA,CONSTANT_CATCH:()=>Pl,Class:()=>aI,NUMBER_FORMAT_RANGES:()=>EA,aborted:()=>at,allowsEval:()=>uI,assert:()=>HW,assertEqual:()=>VW,assertIs:()=>YW,assertNever:()=>jW,assertNotEqual:()=>JW,assignProp:()=>je,attachSchema:()=>CA,base64ToUint8Array:()=>q_,base64urlToUint8Array:()=>fZ,cached:()=>ys,captureStackTrace:()=>Ml,cleanEnum:()=>dZ,cleanRegex:()=>cn,clone:()=>fe,cloneDef:()=>ZW,codePointLength:()=>ji,constantCatch:()=>pI,createTransparentProxy:()=>nZ,defineLazy:()=>AI,defineLazyInternal:()=>re,derived:()=>mZ,esc:()=>st,escapeRegex:()=>Kt,explicitlyAborted:()=>fI,extend:()=>sZ,finalizeIssue:()=>Ct,floatSafeRemainder:()=>hA,getElementAtPath:()=>KW,getEnumValues:()=>Is,getLengthableOrigin:()=>QA,getParsedType:()=>rZ,getSizableOrigin:()=>BA,hexToUint8Array:()=>pZ,hide:()=>vA,installLazyProp:()=>CZ,isObject:()=>Yi,isPlainObject:()=>Zt,issue:()=>Qs,joinValues:()=>y,jsonStringifyReplacer:()=>Es,members:()=>gI,merge:()=>AZ,mergeDefs:()=>hr,normalizeParams:()=>x,nullish:()=>Fl,numKeys:()=>tZ,objectClone:()=>qW,omit:()=>oZ,optionalKeys:()=>dI,own:()=>Mn,parsedType:()=>v,partial:()=>cZ,pick:()=>iZ,prefixIssues:()=>yt,primitiveTypes:()=>lI,promiseAllObject:()=>XW,propertyKeyTypes:()=>IA,randomString:()=>eZ,rawShape:()=>Cs,required:()=>uZ,safeExtend:()=>aZ,shallowClone:()=>mA,sizeCaps:()=>Bs,slugify:()=>cI,stringifyPrimitive:()=>Q,toZod:()=>pA,uint8ArrayToBase64:()=>W_,uint8ArrayToBase64url:()=>gZ,uint8ArrayToHex:()=>hZ,unwrapMessage:()=>ms});function VW(e){return e}function JW(e){return e}function pA(){return e=>e}function YW(e){}function jW(e){throw new Error("Unexpected value in exhaustive check")}function HW(e){}function Is(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function y(e,t="|"){return e.map(n=>Q(n)).join(t)}function Es(e,t){return typeof t=="bigint"?t.toString():t}var sI=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function ys(e){return new sI(e)}function Fl(e){return e==null}function cn(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function hA(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var J_=Symbol("evaluating");function AI(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==J_)return i===void 0&&(i=J_,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function qW(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function je(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cs(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function An(e){return Cs(e._zod.def)??e._zod.def.shape}function Y_(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return je(this,t,i),i},enumerable:!0,configurable:!0})}function j_(e,t,n){t in e?je(e,t,n):e[t]=n}function Ji(e,t,n,i){let r=An(t);for(let o of n){let s=Object.getOwnPropertyDescriptor(r,o);s.enumerable&&(s.get?Y_(e,o,()=>{let a=t._zod.def.shape[o];return i?i(a,o):a}):j_(e,o,i?i(s.value,o):s.value))}}function WW(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?Y_(e,n,()=>t[n]):j_(e,n,i.value))}}function hr(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function ZW(e){return hr(e._zod.def)}function KW(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function XW(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function eZ(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function st(e){return JSON.stringify(e)}function cI(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ml="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var uI=ys(()=>{if(ze.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Zt(e){if(Yi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Yi(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function mA(e){return Zt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function tZ(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var rZ=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 new Error(`Unknown data type: ${t}`)}},IA=new Set(["string","number","symbol"]),lI=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function x(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function nZ(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function Q(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dI(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var EA={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]},yA={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function iZ(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return Ji(o,e,Ll(e,t)),fe(e,hr(n,{shape:o,checks:[]}))}function Ll(e,t){let n=An(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}function oZ(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(Ll(e,t)),s={};return Ji(s,e,Reflect.ownKeys(An(e)).filter(a=>!o.has(a))),fe(e,hr(n,{shape:s,checks:[]}))}function sZ(e,t){if(!Zt(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=An(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fe(e,hr(e._zod.def,{shape:H_(e,t)}))}function H_(e,t){let n={};return Ji(n,e,Reflect.ownKeys(An(e))),WW(n,t),n}function aZ(e,t){if(!Zt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return fe(e,hr(e._zod.def,{shape:H_(e,t)}))}function AZ(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Ji(n,e,Reflect.ownKeys(An(e))),Ji(n,t,Reflect.ownKeys(An(t)));let i=hr(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return fe(e,i)}function cZ(e,t,n,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ll(t,n)):void 0,A={};return Ji(A,t,Reflect.ownKeys(An(t)),e&&((c,l)=>a&&!a.has(l)?c:new e({type:"optional",innerType:c}))),fe(t,hr(t._zod.def,{shape:A,checks:[]}))}function uZ(e,t,n){let i=n?new Set(Ll(t,n)):void 0,r={};return Ji(r,t,Reflect.ownKeys(An(t)),(o,s)=>i&&!i.has(s)?o:new e({type:"nonoptional",innerType:o})),fe(t,hr(t._zod.def,{shape:r}))}function at(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function fI(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function yt(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function ms(e){return typeof e=="string"?e:e?.message}function Bs(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}function CA(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function Ct(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ms(e.inst?._zod.def?.error?.(e))??ms(o?.(e))??ms(t?.error?.(e))??ms(n.customError?.(e))??ms(n.localeError?.(e))??"Invalid input",a={};for(let A of Object.keys(e))A==="inst"||A==="schema"||A==="continue"||A==="input"||A==="__proto__"||(a[A]=e[A]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function BA(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var lZ=/[\uD800-\uDBFF]/;function ji(e){let t=e.length;if(!lZ.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function QA(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function v(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Qs(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function dZ(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function q_(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function W_(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function fZ(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return q_(t+n)}function gZ(e){return W_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pZ(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function hZ(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var aI=class{constructor(...t){}};function gI(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):IZ(e,n,i.value)}}function Mn(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function vA(e,t,n){return Mn(e,t,n,!1)}function mZ(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Mn(this,n,i(this))},set(r){Mn(this,n,r)}})}return t}function IZ(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Mn(this,t,n.bind(this))},set(i){Mn(this,t,i)}})}function EZ(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var oI,Fn=!1,yZ={configurable:!0,get(){Fn=!0}};function re(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&oI!==e._zod){oI=void 0;return}oI=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,yZ);let r=Fn;Fn=!1;try{let o=n(this);return Fn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),Fn=Fn||r,o}catch(o){throw delete this[t],Fn=Fn||r,o}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function CZ(e,t,n,i){let r=EZ(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Pl="~constantCatch";function pI(e){let t=()=>e;return t[Pl]=!0,t}var Z_,mI=Object.freeze({status:"aborted"}),hI={value:void 0,enumerable:!1},K_="captureStackTrace"in Error?Error:null;function BZ(e){let t=K_;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return K_=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function I(e,t,n,i){let r={};function o(f){this.def=f,this.constr=d,this.traits=new Set}o.prototype=r;let s=n,a=s&&new WeakSet;function A(f,g){if(f._zod){if(f._zod.traits.has(e))return}else{hI.value=new o(g);try{Object.defineProperty(f,"_zod",hI)}finally{hI.value=void 0}}if(f._zod.traits.add(e),t(f,g),a){let h=Object.getPrototypeOf(f),E=f._zod.constr.prototype,m=h;for(;m&&m!==E;)m=Object.getPrototypeOf(m);let C=m??h;a.has(C)||(a.add(C),gI(C,s))}let p=d.prototype;for(let h in p)Object.prototype.hasOwnProperty.call(p,h)&&(h in f||(f[h]=p[h].bind(f)))}let c=i?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(f){let g=i?.Parent?BZ(l):this;A(g,f);let p=g._zod.deferred;if(p){for(let E of p)E();g._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(g),g}return Object.defineProperty(d,"init",{value:A}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var II=Symbol("zod_brand"),Bt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ln=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Z_=globalThis).__zod_globalConfig??(Z_.__zod_globalConfig={});var ze=globalThis.__zod_globalConfig;function De(e){return e&&Object.assign(ze,e),ze}function QZ(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Es,2)),e.message}function vZ(e){this._zod.message=e}var wZ={get:QZ,set:vZ,enumerable:!0,configurable:!0},yI={value:void 0,enumerable:!1},X_=new WeakSet([Object.prototype,Error.prototype]),eN=(e,t)=>{e.name="$ZodError",yI.value=t,Object.defineProperty(e,"issues",yI),yI.value=void 0,Object.defineProperty(e,"message",wZ);let n=Object.getPrototypeOf(e);X_.has(n)||(X_.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},CI=I("$ZodError",eN),Qt=I("$ZodError",eN,void 0,{Parent:Error});function bZ(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function wA(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?bZ(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}function bA(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let A=n,c=0;for(;c<a.length;){let l=a[c],d=c===a.length-1;if(l==="_errors"){d&&A._errors.push(t(s)),c++;continue}Object.prototype.hasOwnProperty.call(A,l)||Object.defineProperty(A,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=A[l];d&&f._errors.push(t(s)),A=f,c++}}}};return i(e),n}function BI(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var s;for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(A=>i({issues:A},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let A=[...o,...a.path];if(A.length===0){n.errors.push(t(a));continue}let c=n,l=0;for(;l<A.length;){let d=A[l],f=l===A.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(s=c.items)[d]??(s[d]={errors:[]}),c=c.items[d]),f&&c.errors.push(t(a)),l++}}};return i(e),n}function tN(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function QI(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${tN(i.path)}`);return t.join(`
|
|
127
|
+
`;var CX=`${LQ} up to, not including, ${PQ}`;var u={};Br(u,{BRAND:()=>TF,DIRTY:()=>ei,EMPTY_PATH:()=>gF,INVALID:()=>J,NEVER:()=>yM,OK:()=>We,ParseStatus:()=>Ge,Schema:()=>ne,ZodAny:()=>mn,ZodArray:()=>jr,ZodBigInt:()=>ri,ZodBoolean:()=>ni,ZodBranded:()=>ia,ZodCatch:()=>gi,ZodDate:()=>ii,ZodDefault:()=>fi,ZodDiscriminatedUnion:()=>Cc,ZodEffects:()=>Gt,ZodEnum:()=>li,ZodError:()=>dt,ZodFirstPartyTypeKind:()=>j,ZodFunction:()=>Qc,ZodIntersection:()=>Ai,ZodIssueCode:()=>S,ZodLazy:()=>ci,ZodLiteral:()=>ui,ZodMap:()=>ho,ZodNaN:()=>Io,ZodNativeEnum:()=>di,ZodNever:()=>nr,ZodNull:()=>si,ZodNullable:()=>wr,ZodNumber:()=>ti,ZodObject:()=>ft,ZodOptional:()=>Ot,ZodParsedType:()=>U,ZodPipeline:()=>oa,ZodPromise:()=>In,ZodReadonly:()=>pi,ZodRecord:()=>Bc,ZodSchema:()=>ne,ZodSet:()=>mo,ZodString:()=>hn,ZodSymbol:()=>go,ZodTransformer:()=>Gt,ZodTuple:()=>vr,ZodType:()=>ne,ZodUndefined:()=>oi,ZodUnion:()=>ai,ZodUnknown:()=>Yr,ZodVoid:()=>po,addIssueToContext:()=>_,any:()=>JF,array:()=>qF,bigint:()=>PF,boolean:()=>ZQ,coerce:()=>EM,custom:()=>HQ,date:()=>OF,datetimeRegex:()=>YQ,defaultErrorMap:()=>Vr,discriminatedUnion:()=>XF,effect:()=>lM,enum:()=>AM,function:()=>oM,getErrorMap:()=>uo,getParsedType:()=>Qr,instanceof:()=>MF,intersection:()=>eM,isAborted:()=>Ec,isAsync:()=>lo,isDirty:()=>yc,isValid:()=>pn,late:()=>FF,lazy:()=>sM,literal:()=>aM,makeIssue:()=>na,map:()=>nM,nan:()=>LF,nativeEnum:()=>cM,never:()=>jF,null:()=>VF,nullable:()=>fM,number:()=>WQ,object:()=>WF,objectUtil:()=>Zf,oboolean:()=>IM,onumber:()=>mM,optional:()=>dM,ostring:()=>hM,pipeline:()=>pM,preprocess:()=>gM,promise:()=>uM,quotelessJson:()=>lF,record:()=>rM,set:()=>iM,setErrorMap:()=>fF,strictObject:()=>ZF,string:()=>qQ,symbol:()=>zF,transformer:()=>lM,tuple:()=>tM,undefined:()=>GF,union:()=>KF,unknown:()=>YF,util:()=>se,void:()=>HF});var se;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let s of r)o[s]=s;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),s={};for(let a of o)s[a]=r[a];return e.objectValues(s)},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 s in r)Object.prototype.hasOwnProperty.call(r,s)&&o.push(s);return o},e.find=(r,o)=>{for(let s of r)if(o(s))return s},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(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(se||(se={}));var Zf;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Zf||(Zf={}));var U=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qr=e=>{switch(typeof e){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(e)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(e)?U.array:e===null?U.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?U.promise:typeof Map<"u"&&e instanceof Map?U.map:typeof Set<"u"&&e instanceof Set?U.set:typeof Date<"u"&&e instanceof Date?U.date:U.object;default:return U.unknown}};var S=se.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"]),lF=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),dt=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 s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(n(s));else{let a=i,A=0;for(;A<s.path.length;){let c=s.path[A],l=A===s.path.length-1;if(c==="_errors"){l&&a._errors.push(n(s)),A++;continue}Object.prototype.hasOwnProperty.call(a,c)||(c==="__proto__"?Object.defineProperty(a,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[c]={_errors:[]}),a=a[c],l&&a._errors.push(n(s)),A++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),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()}};dt.create=e=>new dt(e);var dF=(e,t)=>{let n;switch(e.code){case S.invalid_type:e.received===U.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case S.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,se.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:n=`Unrecognized key(s) in object: ${se.joinValues(e.keys,", ")}`;break;case S.invalid_union:n="Invalid input";break;case S.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${se.joinValues(e.options)}`;break;case S.invalid_enum_value:n=`Invalid enum value. Expected ${se.joinValues(e.options)}, received '${e.received}'`;break;case S.invalid_arguments:n="Invalid function arguments";break;case S.invalid_return_type:n="Invalid function return type";break;case S.invalid_date:n="Invalid date";break;case S.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}"`:se.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case S.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 S.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 S.custom:n="Invalid input";break;case S.invalid_intersection_types:n="Intersection results could not be merged";break;case S.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case S.not_finite:n="Number must be finite";break;default:n=t.defaultError,se.assertNever(e)}return{message:n}},Vr=dF;var OQ=Vr;function fF(e){OQ=e}function uo(){return OQ}var na=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],s={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let a="",A=i.filter(c=>!!c).slice().reverse();for(let c of A)a=c(s,{data:t,defaultError:a}).message;return{...r,path:o,message:a}},gF=[];function _(e,t){let n=uo(),i=na({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Vr?void 0:Vr].filter(r=>!!r)});e.common.issues.push(i)}var Ge=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 J;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,s=await r.value;i.push({key:o,value:s})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:s}=r;if(o.status==="aborted"||s.status==="aborted")return J;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[o.value]=s.value)}return{status:t.value,value:i}}},J=Object.freeze({status:"aborted"}),ei=e=>({status:"dirty",value:e}),We=e=>({status:"valid",value:e}),Ec=e=>e.status==="aborted",yc=e=>e.status==="dirty",pn=e=>e.status==="valid",lo=e=>typeof Promise<"u"&&e instanceof Promise;var F;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(F||(F={}));var zt=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}},zQ=(e,t)=>{if(pn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new dt(e.common.issues);return this._error=n,this._error}}};function X(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(s,a)=>{let{message:A}=e;return s.code==="invalid_enum_value"?{message:A??a.defaultError}:typeof a.data>"u"?{message:A??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:A??n??a.defaultError}},description:r}}var ne=class{get description(){return this._def.description}_getType(t){return Qr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Qr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ge,ctx:{common:t.parent.common,data:t.data,parsedType:Qr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(lo(n))throw new 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:Qr(t)},r=this._parseSync({data:t,path:i.path,parent:i});return zQ(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qr(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return pn(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=>pn(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:Qr(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(lo(r)?r:Promise.resolve(r));return zQ(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 s=t(r),a=()=>o.addIssue({code:S.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(A=>A?!0:(a(),!1)):s?!0:(a(),!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 Gt({schema:this,typeName:j.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 Ot.create(this,this._def)}nullable(){return wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jr.create(this)}promise(){return In.create(this,this._def)}or(t){return ai.create([this,t],this._def)}and(t){return Ai.create(this,t,this._def)}transform(t){return new Gt({...X(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new fi({...X(this._def),innerType:this,defaultValue:n,typeName:j.ZodDefault})}brand(){return new ia({typeName:j.ZodBranded,type:this,...X(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new gi({...X(this._def),innerType:this,catchValue:n,typeName:j.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return oa.create(this,t)}readonly(){return pi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pF=/^c[^\s-]{8,}$/i,hF=/^[0-9a-z]+$/,mF=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IF=/^[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,EF=/^[a-z0-9_-]{21}$/i,yF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,CF=/^[-+]?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)?)??$/,BF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,QF="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Kf,vF=/^(?:(?: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])$/,wF=/^(?:(?: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])$/,bF=/^(([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]))$/,kF=/^(([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])$/,SF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VQ="((\\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])))",RF=new RegExp(`^${VQ}$`);function JQ(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function DF(e){return new RegExp(`^${JQ(e)}$`)}function YQ(e){let t=`${VQ}T${JQ(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function _F(e,t){return!!((t==="v4"||!t)&&vF.test(e)||(t==="v6"||!t)&&bF.test(e))}function NF(e,t){if(!yF.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function UF(e,t){return!!((t==="v4"||!t)&&wF.test(e)||(t==="v6"||!t)&&kF.test(e))}var hn=class e extends ne{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==U.string){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_type,expected:U.string,received:o.parsedType}),J}let i=new Ge,r;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(r=this._getOrReturnCtx(t,r),s?_(r,{code:S.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&_(r,{code:S.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")BF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"email",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")Kf||(Kf=new RegExp(QF,"u")),Kf.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"emoji",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")IF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"uuid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")EF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"nanoid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")pF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")hF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid2",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")mF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ulid",code:S.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),_(r,{validation:"url",code:S.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"regex",code:S.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?YQ(o).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?RF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?DF(o).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:S.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?CF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"duration",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?_F(t.data,o.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ip",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?NF(t.data,o.alg)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"jwt",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?UF(t.data,o.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cidr",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?SF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64",code:S.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?xF.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64url",code:S.invalid_string,message:o.message}),i.dirty()):se.assertNever(o);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:S.invalid_string,...F.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...F.errToObj(t)})}url(t){return this._addCheck({kind:"url",...F.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...F.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...F.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...F.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...F.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...F.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...F.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...F.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...F.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...F.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...F.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...F.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,...F.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,...F.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...F.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...F.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...F.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...F.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...F.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...F.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...F.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...F.errToObj(n)})}nonempty(t){return this.min(1,F.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}};hn.create=e=>new hn({checks:[],typeName:j.ZodString,coerce:e?.coerce??!1,...X(e)});function $F(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(e.toFixed(r).replace(".","")),s=Number.parseInt(t.toFixed(r).replace(".",""));return o%s/10**r}var ti=class e extends ne{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)!==U.number){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_type,expected:U.number,received:o.parsedType}),J}let i,r=new Ge;for(let o of this._def.checks)o.kind==="int"?se.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),_(i,{code:S.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="multipleOf"?$F(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),_(i,{code:S.not_finite,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,F.toString(n))}gt(t,n){return this.setLimit("min",t,!1,F.toString(n))}lte(t,n){return this.setLimit("max",t,!0,F.toString(n))}lt(t,n){return this.setLimit("max",t,!1,F.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:F.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:F.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:F.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:F.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.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"&&se.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)}};ti.create=e=>new ti({checks:[],typeName:j.ZodNumber,coerce:e?.coerce||!1,...X(e)});var ri=class e extends ne{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)!==U.bigint)return this._getInvalidInput(t);let i,r=new Ge;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),_(i,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return _(n,{code:S.invalid_type,expected:U.bigint,received:n.parsedType}),J}gte(t,n){return this.setLimit("min",t,!0,F.toString(n))}gt(t,n){return this.setLimit("min",t,!1,F.toString(n))}lte(t,n){return this.setLimit("max",t,!0,F.toString(n))}lt(t,n){return this.setLimit("max",t,!1,F.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:F.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:F.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:F.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}};ri.create=e=>new ri({checks:[],typeName:j.ZodBigInt,coerce:e?.coerce??!1,...X(e)});var ni=class extends ne{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==U.boolean){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.boolean,received:i.parsedType}),J}return We(t.data)}};ni.create=e=>new ni({typeName:j.ZodBoolean,coerce:e?.coerce||!1,...X(e)});var ii=class e extends ne{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==U.date){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_type,expected:U.date,received:o.parsedType}),J}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return _(o,{code:S.invalid_date}),J}let i=new Ge,r;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:S.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):se.assertNever(o);return{status:i.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:F.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:F.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}};ii.create=e=>new ii({checks:[],coerce:e?.coerce||!1,typeName:j.ZodDate,...X(e)});var go=class extends ne{_parse(t){if(this._getType(t)!==U.symbol){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.symbol,received:i.parsedType}),J}return We(t.data)}};go.create=e=>new go({typeName:j.ZodSymbol,...X(e)});var oi=class extends ne{_parse(t){if(this._getType(t)!==U.undefined){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.undefined,received:i.parsedType}),J}return We(t.data)}};oi.create=e=>new oi({typeName:j.ZodUndefined,...X(e)});var si=class extends ne{_parse(t){if(this._getType(t)!==U.null){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.null,received:i.parsedType}),J}return We(t.data)}};si.create=e=>new si({typeName:j.ZodNull,...X(e)});var mn=class extends ne{constructor(){super(...arguments),this._any=!0}_parse(t){return We(t.data)}};mn.create=e=>new mn({typeName:j.ZodAny,...X(e)});var Yr=class extends ne{constructor(){super(...arguments),this._unknown=!0}_parse(t){return We(t.data)}};Yr.create=e=>new Yr({typeName:j.ZodUnknown,...X(e)});var nr=class extends ne{_parse(t){let n=this._getOrReturnCtx(t);return _(n,{code:S.invalid_type,expected:U.never,received:n.parsedType}),J}};nr.create=e=>new nr({typeName:j.ZodNever,...X(e)});var po=class extends ne{_parse(t){if(this._getType(t)!==U.undefined){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.void,received:i.parsedType}),J}return We(t.data)}};po.create=e=>new po({typeName:j.ZodVoid,...X(e)});var jr=class e extends ne{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==U.array)return _(n,{code:S.invalid_type,expected:U.array,received:n.parsedType}),J;if(r.exactLength!==null){let s=n.data.length>r.exactLength.value,a=n.data.length<r.exactLength.value;(s||a)&&(_(n,{code:s?S.too_big:S.too_small,minimum:a?r.exactLength.value:void 0,maximum:s?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&&(_(n,{code:S.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&&(_(n,{code:S.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((s,a)=>r.type._parseAsync(new zt(n,s,n.path,a)))).then(s=>Ge.mergeArray(i,s));let o=[...n.data].map((s,a)=>r.type._parseSync(new zt(n,s,n.path,a)));return Ge.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:F.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:F.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:F.toString(n)}})}nonempty(t){return this.min(1,t)}};jr.create=(e,t)=>new jr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...X(t)});function fo(e){if(e instanceof ft){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=Ot.create(fo(i))}return new ft({...e._def,shape:()=>t})}else return e instanceof jr?new jr({...e._def,type:fo(e.element)}):e instanceof Ot?Ot.create(fo(e.unwrap())):e instanceof wr?wr.create(fo(e.unwrap())):e instanceof vr?vr.create(e.items.map(t=>fo(t))):e}var ft=class e extends ne{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=se.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==U.object){let c=this._getOrReturnCtx(t);return _(c,{code:S.invalid_type,expected:U.object,received:c.parsedType}),J}let{status:i,ctx:r}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof nr&&this._def.unknownKeys==="strip"))for(let c in r.data)s.includes(c)||a.push(c);let A=[];for(let c of s){let l=o[c],d=r.data[c];A.push({key:{status:"valid",value:c},value:l._parse(new zt(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof nr){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of a)A.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(c==="strict")a.length>0&&(_(r,{code:S.unrecognized_keys,keys:a}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of a){let d=r.data[l];A.push({key:{status:"valid",value:l},value:c._parse(new zt(r,d,r.path,l)),alwaysSet:l in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of A){let d=await l.key,f=await l.value;c.push({key:d,value:f,alwaysSet:l.alwaysSet})}return c}).then(c=>Ge.mergeObjectSync(i,c)):Ge.mergeObjectSync(i,A)}get shape(){return this._def.shape()}strict(t){return F.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:F.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:j.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 se.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 se.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return fo(this)}partial(t){let n={};for(let i of se.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 se.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof Ot;)o=o._def.innerType;n[i]=o}return new e({...this._def,shape:()=>n})}keyof(){return jQ(se.objectKeys(this.shape))}};ft.create=(e,t)=>new ft({shape:()=>e,unknownKeys:"strip",catchall:nr.create(),typeName:j.ZodObject,...X(t)});ft.strictCreate=(e,t)=>new ft({shape:()=>e,unknownKeys:"strict",catchall:nr.create(),typeName:j.ZodObject,...X(t)});ft.lazycreate=(e,t)=>new ft({shape:e,unknownKeys:"strip",catchall:nr.create(),typeName:j.ZodObject,...X(t)});var ai=class extends ne{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new dt(a.ctx.common.issues));return _(n,{code:S.invalid_union,unionErrors:s}),J}if(n.common.async)return Promise.all(i.map(async o=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(r);{let o,s=[];for(let A of i){let c={...n,common:{...n.common,issues:[]},parent:null},l=A._parseSync({data:n.data,path:n.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(A=>new dt(A));return _(n,{code:S.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}};ai.create=(e,t)=>new ai({options:e,typeName:j.ZodUnion,...X(t)});var Jr=e=>e instanceof ci?Jr(e.schema):e instanceof Gt?Jr(e.innerType()):e instanceof ui?[e.value]:e instanceof li?e.options:e instanceof di?se.objectValues(e.enum):e instanceof fi?Jr(e._def.innerType):e instanceof oi?[void 0]:e instanceof si?[null]:e instanceof Ot?[void 0,...Jr(e.unwrap())]:e instanceof wr?[null,...Jr(e.unwrap())]:e instanceof ia||e instanceof pi?Jr(e.unwrap()):e instanceof gi?Jr(e._def.innerType):[],Cc=class e extends ne{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==U.object)return _(n,{code:S.invalid_type,expected:U.object,received:n.parsedType}),J;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}):(_(n,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),J)}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 s=Jr(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,o)}}return new e({typeName:j.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...X(i)})}};function Xf(e,t){let n=Qr(e),i=Qr(t);if(e===t)return{valid:!0,data:e};if(n===U.object&&i===U.object){let r=se.objectKeys(t),o=se.objectKeys(e).filter(a=>r.indexOf(a)!==-1),s={...e,...t};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let a of o){if(a==="__proto__")continue;let A=Xf(e[a],t[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(n===U.array&&i===U.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],A=Xf(s,a);if(!A.valid)return{valid:!1};r.push(A.data)}return{valid:!0,data:r}}else return n===U.date&&i===U.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ai=class extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,s)=>{if(Ec(o)||Ec(s))return J;let a=Xf(o.value,s.value);return a.valid?((yc(o)||yc(s))&&n.dirty(),{status:n.value,value:a.data}):(_(i,{code:S.invalid_intersection_types}),J)};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,s])=>r(o,s)):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}))}};Ai.create=(e,t,n)=>new Ai({left:e,right:t,typeName:j.ZodIntersection,...X(n)});var vr=class e extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==U.array)return _(i,{code:S.invalid_type,expected:U.array,received:i.parsedType}),J;if(i.data.length<this._def.items.length)return _(i,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J;!this._def.rest&&i.data.length>this._def.items.length&&(_(i,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...i.data].map((s,a)=>{let A=this._def.items[a]||this._def.rest;return A?A._parse(new zt(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>Ge.mergeArray(n,s)):Ge.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};vr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vr({items:e,typeName:j.ZodTuple,rest:null,...X(t)})};var Bc=class e extends ne{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!==U.object)return _(i,{code:S.invalid_type,expected:U.object,received:i.parsedType}),J;let r=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)r.push({key:o._parse(new zt(i,a,i.path,a)),value:s._parse(new zt(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Ge.mergeObjectAsync(n,r):Ge.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof ne?new e({keyType:t,valueType:n,typeName:j.ZodRecord,...X(i)}):new e({keyType:hn.create(),valueType:t,typeName:j.ZodRecord,...X(n)})}},ho=class extends ne{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!==U.map)return _(i,{code:S.invalid_type,expected:U.map,received:i.parsedType}),J;let r=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,A],c)=>({key:r._parse(new zt(i,a,i.path,[c,"key"])),value:o._parse(new zt(i,A,i.path,[c,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let A of s){let c=await A.key,l=await A.value;if(c.status==="aborted"||l.status==="aborted")return J;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let A of s){let c=A.key,l=A.value;if(c.status==="aborted"||l.status==="aborted")return J;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}}}};ho.create=(e,t,n)=>new ho({valueType:t,keyType:e,typeName:j.ZodMap,...X(n)});var mo=class e extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==U.set)return _(i,{code:S.invalid_type,expected:U.set,received:i.parsedType}),J;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(_(i,{code:S.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&&(_(i,{code:S.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function s(A){let c=new Set;for(let l of A){if(l.status==="aborted")return J;l.status==="dirty"&&n.dirty(),c.add(l.value)}return{status:n.value,value:c}}let a=[...i.data.values()].map((A,c)=>o._parse(new zt(i,A,i.path,c)));return i.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:F.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:F.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};mo.create=(e,t)=>new mo({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...X(t)});var Qc=class e extends ne{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==U.function)return _(n,{code:S.invalid_type,expected:U.function,received:n.parsedType}),J;function i(a,A){return na({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,uo(),Vr].filter(c=>!!c),issueData:{code:S.invalid_arguments,argumentsError:A}})}function r(a,A){return na({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,uo(),Vr].filter(c=>!!c),issueData:{code:S.invalid_return_type,returnTypeError:A}})}let o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof In){let a=this;return We(async function(...A){let c=new dt([]),l=await a._def.args.parseAsync(A,o).catch(g=>{throw c.addIssue(i(A,g)),c}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(g=>{throw c.addIssue(r(d,g)),c})})}else{let a=this;return We(function(...A){let c=a._def.args.safeParse(A,o);if(!c.success)throw new dt([i(A,c.error)]);let l=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new dt([r(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:vr.create(t).rest(Yr.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||vr.create([]).rest(Yr.create()),returns:n||Yr.create(),typeName:j.ZodFunction,...X(i)})}},ci=class extends ne{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})}};ci.create=(e,t)=>new ci({getter:e,typeName:j.ZodLazy,...X(t)});var ui=class extends ne{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return _(n,{received:n.data,code:S.invalid_literal,expected:this._def.value}),J}return{status:"valid",value:t.data}}get value(){return this._def.value}};ui.create=(e,t)=>new ui({value:e,typeName:j.ZodLiteral,...X(t)});function jQ(e,t){return new li({values:e,typeName:j.ZodEnum,...X(t)})}var li=class e extends ne{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return _(n,{expected:se.joinValues(i),received:n.parsedType,code:S.invalid_type}),J}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 _(n,{received:n.data,code:S.invalid_enum_value,options:i}),J}return We(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})}};li.create=jQ;var di=class extends ne{_parse(t){let n=se.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==U.string&&i.parsedType!==U.number){let r=se.objectValues(n);return _(i,{expected:se.joinValues(r),received:i.parsedType,code:S.invalid_type}),J}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=se.objectValues(n);return _(i,{received:i.data,code:S.invalid_enum_value,options:r}),J}return We(t.data)}get enum(){return this._def.values}};di.create=(e,t)=>new di({values:e,typeName:j.ZodNativeEnum,...X(t)});var In=class extends ne{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==U.promise&&n.common.async===!1)return _(n,{code:S.invalid_type,expected:U.promise,received:n.parsedType}),J;let i=n.parsedType===U.promise?n.data:Promise.resolve(n.data);return We(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};In.create=(e,t)=>new In({type:e,typeName:j.ZodPromise,...X(t)});var Gt=class extends ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.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:s=>{_(i,s),s.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let s=r.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return J;let A=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return A.status==="aborted"?J:A.status==="dirty"?ei(A.value):n.value==="dirty"?ei(A.value):A});{if(n.value==="aborted")return J;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?J:a.status==="dirty"?ei(a.value):n.value==="dirty"?ei(a.value):a}}if(r.type==="refinement"){let s=a=>{let A=r.refinement(a,o);if(i.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?J:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?J:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!pn(s))return J;let a=r.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>pn(s)?Promise.resolve(r.transform(s.value,o)).then(a=>({status:n.value,value:a})):J);se.assertNever(r)}};Gt.create=(e,t,n)=>new Gt({schema:e,typeName:j.ZodEffects,effect:t,...X(n)});Gt.createWithPreprocess=(e,t,n)=>new Gt({schema:t,effect:{type:"preprocess",transform:e},typeName:j.ZodEffects,...X(n)});var Ot=class extends ne{_parse(t){return this._getType(t)===U.undefined?We(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ot.create=(e,t)=>new Ot({innerType:e,typeName:j.ZodOptional,...X(t)});var wr=class extends ne{_parse(t){return this._getType(t)===U.null?We(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};wr.create=(e,t)=>new wr({innerType:e,typeName:j.ZodNullable,...X(t)});var fi=class extends ne{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===U.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};fi.create=(e,t)=>new fi({innerType:e,typeName:j.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});var gi=class extends ne{_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 lo(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new dt(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new dt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};gi.create=(e,t)=>new gi({innerType:e,typeName:j.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});var Io=class extends ne{_parse(t){if(this._getType(t)!==U.nan){let i=this._getOrReturnCtx(t);return _(i,{code:S.invalid_type,expected:U.nan,received:i.parsedType}),J}return{status:"valid",value:t.data}}};Io.create=e=>new Io({typeName:j.ZodNaN,...X(e)});var TF=Symbol("zod_brand"),ia=class extends ne{_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}},oa=class e extends ne{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?J:o.status==="dirty"?(n.dirty(),ei(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?J: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:j.ZodPipeline})}},pi=class extends ne{_parse(t){let n=this._def.innerType._parse(t),i=r=>(pn(r)&&(r.value=Object.freeze(r.value)),r);return lo(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};pi.create=(e,t)=>new pi({innerType:e,typeName:j.ZodReadonly,...X(t)});function GQ(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function HQ(e,t={},n){return e?mn.create().superRefine((i,r)=>{let o=e(i);if(o instanceof Promise)return o.then(s=>{if(!s){let a=GQ(t,i),A=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:A})}});if(!o){let s=GQ(t,i),a=s.fatal??n??!0;r.addIssue({code:"custom",...s,fatal:a})}}):mn.create()}var FF={object:ft.lazycreate},j;(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"})(j||(j={}));var MF=(e,t={message:`Input not instance of ${e.name}`})=>HQ(n=>n instanceof e,t),qQ=hn.create,WQ=ti.create,LF=Io.create,PF=ri.create,ZQ=ni.create,OF=ii.create,zF=go.create,GF=oi.create,VF=si.create,JF=mn.create,YF=Yr.create,jF=nr.create,HF=po.create,qF=jr.create,WF=ft.create,ZF=ft.strictCreate,KF=ai.create,XF=Cc.create,eM=Ai.create,tM=vr.create,rM=Bc.create,nM=ho.create,iM=mo.create,oM=Qc.create,sM=ci.create,aM=ui.create,AM=li.create,cM=di.create,uM=In.create,lM=Gt.create,dM=Ot.create,fM=wr.create,gM=Gt.createWithPreprocess,pM=oa.create,hM=()=>qQ().optional(),mM=()=>WQ().optional(),IM=()=>ZQ().optional(),EM={string:(e=>hn.create({...e,coerce:!0})),number:(e=>ti.create({...e,coerce:!0})),boolean:(e=>ni.create({...e,coerce:!0})),bigint:(e=>ri.create({...e,coerce:!0})),date:(e=>ii.create({...e,coerce:!0}))};var yM=J;var eg=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(eg||{}),tg=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(tg||{});var rg=300,xe=u.string().trim().min(1),CM=u.object({action:u.enum(["start","run","wait"]),text:xe,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:xe.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),ng=/^[A-Za-z_][A-Za-z0-9_]*$/,ir=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,sa=(s=>(s.VersionEndpoint="version_endpoint",s.DeployWorkflow="deploy_workflow",s.KubernetesLabels="kubernetes_labels",s.Command="command",s.Api="api",s.NotTracked="not_tracked",s))(sa||{}),Hr="shared",BM=xe.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),Eo=u.object({address:BM,readyWhen:xe.nullable(),credentials:u.array(u.string().regex(ir)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(sa),detail:xe.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(xe).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),ig={steps:u.array(CM).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:xe,service:xe.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(ng)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},QM=u.object({name:xe,repository:xe.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:u.boolean(),...ig,deployed:xe.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),vM=u.object({name:u.string().regex(ir).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:u.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:u.boolean().describe("false only when the SUT starts without it, with less working"),how:xe.max(rg).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),wM=u.object({component:xe,problem:xe,evidence:xe.describe("the exact command and output that shows it"),fix:xe.describe("what the user must provide, and where")}),bM=u.object({framework:xe,file:xe.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),kM=u.object({input:xe.describe("the part of the user's SUT input, as given"),reason:xe}),i5=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(tg).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:u.array(QM),suites:u.array(bM).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(xe).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:xe.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:xe.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(kM).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one the repositories or the app show is wrong, such as a file, command, port, route or setting that is not there. Something outside them that does not answer is not one: that is a blocker"),blockers:u.array(wM).describe("required (non-empty) when status is blocked"),inputs:u.array(vM).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),environment:Eo.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var og=64*1024,sg=512*1024,KQ=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var c5=new TextDecoder("utf-8",{fatal:!0});var aa=(o=>(o.NotFound="not_found",o.NoAccess="no_access",o.Unavailable="unavailable",o.AccessLost="access_lost",o.CannotOpen="cannot_open",o))(aa||{});var XQ=e=>`${e.source}:${e.site??""}:${e.key}`;var vc=/^pasted-[0-9a-f]{16}$/,wc=/^file-[0-9a-f]{16}$/,bc=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(bc||{});var ag=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(ag||{}),Ag=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(Ag||{}),cg=(m=>(m.RelatedChangeConflict="related_change_conflict",m.ReferenceOutsideTarget="reference_outside_target",m.SourceAccessLost="source_access_lost",m.ConfigurationIncomplete="configuration_incomplete",m.CredentialUnavailable="credential_unavailable",m.WorkflowBindingUnverified="workflow_binding_unverified",m.WorkflowRefUnprotected="workflow_ref_unprotected",m.BedrockWorkflowRequired="bedrock_workflow_required",m.DeploymentReview="deployment_review",m.SutRevisionMismatch="sut_revision_mismatch",m.IsolationUnavailable="isolation_unavailable",m.EvidenceInsufficient="evidence_insufficient",m.ConfigurationUnresolved="configuration_unresolved",m.ModelProviderDenied="model_provider_denied",m.ModelProviderUnavailable="model_provider_unavailable",m.RunnerProviderNotReady="runner_provider_not_ready",m.MergeConflict="merge_conflict",m))(cg||{}),Aa=(o=>(o.CiCheck="ci_check",o.TestReport="test_report",o.StaticAnalysis="static_analysis",o.CodeReview="code_review",o.Other="other",o))(Aa||{}),ug=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(ug||{}),lg=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(lg||{});var dg=(n=>(n.Probe="probe",n.Agent="agent",n))(dg||{}),fg=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(fg||{}),gg=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(gg||{});var ev=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(ev||{}),br=u.string().trim().min(1),SM=u.object({case:br.describe("recommend id this assertion enforces"),evidence:br.describe("the exact assertion line from the file that checks that case's observable")});var xM=u.object({route:u.literal("persistence"),url:u.string().url()}).strict(),pg=u.object({kind:u.nativeEnum(fg).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:br.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(gg).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:br.describe("what it sets up"),worker:br.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:xM.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:br.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:br.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),RM=u.object({file:br.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(ev),language:br,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(SM).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(pg).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),g5=u.object({schemaVersion:u.literal(1),tests:u.array(RM),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:br.describe("one paragraph")});var tv=(s=>(s.Place="place",s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s.None="none",s))(tv||{}),rv=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(rv||{}),tt=u.string().trim().min(1),nv=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(nv||{}),DM=u.object({kind:u.nativeEnum(nv),reason:tt.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),hg=u.array(u.string().url().max(2048).regex(/^https?:\/\//i)).max(50),_M=u.object({case:tt.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(rv),runtimeTargets:hg.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:tt.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:u.boolean().optional(),testProblem:DM.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:u.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:u.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),NM=u.object({started:u.boolean().optional().describe("with exit null: true if the test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:u.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(_M).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),UM=u.object({context:u.array(pg).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:u.string().optional().describe("staged path \u2014 required for placements"),file:tt.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:tt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(tv),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:tt.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:tt.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:NM,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:u.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:u.array(tt).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:u.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),iv=(n=>(n.Junit="junit",n.Converter="converter",n))(iv||{}),$M=tt.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),TM=u.object({results:tt.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(iv),run:tt.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(tt).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:tt.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:tt.describe("the covers id it realizes"),file:$M})).describe("map each reported test name to the case it covers")}),FM=u.object({suites:u.array(TM).min(1)}),I5=u.object({schemaVersion:u.literal(1),items:u.array(UM),runnerResults:FM.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:tt.describe("one paragraph")});var Ql=lt(lv(),1),dq=lt(T0(),1);var Mr;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(Mr||(Mr={}));var F0;(function(e){e.Accept="accept",e.ContentType="content-type"})(F0||(F0={}));var M0;(function(e){e.ApplicationJson="application/json"})(M0||(M0={}));var v7=[Mr.MovedPermanently,Mr.ResourceMoved,Mr.SeeOther,Mr.TemporaryRedirect,Mr.PermanentRedirect],w7=[Mr.BadGateway,Mr.ServiceUnavailable,Mr.GatewayTimeout];var P0=require("os"),dA=require("fs"),Jm=function(e,t,n,i){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(l){try{c(i.next(l))}catch(d){s(d)}}function A(l){try{c(i.throw(l))}catch(d){s(d)}}function c(l){l.done?o(l.value):r(l.value).then(a,A)}c((i=i.apply(e,t||[])).next())})},{access:gq,appendFile:pq,writeFile:hq}=dA.promises,L0="GITHUB_STEP_SUMMARY";var Ym=class{constructor(){this._buffer=""}filePath(){return Jm(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let t=process.env[L0];if(!t)throw new Error(`Unable to find environment variable for $${L0}. Check if your runtime environment supports job summaries.`);try{yield gq(t,dA.constants.R_OK|dA.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}return this._filePath=t,this._filePath})}wrap(t,n,i={}){let r=Object.entries(i).map(([o,s])=>` ${o}="${s}"`).join("");return n?`<${t}${r}>${n}</${t}>`:`<${t}${r}>`}write(t){return Jm(this,void 0,void 0,function*(){let n=!!t?.overwrite,i=yield this.filePath();return yield(n?hq:pq)(i,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Jm(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(t,n=!1){return this._buffer+=t,n?this.addEOL():this}addEOL(){return this.addRaw(P0.EOL)}addCodeBlock(t,n){let i=Object.assign({},n&&{lang:n}),r=this.wrap("pre",this.wrap("code",t),i);return this.addRaw(r).addEOL()}addList(t,n=!1){let i=n?"ol":"ul",r=t.map(s=>this.wrap("li",s)).join(""),o=this.wrap(i,r);return this.addRaw(o).addEOL()}addTable(t){let n=t.map(r=>{let o=r.map(s=>{if(typeof s=="string")return this.wrap("td",s);let{header:a,data:A,colspan:c,rowspan:l}=s,d=a?"th":"td",f=Object.assign(Object.assign({},c&&{colspan:c}),l&&{rowspan:l});return this.wrap(d,A,f)}).join("");return this.wrap("tr",o)}).join(""),i=this.wrap("table",n);return this.addRaw(i).addEOL()}addDetails(t,n){let i=this.wrap("details",this.wrap("summary",t)+n);return this.addRaw(i).addEOL()}addImage(t,n,i){let{width:r,height:o}=i||{},s=Object.assign(Object.assign({},r&&{width:r}),o&&{height:o}),a=this.wrap("img",null,Object.assign({src:t,alt:n},s));return this.addRaw(a).addEOL()}addHeading(t,n){let i=`h${n}`,r=["h1","h2","h3","h4","h5","h6"].includes(i)?i:"h1",o=this.wrap(r,t);return this.addRaw(o).addEOL()}addSeparator(){let t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){let t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,n){let i=Object.assign({},n&&{cite:n}),r=this.wrap("blockquote",t,i);return this.addRaw(r).addEOL()}addLink(t,n){let i=this.wrap("a",t,{href:n});return this.addRaw(i).addEOL()}},$7=new Ym;var jm=lt(require("os"),1);var vl=lt(require("fs"),1);var{chmod:mq,copyFile:Iq,lstat:Eq,mkdir:yq,open:M7,readdir:Cq,rename:Bq,rm:Qq,rmdir:L7,stat:vq,symlink:wq,unlink:bq}=vl.promises,kq=process.platform==="win32";var P7=vl.constants.O_RDONLY;var J7=process.platform==="win32";var q7=jm.default.platform(),W7=jm.default.arch();var G0;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(G0||(G0={}));function J0(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}var Y0=lt(require("path"));var Hm=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Hm||{}),gr=u.string().trim().min(1),Nq=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:gr.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),Uq=u.array(u.object({component:gr.describe("a shared component listed above"),url:gr.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:gr.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),$q=u.object({name:gr.describe("the credential's environment variable name, as listed above; never its value"),component:gr.describe("the component that refused it"),status:u.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:gr.describe("the request or command you tested it with and what came back, never the value")}),Bee=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:Nq.optional(),teardown:gr.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(Hm).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:gr,output:gr}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:u.boolean(),startedAt:gr.describe("ISO timestamp"),revisions:Uq.optional(),missingSecrets:u.array(u.string().regex(ng)).optional().describe("bringup-failed only: each secret the app cannot start without that this run has no value for, by its environment variable name; never a value"),credentialsRefused:u.array($q).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:u.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Ye=u.string().trim().min(1),wl=Ye,qm=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(qm||{}),Wm=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],j0=u.object({schemaVersion:u.literal(1),type:u.nativeEnum(qm).optional(),repository:wl.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:u.enum(["ready","blocked"]),environment:Eo.optional(),components:u.array(u.object({name:Ye,repository:Ye.describe(`owner/repo, or "${Hr}" for a customer-deployed component no repository builds`),healthy:u.boolean(),url:u.string().min(1).nullable(),...ig,credentials:u.array(u.string().regex(ir)).max(50).optional(),deployed:Ye.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:u.array(u.object({framework:Ye,file:Ye,result:u.enum(["pass","fail","error"])}).strict()),inputsUsed:u.array(Ye),inputsUsedHow:u.array(u.object({input:Ye,how:Ye}).strict()).optional(),inputsNotUsed:u.array(u.object({input:Ye,reason:Ye}).strict()),blockers:u.array(u.object({component:Ye,problem:Ye,evidence:Ye,fix:Ye}).strict()),replay:u.object({outcome:Ye,durationSeconds:u.number().nonnegative().nullable()}).strict().nullable(),files:u.array(u.object({path:Ye,content:u.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,o)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:u.ZodIssueCode.custom,path:["inputsUsedHow",o,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,o)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:u.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,o)=>{r.components.forEach((s,a)=>{i.has(s)||t.addIssue({code:u.ZodIssueCode.custom,path:["environment","revisionSources",o,"components",a],message:"not one of components"})})}),e.components.forEach((r,o)=>{r.deployed!==void 0!==n&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===Hr&&!n&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"repository"],message:`only a customer_deployed component is ${Hr}`})}),n&&(e.components.forEach((r,o)=>{e.components.findIndex(s=>s.name===r.name)!==o&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:u.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,o)=>{Wm.includes(r.path)&&t.addIssue({code:u.ZodIssueCode.custom,path:["files",o,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(o=>o.components));e.components.forEach((o,s)=>{o.repository!==Hr&&!r.has(o.name)&&t.addIssue({code:u.ZodIssueCode.custom,path:["components",s,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var See=["clean","recipe-drift"];function bl(e){let t=Y0.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}var H0=u.string().uuid(),kl=u.object({environmentId:u.string().uuid(),allowed:u.boolean(),revision:H0,updatedAt:u.string().datetime(),updatedBy:u.string().uuid()}).strict();var q0=(s=>(s.NoEnvironment="no_environment",s.NoRecordedGrant="no_recorded_grant",s.Unavailable="unavailable",s.Changed="changed",s.Denied="denied",s.OutOfScope="out_of_scope",s))(q0||{});var _ee=u.object({environmentId:u.string().uuid(),environmentAddress:u.string().url(),revision:H0}).strict(),Nee=u.object({refusal:u.nativeEnum(q0)}).strict();var l_=u.unknown().optional();var gA=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(gA||{}),eI=(o=>(o.Trigger="TRIGGER",o.Baseline="BASELINE",o.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",o.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",o.ManualOverride="MANUAL_OVERRIDE",o))(eI||{}),d_=(s=>(s.PullRequest="pull_request",s.ReadyForReview="ready_for_review",s.Schedule="schedule",s.Manual="manual",s.SutSetup="sut_setup",s.RevisionRead="revision_read",s))(d_||{}),Mq=["sut_setup"],Lq=["sut_setup","schedule","revision_read"];var f_=(t=>(t.PullRequest="pull_request",t))(f_||{}),g_=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(g_||{}),W0=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var p_=(o=>(o.ReportUploaded="report_uploaded",o.NoReport="no_report",o.Cancelled="cancelled",o.RecipeUploaded="recipe_uploaded",o.RevisionsUploaded="revisions_uploaded",o))(p_||{}),h_=(n=>(n.Running="running",n.Ended="ended",n))(h_||{}),m_=(f=>(f.TimedOut="timed_out",f.AgentFailed="agent_failed",f.SetupFailed="setup_failed",f.CredentialMissing="credential_missing",f.RunnerLost="runner_lost",f.CheckoutFailed="checkout_failed",f.EnvironmentUnverified="environment_unverified",f.ModelProviderDenied="model_provider_denied",f.ModelProviderUnavailable="model_provider_unavailable",f.RunnerProviderNotReady="runner_provider_not_ready",f.MergeConflict="merge_conflict",f.EnvironmentUnavailable="environment_unavailable",f))(m_||{}),I_=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(I_||{}),tI=(n=>(n.Started="started",n.Finished="finished",n))(tI||{}),E_=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(E_||{});var y_=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(y_||{});var C_=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(C_||{}),rI=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(rI||{}),Km=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(Km||{});var nI=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(nI||{}),qt=u.string().regex(/^[1-9][0-9]{0,18}$/),Wt=u.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Xm=u.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),B_=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;var Xe=u.string().regex(B_),ot=u.string().regex(/^[0-9a-f]{64}$/),Dl=u.object({id:Xe,revision:qt}).strict(),Nl={provider:u.literal("github"),providerAccountId:qt,providerRepositoryId:qt},Ul={provider:u.literal("azure-devops"),providerAccountId:Xe,providerRepositoryId:Xe},pr=u.discriminatedUnion("provider",[u.object(Nl).strict(),u.object(Ul).strict()]),zee=u.discriminatedUnion("provider",[u.object(Nl).passthrough(),u.object(Ul).passthrough()]),_l=e=>`${e.provider}:${e.providerRepositoryId}`,Z0={namespace:u.string().min(1),name:u.string().min(1)},Q_=u.discriminatedUnion("provider",[u.object({...Nl,...Z0}).strict(),u.object({...Ul,...Z0}).strict()]),K0=u.object({ref:u.string().min(1),revision:Wt}).strict(),Pq=u.object({kind:u.nativeEnum(g_),number:qt.optional(),ref:u.string().min(1),revision:Wt,reason:u.nativeEnum(eI)}).strict(),Oq=u.object({repository:Q_,revision:Wt,ref:u.string().nullable(),reason:u.nativeEnum(eI),change:u.object({kind:u.nativeEnum(f_),number:qt,base:K0.optional()}).strict().nullable(),compareWith:K0.optional(),merge:u.array(Pq).min(2).optional()}).strict();function zq(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,i=new Set;for(let[o,s]of t.entries()){if(s.kind==="pull_request"!=(s.number!==void 0))return{path:["merge",o,"number"],message:"a pull request names its number, and a branch none"};if(!W0.includes(s.reason))return{path:["merge",o,"reason"],message:`${s.reason} does not select a merged revision`};if(s.kind==="branch"&&s.reason!=="MANUAL_OVERRIDE")return{path:["merge",o,"reason"],message:"only a person chooses a branch to merge"};if(s.ref===e.ref)return{path:["merge",o,"ref"],message:"the baseline branch is what the source merges onto"};if(s.number!==void 0&&n.has(s.number)||i.has(s.ref))return{path:["merge",o],message:"names a revision the source already merges"};s.number!==void 0&&n.add(s.number),i.add(s.ref)}let r=W0.find(o=>t.some(s=>s.reason===o));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}function Gq(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(c=>c!=null).length>1)return"a run compares with one baseline";let o=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return o?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let s=new Set(e.sources.map(c=>_l(c.repository))),a=new Set(r.map(c=>_l(c.repository)));return a.size===r.length&&a.size===s.size&&[...a].every(c=>s.has(c))?null:"names every source of the snapshot, once"}var v_=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,w_=/^[1-9][0-9]{0,18}$/,X0=new RegExp(`${v_.source}|${w_.source}`),e_=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,Vq=u.union([u.object({source:u.literal("jira"),site:u.string().regex(e_),key:u.string().regex(v_),updated:u.string().datetime(),contentHash:ot}).strict(),u.object({source:u.literal("confluence"),site:u.string().regex(e_),key:u.string().regex(w_),version:u.number().int().positive(),contentHash:ot}).strict(),u.object({source:u.literal("other"),key:u.string().regex(vc),contentHash:ot}).strict(),u.object({source:u.literal("other"),key:u.string().regex(wc),contentHash:ot,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(bc)}).strict()]),t_=u.union([u.literal("jira"),u.literal("confluence")]),Gee=u.object({schemaVersion:u.literal(1),items:u.array(u.union([u.object({source:t_,site:u.string(),key:u.string().regex(X0),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:t_,site:u.string(),key:u.string().regex(X0),state:u.literal("not_read"),reason:u.nativeEnum(aa)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(vc),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:u.literal("other"),key:u.string().regex(vc),state:u.literal("not_read"),reason:u.nativeEnum(aa)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(wc),state:u.literal("read"),version:ot,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(bc)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(wc),state:u.literal("not_read"),reason:u.nativeEnum(aa)}).strict()])),instructions:u.array(u.string()).optional()}).strict(),Jq=u.object({resultId:u.string().min(1),repository:u.string().min(1),testType:u.string().min(1),path:u.string(),finding:u.string().min(1)}).strict(),Yq=u.object({schemaVersion:u.literal(1),runId:Xe,skyrampOrgId:Xe,target:Dl,policy:Dl.nullable(),trigger:u.object({kind:u.nativeEnum(d_),requestedAt:u.string().datetime()}).strict(),configuration:u.object({captureId:Xe,revision:qt.nullable(),hash:ot}).strict(),baseline:u.object({confirmedRunId:Xe.nullable(),initialBaselineId:Xe.optional(),comparisonBaselineId:Xe.optional(),knownFailures:u.array(Jq).optional(),sources:u.array(u.object({repository:pr,revision:Wt}).strict()).optional()}).strict().optional(),sources:u.array(Oq).min(1).max(1e3),execution:u.object({provider:u.nativeEnum(gA),repository:Q_,workflowPath:u.string(),ref:u.string()}).strict(),credentials:u.array(u.object({name:u.string(),purpose:u.nativeEnum(eg),required:u.boolean()}).strict()),requirements:u.array(Vq).min(1).optional(),instructions:u.object({contentHash:ot}).strict().optional(),deployedRevisions:u.array(u.object({repository:pr,revision:Wt}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((A,c)=>{let l="fileName"in A?"file":"pasted";A.source==="other"&&A.key!==`${l}-${A.contentHash.slice(0,16)}`&&t.addIssue({code:u.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",c,"key"]});let d=XQ({source:A.source,key:A.key});n.has(d)&&t.addIssue({code:u.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",c,"key"]}),n.add(d)});let i=e.trigger.kind,r=Mq.includes(i);r!==(e.policy===null)&&t.addIssue({code:u.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:u.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let o=Gq(e);o&&t.addIssue({code:u.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:o}),Lq.includes(i)&&e.sources.forEach((A,c)=>{A.reason!=="BASELINE"&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let s=new Set(e.sources.map(A=>_l(A.repository))),a=new Set;(e.deployedRevisions??[]).forEach((A,c)=>{let l=_l(A.repository);s.has(l)?a.has(l)&&t.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",c,"repository"],message:"repository appears twice"}):t.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",c,"repository"],message:"names a repository outside the snapshot"}),a.add(l)}),e.sources.forEach((A,c)=>{A.compareWith&&(A.reason!=="MANUAL_OVERRIDE"||A.change)&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(A.change?.base||A.compareWith||A.merge)&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let l=zq(A);l&&t.addIssue({code:u.ZodIssueCode.custom,path:["sources",c,...l.path],message:l.message})})});var b_=(n=>(n.Person="person",n.Policy="policy",n))(b_||{}),jq=u.object({kind:u.nativeEnum(b_),name:u.string().min(1).max(256)}).strict(),Hq=u.object({mcp:u.discriminatedUnion("source",[u.object({source:u.literal("npm"),version:u.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),u.object({source:u.literal("github"),ref:u.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:u.object({region:u.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:u.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Vee=u.object({schemaVersion:u.literal(1),attempt:u.object({id:Xe,number:u.number().int().positive(),deadlineAt:u.string().datetime()}).strict(),manifest:Yq,manifestHash:ot,entitlements:u.array(u.string()).optional(),runToken:u.string().min(1).optional(),requestedBy:jq.nullable().optional(),writeAllowed:u.boolean().optional(),claudeCodeVersion:u.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:u.array(u.object({repository:pr,revision:Wt}).strict()).optional(),statedRevisions:u.array(u.object({repository:pr,revision:Wt}).strict()).optional(),runSettings:Hq.optional()}).strict(),r_={providerRunAttempt:u.number().int().positive(),workflowRef:u.string().min(1)},qq=u.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),Jee=u.object({schemaVersion:u.literal(1),runId:Xe,execution:u.discriminatedUnion("provider",[u.object({...r_,provider:u.literal("github"),repository:u.object(Nl).strict(),providerRunId:qt}).strict(),u.object({...r_,provider:u.literal("azure-devops"),repository:u.object(Ul).strict(),providerRunId:qq}).strict()]),requester:u.literal(!0).optional(),writeCheck:u.literal(!0).optional(),claudeCodePin:u.literal(!0).optional(),deployedPins:u.literal(!0).optional(),statedPins:u.literal(!0).optional(),runSettings:u.literal(!0).optional(),credentialKinds:u.literal(!0).optional()}).strict(),n_=u.object({repository:pr,number:qt,commitSha:Wt.optional()}).strict(),Sl=u.array(u.object({repository:pr,reason:u.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),Wq=u.object({branch:Xm.optional(),commitSha:Wt.optional()}).strict(),k_=4096,Zq=u.array(u.object({file:u.string().max(4096).regex(/\S/),dependsOn:u.array(u.string().max(2048).regex(/\S/)).max(100)}).strict()).min(1).max(500),i_=u.object({repository:pr,message:u.string().max(k_),...Wq.shape,heldBack:Zq.optional()}).strict(),Kq=u.discriminatedUnion("status",[u.object({status:u.literal("none"),noTests:Sl}).strict(),u.object({status:u.literal("delivered"),noTests:Sl,pullRequests:u.array(n_).min(1)}).strict(),u.object({status:u.literal("partial"),noTests:Sl,pullRequests:u.array(n_).min(1),failures:u.array(i_).min(1)}).strict(),u.object({status:u.literal("failed"),message:u.string().max(k_),noTests:Sl,failures:u.array(i_).min(1).optional()}).strict()]),Yee=1024*1024,jee=16*1024*1024,fA={id:4096,text:16384,businessCase:65536},Xq={id:fA.id,statement:fA.text,rows:1e3},o_=u.string().min(1).max(fA.id),Rl=u.string().max(fA.text),xl=(e,t)=>u.array(u.object({[e]:Rl}).strict()).max(t).optional(),eW=u.object({language:u.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:u.string().max(fA.businessCase),validation:u.object({rationale:Rl.min(1),gaps:u.array(u.string().min(1).max(4096)).max(200)}).strict().optional(),changes:u.array(u.object({id:o_,text:Rl}).strict()).max(1e3).optional(),requirements:u.array(u.object({id:o_,statement:Rl}).strict()).max(Xq.rows).optional(),issuesFound:xl("description",5e3),newTestsCreated:xl("description",5e3),testResults:xl("details",5e3),caveats:xl("text",100)}).strict(),tW=u.object({blockedPreflight:u.object({file:u.string().min(1),repository:u.string().min(1).optional(),reason:u.string().min(1).max(300),evidence:u.string().min(1).max(400)}).strict().optional(),sufficiency:u.nativeEnum(Ag),rationale:u.string().min(1),gaps:u.array(u.string().min(1)),acceptedEvidence:u.array(u.object({kind:u.nativeEnum(Aa),repository:u.string().min(1),revision:Wt,reference:u.string().min(1),summary:u.string().min(1)}).strict()),actionRequired:u.array(u.nativeEnum(cg))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:u.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Zm=500,rW=2048,nW=1e3,iW=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,s_=e=>e.length>0&&e.length<=64&&e===e.trim()&&!iW.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),S_=e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&s_(n)&&s_(i)},oW=u.object({testResults:u.array(u.object({resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:u.string().refine(S_,"Invalid"),testType:u.string(),runtimeTargets:hg.optional(),endpoint:u.string(),status:u.enum(["Pass","Fail","Skipped"]),details:u.string(),fileName:u.string().optional(),testId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:u.object({kind:u.nativeEnum(ug),family:u.nativeEnum(lg).optional()}).strict().optional(),origin:u.nativeEnum(ag).optional()}).strict()),validation:tW,changes:u.array(u.object({id:u.string().min(1).max(512),text:u.string().max(16384),source:u.string().max(rW),testedBy:u.array(u.string().min(1).max(1024)).max(Zm),writtenBy:u.array(u.string().min(1).max(1024)).max(Zm),maintainedBy:u.array(u.string().min(1).max(1024)).max(Zm)}).strict()).max(nW).optional(),traceVersion:u.literal(1),display:eW.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let o of["issuesFound","newTestsCreated","testResults","caveats"]){let s=n?.[o];s&&s.length!==(Array.isArray(i[o])?i[o].length:0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["display",o],message:`has not one row per ${o} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((o,s)=>{let a=o.failureCause;a&&o.status==="Pass"&&t.addIssue({code:u.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),a&&a.kind==="environment"!=(a.family!==void 0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let A=["testResults",s,"resultId"],c=o.resultId.slice(`${o.repository}:${o.testType}:`.length);(!o.resultId.startsWith(`${o.repository}:${o.testType}:`)||c===""||c.startsWith("/")||c.startsWith("#"))&&t.addIssue({code:u.ZodIssueCode.custom,path:A,message:"is not repository:testType:path for this result"}),r.has(o.resultId)&&t.addIssue({code:u.ZodIssueCode.custom,path:A,message:"stable identity repeated"}),r.add(o.resultId)})});var sW=50,aW=u.discriminatedUnion("kind",[u.object({kind:u.literal("branch_pushed"),repository:pr,branch:Xm,commit:Wt}).strict(),u.object({kind:u.enum(["pull_request_opened","pull_request_edited"]),repository:pr,number:qt,branch:Xm}).strict()]),AW=100,cW=2048,Hee=u.object({records:u.array(u.string().regex(/^https?:\/\/[^\s/?#@]+(\/[^\s?#]*)?$/).max(cW)).max(AW),unlisted:u.number().int().nonnegative()}).strict().refine(e=>e.records.length+e.unlisted>0,"names at least one create"),uW=u.object({schemaVersion:u.literal(1),run:u.object({runId:Xe,attemptNumber:u.number().int().positive(),manifestHash:ot}).strict(),target:Dl,policy:Dl,provenance:u.object({sources:u.array(u.object({repository:pr,revision:Wt}).strict()),firstQualification:u.literal(!0).optional()}).strict(),delivery:u.object({generatedTests:Kq}).strict(),producer:u.object({testbot:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:oW,githubWrites:u.array(aW).max(sW).optional()}).strict(),x_=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(x_||{}),lW=200,dW=u.object({cause:u.nativeEnum(x_),credential:u.string().regex(ir).optional(),reason:u.string().trim().min(1).max(lW).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),fW=u.object({name:u.string().regex(ir),purpose:u.enum(["sut_access","other"]),required:u.boolean(),how:u.string().trim().min(1).max(rg)}).strict(),qee=uW.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:j0,check:dW.optional(),inputs:u.array(fW).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=(o,s)=>t.addIssue({code:u.ZodIssueCode.custom,path:["recipe",...o],message:s});e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((o,s)=>{bl(o.path)||n(["files",s,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),i.has(o.path)&&n(["files",s,"path"],"file repeated"),i.add(o.path),KQ.test(o.content)&&n(["files",s,"content"],"is not text");let a=Buffer.byteLength(o.content,"utf8");r+=a,a>og&&n(["files",s,"content"],`larger than ${og} bytes`)}),r>sg&&n(["files"],`recipe text over ${sg} bytes in total`)}),Wee=u.object({components:u.array(u.object({name:u.string().min(1),repository:u.string().refine(S_,"Invalid"),observedRevision:u.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:u.nativeEnum(dg),evidence:u.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Zee=u.object({schemaVersion:u.literal(1),stage:u.nativeEnum(I_),event:u.nativeEnum(tI),status:u.nativeEnum(E_).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),$l=100,gW=5e3,Vi=2e3,a_=100,R_=/^[A-Za-z0-9_-]{1,64}$/,pW=20,hW=200,mW=100,IW=100,EW=200,A_="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",yW=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${A_}/${A_})$`),CW=500,c_=50,BW=10,QW=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,D_=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Tt=e=>u.string().max(e).refine(t=>t.trim().length>0&&!D_.test(t),"blank, or not text"),Lr={sequence:u.number().int().min(1).max(gW),at:u.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},__=u.object({...Lr,kind:u.literal("reply"),to:u.string().uuid(),outcome:u.nativeEnum(C_),accepted:u.boolean(),text:Tt(Vi),note:u.object({source:u.enum(["target","environment"]),quote:Tt(Vi)}).strict().optional(),kept:Tt(Vi).optional()}).strict();function N_(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:u.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:u.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:u.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}var vW=u.discriminatedUnion("kind",[u.object({...Lr,kind:u.literal("log"),phase:u.nativeEnum(rI),text:Tt(Vi)}).strict(),u.object({...Lr,kind:u.literal("component"),name:Tt(a_),repository:Tt(EW).refine(e=>yW.test(e)||e===Hr,"not owner/name"),file:Tt(CW).nullable(),status:u.nativeEnum(nI),version:Tt(IW).optional()}).strict(),__,u.object({...Lr,kind:u.literal("question"),id:u.string().regex(R_),type:u.nativeEnum(y_),text:Tt(Vi),component:Tt(a_).nullable(),choices:u.array(Tt(hW)).max(pW),placeholder:Tt(mW).optional()}).strict(),u.object({...Lr,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max($l)}).strict(),u.object({...Lr,kind:u.literal("credentials"),names:u.array(u.string().regex(ir)).min(1).max(c_),logins:u.array(u.object({key:u.string().regex(QW),usernameVariable:u.string().regex(ir),passwordVariable:u.string().regex(ir)}).strict()).min(1).max(BW).optional(),variables:u.array(u.string().regex(ir)).min(1).max(c_).optional()}).strict()]).superRefine((e,t)=>{if(N_(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>J0(i.key));new Set(n).size!==n.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let o of["usernameVariable","passwordVariable"])e.names.includes(i[o])||t.addIssue({code:u.ZodIssueCode.custom,path:["logins",r,o],message:"not one of the names"})})}e.kind==="credentials"&&e.variables&&(new Set(e.variables).size!==e.variables.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["variables"],message:"a name twice"}),e.variables.forEach((n,i)=>{e.names.includes(n)||t.addIssue({code:u.ZodIssueCode.custom,path:["variables",i],message:"not one of the names"})})),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Kee=u.object({schemaVersion:u.literal(1),events:u.array(vW).max($l)}).strict(),wW=u.discriminatedUnion("kind",[u.object({...Lr,kind:u.literal("log"),stage:u.nativeEnum(Km),text:Tt(Vi)}).strict(),__,u.object({...Lr,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max($l)}).strict(),u.object({...Lr,kind:u.literal("stage"),stage:u.nativeEnum(Km),event:u.nativeEnum(tI)}).strict(),u.object({...Lr,kind:u.literal("test"),resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:u.enum(["Pass","Fail","Skipped"]),details:u.string().max(Vi).refine(e=>!D_.test(e),"not text")}).strict()]).superRefine(N_),Xee=u.object({schemaVersion:u.literal(1),events:u.array(wW).max($l)}).strict(),u_={id:u.string().uuid(),text:u.string(),by:u.string().nullable(),at:u.string(),replied:u.literal(!0).optional()},U_=u.discriminatedUnion("kind",[u.object({...u_,kind:u.literal("instruction"),question:u.null()}),u.object({...u_,kind:u.literal("answer"),question:u.string().regex(R_)})]),$_=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),bW=u.object({id:u.string().uuid(),revision:u.string(),by:u.string().nullable(),at:u.string(),target:u.string(),own:u.object({source:u.enum(["policy","test_environment"]),text:u.string()}).nullable()}),ete=u.object({schemaVersion:u.literal(1),leftOut:u.array(u.string()),messages:u.array(U_).optional(),stop:u.object({key:$_}).optional(),notes:bW.optional()}),tte=u.object({schemaVersion:u.literal(1),messages:u.array(U_).optional()});var kW=500*1024*1024,T_=u.object({id:qt,name:u.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:qt,expiresAt:u.string().datetime()}).strict(),rte=u.object({schemaVersion:u.literal(1),artifact:T_,sessionId:Xe,contentHash:ot,bytes:u.number().int().min(1).max(kW)}).strict(),nte=u.object({schemaVersion:u.literal(1),checkpoint:u.object({artifact:T_,repository:u.object({namespace:u.string().min(1),name:u.string().min(1)}).strict(),sessionId:Xe,contentHash:ot,key:$_}).strict().nullable()}).strict(),SW=200,hs=100,F_=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(F_||{}),xW=u.object({kind:u.nativeEnum(F_),setup:u.object({runId:Xe,endedAt:u.string().nullable(),outcome:u.string().nullable()}).strict(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1),status:u.nativeEnum(nI)}).strict()).max(hs),credentials:u.array(u.string().min(1)).max(hs),answers:u.array(u.object({question:u.string(),answer:u.string().nullable()}).strict()).max(hs),instructions:u.array(u.object({text:u.string(),reply:u.string().nullable()}).strict()).max(hs),log:u.array(u.object({phase:u.nativeEnum(rI),text:u.string()}).strict()).max(SW),recipe:u.object({files:u.array(u.object({path:u.string().min(1),content:u.string()}).strict()).max(hs),blockers:u.array(u.object({component:u.string(),problem:u.string(),evidence:u.string(),fix:u.string()}).strict()).max(hs)}).strict().optional()}).strict(),ite=u.object({schemaVersion:u.literal(1),context:xW.nullable()}).strict(),ote=u.object({schemaVersion:u.literal(1),configuration:u.object({captureId:Xe,revision:qt.nullable(),hash:ot}).strict(),capture:u.object({schemaVersion:u.literal(1),settings:u.object({target:u.object({environment:u.unknown()}).passthrough(),timeoutMinutes:u.number().int().positive(),answerWaitMinutes:u.number().int().positive().optional(),testEnvironment:u.object({name:u.string().min(1),address:u.string().min(1).optional(),readyWhen:u.string().min(1).optional(),environmentId:u.string().uuid().optional(),persistentDataPolicy:l_}).passthrough().optional()}).passthrough(),provenance:u.object({}).passthrough(),hash:ot}).strict()}).strict(),ste=u.object({schemaVersion:u.literal(1),environmentId:u.string().uuid().nullable(),environmentAddress:u.string().url().nullable(),persistentDataPolicy:kl.nullable()}).strict(),RW=Eo.extend({environmentId:u.string().uuid().optional(),persistentDataPolicy:l_,version:u.number().int().positive(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1)}).strict()),contentHash:ot.optional(),files:u.array(u.object({path:u.string().refine(e=>bl(e)&&!Wm.includes(e),"not a file of a customer_deployed plan"),content:u.string()}).strict()).optional()}).strict(),ate=u.object({schemaVersion:u.literal(1),testEnvironment:RW.nullable().optional(),runtimePlan:u.object({version:u.number().int().positive(),contentHash:ot,files:u.array(u.object({path:u.string().refine(bl,"not a recipe file path"),content:u.string()}).strict()).min(1),repository:wl.optional(),recipeRepository:wl.optional(),recipe:u.record(u.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),Ate=u.object({schemaVersion:u.literal(1),state:u.nativeEnum(h_),ending:u.nativeEnum(p_).nullable(),cause:u.nativeEnum(m_).nullable(),deadlineAt:u.string().datetime()}).strict();var DW=50,cte=u.object({repository:pr,revisions:u.array(u.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:u.array(u.string().min(1)).min(1).max(DW)}).strict();var NW=".skyramp/sut/deployed-revisions.sh",M_=(n=>(n.Running="running",n.Requested="requested",n))(M_||{});var yte=new Set(Object.values(M_));var Cte=`Fix ${NW} so it prints the full commit each component runs, then set it up again.`;var $W=/^(login|logout|signin|sign-in|signup|sign-up|auth|oauth|token|session)$/i,TW=/^(login|logout|signin|sign-in|signup|sign-up|auth|oauth|token|sessions?)$/i,FW=/(^|\/)(graphql(\.json)?|gql)(\/|$)/i,MW=["id","uuid","_id","pk"],LW=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,PW=/^[0-9a-f]{24}$/i,O_=/^\d+$/,OW=/^(token|jwt|(access|refresh|id|session)[-_]?token)$/i;function iI(e,t){if(e.toUpperCase()!=="POST")return!1;let n;try{n=new URL(t)}catch{return!1}let i=n.pathname.split("/").filter(Boolean),r=i.pop();return!!r&&!$W.test(r)&&!i.some(o=>TW.test(o))&&!FW.test(n.pathname)}function z_(e){if(typeof e=="number")return Number.isSafeInteger(e)&&e>=0?e:void 0;if(typeof e=="string"&&(O_.test(e)||LW.test(e)||PW.test(e)))return e}function zW(e,t){let n=String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`(^|[^A-Za-z0-9])${n}($|[^A-Za-z0-9])`,"i");for(let[r,o]of Object.entries(t)){let s=r.toLowerCase();if(s==="location"||s==="content-location"||o===void 0)continue;let a=s==="set-cookie";if(!(!a&&O_.test(String(e))))for(let A of Array.isArray(o)?o:[o]){let c=a?A.split(";")[0].split("=").slice(1).join("="):A;if(i.test(c))return!0}}return!1}function G_(e,t,n,i,r){if(!iI(e,t)||n!==201)return{kind:"not-a-create"};let o={};try{let f=r===null||r.trim()===""?{}:JSON.parse(r);f&&typeof f=="object"&&!Array.isArray(f)&&(o=f)}catch{}if(Object.keys(o).some(f=>OW.test(f)))return{kind:"sign-in"};let s=new URL(t);s.search="",s.hash="";let a=s.toString().replace(/\/+$/,""),A=typeof i.location=="string"?GW(a,i.location):void 0,c=MW.find(f=>o[f]!==void 0),l=c?z_(o[c]):void 0,d=A??(l===void 0?void 0:{entityUrl:`${a}/${l}`,id:l});return d?zW(d.id,i)?{kind:"sign-in"}:{kind:"record",record:d}:i["set-cookie"]===void 0?{kind:"unnamed"}:{kind:"sign-in"}}function GW(e,t){let n;try{n=new URL(t,`${e}/`)}catch{return}let i=new URL(e);if(n.origin!==i.origin)return;let r=n.pathname.replace(/\/+$/,"");if(!r.startsWith(`${i.pathname}/`))return;let o=r.slice(i.pathname.length+1),s=o.includes("/")?void 0:z_(o);return s===void 0?void 0:{entityUrl:`${e}/${s}`,id:s}}function Tl(e){try{let t=new URL(e);return t.origin+t.pathname.replace(/\/+$/,"")}catch{return}}function V_(e,t){let n=Tl(t);return!!n&&e.some(i=>n===i||n.startsWith(`${i}/`))}var Zn=lt(require("fs")),Wn=lt(require("http")),q8=lt(require("https")),Yf=lt(require("dns")),KT=require("module"),Le=lt(require("net"));var jf=lt(require("path")),Hf=require("stream"),XT=require("stream/promises"),TQ=require("timers/promises"),Kn=lt(require("tls"));var M={};Br(M,{$brand:()=>II,$input:()=>Vy,$output:()=>Gy,INVALID:()=>At,NEVER:()=>mI,TimePrecision:()=>rC,ZodAny:()=>GB,ZodArray:()=>jB,ZodBase64:()=>Nf,ZodBase64URL:()=>Uf,ZodBigInt:()=>ea,ZodBigIntFormat:()=>Ff,ZodBoolean:()=>Xs,ZodCIDRv4:()=>Df,ZodCIDRv6:()=>_f,ZodCUID:()=>vf,ZodCUID2:()=>wf,ZodCatch:()=>gQ,ZodCodec:()=>cc,ZodCompileAsyncError:()=>mr,ZodCompileUnsupportedError:()=>oe,ZodCreditCard:()=>$B,ZodCustom:()=>uc,ZodCustomStringFormat:()=>ao,ZodDate:()=>nc,ZodDefault:()=>AQ,ZodDiscriminatedUnion:()=>qB,ZodE164:()=>$f,ZodEmail:()=>yf,ZodEmoji:()=>Bf,ZodEnum:()=>Ws,ZodError:()=>A8,ZodExactOptional:()=>Of,ZodFile:()=>iQ,ZodFirstPartyTypeKind:()=>SQ,ZodFunction:()=>vQ,ZodGUID:()=>Cf,ZodIBAN:()=>TB,ZodIPv4:()=>xf,ZodIPv6:()=>Rf,ZodISODate:()=>jn,ZodISODateTime:()=>Yn,ZodISODuration:()=>qn,ZodISOTime:()=>Hn,ZodInstanceOf:()=>kQ,ZodIntersection:()=>WB,ZodIssueCode:()=>l8,ZodJWT:()=>Tf,ZodKSUID:()=>Sf,ZodLazy:()=>CQ,ZodLiteral:()=>nQ,ZodMAC:()=>UB,ZodMap:()=>tQ,ZodNaN:()=>hQ,ZodNanoID:()=>Qf,ZodNever:()=>JB,ZodNonOptional:()=>zf,ZodNull:()=>OB,ZodNullable:()=>aQ,ZodNumber:()=>Ks,ZodNumberFormat:()=>Ao,ZodObject:()=>oc,ZodOptional:()=>ac,ZodPipe:()=>Ac,ZodPrefault:()=>uQ,ZodPreprocess:()=>mQ,ZodPromise:()=>QQ,ZodReadonly:()=>IQ,ZodRealError:()=>vt,ZodRecord:()=>qs,ZodSet:()=>rQ,ZodString:()=>Zs,ZodStringFormat:()=>me,ZodSuccess:()=>fQ,ZodSymbol:()=>LB,ZodTemplateLiteral:()=>yQ,ZodTransform:()=>oQ,ZodTuple:()=>KB,ZodType:()=>ee,ZodULID:()=>bf,ZodURL:()=>rc,ZodUUID:()=>Gr,ZodUndefined:()=>PB,ZodUnion:()=>sc,ZodUnknown:()=>VB,ZodVoid:()=>YB,ZodXID:()=>kf,ZodXor:()=>HB,_ZodString:()=>Ef,_default:()=>cQ,_function:()=>vT,any:()=>tT,array:()=>ic,base64:()=>$$,base64url:()=>T$,bigint:()=>W$,boolean:()=>MB,catch:()=>pQ,check:()=>wT,cidrv4:()=>N$,cidrv6:()=>U$,clone:()=>fe,codec:()=>yT,coerce:()=>RQ,compile:()=>Hy,config:()=>De,core:()=>dn,creditCard:()=>M$,cuid:()=>w$,cuid2:()=>b$,currencyCode:()=>V$,custom:()=>bT,date:()=>nT,decode:()=>kB,decodeAsync:()=>xB,deepPartial:()=>LT,describe:()=>kT,discriminatedUnion:()=>cT,e164:()=>F$,email:()=>p$,emoji:()=>Q$,encode:()=>bB,encodeAsync:()=>SB,endsWith:()=>Ms,enum:()=>Lf,exactOptional:()=>sQ,file:()=>hT,flattenError:()=>wA,float32:()=>Y$,float64:()=>j$,formatError:()=>bA,fromJSONSchema:()=>FT,function:()=>vT,getDiscriminatedOption:()=>my,getErrorMap:()=>f8,globalRegistry:()=>He,gt:()=>Or,gte:()=>Mt,guid:()=>h$,hash:()=>J$,hex:()=>G$,hostname:()=>z$,httpUrl:()=>B$,iban:()=>L$,includes:()=>Ts,input:()=>OT,instanceof:()=>xT,int:()=>mf,int32:()=>H$,int64:()=>Z$,intersection:()=>ZB,invertCodec:()=>CT,ipv4:()=>R$,ipv6:()=>_$,iso:()=>lc,json:()=>DT,jwt:()=>P$,keyof:()=>iT,ksuid:()=>x$,lazy:()=>BQ,length:()=>ro,literal:()=>pT,locales:()=>YA,looseObject:()=>aT,looseRecord:()=>lT,lowercase:()=>Us,lt:()=>Pr,lte:()=>Ft,mac:()=>D$,map:()=>dT,maxLength:()=>to,maxSize:()=>zn,memoizer:()=>VA,meta:()=>ST,mime:()=>Ps,minLength:()=>ln,minSize:()=>zr,multipleOf:()=>On,nan:()=>ET,nanoid:()=>v$,nativeEnum:()=>gT,negative:()=>sf,never:()=>Mf,nonnegative:()=>Af,nonoptional:()=>dQ,nonpositive:()=>af,normalize:()=>Os,null:()=>zB,nullable:()=>tc,nullish:()=>mT,number:()=>FB,object:()=>oT,optional:()=>oo,output:()=>zT,overwrite:()=>Ir,parse:()=>BB,parseAsync:()=>QB,partialRecord:()=>uT,pipe:()=>If,positive:()=>of,prefault:()=>lQ,preprocess:()=>_T,prettifyError:()=>QI,promise:()=>QT,properties:()=>Ls,property:()=>cf,readonly:()=>EQ,record:()=>eQ,refine:()=>wQ,regex:()=>Ns,regexes:()=>Xt,registry:()=>Nd,safeDecode:()=>DB,safeDecodeAsync:()=>NB,safeEncode:()=>RB,safeEncodeAsync:()=>_B,safeParse:()=>vB,safeParseAsync:()=>wB,set:()=>fT,setErrorMap:()=>d8,size:()=>eo,slugify:()=>Js,startsWith:()=>Fs,strictObject:()=>sT,string:()=>ec,stringFormat:()=>O$,stringbool:()=>RT,success:()=>IT,superRefine:()=>bQ,symbol:()=>X$,templateLiteral:()=>BT,toJSONSchema:()=>ff,toLowerCase:()=>Gs,toUpperCase:()=>Vs,toZod:()=>pA,transform:()=>Pf,treeifyError:()=>BI,trim:()=>zs,tuple:()=>XB,uint32:()=>q$,uint64:()=>K$,ulid:()=>k$,undefined:()=>eT,union:()=>ta,unknown:()=>io,uppercase:()=>$s,url:()=>C$,util:()=>B,uuid:()=>m$,uuidv4:()=>I$,uuidv6:()=>E$,uuidv7:()=>y$,validate:()=>kA,validateAsync:()=>SA,void:()=>rT,withParser:()=>Ud,xid:()=>S$,xor:()=>AT});var dn={};Br(dn,{$ZodAny:()=>Ay,$ZodArray:()=>gy,$ZodAsyncError:()=>Bt,$ZodBase64:()=>WE,$ZodBase64URL:()=>ZE,$ZodBigInt:()=>Ed,$ZodBigIntFormat:()=>iy,$ZodBoolean:()=>MA,$ZodCIDRv4:()=>HE,$ZodCIDRv6:()=>qE,$ZodCUID:()=>TE,$ZodCUID2:()=>FE,$ZodCatch:()=>Ny,$ZodCheck:()=>ye,$ZodCheckBigIntFormat:()=>cE,$ZodCheckEndsWith:()=>CE,$ZodCheckGreaterThan:()=>nd,$ZodCheckIncludes:()=>EE,$ZodCheckLengthEquals:()=>pE,$ZodCheckLessThan:()=>rd,$ZodCheckLowerCase:()=>mE,$ZodCheckMaxLength:()=>fE,$ZodCheckMaxSize:()=>uE,$ZodCheckMimeType:()=>vE,$ZodCheckMinLength:()=>gE,$ZodCheckMinSize:()=>lE,$ZodCheckMultipleOf:()=>aE,$ZodCheckNumberFormat:()=>AE,$ZodCheckOverwrite:()=>wE,$ZodCheckProperties:()=>QE,$ZodCheckProperty:()=>BE,$ZodCheckRegex:()=>hE,$ZodCheckSizeEquals:()=>dE,$ZodCheckStartsWith:()=>yE,$ZodCheckStringFormat:()=>Ss,$ZodCheckUpperCase:()=>IE,$ZodCodec:()=>PA,$ZodCreditCard:()=>XE,$ZodCustom:()=>Py,$ZodCustomStringFormat:()=>ry,$ZodCyclicError:()=>bd,$ZodDate:()=>dy,$ZodDefault:()=>xy,$ZodDiscriminatedUnion:()=>Iy,$ZodE164:()=>KE,$ZodEmail:()=>RE,$ZodEmoji:()=>UE,$ZodEncodeError:()=>Ln,$ZodEnum:()=>Qy,$ZodError:()=>CI,$ZodExactOptional:()=>ky,$ZodFile:()=>wy,$ZodFunction:()=>My,$ZodGUID:()=>SE,$ZodIBAN:()=>ey,$ZodIPv4:()=>JE,$ZodIPv6:()=>YE,$ZodISODate:()=>zE,$ZodISODateTime:()=>OE,$ZodISODuration:()=>VE,$ZodISOTime:()=>GE,$ZodIntersection:()=>Ey,$ZodJWT:()=>ty,$ZodKSUID:()=>PE,$ZodLazy:()=>OA,$ZodLiteral:()=>vy,$ZodMAC:()=>jE,$ZodMap:()=>Cy,$ZodNaN:()=>Uy,$ZodNanoID:()=>$E,$ZodNever:()=>uy,$ZodNonOptional:()=>Dy,$ZodNull:()=>ay,$ZodNullable:()=>Sy,$ZodNumber:()=>Id,$ZodNumberFormat:()=>ny,$ZodObject:()=>wN,$ZodObjectJIT:()=>py,$ZodOptional:()=>Cd,$ZodPipe:()=>Bd,$ZodPrefault:()=>Ry,$ZodPreprocess:()=>$y,$ZodPromise:()=>Ly,$ZodReadonly:()=>Ty,$ZodRealError:()=>Qt,$ZodRecord:()=>yy,$ZodRegistry:()=>_d,$ZodSet:()=>By,$ZodString:()=>Wi,$ZodStringFormat:()=>ge,$ZodSuccess:()=>_y,$ZodSymbol:()=>oy,$ZodTemplateLiteral:()=>Fy,$ZodTransform:()=>by,$ZodTuple:()=>yd,$ZodType:()=>Z,$ZodULID:()=>ME,$ZodURL:()=>NE,$ZodUUID:()=>xE,$ZodUndefined:()=>sy,$ZodUnion:()=>LA,$ZodUnknown:()=>cy,$ZodVoid:()=>ly,$ZodXID:()=>LE,$ZodXor:()=>hy,$brand:()=>II,$constructor:()=>I,$input:()=>Vy,$output:()=>Gy,Doc:()=>qi,INVALID:()=>At,JSONSchema:()=>d$,JSONSchemaGenerator:()=>gf,NEVER:()=>mI,TimePrecision:()=>rC,URL_BAD_FORMAT:()=>DE,URL_UNPARSEABLE:()=>NA,ZodCompileAsyncError:()=>mr,ZodCompileUnsupportedError:()=>oe,_any:()=>EC,_array:()=>bC,_base64:()=>ef,_base64url:()=>tf,_bigint:()=>dC,_boolean:()=>uC,_catch:()=>WK,_check:()=>WU,_cidrv4:()=>Kd,_cidrv6:()=>Xd,_coercedBigint:()=>fC,_coercedBoolean:()=>lC,_coercedDate:()=>vC,_coercedNumber:()=>iC,_coercedString:()=>Ky,_creditCard:()=>eC,_cuid:()=>Jd,_cuid2:()=>Yd,_custom:()=>SC,_date:()=>QC,_decode:()=>Jl,_decodeAsync:()=>jl,_default:()=>jK,_discriminatedUnion:()=>$K,_e164:()=>rf,_email:()=>Fd,_emoji:()=>Gd,_encode:()=>Vl,_encodeAsync:()=>Yl,_endsWith:()=>Ms,_enum:()=>OK,_file:()=>kC,_float32:()=>sC,_float64:()=>aC,_gt:()=>Or,_gte:()=>Mt,_guid:()=>Md,_iban:()=>tC,_includes:()=>Ts,_int:()=>oC,_int32:()=>AC,_int64:()=>gC,_intersection:()=>TK,_ipv4:()=>Wd,_ipv6:()=>Zd,_isoDate:()=>qA,_isoDateTime:()=>HA,_isoDuration:()=>ZA,_isoTime:()=>WA,_jwt:()=>nf,_ksuid:()=>qd,_lazy:()=>e8,_length:()=>ro,_literal:()=>GK,_lowercase:()=>Us,_lt:()=>Pr,_lte:()=>Ft,_mac:()=>Xy,_map:()=>LK,_max:()=>Ft,_maxLength:()=>to,_maxSize:()=>zn,_mime:()=>Ps,_min:()=>Mt,_minLength:()=>ln,_minSize:()=>zr,_multipleOf:()=>On,_nan:()=>wC,_nanoid:()=>Vd,_nativeEnum:()=>zK,_negative:()=>sf,_never:()=>CC,_nonnegative:()=>Af,_nonoptional:()=>HK,_nonpositive:()=>af,_normalize:()=>Os,_null:()=>IC,_nullable:()=>YK,_number:()=>nC,_optional:()=>JK,_overwrite:()=>Ir,_parse:()=>vs,_parseAsync:()=>ws,_pipe:()=>ZK,_positive:()=>of,_promise:()=>t8,_properties:()=>Ls,_property:()=>cf,_readonly:()=>KK,_record:()=>MK,_refine:()=>xC,_regex:()=>Ns,_safeDecode:()=>ql,_safeDecodeAsync:()=>Zl,_safeEncode:()=>Hl,_safeEncodeAsync:()=>Wl,_safeParse:()=>bs,_safeParseAsync:()=>ks,_set:()=>PK,_size:()=>eo,_slugify:()=>Js,_startsWith:()=>Fs,_string:()=>Zy,_stringFormat:()=>no,_stringbool:()=>NC,_success:()=>qK,_superRefine:()=>RC,_symbol:()=>hC,_templateLiteral:()=>XK,_toLowerCase:()=>Gs,_toUpperCase:()=>Vs,_transform:()=>VK,_trim:()=>zs,_tuple:()=>FK,_uint32:()=>cC,_uint64:()=>pC,_ulid:()=>jd,_undefined:()=>mC,_union:()=>NK,_unknown:()=>yC,_uppercase:()=>$s,_url:()=>jA,_uuid:()=>Ld,_uuidv4:()=>Pd,_uuidv6:()=>Od,_uuidv7:()=>zd,_void:()=>BC,_xid:()=>Hd,_xor:()=>UK,base64Charset:()=>fd,base64urlCharset:()=>FA,canParseURL:()=>_E,clone:()=>fe,compile:()=>Hy,compileFn:()=>$d,config:()=>De,createStandardJSONSchemaMethod:()=>Ys,createToJSONSchemaMethod:()=>$C,decode:()=>UZ,decodeAsync:()=>TZ,describe:()=>DC,encode:()=>NZ,encodeAsync:()=>$Z,extractDefs:()=>Vn,finalize:()=>Jn,flattenError:()=>wA,formatError:()=>bA,getDiscriminatedOption:()=>my,globalConfig:()=>ze,globalRegistry:()=>He,handleUnrepresentable:()=>Fe,initializeContext:()=>Gn,isBackEdge:()=>Sd,isRecursiveSchema:()=>kd,isValidBase64:()=>TA,isValidBase64URL:()=>gd,isValidCIDRv6:()=>dd,isValidCreditCard:()=>pd,isValidIBAN:()=>hd,isValidIPv6:()=>$A,isValidJWT:()=>md,locales:()=>YA,memoizer:()=>VA,mergeValues:()=>xs,meta:()=>_C,parse:()=>zl,parseAsync:()=>Gl,parseURLObject:()=>BN,prettifyError:()=>QI,process:()=>pe,processSchema:()=>pe,regexes:()=>Xt,registry:()=>Nd,safeDecode:()=>MZ,safeDecodeAsync:()=>PZ,safeEncode:()=>FZ,safeEncodeAsync:()=>LZ,safeParse:()=>SZ,safeParseAsync:()=>xZ,standardProps:()=>Ad,stripTabAndNewline:()=>UA,toDotPath:()=>tN,toJSONSchema:()=>ff,toZod:()=>pA,treeifyError:()=>BI,urlHostnameOk:()=>ud,urlProtocolOk:()=>ld,util:()=>B,validate:()=>kA,validateAsync:()=>SA,validateURL:()=>cd,version:()=>bE,withParser:()=>Ud});var B={};Br(B,{BIGINT_FORMAT_RANGES:()=>yA,CONSTANT_CATCH:()=>Pl,Class:()=>aI,NUMBER_FORMAT_RANGES:()=>EA,aborted:()=>at,allowsEval:()=>uI,assert:()=>HW,assertEqual:()=>VW,assertIs:()=>YW,assertNever:()=>jW,assertNotEqual:()=>JW,assignProp:()=>je,attachSchema:()=>CA,base64ToUint8Array:()=>q_,base64urlToUint8Array:()=>fZ,cached:()=>ys,captureStackTrace:()=>Ml,cleanEnum:()=>dZ,cleanRegex:()=>cn,clone:()=>fe,cloneDef:()=>ZW,codePointLength:()=>ji,constantCatch:()=>pI,createTransparentProxy:()=>nZ,defineLazy:()=>AI,defineLazyInternal:()=>re,derived:()=>mZ,esc:()=>st,escapeRegex:()=>Kt,explicitlyAborted:()=>fI,extend:()=>sZ,finalizeIssue:()=>Ct,floatSafeRemainder:()=>hA,getElementAtPath:()=>KW,getEnumValues:()=>Is,getLengthableOrigin:()=>QA,getParsedType:()=>rZ,getSizableOrigin:()=>BA,hexToUint8Array:()=>pZ,hide:()=>vA,installLazyProp:()=>CZ,isObject:()=>Yi,isPlainObject:()=>Zt,issue:()=>Qs,joinValues:()=>y,jsonStringifyReplacer:()=>Es,members:()=>gI,merge:()=>AZ,mergeDefs:()=>hr,normalizeParams:()=>x,nullish:()=>Fl,numKeys:()=>tZ,objectClone:()=>qW,omit:()=>oZ,optionalKeys:()=>dI,own:()=>Mn,parsedType:()=>v,partial:()=>cZ,pick:()=>iZ,prefixIssues:()=>yt,primitiveTypes:()=>lI,promiseAllObject:()=>XW,propertyKeyTypes:()=>IA,randomString:()=>eZ,rawShape:()=>Cs,required:()=>uZ,safeExtend:()=>aZ,shallowClone:()=>mA,sizeCaps:()=>Bs,slugify:()=>cI,stringifyPrimitive:()=>Q,toZod:()=>pA,uint8ArrayToBase64:()=>W_,uint8ArrayToBase64url:()=>gZ,uint8ArrayToHex:()=>hZ,unwrapMessage:()=>ms});function VW(e){return e}function JW(e){return e}function pA(){return e=>e}function YW(e){}function jW(e){throw new Error("Unexpected value in exhaustive check")}function HW(e){}function Is(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function y(e,t="|"){return e.map(n=>Q(n)).join(t)}function Es(e,t){return typeof t=="bigint"?t.toString():t}var sI=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function ys(e){return new sI(e)}function Fl(e){return e==null}function cn(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function hA(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var J_=Symbol("evaluating");function AI(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==J_)return i===void 0&&(i=J_,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function qW(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function je(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cs(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function An(e){return Cs(e._zod.def)??e._zod.def.shape}function Y_(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return je(this,t,i),i},enumerable:!0,configurable:!0})}function j_(e,t,n){t in e?je(e,t,n):e[t]=n}function Ji(e,t,n,i){let r=An(t);for(let o of n){let s=Object.getOwnPropertyDescriptor(r,o);s.enumerable&&(s.get?Y_(e,o,()=>{let a=t._zod.def.shape[o];return i?i(a,o):a}):j_(e,o,i?i(s.value,o):s.value))}}function WW(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?Y_(e,n,()=>t[n]):j_(e,n,i.value))}}function hr(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function ZW(e){return hr(e._zod.def)}function KW(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function XW(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function eZ(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function st(e){return JSON.stringify(e)}function cI(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ml="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var uI=ys(()=>{if(ze.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Zt(e){if(Yi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Yi(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function mA(e){return Zt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function tZ(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var rZ=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 new Error(`Unknown data type: ${t}`)}},IA=new Set(["string","number","symbol"]),lI=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function x(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function nZ(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function Q(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dI(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var EA={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]},yA={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function iZ(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return Ji(o,e,Ll(e,t)),fe(e,hr(n,{shape:o,checks:[]}))}function Ll(e,t){let n=An(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}function oZ(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(Ll(e,t)),s={};return Ji(s,e,Reflect.ownKeys(An(e)).filter(a=>!o.has(a))),fe(e,hr(n,{shape:s,checks:[]}))}function sZ(e,t){if(!Zt(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=An(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fe(e,hr(e._zod.def,{shape:H_(e,t)}))}function H_(e,t){let n={};return Ji(n,e,Reflect.ownKeys(An(e))),WW(n,t),n}function aZ(e,t){if(!Zt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return fe(e,hr(e._zod.def,{shape:H_(e,t)}))}function AZ(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Ji(n,e,Reflect.ownKeys(An(e))),Ji(n,t,Reflect.ownKeys(An(t)));let i=hr(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return fe(e,i)}function cZ(e,t,n,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ll(t,n)):void 0,A={};return Ji(A,t,Reflect.ownKeys(An(t)),e&&((c,l)=>a&&!a.has(l)?c:new e({type:"optional",innerType:c}))),fe(t,hr(t._zod.def,{shape:A,checks:[]}))}function uZ(e,t,n){let i=n?new Set(Ll(t,n)):void 0,r={};return Ji(r,t,Reflect.ownKeys(An(t)),(o,s)=>i&&!i.has(s)?o:new e({type:"nonoptional",innerType:o})),fe(t,hr(t._zod.def,{shape:r}))}function at(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function fI(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function yt(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function ms(e){return typeof e=="string"?e:e?.message}function Bs(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}function CA(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function Ct(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ms(e.inst?._zod.def?.error?.(e))??ms(o?.(e))??ms(t?.error?.(e))??ms(n.customError?.(e))??ms(n.localeError?.(e))??"Invalid input",a={};for(let A of Object.keys(e))A==="inst"||A==="schema"||A==="continue"||A==="input"||A==="__proto__"||(a[A]=e[A]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function BA(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var lZ=/[\uD800-\uDBFF]/;function ji(e){let t=e.length;if(!lZ.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function QA(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function v(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Qs(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function dZ(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function q_(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function W_(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function fZ(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return q_(t+n)}function gZ(e){return W_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pZ(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function hZ(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var aI=class{constructor(...t){}};function gI(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):IZ(e,n,i.value)}}function Mn(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function vA(e,t,n){return Mn(e,t,n,!1)}function mZ(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Mn(this,n,i(this))},set(r){Mn(this,n,r)}})}return t}function IZ(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Mn(this,t,n.bind(this))},set(i){Mn(this,t,i)}})}function EZ(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var oI,Fn=!1,yZ={configurable:!0,get(){Fn=!0}};function re(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&oI!==e._zod){oI=void 0;return}oI=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,yZ);let r=Fn;Fn=!1;try{let o=n(this);return Fn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),Fn=Fn||r,o}catch(o){throw delete this[t],Fn=Fn||r,o}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function CZ(e,t,n,i){let r=EZ(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Pl="~constantCatch";function pI(e){let t=()=>e;return t[Pl]=!0,t}var Z_,mI=Object.freeze({status:"aborted"}),hI={value:void 0,enumerable:!1},K_="captureStackTrace"in Error?Error:null;function BZ(e){let t=K_;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return K_=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function I(e,t,n,i){let r={};function o(f){this.def=f,this.constr=d,this.traits=new Set}o.prototype=r;let s=n,a=s&&new WeakSet;function A(f,g){if(f._zod){if(f._zod.traits.has(e))return}else{hI.value=new o(g);try{Object.defineProperty(f,"_zod",hI)}finally{hI.value=void 0}}if(f._zod.traits.add(e),t(f,g),a){let h=Object.getPrototypeOf(f),E=f._zod.constr.prototype,m=h;for(;m&&m!==E;)m=Object.getPrototypeOf(m);let C=m??h;a.has(C)||(a.add(C),gI(C,s))}let p=d.prototype;for(let h in p)Object.prototype.hasOwnProperty.call(p,h)&&(h in f||(f[h]=p[h].bind(f)))}let c=i?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(f){let g=i?.Parent?BZ(l):this;A(g,f);let p=g._zod.deferred;if(p){for(let E of p)E();g._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(g),g}return Object.defineProperty(d,"init",{value:A}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var II=Symbol("zod_brand"),Bt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ln=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Z_=globalThis).__zod_globalConfig??(Z_.__zod_globalConfig={});var ze=globalThis.__zod_globalConfig;function De(e){return e&&Object.assign(ze,e),ze}function QZ(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Es,2)),e.message}function vZ(e){this._zod.message=e}var wZ={get:QZ,set:vZ,enumerable:!0,configurable:!0},yI={value:void 0,enumerable:!1},X_=new WeakSet([Object.prototype,Error.prototype]),eN=(e,t)=>{e.name="$ZodError",yI.value=t,Object.defineProperty(e,"issues",yI),yI.value=void 0,Object.defineProperty(e,"message",wZ);let n=Object.getPrototypeOf(e);X_.has(n)||(X_.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},CI=I("$ZodError",eN),Qt=I("$ZodError",eN,void 0,{Parent:Error});function bZ(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function wA(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?bZ(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}function bA(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let A=n,c=0;for(;c<a.length;){let l=a[c],d=c===a.length-1;if(l==="_errors"){d&&A._errors.push(t(s)),c++;continue}Object.prototype.hasOwnProperty.call(A,l)||Object.defineProperty(A,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=A[l];d&&f._errors.push(t(s)),A=f,c++}}}};return i(e),n}function BI(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var s;for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(A=>i({issues:A},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let A=[...o,...a.path];if(A.length===0){n.errors.push(t(a));continue}let c=n,l=0;for(;l<A.length;){let d=A[l],f=l===A.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(s=c.items)[d]??(s[d]={errors:[]}),c=c.items[d]),f&&c.errors.push(t(a)),l++}}};return i(e),n}function tN(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function QI(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${tN(i.path)}`);return t.join(`
|
|
128
128
|
`)}function Ol(e,t){return{callee:t?.callee??e,Err:t?.Err}}var vs=e=>{let t=(n,i,r,o)=>{let s=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},s);if(a instanceof Promise)throw new Bt;if(a.issues.length){let A=new(o?.Err??e)(a.issues.map(c=>Ct(c,s,De())));throw Ml(A,o?.callee??t),A}return a.value};return t},zl=vs(Qt),ws=e=>{let t=async(n,i,r,o)=>{let s=r?{...r,async:!0}:{async:!0},a=n._zod.run({value:i,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let A=new(o?.Err??e)(a.issues.map(c=>Ct(c,s,De())));throw Ml(A,o?.callee??t),A}return a.value};return t},Gl=ws(Qt),bs=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 Bt;return o.issues.length?rN(e,o.issues,r):{success:!0,data:o.value}},SZ=bs(Qt);function rN(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(r=>Ct(r,n,De()))),t=void 0,n=void 0),i},set error(r){i=r,t=void 0,n=void 0}}}var ks=e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?rN(e,o.issues,r):{success:!0,data:o.value}},xZ=ks(Qt),RZ=Symbol.for("zod.compile.invalid"),DZ=Symbol.for("zod.compile.fallback"),kA=((e,t,n)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==RZ)return!0;if(i.definite===!0&&n===void 0)return!1}return _Z(e,t,n)});function _Z(e,t,n){let i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,o;if(r?(i[DZ]=!0,o=r({value:t,issues:[]},i)):o=e._zod.run({value:t,issues:[]},i),o instanceof Promise)throw new Bt;return o.issues.length===0}var SA=async(e,t,n)=>{let i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length===0},Vl=e=>{let t=vs(e),n=(i,r,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(i,r,a,Ol(n,s))};return n},NZ=Vl(Qt),Jl=e=>{let t=vs(e),n=(i,r,o,s)=>t(i,r,o,Ol(n,s));return n},UZ=Jl(Qt),Yl=e=>{let t=ws(e),n=async(i,r,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(i,r,a,Ol(n,s))};return n},$Z=Yl(Qt),jl=e=>{let t=ws(e),n=async(i,r,o,s)=>await t(i,r,o,Ol(n,s));return n},TZ=jl(Qt),Hl=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return bs(e)(t,n,r)},FZ=Hl(Qt),ql=e=>(t,n,i)=>bs(e)(t,n,i),MZ=ql(Qt),Wl=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return ks(e)(t,n,r)},LZ=Wl(Qt),Zl=e=>async(t,n,i)=>ks(e)(t,n,i),PZ=Zl(Qt);var Xt={};Br(Xt,{anyString:()=>WI,base64:()=>OI,base64url:()=>zI,bigint:()=>KI,boolean:()=>XI,browserEmail:()=>HZ,cidrv4:()=>LI,cidrv6:()=>PI,creditCard:()=>Kl,cuid:()=>wI,cuid2:()=>bI,currencyCode:()=>YI,date:()=>jI,datetime:()=>qI,domain:()=>VI,duration:()=>_I,e164:()=>JI,email:()=>UI,emoji:()=>$I,extendedDuration:()=>OZ,guid:()=>NI,hex:()=>iE,hostname:()=>GI,html5Email:()=>JZ,httpProtocol:()=>xA,iban:()=>Xl,idnEmail:()=>jZ,integer:()=>RA,ipv4:()=>TI,ipv6:()=>FI,ksuid:()=>xI,lowercase:()=>rE,mac:()=>MI,md5_base64:()=>KZ,md5_base64url:()=>XZ,md5_hex:()=>ZZ,nanoid:()=>RI,nanoidOfLength:()=>DI,null:()=>eE,number:()=>un,rfc5322Email:()=>YZ,sha1_base64:()=>t6,sha1_base64url:()=>r6,sha1_hex:()=>e6,sha256_base64:()=>i6,sha256_base64url:()=>o6,sha256_hex:()=>n6,sha384_base64:()=>a6,sha384_base64url:()=>A6,sha384_hex:()=>s6,sha512_base64:()=>u6,sha512_base64url:()=>l6,sha512_hex:()=>c6,string:()=>ZI,time:()=>HI,ulid:()=>kI,undefined:()=>tE,unicodeEmail:()=>nN,uppercase:()=>nE,uuid:()=>Hi,uuid4:()=>zZ,uuid6:()=>GZ,uuid7:()=>VZ,xid:()=>SI});var wI=/^[cC][0-9a-z]{6,}$/,bI=/^[0-9a-z]+$/,kI=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,SI=/^[0-9a-vA-V]{20}$/,xI=/^[A-Za-z0-9]{27}$/,RI=/^[a-zA-Z0-9_-]{21}$/;function DI(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _I=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OZ=/^[-+]?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)?)??$/,NI=/^([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})$/,Hi=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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,zZ=Hi(4),GZ=Hi(6),VZ=Hi(7),UI=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,JZ=/^[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])?)*$/,YZ=/^(([^<>()\[\]\\.,;:\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,}))$/,nN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,jZ=nN,HZ=/^[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])?)*$/,qZ="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function $I(){return new RegExp(qZ,"u")}var TI=/^(?:(?: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])$/,FI=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,MI=e=>{let t=Kt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},LI=/^((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])$/,PI=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,OI=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zI=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,GI=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,VI=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,xA=/^https?$/,JI=/^\+[1-9]\d{6,14}$/,Kl=/^\d(?:[ -]?\d){11,18}$/,YI=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Xl=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,iN="(?:(?:\\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])))";function WZ(e){return new RegExp(`^${e}$`)}var jI=WZ(iN);function vI(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function HI(e){return new RegExp(`^${vI(e)}$`)}function qI(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${vI({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${vI({precision:e.precision})}`:n;return new RegExp(`^${iN}T(?:${i})$`)}var WI=/^[\s\S]{0,}$/,ZI=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},KI=/^-?\d+n?$/,RA=/^-?\d+$/,un=/^-?\d+(?:\.\d+)?$/,XI=/^(?:true|false)$/i,eE=/^null$/i;var tE=/^undefined$/i;var rE=/^[^A-Z]*$/,nE=/^[^a-z]*$/,iE=/^[0-9a-fA-F]*$/;function DA(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function _A(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var ZZ=/^[0-9a-fA-F]{32}$/,KZ=DA(22,"=="),XZ=_A(22),e6=/^[0-9a-fA-F]{40}$/,t6=DA(27,"="),r6=_A(27),n6=/^[0-9a-fA-F]{64}$/,i6=DA(43,"="),o6=_A(43),s6=/^[0-9a-fA-F]{96}$/,a6=DA(64,""),A6=_A(64),c6=/^[0-9a-fA-F]{128}$/,u6=DA(86,"=="),l6=_A(86);var ye=I("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),oE=e=>{let t=e.value;return!Fl(t)&&t.size!==void 0},sE=e=>{let t=e.value;return!Fl(t)&&t.length!==void 0},ed={number:"number",bigint:"bigint",object:"date"},rd=I("$ZodCheckLessThan",(e,t)=>{ye.init(e,t);let n=ed[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:ed[typeof i.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nd=I("$ZodCheckGreaterThan",(e,t)=>{ye.init(e,t);let n=ed[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:ed[typeof i.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),aE=I("$ZodCheckMultipleOf",(e,t)=>{ye.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):hA(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})}}),AE=I("$ZodCheckNumberFormat",(e,t)=>{ye.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=EA[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),cE=I("$ZodCheckBigIntFormat",(e,t)=>{ye.init(e,t);let[n,i]=yA[t.format];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,inclusive:!0,inst:e,continue:!t.abort})}}),uE=I("$ZodCheckMaxSize",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=oE),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:BA(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lE=I("$ZodCheckMinSize",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=oE),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:BA(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dE=I("$ZodCheckSizeEquals",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=oE),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let s=o>t.size;i.issues.push({origin:BA(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),fE=I("$ZodCheckMaxLength",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=sE),e._zod.check=i=>{let r=i.value,o=r.length;if((typeof r=="string"&&o>t.maximum?ji(r):o)<=t.maximum)return;let a=QA(r);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gE=I("$ZodCheckMinLength",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=sE),e._zod.check=i=>{let r=i.value,o=r.length;if((typeof r=="string"&&o>=t.minimum&&o<t.minimum*2?ji(r):o)>=t.minimum)return;let a=QA(r);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pE=I("$ZodCheckLengthEquals",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=sE),e._zod.check=i=>{let r=i.value,o=r.length,s=typeof r=="string"&&o>=t.length&&o<=t.length*2?ji(r):o;if(s===t.length)return;let a=QA(r),A=s>t.length;i.issues.push({origin:a,...A?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Ss=I("$ZodCheckStringFormat",(e,t)=>{var n,i;ye.init(e,t),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=()=>{})}),hE=I("$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})}}),mE=I("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rE),Ss.init(e,t)}),IE=I("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nE),Ss.init(e,t)}),EE=I("$ZodCheckIncludes",(e,t)=>{ye.init(e,t);let n=Kt(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=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})}}),yE=I("$ZodCheckStartsWith",(e,t)=>{ye.init(e,t);let n=new RegExp(`^${Kt(t.prefix)}.*`);t.pattern??(t.pattern=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})}}),CE=I("$ZodCheckEndsWith",(e,t)=>{ye.init(e,t);let n=new RegExp(`.*${Kt(t.suffix)}$`);t.pattern??(t.pattern=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})}});function td(e,t,n){e.issues.length&&t.issues.push(...yt(n,e.issues))}var BE=I("$ZodCheckProperty",(e,t)=>{ye.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=>td(r,n,t.property));td(i,n,t.property)}}),QE=I("$ZodCheckProperties",(e,t)=>{ye.init(e,t),vA(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=i=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let r=i.value,o;for(let[s,a]of n){let A=a._zod.run({value:r[s],issues:[]},{});A instanceof Promise?(o??(o=[]),o.push(A.then(c=>td(c,i,s)))):td(A,i,s)}if(o)return Promise.all(o).then(()=>{})}}),vE=I("$ZodCheckMimeType",(e,t)=>{ye.init(e,t);let n=new Set(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,continue:!t.abort})}}),wE=I("$ZodCheckOverwrite",(e,t)=>{ye.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var qi=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
|
|
129
129
|
`).filter(s=>s),r=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
130
130
|
${n.join(`
|
|
@@ -183,9 +183,9 @@ ${n.join(`
|
|
|
183
183
|
`),c=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
|
|
184
184
|
${A}`:A:"",l=Function,d=`return (input) => {
|
|
185
185
|
${A}
|
|
186
|
-
}`,f;try{f=new l(...s,d)(...a)}catch(g){throw new oe(`this schema (generated code failed to evaluate: ${g.message})`)}return t?.debug&&(f.code=c),f.definite=i.definite,f}function q(e,t){for(let[i,r]of e.constants)if(r===t)return i;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function Ki(e,t){return e.definite=!1,q(e,t)}function L(e){return`v${e.varCounter++}`}function T9(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return At;let i=n;return i.issues.length===0?i.value:At}function et(e,t,n,i,r=!0){let o=e.content.length,s=t.constants.size,a=t.constantCounter,A=t.varCounter;try{return ke(e,t,n,i,r)}catch(c){if(!(c instanceof oe)||!c.islandable)throw c;if(e.content.length=o,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=A,F9(e,t,n,i)}}function F9(e,t,n,i){t.definite=!1;let r=q(t,n),o=q(t,T9),s=L(t);return e.write(`const ${s} = ${o}(${r}, ${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var M9=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function L9(e,t,n,i){let r=n._zod.def.checks;if(!r||r.length===0)return i;let o=i;for(let s of r){let a=s._zod.def;if(a.when&&!M9.has(a.check))throw new oe('check with a custom "when" condition');switch(a.check){case"greater_than":P9(e,t,a,o);break;case"less_than":O9(e,t,a,o);break;case"multiple_of":z9(e,t,a,o);break;case"number_format":HU(e,a,o);break;case"min_length":{let A=Pn(a.minimum,"min_length"),c=Jy(e,t,o,`${o}.length >= ${A} && ${o}.length < ${a.minimum*2}`);e.write(`if (${c} < ${A}) return INVALID;`);break}case"max_length":{let A=Pn(a.maximum,"max_length"),c=Jy(e,t,o,`${o}.length > ${A}`);e.write(`if (${c} > ${A}) return INVALID;`);break}case"length_equals":{let A=Pn(a.length,"length_equals"),c=Jy(e,t,o,`${o}.length >= ${A} && ${o}.length <= ${a.length*2}`);e.write(`if (${c} !== ${A}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${Pn(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${Pn(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${Pn(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=qU(e,t,a,o);break;case"custom":o=H9(e,t,s,o);break;case"bigint_format":G9(e,a,o);break;case"mime_type":V9(e,t,a,o);break;case"property":Y9(e,t,a,o);break;case"properties":J9(e,t,a,o);break;case"overwrite":{let A=L(t);j9(e,t,s,o,A),o=A;break}default:throw new oe(`check type ${a.check}`)}}return o}function Jy(e,t,n,i){let r=q(t,ji),o=L(t);return e.write(`const ${o} = typeof ${n} === "string" && ${i} ? ${r}(${n}) : ${n}.length;`),o}function Pn(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new oe(`${t} bound of type ${typeof e}`);return`${e}`}function jU(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new oe("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new oe("comparison check with Invalid Date bound");return q(e,t)}throw new oe(`comparison check bound of type ${typeof t}`)}function P9(e,t,n,i){let r=n.inclusive?"<":"<=";e.write(`if (${i} ${r} ${jU(t,n.value)}) return INVALID;`)}function O9(e,t,n,i){let r=n.inclusive?">":">=";e.write(`if (${i} ${r} ${jU(t,n.value)}) return INVALID;`)}function z9(e,t,n,i){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new oe("multiple_of check with a zero divisor");e.write(`if (${i} % ${n.value}n !== 0n) return INVALID;`)}else{let r=q(t,hA);e.write(`if (${r}(${i}, ${Pn(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function HU(e,t,n){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new oe(`number format ${i}`)}}function G9(e,t,n){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new oe(`bigint format ${i}`)}}function V9(e,t,n,i){let r=n.mime;if(r&&r.length>0){let o=q(t,new Set(r));e.write(`if (!${o}.has(${i}.type)) return INVALID;`)}}function J9(e,t,n,i){if(n.when)throw new oe('check with a custom "when" condition');e.write(`if (${i} == null) return INVALID;`);let r=n.shape;for(let o of Reflect.ownKeys(r)){let s=typeof o=="symbol"?q(t,o):st(o),a=L(t);e.write(`const ${a} = ${i}[${s}];`),et(e,t,r[o],a,!1)}}function Y9(e,t,n,i){let r=`${i}[${JSON.stringify(n.property)}]`;ke(e,t,n.schema,r)}function j9(e,t,n,i,r){let o=n._zod.def.tx;if(!o)throw new oe("overwrite check without a transform function");if(Xi(o))throw new mr("z.compile: async overwrite transforms are not supported");let s=q(t,o);e.write(`const ${r} = ${s}(${i});`)}function Yy(){throw new Bt}function qy(e){this.issues.push(e)}function H9(e,t,n,i){let r=n._zod.def;if(r.fn){if(Xi(r.fn))throw new mr("z.compile: async .refine() predicates are not supported");let o=Ki(t,r.fn),s=q(t,Yy),a=L(t);return e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),i}if(n._zod.check){if(Xi(n._zod.check))throw new mr("z.compile: async .superRefine() / check functions are not supported");let o=n._zod.check,a=Ki(t,c=>{let l={value:c,issues:[],addIssue:qy};return o(l)instanceof Promise&&Yy(),l.issues.length===0?l.value:At}),A=L(t);return e.write(`const ${A} = ${a}(${i});`),e.write(`if (${A} === INVALID) return INVALID;`),A}throw new oe("custom check without a predicate or check function")}var q9=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function qU(e,t,n,i,r=!0){let o=n.format;if(o==="base64"){let c=q(t,TA);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="base64url"){let c=q(t,gd);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="jwt"){let c=q(t,md),l=q(t,n.alg??null);return e.write(`if (!${c}(${i}, ${l})) return INVALID;`),i}if(o==="ipv6"){let c=q(t,$A);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="cidrv6"){let c=q(t,dd);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="credit_card"){let c=q(t,pd);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="iban"){let c=q(t,hd);return e.write(`if (!${c}(${i})) return INVALID;`),i}let s=n;if(o==="url"||o==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let c=q(t,cd),l=q(t,n),d=L(t),f=L(t);if(e.write(`const ${d} = ${i}.trim();`),e.write(`const ${f} = ${c}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),s.hostname!==void 0){let h=q(t,ud);e.write(`if (!${h}(${f}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let h=q(t,ld);e.write(`if (!${h}(${f}, ${l}.protocol)) return INVALID;`)}if(!r)return null;let g=L(t),p=s.normalize?`${f}.href`:`${q(t,UA)}(${d})`;return e.write(`const ${g} = ${p};`),g}let a=n.fn;if(a){if(Xi(a))throw new oe(`async string format ${o}`);let c=q(t,a);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(q9.has(o)&&n.pattern){let c=q(t,n.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${i})) return INVALID;`),i}let A=n.format;switch(A){case"regex":throw new oe("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${st(n.includes)})) return INVALID;`);break;case"starts_with":{let c=n.prefix;e.write(`if (${i}.slice(0, ${c.length}) !== ${st(c)}) return INVALID;`);break}case"ends_with":{let c=n.suffix;e.write(`if (${i}.slice(-${c.length}) !== ${st(c)}) return INVALID;`);break}default:throw new oe(`string format ${A}`)}return i}function ke(e,t,n,i,r=!0){let o=n._zod.def,s=o.type;if(o.coerce)throw new oe(`coercion (z.coerce.${s}())`);let a=r||!!o.checks?.length,A;switch(s){case"string":A=W9(e,t,n,i,a);break;case"number":A=Z9(e,n,i);break;case"boolean":A=K9(e,i);break;case"bigint":A=X9(e,n,i);break;case"symbol":A=eK(e,i);break;case"undefined":A=tK(e,i);break;case"null":A=rK(e,i);break;case"any":case"unknown":A=i;break;case"never":e.write("return INVALID;"),A=i;break;case"void":A=nK(e,i);break;case"nan":A=iK(e,i);break;case"date":A=oK(e,i);break;case"object":A=sK(e,t,n,i,a);break;case"optional":A=aK(e,t,n,i,a);break;case"nullable":A=uK(e,t,n,i,a);break;case"array":A=lK(e,t,n,i,a);break;case"literal":A=dK(e,t,n,i);break;case"enum":A=fK(e,t,n,i);break;case"readonly":{let c=VU(e,t,n,i),l=L(t);e.write(`const ${l} = Object.freeze(${c});`),A=l;break}case"success":VU(e,t,n,i),A="true";break;case"default":case"prefault":A=gK(e,t,n,i);break;case"nonoptional":A=pK(e,t,n,i);break;case"tuple":A=hK(e,t,n,i);break;case"union":A=mK(e,t,n,i);break;case"intersection":A=yK(e,t,n,i);break;case"record":A=CK(e,t,n,i);break;case"map":A=QK(e,t,n,i);break;case"set":A=vK(e,t,n,i);break;case"file":A=wK(e,i);break;case"template_literal":A=bK(e,t,n,i);break;case"lazy":A=kK(e,t,n,i);break;case"pipe":A=SK(e,t,n,i);break;case"custom":A=xK(e,t,n,i);break;case"transform":A=_K(e,t,n,i);break;case"catch":A=DK(e,t,n,i);break;default:throw new oe(`schema type ${s}`)}return A===null?null:L9(e,t,n,A)}function W9(e,t,n,i,r=!0){e.write(`if (typeof ${i} !== "string") return INVALID;`);let o=n._zod.def;return o.format===void 0?i:qU(e,t,o,i,r)}function Z9(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&HU(e,{format:i.format},n),n}function K9(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function X9(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function eK(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function tK(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function rK(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function nK(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function iK(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function oK(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function sK(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,a=Object.keys(s),A=Object.getOwnPropertySymbols(s),c=A.length?[...a,...A]:a,l=C=>typeof C=="symbol"?q(t,C):st(C),d=C=>typeof C=="symbol"?`[${l(C)}]`:st(C),f=s;if(a.includes("__proto__"))throw new oe('object shape key "__proto__"');let g=new Map;for(let C of c){let w=f[C],b=l(C),T=L(t);if(e.write(`const ${T} = ${i}[${b}];`),w._zod.optin!==void 0){let $=L(t);e.write(`let ${$} = (() => {`),e.indented(K=>{let Se=et(K,t,w,T);K.write(`return ${Se};`)}),e.write("})();"),w._zod.optout==="optional"?(e.write(`if (${$} === INVALID) {`),e.indented(K=>{K.write(`if (${b} in ${i}) return INVALID;`),K.write(`${$} = undefined;`)}),e.write("}")):e.write(`if (${$} === INVALID) return INVALID;`),g.set(C,$)}else{cK(w)&&e.write(`if (!(${b} in ${i})) return INVALID;`);let $=et(e,t,w,T,r);$!==null&&g.set(C,$)}}let p=o.catchall,h="none";if(p){let C=p._zod.def.type;if(C==="never"){let w=a.map(b=>`k !== ${st(b)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(b=>{b.write(`if (${w}) return INVALID;`)}),e.write("}")}else(C==="unknown"||C==="any")&&!p._zod.def.checks?.length?h="passthrough":h="schema"}let E=L(t),m=c.some(C=>GU(f[C])||jy(f[C]));if(!r){if(h==="schema"){let C=a.length>0?q(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(w=>{w.write('if (k === "__proto__") continue;'),C&&w.write(`if (${C}.has(k)) continue;`);let b=L(t);w.write(`const ${b} = ${i}[k];`),et(w,t,p,b,!1)}),e.write("}")}return null}if(m){e.write(`const ${E} = {};`);for(let C of c){let w=l(C),b=g.get(C);jy(f[C])?e.write(`if (${w} in ${i}) ${E}[${w}] = ${b};`):GU(f[C])?e.write(`if (${b} !== undefined || ${w} in ${i}) ${E}[${w}] = ${b};`):e.write(`${E}[${w}] = ${b};`)}}else{let C=c.map(w=>`${d(w)}: ${g.get(w)}`).join(", ");e.write(`const ${E} = { ${C} };`)}if(h!=="none"){let C=a.length>0?q(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(w=>{if(w.write('if (k === "__proto__") continue;'),C&&w.write(`if (${C}.has(k)) continue;`),h==="passthrough")w.write(`${E}[k] = ${i}[k];`);else{let b=L(t);w.write(`const ${b} = ${i}[k];`);let T=et(w,t,p,b);w.write(`${E}[k] = ${T};`)}}),e.write("}")}return E}function aK(e,t,n,i,r=!0){let o=n._zod.def;if(AK(n))return ke(e,t,o.innerType,i,r);if(o.innerType._zod.optin==="defaulted"){let a=L(t),A=L(t);return e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(c=>{c.write(`const ${A} = (() => {`),c.indented(l=>{let d=ke(l,t,o.innerType,i);l.write(`return ${d};`)}),c.write("})();"),c.write(`if (${A} !== INVALID) ${a} = ${A};`)}),e.write("} else {"),e.indented(c=>{let l=ke(c,t,o.innerType,i);c.write(`${a} = ${l};`)}),e.write("}"),a}let s=r?L(t):null;return s&&e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(a=>{let A=ke(a,t,o.innerType,i,r);s&&A!==null&&a.write(`${s} = ${A};`)}),e.write("}"),s}function AK(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function cK(e){return e._zod.optin===void 0&&Zi(e)}function Zi(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Zi(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Zi(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Zi):!0;case"intersection":return!t.left||!t.right?!0:Zi(t.left)&&Zi(t.right);case"pipe":return t.in?Zi(t.in):!0;default:return!0}}function jy(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function GU(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&_s(e)}function _s(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?_s(t.innerType):!0;case"union":return t.options?t.options.some(_s):!0;case"intersection":return!t.left||!t.right||_s(t.left)||_s(t.right);case"pipe":return t.out?_s(t.out):!0;default:return!0}}function uK(e,t,n,i,r=!0){let o=n._zod.def,s=r?L(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${i} !== null) {`),e.indented(a=>{let A=ke(a,t,o.innerType,i,r);s&&A!==null&&a.write(`${s} = ${A};`)}),e.write("}"),s}function Wy(e,t,n){for(let[i,r]of Bs(t._zod.def.checks))e.write(`if (${n} > ${Pn(i,r._zod.def.check)}) return INVALID;`)}function lK(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`),Wy(e,n,`${i}.length`);let s=r?L(t):null,a=L(t),A=L(t);return s&&e.write(`const ${s} = new Array(${i}.length);`),e.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),e.indented(c=>{c.write(`const ${A} = ${i}[${a}];`);let l=et(c,t,o.element,A,r);s&&l!==null&&c.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function dK(e,t,n,i){let o=n._zod.def.values;if(o.length!==1){let a=q(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}let s=o[0];if(typeof s=="number"&&Number.isNaN(s)){let a=q(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof s=="string")e.write(`if (${i} !== ${st(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${i} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${i} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${i} !== ${s}n) return INVALID;`);else throw new oe(`literal type ${typeof s}`);return i}function fK(e,t,n,i){let r=n._zod.values;if(!r)throw new oe("enum schema without enumerated values");let o=q(t,r);return e.write(`if (!${o}.has(${i})) return INVALID;`),i}function VU(e,t,n,i){let r=n._zod.def;return ke(e,t,r.innerType,i)}function gK(e,t,n,i){let r=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return ke(e,t,r.innerType,i);let A=q(t,s),c=L(t);return e.write(`let ${c} = ${i};`),e.write(`if (${i} === undefined) ${c} = ${A}();`),ke(e,t,r.innerType,c)}let a=L(t);if(s){let A=q(t,s),c=q(t,mA);e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(l=>{l.write(`${a} = ${c}(${A}());`)}),e.write("} else {"),e.indented(l=>{let d=ke(l,t,r.innerType,i);l.write(`${a} = ${d} === undefined ? ${c}(${A}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${i} !== undefined) {`),e.indented(A=>{let c=ke(A,t,r.innerType,i);A.write(`${a} = ${c};`)}),e.write("}");return a}function pK(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.innerType,i),s=L(t);return e.write(`const ${s} = ${o};`),e.write(`if (${s} === undefined) return INVALID;`),s}function hK(e,t,n,i){let r=n._zod.def,o=r.items,s=r.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let a=JU(o,"optin"),A=JU(o,"optout");s?e.write(`if (${i}.length < ${a}) return INVALID;`):e.write(`if (${i}.length < ${a} || ${i}.length > ${o.length}) return INVALID;`);let c=L(t);e.write(`const ${c} = [];`);for(let l=0;l<o.length;l++){let d=o[l];if(l>=A)e.write(`if (${c}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${i}.length) {`),f.indented(g=>{let p=L(t);g.write(`const ${p} = ${i}[${l}];`);let h=et(g,t,d,p);g.write(`${c}[${l}] = ${h};`)}),f.write("} else {"),f.indented(g=>{if(jy(d)){g.write(`${c}.length = ${l};`);return}let p=L(t),h=L(t);g.write(`const ${p} = undefined;`),g.write(`const ${h} = (() => {`),g.indented(E=>{let m=et(E,t,d,p);E.write(`return ${m};`)}),g.write("})();"),g.write(`if (${h} === INVALID || ${h} === undefined) ${c}.length = ${l};`),g.write(`else ${c}[${l}] = ${h};`)}),f.write("}")}),e.write("}");else{let f=L(t);e.write(`const ${f} = ${i}[${l}];`);let g=et(e,t,d,f);e.write(`${c}[${l}] = ${g};`)}}if(s){let l=L(t),d=L(t);e.write(`for (let ${l} = ${o.length}; ${l} < ${i}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${i}[${l}];`);let g=et(f,t,s,d);f.write(`${c}[${l}] = ${g};`)}),e.write("}")}return c}function JU(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function mK(e,t,n,i){let r=n._zod.def,o=r.options;if(r.discriminator)return IK(e,t,r,i);if(r.inclusive===!1)throw new oe("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),i;if(o.length===1)return ke(e,t,o[0],i);if(o.every(A=>A._zod.def.type==="literal"&&!A._zod.def.checks?.length)){let A=new Set(o.flatMap(l=>l._zod.def.values)),c=q(t,A);return e.write(`if (!${c}.has(${i})) return INVALID;`),i}let a=L(t);e.write(`let ${a};`);for(let A=0;A<o.length;A++){let c=o[A];A===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let d=ke(l,t,c,i);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function IK(e,t,n,i){if(n.unionFallback)throw new oe("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),i;let r=L(t),o=L(t);e.write(`const ${r} = ${i}?.[${st(n.discriminator)}];`),e.write(`let ${o};`);let s=!0,a=new Set;for(let A of n.options){let c=A._zod.propValues?.[n.discriminator];if(!c||c.size===0)throw new oe("discriminated union option without static discriminator values");for(let f of c){if(a.has(f))throw new oe(`duplicate discriminator value ${String(f)}`);a.add(f)}let l=Array.from(c,f=>EK(t,r,f)),d=s?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let g=ke(f,t,A,i);f.write(`${o} = ${g};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),o}function EK(e,t,n){if(typeof n=="string")return`${t} === ${st(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let i=q(e,n);return`${t} === ${i}`}throw new oe(`literal discriminator value ${String(n)}`)}function yK(e,t,n,i){let r=n._zod.def;t.definite=!1;let o=et(e,t,r.left,i),s=et(e,t,r.right,i),a=q(t,xs),A=L(t);return e.write(`const ${A} = ${a}(${o}, ${s});`),e.write(`if (!${A}.valid) return INVALID;`),`${A}.data`}function CK(e,t,n,i){let r=n._zod.def,o=q(t,Zt);e.write(`if (!${o}(${i})) return INVALID;`);let s=L(t),a=L(t),A=L(t);e.write(`const ${s} = {};`);let c=r,l=c.partial?void 0:r.keyType._zod.values;if(l){let g=[];for(let h of l){if(!(typeof h=="string"||typeof h=="number"||typeof h=="symbol"))throw new oe(`record key value ${String(h)}`);let E=typeof h=="number"?h.toString():h;if(E==="__proto__")throw new oe('record key "__proto__"');g.push(E);let m=q(t,h),C=ke(e,t,r.keyType,m),w=L(t);e.write(`const ${w} = ${i}[${BK(t,E)}];`);let b=et(e,t,r.valueType,w);e.write(`${s}[${C}] = ${b};`)}let p=q(t,new Set(g));return e.write(`for (const ${a} in ${i}) {`),e.indented(h=>{h.write(`if (${p}.has(${a})) continue;`),c.mode==="loose"?h.write(`if (${a} !== "__proto__") ${s}[${a}] = ${i}[${a}];`):h.write("return INVALID;")}),e.write("}"),s}let d=r.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let g=r.mode==="loose",p=$d(r.keyType);p.definite===!1&&(t.definite=!1);let h=q(t,p),E=q(t,un),m=L(t);return YU(e,t,i,a,C=>{C.write(`let ${m} = ${h}(${a});`),C.write(`if (${m} === INVALID && typeof ${a} === "string" && ${E}.test(${a})) ${m} = ${h}(Number(${a}));`),g?C.write(`if (${m} === INVALID) { ${s}[${a}] = ${i}[${a}]; continue; }`):C.write(`if (${m} === INVALID) return INVALID;`),C.write(`if (${m} === "__proto__") continue;`);let w=L(t);C.write(`const ${w} = ${i}[${a}];`);let b=et(C,t,r.valueType,w);C.write(`${s}[${m}] = ${b};`)}),s}return YU(e,t,i,a,g=>{g.write(`const ${A} = ${i}[${a}];`);let p=et(g,t,r.valueType,A);g.write(`${s}[${a}] = ${p};`)},"return INVALID;"),s}function YU(e,t,n,i,r,o){let s=q(t,Object.prototype.propertyIsEnumerable),a=L(t),A=L(t),c=L(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${A} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${c} = 0; ${c} < ${A}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${i} = ${A}[${c}];`),l.write(`if (${i} === "__proto__" || !${s}.call(${n}, ${i})) continue;`),r(l)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${a}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${i} = ${a}[${c}];`),l.write(`if (!${s}.call(${n}, ${i})) continue;`),o?l.write(o):r(l)}),e.write("}")}function BK(e,t){return typeof t=="string"?st(t):q(e,t)}function QK(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`),Wy(e,n,`${i}.size`);let o=L(t),s=L(t),a=L(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${s}, ${a}] of ${i}) {`),e.indented(A=>{let c=ke(A,t,r.keyType,s),l=ke(A,t,r.valueType,a);A.write(`${o}.set(${c}, ${l});`)}),e.write("}"),o}function vK(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`),Wy(e,n,`${i}.size`);let o=L(t),s=L(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${s} of ${i}) {`),e.indented(a=>{let A=ke(a,t,r.valueType,s);a.write(`${o}.add(${A});`)}),e.write("}"),o}function wK(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function bK(e,t,n,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let r=n._zod.pattern;if(r){let o=q(t,r);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${i})) return INVALID;`)}return i}function kK(e,t,n,i){let r=n._zod.def,o=Ki(t,r.getter),s=q(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(A=>{A.write(`const inner = ${o}();`),A.write(`${s}.parser = function(input) {`),A.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),A.write("};")}),e.write("}");let a=L(t);return e.write(`const ${a} = ${s}.parser(${i});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function SK(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.in,i);if(r.transform){if(Xi(r.transform))throw new mr("z.compile: async transforms in pipes are not supported");let s=r.transform,A=Ki(t,l=>{let d={value:l,issues:[],addIssue:qy},f=s(l,d);return f instanceof Promise?At:d.issues.length===0?f:At}),c=L(t);return e.write(`const ${c} = ${A}(${o});`),e.write(`if (${c} === INVALID) return INVALID;`),ke(e,t,r.out,c)}else return ke(e,t,r.out,o)}function Xi(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function xK(e,t,n,i){let r=n._zod.def;if(r.fn){if(Xi(r.fn))throw new mr("z.compile: async custom predicates are not supported");let o=Ki(t,r.fn),s=q(t,Yy),a=L(t);e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new oe("custom schema without a predicate function");return i}function RK(e,t,n){let i=e._zod.run({value:n,issues:[]},{});if(i&&typeof i.then=="function")return At;let r=i;return r.issues.length===0?r.value:t()}function DK(e,t,n,i){let r=n._zod.def;if(!r.catchValue[Pl])throw new oe("catch with a callback (only a constant catch value compiles)",!1);let o=L(t);e.write(`let ${o} = (() => {`),e.indented(c=>{let l=et(c,t,r.innerType,i);c.write(`return ${l};`)}),e.write("})();");let s=q(t,r.innerType),a=Ki(t,r.catchValue),A=q(t,RK);return e.write(`if (${o} === INVALID) {`),e.indented(c=>{c.write(`${o} = ${A}(${s}, ${a}, ${i});`),c.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function _K(e,t,n,i){let r=n._zod.def;if(r.transform){if(Xi(r.transform))throw new mr("z.compile: async transforms are not supported");let o=r.transform,a=Ki(t,c=>{let l={value:c,issues:[],addIssue:qy},d=o(c,l);return d instanceof Promise?At:l.issues.length===0?d:At}),A=L(t);return e.write(`const ${A} = ${a}(${i});`),e.write(`if (${A} === INVALID) return INVALID;`),A}return i}function Td(e){return e.checks&&(e.checks=[...e.checks]),e}function Zy(e,t){return new e(Td({type:"string",...x(t)}))}function Ky(e,t){return new e(Td({type:"string",coerce:!0,...x(t)}))}function Fd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}function Md(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}function Ld(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}function Pd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}function Od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}function zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}function jA(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}function Gd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}function Vd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}function Jd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}function Yd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}function jd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}function Hd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}function qd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}function Wd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}function Zd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}function Xy(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...x(t)})}function Kd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}function Xd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}function ef(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}function tf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}function rf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}function eC(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...x(t)})}function tC(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...x(t)})}function nf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}var rC={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function HA(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}function qA(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}function WA(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}function ZA(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}function nC(e,t){return new e(Td({type:"number",checks:[],...x(t)}))}function iC(e,t){return new e(Td({type:"number",coerce:!0,checks:[],...x(t)}))}function oC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}function sC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...x(t)})}function aC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...x(t)})}function AC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...x(t)})}function cC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...x(t)})}function uC(e,t){return new e({type:"boolean",...x(t)})}function lC(e,t){return new e({type:"boolean",coerce:!0,...x(t)})}function dC(e,t){return new e({type:"bigint",...x(t)})}function fC(e,t){return new e({type:"bigint",coerce:!0,...x(t)})}function gC(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...x(t)})}function pC(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...x(t)})}function hC(e,t){return new e({type:"symbol",...x(t)})}function mC(e,t){return new e({type:"undefined",...x(t)})}function IC(e,t){return new e({type:"null",...x(t)})}function EC(e){return new e({type:"any"})}function yC(e){return new e({type:"unknown"})}function CC(e,t){return new e({type:"never",...x(t)})}function BC(e,t){return new e({type:"void",...x(t)})}function QC(e,t){return new e({type:"date",...x(t)})}function vC(e,t){return new e({type:"date",coerce:!0,...x(t)})}function wC(e,t){return new e({type:"nan",...x(t)})}function Pr(e,t){return new rd({check:"less_than",...x(t),value:e,inclusive:!1})}function Ft(e,t){return new rd({check:"less_than",...x(t),value:e,inclusive:!0})}function Or(e,t){return new nd({check:"greater_than",...x(t),value:e,inclusive:!1})}function Mt(e,t){return new nd({check:"greater_than",...x(t),value:e,inclusive:!0})}function of(e){return Or(0,e)}function sf(e){return Pr(0,e)}function af(e){return Ft(0,e)}function Af(e){return Mt(0,e)}function On(e,t){return new aE({check:"multiple_of",...x(t),value:e})}function zn(e,t){return new uE({check:"max_size",...x(t),maximum:e})}function zr(e,t){return new lE({check:"min_size",...x(t),minimum:e})}function eo(e,t){return new dE({check:"size_equals",...x(t),size:e})}function to(e,t){return new fE({check:"max_length",...x(t),maximum:e})}function ln(e,t){return new gE({check:"min_length",...x(t),minimum:e})}function ro(e,t){return new pE({check:"length_equals",...x(t),length:e})}function Ns(e,t){return new hE({check:"string_format",format:"regex",...x(t),pattern:e})}function Us(e){return new mE({check:"string_format",format:"lowercase",...x(e)})}function $s(e){return new IE({check:"string_format",format:"uppercase",...x(e)})}function Ts(e,t){return new EE({check:"string_format",format:"includes",...x(t),includes:e})}function Fs(e,t){return new yE({check:"string_format",format:"starts_with",...x(t),prefix:e})}function Ms(e,t){return new CE({check:"string_format",format:"ends_with",...x(t),suffix:e})}function cf(e,t,n){return new BE({check:"property",property:e,schema:t,...x(n)})}function Ls(e,t){return new QE({check:"properties",shape:e,...x(t)})}function Ps(e,t){return new vE({check:"mime_type",mime:e,...x(t)})}function Ir(e){return new wE({check:"overwrite",tx:e})}function Os(e){return Ir(t=>t.normalize(e))}function zs(){return Ir(e=>e.trim())}function Gs(){return Ir(e=>e.toLowerCase())}function Vs(){return Ir(e=>e.toUpperCase())}function Js(){return Ir(e=>cI(e))}function bC(e,t,n){return new e({type:"array",element:t,...x(n)})}function NK(e,t,n){return new e({type:"union",options:t,...x(n)})}function UK(e,t,n){return new e({type:"union",options:t,inclusive:!1,...x(n)})}function $K(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...x(i)})}function TK(e,t,n){return new e({type:"intersection",left:t,right:n})}function FK(e,t,n,i){let r=n instanceof Z,o=r?i:n,s=r?n:null;return new e({type:"tuple",items:t,rest:s,...x(o)})}function MK(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...x(i)})}function LK(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...x(i)})}function PK(e,t,n){return new e({type:"set",valueType:t,...x(n)})}function OK(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...x(n)})}function zK(e,t,n){return new e({type:"enum",entries:t,...x(n)})}function GK(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...x(n)})}function kC(e,t){return new e({type:"file",...x(t)})}function VK(e,t){return new e({type:"transform",transform:t})}function JK(e,t){return new e({type:"optional",innerType:t})}function YK(e,t){return new e({type:"nullable",innerType:t})}function jK(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():mA(n)}})}function HK(e,t,n){return new e({type:"nonoptional",innerType:t,...x(n)})}function qK(e,t){return new e({type:"success",innerType:t})}function WK(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:pI(n)})}function ZK(e,t,n){return new e({type:"pipe",in:t,out:n})}function KK(e,t){return new e({type:"readonly",innerType:t})}function XK(e,t,n){return new e({type:"template_literal",parts:t,...x(n)})}function e8(e,t){return new e({type:"lazy",getter:t})}function t8(e,t){return new e({type:"promise",innerType:t})}function SC(e,t,n){let i=x(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function xC(e,t,n){return new e({type:"custom",check:"custom",fn:t,...x(n)})}function RC(e,t){let n=WU(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(Qs(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(Qs(o))}},e(i.value,i)),t);return n}function WU(e,t){let n=new ye({check:"custom",...x(t)});return n._zod.check=e,n}function DC(e){let t=new ye({check:"describe"});return t._zod.onattach=[n=>{let i=He.get(n)??{};He.add(n,{...i,description:e})}],t._zod.check=()=>{},t}function _C(e){let t=new ye({check:"meta"});return t._zod.onattach=[n=>{let i=He.get(n)??{};He.add(n,{...i,...e})}],t._zod.check=()=>{},t}function NC(e,t){let n=x(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(g=>typeof g=="string"?g.toLowerCase():g),r=r.map(g=>typeof g=="string"?g.toLowerCase():g));let o=new Set(i),s=new Set(r),a=e.Codec??PA,A=e.Boolean??MA,c=e.String??Wi,l=new c({type:"string",error:n.error}),d=new A({type:"boolean",error:n.error}),f=new a({type:"pipe",in:l,out:d,transform:((g,p)=>{let h=g;return n.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(p.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:p.value,inst:f,continue:!1}),{})}),reverseTransform:((g,p)=>g===!0?i[0]||"true":r[0]||"false"),error:n.error});return f._zod.bag.truthy=i,f._zod.bag.falsy=r,f._zod.bag.case=n.case??"insensitive",f}function no(e,t,n,i={}){let r=x(i),o={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}function KA(e,...t){for(let n of t)for(let i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&je(e,i,n[i]);return e}function Gn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??He,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Fe(e,t,n,i,r){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:r}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(r);return Object.assign(n,o),!0}function pe(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let f=s.schema,g=t.processors[r.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);g(e,t,f,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),pe(d,t,l),t.seen.get(d).isParent=!0)}let A=t.metadataRegistry.get(e);return A&&KA(s.schema,A),t.io==="input"&&ct(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ZU(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Vn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let A=i.get(a);if(A&&A!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let r=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,f=e.external.uri??(p=>p);if(d)return{ref:f(d)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${f("__shared")}#/${a}/${ZU(g)}`}}let A="#",c=`${A}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:A};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+ZU(l)}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:A,defId:c}=r(s);a.def={...a.schema},c&&(a.defId=c);let l=a.schema;for(let d in l)delete l[d];l.$ref=A};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
186
|
+
}`,f;try{f=new l(...s,d)(...a)}catch(g){throw new oe(`this schema (generated code failed to evaluate: ${g.message})`)}return t?.debug&&(f.code=c),f.definite=i.definite,f}function q(e,t){for(let[i,r]of e.constants)if(r===t)return i;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function Ki(e,t){return e.definite=!1,q(e,t)}function P(e){return`v${e.varCounter++}`}function T9(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return At;let i=n;return i.issues.length===0?i.value:At}function et(e,t,n,i,r=!0){let o=e.content.length,s=t.constants.size,a=t.constantCounter,A=t.varCounter;try{return ke(e,t,n,i,r)}catch(c){if(!(c instanceof oe)||!c.islandable)throw c;if(e.content.length=o,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=A,F9(e,t,n,i)}}function F9(e,t,n,i){t.definite=!1;let r=q(t,n),o=q(t,T9),s=P(t);return e.write(`const ${s} = ${o}(${r}, ${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var M9=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function L9(e,t,n,i){let r=n._zod.def.checks;if(!r||r.length===0)return i;let o=i;for(let s of r){let a=s._zod.def;if(a.when&&!M9.has(a.check))throw new oe('check with a custom "when" condition');switch(a.check){case"greater_than":P9(e,t,a,o);break;case"less_than":O9(e,t,a,o);break;case"multiple_of":z9(e,t,a,o);break;case"number_format":HU(e,a,o);break;case"min_length":{let A=Pn(a.minimum,"min_length"),c=Jy(e,t,o,`${o}.length >= ${A} && ${o}.length < ${a.minimum*2}`);e.write(`if (${c} < ${A}) return INVALID;`);break}case"max_length":{let A=Pn(a.maximum,"max_length"),c=Jy(e,t,o,`${o}.length > ${A}`);e.write(`if (${c} > ${A}) return INVALID;`);break}case"length_equals":{let A=Pn(a.length,"length_equals"),c=Jy(e,t,o,`${o}.length >= ${A} && ${o}.length <= ${a.length*2}`);e.write(`if (${c} !== ${A}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${Pn(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${Pn(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${Pn(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=qU(e,t,a,o);break;case"custom":o=H9(e,t,s,o);break;case"bigint_format":G9(e,a,o);break;case"mime_type":V9(e,t,a,o);break;case"property":Y9(e,t,a,o);break;case"properties":J9(e,t,a,o);break;case"overwrite":{let A=P(t);j9(e,t,s,o,A),o=A;break}default:throw new oe(`check type ${a.check}`)}}return o}function Jy(e,t,n,i){let r=q(t,ji),o=P(t);return e.write(`const ${o} = typeof ${n} === "string" && ${i} ? ${r}(${n}) : ${n}.length;`),o}function Pn(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new oe(`${t} bound of type ${typeof e}`);return`${e}`}function jU(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new oe("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new oe("comparison check with Invalid Date bound");return q(e,t)}throw new oe(`comparison check bound of type ${typeof t}`)}function P9(e,t,n,i){let r=n.inclusive?"<":"<=";e.write(`if (${i} ${r} ${jU(t,n.value)}) return INVALID;`)}function O9(e,t,n,i){let r=n.inclusive?">":">=";e.write(`if (${i} ${r} ${jU(t,n.value)}) return INVALID;`)}function z9(e,t,n,i){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new oe("multiple_of check with a zero divisor");e.write(`if (${i} % ${n.value}n !== 0n) return INVALID;`)}else{let r=q(t,hA);e.write(`if (${r}(${i}, ${Pn(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function HU(e,t,n){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new oe(`number format ${i}`)}}function G9(e,t,n){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new oe(`bigint format ${i}`)}}function V9(e,t,n,i){let r=n.mime;if(r&&r.length>0){let o=q(t,new Set(r));e.write(`if (!${o}.has(${i}.type)) return INVALID;`)}}function J9(e,t,n,i){if(n.when)throw new oe('check with a custom "when" condition');e.write(`if (${i} == null) return INVALID;`);let r=n.shape;for(let o of Reflect.ownKeys(r)){let s=typeof o=="symbol"?q(t,o):st(o),a=P(t);e.write(`const ${a} = ${i}[${s}];`),et(e,t,r[o],a,!1)}}function Y9(e,t,n,i){let r=`${i}[${JSON.stringify(n.property)}]`;ke(e,t,n.schema,r)}function j9(e,t,n,i,r){let o=n._zod.def.tx;if(!o)throw new oe("overwrite check without a transform function");if(Xi(o))throw new mr("z.compile: async overwrite transforms are not supported");let s=q(t,o);e.write(`const ${r} = ${s}(${i});`)}function Yy(){throw new Bt}function qy(e){this.issues.push(e)}function H9(e,t,n,i){let r=n._zod.def;if(r.fn){if(Xi(r.fn))throw new mr("z.compile: async .refine() predicates are not supported");let o=Ki(t,r.fn),s=q(t,Yy),a=P(t);return e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),i}if(n._zod.check){if(Xi(n._zod.check))throw new mr("z.compile: async .superRefine() / check functions are not supported");let o=n._zod.check,a=Ki(t,c=>{let l={value:c,issues:[],addIssue:qy};return o(l)instanceof Promise&&Yy(),l.issues.length===0?l.value:At}),A=P(t);return e.write(`const ${A} = ${a}(${i});`),e.write(`if (${A} === INVALID) return INVALID;`),A}throw new oe("custom check without a predicate or check function")}var q9=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function qU(e,t,n,i,r=!0){let o=n.format;if(o==="base64"){let c=q(t,TA);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="base64url"){let c=q(t,gd);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="jwt"){let c=q(t,md),l=q(t,n.alg??null);return e.write(`if (!${c}(${i}, ${l})) return INVALID;`),i}if(o==="ipv6"){let c=q(t,$A);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="cidrv6"){let c=q(t,dd);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="credit_card"){let c=q(t,pd);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(o==="iban"){let c=q(t,hd);return e.write(`if (!${c}(${i})) return INVALID;`),i}let s=n;if(o==="url"||o==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let c=q(t,cd),l=q(t,n),d=P(t),f=P(t);if(e.write(`const ${d} = ${i}.trim();`),e.write(`const ${f} = ${c}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),s.hostname!==void 0){let h=q(t,ud);e.write(`if (!${h}(${f}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let h=q(t,ld);e.write(`if (!${h}(${f}, ${l}.protocol)) return INVALID;`)}if(!r)return null;let g=P(t),p=s.normalize?`${f}.href`:`${q(t,UA)}(${d})`;return e.write(`const ${g} = ${p};`),g}let a=n.fn;if(a){if(Xi(a))throw new oe(`async string format ${o}`);let c=q(t,a);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(q9.has(o)&&n.pattern){let c=q(t,n.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${i})) return INVALID;`),i}let A=n.format;switch(A){case"regex":throw new oe("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${st(n.includes)})) return INVALID;`);break;case"starts_with":{let c=n.prefix;e.write(`if (${i}.slice(0, ${c.length}) !== ${st(c)}) return INVALID;`);break}case"ends_with":{let c=n.suffix;e.write(`if (${i}.slice(-${c.length}) !== ${st(c)}) return INVALID;`);break}default:throw new oe(`string format ${A}`)}return i}function ke(e,t,n,i,r=!0){let o=n._zod.def,s=o.type;if(o.coerce)throw new oe(`coercion (z.coerce.${s}())`);let a=r||!!o.checks?.length,A;switch(s){case"string":A=W9(e,t,n,i,a);break;case"number":A=Z9(e,n,i);break;case"boolean":A=K9(e,i);break;case"bigint":A=X9(e,n,i);break;case"symbol":A=eK(e,i);break;case"undefined":A=tK(e,i);break;case"null":A=rK(e,i);break;case"any":case"unknown":A=i;break;case"never":e.write("return INVALID;"),A=i;break;case"void":A=nK(e,i);break;case"nan":A=iK(e,i);break;case"date":A=oK(e,i);break;case"object":A=sK(e,t,n,i,a);break;case"optional":A=aK(e,t,n,i,a);break;case"nullable":A=uK(e,t,n,i,a);break;case"array":A=lK(e,t,n,i,a);break;case"literal":A=dK(e,t,n,i);break;case"enum":A=fK(e,t,n,i);break;case"readonly":{let c=VU(e,t,n,i),l=P(t);e.write(`const ${l} = Object.freeze(${c});`),A=l;break}case"success":VU(e,t,n,i),A="true";break;case"default":case"prefault":A=gK(e,t,n,i);break;case"nonoptional":A=pK(e,t,n,i);break;case"tuple":A=hK(e,t,n,i);break;case"union":A=mK(e,t,n,i);break;case"intersection":A=yK(e,t,n,i);break;case"record":A=CK(e,t,n,i);break;case"map":A=QK(e,t,n,i);break;case"set":A=vK(e,t,n,i);break;case"file":A=wK(e,i);break;case"template_literal":A=bK(e,t,n,i);break;case"lazy":A=kK(e,t,n,i);break;case"pipe":A=SK(e,t,n,i);break;case"custom":A=xK(e,t,n,i);break;case"transform":A=_K(e,t,n,i);break;case"catch":A=DK(e,t,n,i);break;default:throw new oe(`schema type ${s}`)}return A===null?null:L9(e,t,n,A)}function W9(e,t,n,i,r=!0){e.write(`if (typeof ${i} !== "string") return INVALID;`);let o=n._zod.def;return o.format===void 0?i:qU(e,t,o,i,r)}function Z9(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&HU(e,{format:i.format},n),n}function K9(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function X9(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function eK(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function tK(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function rK(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function nK(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function iK(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function oK(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function sK(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,a=Object.keys(s),A=Object.getOwnPropertySymbols(s),c=A.length?[...a,...A]:a,l=C=>typeof C=="symbol"?q(t,C):st(C),d=C=>typeof C=="symbol"?`[${l(C)}]`:st(C),f=s;if(a.includes("__proto__"))throw new oe('object shape key "__proto__"');let g=new Map;for(let C of c){let w=f[C],b=l(C),T=P(t);if(e.write(`const ${T} = ${i}[${b}];`),w._zod.optin!==void 0){let $=P(t);e.write(`let ${$} = (() => {`),e.indented(K=>{let Se=et(K,t,w,T);K.write(`return ${Se};`)}),e.write("})();"),w._zod.optout==="optional"?(e.write(`if (${$} === INVALID) {`),e.indented(K=>{K.write(`if (${b} in ${i}) return INVALID;`),K.write(`${$} = undefined;`)}),e.write("}")):e.write(`if (${$} === INVALID) return INVALID;`),g.set(C,$)}else{cK(w)&&e.write(`if (!(${b} in ${i})) return INVALID;`);let $=et(e,t,w,T,r);$!==null&&g.set(C,$)}}let p=o.catchall,h="none";if(p){let C=p._zod.def.type;if(C==="never"){let w=a.map(b=>`k !== ${st(b)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(b=>{b.write(`if (${w}) return INVALID;`)}),e.write("}")}else(C==="unknown"||C==="any")&&!p._zod.def.checks?.length?h="passthrough":h="schema"}let E=P(t),m=c.some(C=>GU(f[C])||jy(f[C]));if(!r){if(h==="schema"){let C=a.length>0?q(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(w=>{w.write('if (k === "__proto__") continue;'),C&&w.write(`if (${C}.has(k)) continue;`);let b=P(t);w.write(`const ${b} = ${i}[k];`),et(w,t,p,b,!1)}),e.write("}")}return null}if(m){e.write(`const ${E} = {};`);for(let C of c){let w=l(C),b=g.get(C);jy(f[C])?e.write(`if (${w} in ${i}) ${E}[${w}] = ${b};`):GU(f[C])?e.write(`if (${b} !== undefined || ${w} in ${i}) ${E}[${w}] = ${b};`):e.write(`${E}[${w}] = ${b};`)}}else{let C=c.map(w=>`${d(w)}: ${g.get(w)}`).join(", ");e.write(`const ${E} = { ${C} };`)}if(h!=="none"){let C=a.length>0?q(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(w=>{if(w.write('if (k === "__proto__") continue;'),C&&w.write(`if (${C}.has(k)) continue;`),h==="passthrough")w.write(`${E}[k] = ${i}[k];`);else{let b=P(t);w.write(`const ${b} = ${i}[k];`);let T=et(w,t,p,b);w.write(`${E}[k] = ${T};`)}}),e.write("}")}return E}function aK(e,t,n,i,r=!0){let o=n._zod.def;if(AK(n))return ke(e,t,o.innerType,i,r);if(o.innerType._zod.optin==="defaulted"){let a=P(t),A=P(t);return e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(c=>{c.write(`const ${A} = (() => {`),c.indented(l=>{let d=ke(l,t,o.innerType,i);l.write(`return ${d};`)}),c.write("})();"),c.write(`if (${A} !== INVALID) ${a} = ${A};`)}),e.write("} else {"),e.indented(c=>{let l=ke(c,t,o.innerType,i);c.write(`${a} = ${l};`)}),e.write("}"),a}let s=r?P(t):null;return s&&e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(a=>{let A=ke(a,t,o.innerType,i,r);s&&A!==null&&a.write(`${s} = ${A};`)}),e.write("}"),s}function AK(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function cK(e){return e._zod.optin===void 0&&Zi(e)}function Zi(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Zi(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Zi(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Zi):!0;case"intersection":return!t.left||!t.right?!0:Zi(t.left)&&Zi(t.right);case"pipe":return t.in?Zi(t.in):!0;default:return!0}}function jy(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function GU(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&_s(e)}function _s(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?_s(t.innerType):!0;case"union":return t.options?t.options.some(_s):!0;case"intersection":return!t.left||!t.right||_s(t.left)||_s(t.right);case"pipe":return t.out?_s(t.out):!0;default:return!0}}function uK(e,t,n,i,r=!0){let o=n._zod.def,s=r?P(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${i} !== null) {`),e.indented(a=>{let A=ke(a,t,o.innerType,i,r);s&&A!==null&&a.write(`${s} = ${A};`)}),e.write("}"),s}function Wy(e,t,n){for(let[i,r]of Bs(t._zod.def.checks))e.write(`if (${n} > ${Pn(i,r._zod.def.check)}) return INVALID;`)}function lK(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`),Wy(e,n,`${i}.length`);let s=r?P(t):null,a=P(t),A=P(t);return s&&e.write(`const ${s} = new Array(${i}.length);`),e.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),e.indented(c=>{c.write(`const ${A} = ${i}[${a}];`);let l=et(c,t,o.element,A,r);s&&l!==null&&c.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function dK(e,t,n,i){let o=n._zod.def.values;if(o.length!==1){let a=q(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}let s=o[0];if(typeof s=="number"&&Number.isNaN(s)){let a=q(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof s=="string")e.write(`if (${i} !== ${st(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${i} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${i} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${i} !== ${s}n) return INVALID;`);else throw new oe(`literal type ${typeof s}`);return i}function fK(e,t,n,i){let r=n._zod.values;if(!r)throw new oe("enum schema without enumerated values");let o=q(t,r);return e.write(`if (!${o}.has(${i})) return INVALID;`),i}function VU(e,t,n,i){let r=n._zod.def;return ke(e,t,r.innerType,i)}function gK(e,t,n,i){let r=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return ke(e,t,r.innerType,i);let A=q(t,s),c=P(t);return e.write(`let ${c} = ${i};`),e.write(`if (${i} === undefined) ${c} = ${A}();`),ke(e,t,r.innerType,c)}let a=P(t);if(s){let A=q(t,s),c=q(t,mA);e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(l=>{l.write(`${a} = ${c}(${A}());`)}),e.write("} else {"),e.indented(l=>{let d=ke(l,t,r.innerType,i);l.write(`${a} = ${d} === undefined ? ${c}(${A}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${i} !== undefined) {`),e.indented(A=>{let c=ke(A,t,r.innerType,i);A.write(`${a} = ${c};`)}),e.write("}");return a}function pK(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.innerType,i),s=P(t);return e.write(`const ${s} = ${o};`),e.write(`if (${s} === undefined) return INVALID;`),s}function hK(e,t,n,i){let r=n._zod.def,o=r.items,s=r.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let a=JU(o,"optin"),A=JU(o,"optout");s?e.write(`if (${i}.length < ${a}) return INVALID;`):e.write(`if (${i}.length < ${a} || ${i}.length > ${o.length}) return INVALID;`);let c=P(t);e.write(`const ${c} = [];`);for(let l=0;l<o.length;l++){let d=o[l];if(l>=A)e.write(`if (${c}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${i}.length) {`),f.indented(g=>{let p=P(t);g.write(`const ${p} = ${i}[${l}];`);let h=et(g,t,d,p);g.write(`${c}[${l}] = ${h};`)}),f.write("} else {"),f.indented(g=>{if(jy(d)){g.write(`${c}.length = ${l};`);return}let p=P(t),h=P(t);g.write(`const ${p} = undefined;`),g.write(`const ${h} = (() => {`),g.indented(E=>{let m=et(E,t,d,p);E.write(`return ${m};`)}),g.write("})();"),g.write(`if (${h} === INVALID || ${h} === undefined) ${c}.length = ${l};`),g.write(`else ${c}[${l}] = ${h};`)}),f.write("}")}),e.write("}");else{let f=P(t);e.write(`const ${f} = ${i}[${l}];`);let g=et(e,t,d,f);e.write(`${c}[${l}] = ${g};`)}}if(s){let l=P(t),d=P(t);e.write(`for (let ${l} = ${o.length}; ${l} < ${i}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${i}[${l}];`);let g=et(f,t,s,d);f.write(`${c}[${l}] = ${g};`)}),e.write("}")}return c}function JU(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function mK(e,t,n,i){let r=n._zod.def,o=r.options;if(r.discriminator)return IK(e,t,r,i);if(r.inclusive===!1)throw new oe("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),i;if(o.length===1)return ke(e,t,o[0],i);if(o.every(A=>A._zod.def.type==="literal"&&!A._zod.def.checks?.length)){let A=new Set(o.flatMap(l=>l._zod.def.values)),c=q(t,A);return e.write(`if (!${c}.has(${i})) return INVALID;`),i}let a=P(t);e.write(`let ${a};`);for(let A=0;A<o.length;A++){let c=o[A];A===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let d=ke(l,t,c,i);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function IK(e,t,n,i){if(n.unionFallback)throw new oe("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),i;let r=P(t),o=P(t);e.write(`const ${r} = ${i}?.[${st(n.discriminator)}];`),e.write(`let ${o};`);let s=!0,a=new Set;for(let A of n.options){let c=A._zod.propValues?.[n.discriminator];if(!c||c.size===0)throw new oe("discriminated union option without static discriminator values");for(let f of c){if(a.has(f))throw new oe(`duplicate discriminator value ${String(f)}`);a.add(f)}let l=Array.from(c,f=>EK(t,r,f)),d=s?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let g=ke(f,t,A,i);f.write(`${o} = ${g};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),o}function EK(e,t,n){if(typeof n=="string")return`${t} === ${st(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let i=q(e,n);return`${t} === ${i}`}throw new oe(`literal discriminator value ${String(n)}`)}function yK(e,t,n,i){let r=n._zod.def;t.definite=!1;let o=et(e,t,r.left,i),s=et(e,t,r.right,i),a=q(t,xs),A=P(t);return e.write(`const ${A} = ${a}(${o}, ${s});`),e.write(`if (!${A}.valid) return INVALID;`),`${A}.data`}function CK(e,t,n,i){let r=n._zod.def,o=q(t,Zt);e.write(`if (!${o}(${i})) return INVALID;`);let s=P(t),a=P(t),A=P(t);e.write(`const ${s} = {};`);let c=r,l=c.partial?void 0:r.keyType._zod.values;if(l){let g=[];for(let h of l){if(!(typeof h=="string"||typeof h=="number"||typeof h=="symbol"))throw new oe(`record key value ${String(h)}`);let E=typeof h=="number"?h.toString():h;if(E==="__proto__")throw new oe('record key "__proto__"');g.push(E);let m=q(t,h),C=ke(e,t,r.keyType,m),w=P(t);e.write(`const ${w} = ${i}[${BK(t,E)}];`);let b=et(e,t,r.valueType,w);e.write(`${s}[${C}] = ${b};`)}let p=q(t,new Set(g));return e.write(`for (const ${a} in ${i}) {`),e.indented(h=>{h.write(`if (${p}.has(${a})) continue;`),c.mode==="loose"?h.write(`if (${a} !== "__proto__") ${s}[${a}] = ${i}[${a}];`):h.write("return INVALID;")}),e.write("}"),s}let d=r.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let g=r.mode==="loose",p=$d(r.keyType);p.definite===!1&&(t.definite=!1);let h=q(t,p),E=q(t,un),m=P(t);return YU(e,t,i,a,C=>{C.write(`let ${m} = ${h}(${a});`),C.write(`if (${m} === INVALID && typeof ${a} === "string" && ${E}.test(${a})) ${m} = ${h}(Number(${a}));`),g?C.write(`if (${m} === INVALID) { ${s}[${a}] = ${i}[${a}]; continue; }`):C.write(`if (${m} === INVALID) return INVALID;`),C.write(`if (${m} === "__proto__") continue;`);let w=P(t);C.write(`const ${w} = ${i}[${a}];`);let b=et(C,t,r.valueType,w);C.write(`${s}[${m}] = ${b};`)}),s}return YU(e,t,i,a,g=>{g.write(`const ${A} = ${i}[${a}];`);let p=et(g,t,r.valueType,A);g.write(`${s}[${a}] = ${p};`)},"return INVALID;"),s}function YU(e,t,n,i,r,o){let s=q(t,Object.prototype.propertyIsEnumerable),a=P(t),A=P(t),c=P(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${A} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${c} = 0; ${c} < ${A}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${i} = ${A}[${c}];`),l.write(`if (${i} === "__proto__" || !${s}.call(${n}, ${i})) continue;`),r(l)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${a}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${i} = ${a}[${c}];`),l.write(`if (!${s}.call(${n}, ${i})) continue;`),o?l.write(o):r(l)}),e.write("}")}function BK(e,t){return typeof t=="string"?st(t):q(e,t)}function QK(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`),Wy(e,n,`${i}.size`);let o=P(t),s=P(t),a=P(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${s}, ${a}] of ${i}) {`),e.indented(A=>{let c=ke(A,t,r.keyType,s),l=ke(A,t,r.valueType,a);A.write(`${o}.set(${c}, ${l});`)}),e.write("}"),o}function vK(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`),Wy(e,n,`${i}.size`);let o=P(t),s=P(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${s} of ${i}) {`),e.indented(a=>{let A=ke(a,t,r.valueType,s);a.write(`${o}.add(${A});`)}),e.write("}"),o}function wK(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function bK(e,t,n,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let r=n._zod.pattern;if(r){let o=q(t,r);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${i})) return INVALID;`)}return i}function kK(e,t,n,i){let r=n._zod.def,o=Ki(t,r.getter),s=q(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(A=>{A.write(`const inner = ${o}();`),A.write(`${s}.parser = function(input) {`),A.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),A.write("};")}),e.write("}");let a=P(t);return e.write(`const ${a} = ${s}.parser(${i});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function SK(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.in,i);if(r.transform){if(Xi(r.transform))throw new mr("z.compile: async transforms in pipes are not supported");let s=r.transform,A=Ki(t,l=>{let d={value:l,issues:[],addIssue:qy},f=s(l,d);return f instanceof Promise?At:d.issues.length===0?f:At}),c=P(t);return e.write(`const ${c} = ${A}(${o});`),e.write(`if (${c} === INVALID) return INVALID;`),ke(e,t,r.out,c)}else return ke(e,t,r.out,o)}function Xi(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function xK(e,t,n,i){let r=n._zod.def;if(r.fn){if(Xi(r.fn))throw new mr("z.compile: async custom predicates are not supported");let o=Ki(t,r.fn),s=q(t,Yy),a=P(t);e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new oe("custom schema without a predicate function");return i}function RK(e,t,n){let i=e._zod.run({value:n,issues:[]},{});if(i&&typeof i.then=="function")return At;let r=i;return r.issues.length===0?r.value:t()}function DK(e,t,n,i){let r=n._zod.def;if(!r.catchValue[Pl])throw new oe("catch with a callback (only a constant catch value compiles)",!1);let o=P(t);e.write(`let ${o} = (() => {`),e.indented(c=>{let l=et(c,t,r.innerType,i);c.write(`return ${l};`)}),e.write("})();");let s=q(t,r.innerType),a=Ki(t,r.catchValue),A=q(t,RK);return e.write(`if (${o} === INVALID) {`),e.indented(c=>{c.write(`${o} = ${A}(${s}, ${a}, ${i});`),c.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function _K(e,t,n,i){let r=n._zod.def;if(r.transform){if(Xi(r.transform))throw new mr("z.compile: async transforms are not supported");let o=r.transform,a=Ki(t,c=>{let l={value:c,issues:[],addIssue:qy},d=o(c,l);return d instanceof Promise?At:l.issues.length===0?d:At}),A=P(t);return e.write(`const ${A} = ${a}(${i});`),e.write(`if (${A} === INVALID) return INVALID;`),A}return i}function Td(e){return e.checks&&(e.checks=[...e.checks]),e}function Zy(e,t){return new e(Td({type:"string",...x(t)}))}function Ky(e,t){return new e(Td({type:"string",coerce:!0,...x(t)}))}function Fd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}function Md(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}function Ld(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}function Pd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}function Od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}function zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}function jA(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}function Gd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}function Vd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}function Jd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}function Yd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}function jd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}function Hd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}function qd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}function Wd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}function Zd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}function Xy(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...x(t)})}function Kd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}function Xd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}function ef(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}function tf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}function rf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}function eC(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...x(t)})}function tC(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...x(t)})}function nf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}var rC={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function HA(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}function qA(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}function WA(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}function ZA(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}function nC(e,t){return new e(Td({type:"number",checks:[],...x(t)}))}function iC(e,t){return new e(Td({type:"number",coerce:!0,checks:[],...x(t)}))}function oC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}function sC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...x(t)})}function aC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...x(t)})}function AC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...x(t)})}function cC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...x(t)})}function uC(e,t){return new e({type:"boolean",...x(t)})}function lC(e,t){return new e({type:"boolean",coerce:!0,...x(t)})}function dC(e,t){return new e({type:"bigint",...x(t)})}function fC(e,t){return new e({type:"bigint",coerce:!0,...x(t)})}function gC(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...x(t)})}function pC(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...x(t)})}function hC(e,t){return new e({type:"symbol",...x(t)})}function mC(e,t){return new e({type:"undefined",...x(t)})}function IC(e,t){return new e({type:"null",...x(t)})}function EC(e){return new e({type:"any"})}function yC(e){return new e({type:"unknown"})}function CC(e,t){return new e({type:"never",...x(t)})}function BC(e,t){return new e({type:"void",...x(t)})}function QC(e,t){return new e({type:"date",...x(t)})}function vC(e,t){return new e({type:"date",coerce:!0,...x(t)})}function wC(e,t){return new e({type:"nan",...x(t)})}function Pr(e,t){return new rd({check:"less_than",...x(t),value:e,inclusive:!1})}function Ft(e,t){return new rd({check:"less_than",...x(t),value:e,inclusive:!0})}function Or(e,t){return new nd({check:"greater_than",...x(t),value:e,inclusive:!1})}function Mt(e,t){return new nd({check:"greater_than",...x(t),value:e,inclusive:!0})}function of(e){return Or(0,e)}function sf(e){return Pr(0,e)}function af(e){return Ft(0,e)}function Af(e){return Mt(0,e)}function On(e,t){return new aE({check:"multiple_of",...x(t),value:e})}function zn(e,t){return new uE({check:"max_size",...x(t),maximum:e})}function zr(e,t){return new lE({check:"min_size",...x(t),minimum:e})}function eo(e,t){return new dE({check:"size_equals",...x(t),size:e})}function to(e,t){return new fE({check:"max_length",...x(t),maximum:e})}function ln(e,t){return new gE({check:"min_length",...x(t),minimum:e})}function ro(e,t){return new pE({check:"length_equals",...x(t),length:e})}function Ns(e,t){return new hE({check:"string_format",format:"regex",...x(t),pattern:e})}function Us(e){return new mE({check:"string_format",format:"lowercase",...x(e)})}function $s(e){return new IE({check:"string_format",format:"uppercase",...x(e)})}function Ts(e,t){return new EE({check:"string_format",format:"includes",...x(t),includes:e})}function Fs(e,t){return new yE({check:"string_format",format:"starts_with",...x(t),prefix:e})}function Ms(e,t){return new CE({check:"string_format",format:"ends_with",...x(t),suffix:e})}function cf(e,t,n){return new BE({check:"property",property:e,schema:t,...x(n)})}function Ls(e,t){return new QE({check:"properties",shape:e,...x(t)})}function Ps(e,t){return new vE({check:"mime_type",mime:e,...x(t)})}function Ir(e){return new wE({check:"overwrite",tx:e})}function Os(e){return Ir(t=>t.normalize(e))}function zs(){return Ir(e=>e.trim())}function Gs(){return Ir(e=>e.toLowerCase())}function Vs(){return Ir(e=>e.toUpperCase())}function Js(){return Ir(e=>cI(e))}function bC(e,t,n){return new e({type:"array",element:t,...x(n)})}function NK(e,t,n){return new e({type:"union",options:t,...x(n)})}function UK(e,t,n){return new e({type:"union",options:t,inclusive:!1,...x(n)})}function $K(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...x(i)})}function TK(e,t,n){return new e({type:"intersection",left:t,right:n})}function FK(e,t,n,i){let r=n instanceof Z,o=r?i:n,s=r?n:null;return new e({type:"tuple",items:t,rest:s,...x(o)})}function MK(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...x(i)})}function LK(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...x(i)})}function PK(e,t,n){return new e({type:"set",valueType:t,...x(n)})}function OK(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...x(n)})}function zK(e,t,n){return new e({type:"enum",entries:t,...x(n)})}function GK(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...x(n)})}function kC(e,t){return new e({type:"file",...x(t)})}function VK(e,t){return new e({type:"transform",transform:t})}function JK(e,t){return new e({type:"optional",innerType:t})}function YK(e,t){return new e({type:"nullable",innerType:t})}function jK(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():mA(n)}})}function HK(e,t,n){return new e({type:"nonoptional",innerType:t,...x(n)})}function qK(e,t){return new e({type:"success",innerType:t})}function WK(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:pI(n)})}function ZK(e,t,n){return new e({type:"pipe",in:t,out:n})}function KK(e,t){return new e({type:"readonly",innerType:t})}function XK(e,t,n){return new e({type:"template_literal",parts:t,...x(n)})}function e8(e,t){return new e({type:"lazy",getter:t})}function t8(e,t){return new e({type:"promise",innerType:t})}function SC(e,t,n){let i=x(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function xC(e,t,n){return new e({type:"custom",check:"custom",fn:t,...x(n)})}function RC(e,t){let n=WU(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(Qs(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(Qs(o))}},e(i.value,i)),t);return n}function WU(e,t){let n=new ye({check:"custom",...x(t)});return n._zod.check=e,n}function DC(e){let t=new ye({check:"describe"});return t._zod.onattach=[n=>{let i=He.get(n)??{};He.add(n,{...i,description:e})}],t._zod.check=()=>{},t}function _C(e){let t=new ye({check:"meta"});return t._zod.onattach=[n=>{let i=He.get(n)??{};He.add(n,{...i,...e})}],t._zod.check=()=>{},t}function NC(e,t){let n=x(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(g=>typeof g=="string"?g.toLowerCase():g),r=r.map(g=>typeof g=="string"?g.toLowerCase():g));let o=new Set(i),s=new Set(r),a=e.Codec??PA,A=e.Boolean??MA,c=e.String??Wi,l=new c({type:"string",error:n.error}),d=new A({type:"boolean",error:n.error}),f=new a({type:"pipe",in:l,out:d,transform:((g,p)=>{let h=g;return n.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(p.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:p.value,inst:f,continue:!1}),{})}),reverseTransform:((g,p)=>g===!0?i[0]||"true":r[0]||"false"),error:n.error});return f._zod.bag.truthy=i,f._zod.bag.falsy=r,f._zod.bag.case=n.case??"insensitive",f}function no(e,t,n,i={}){let r=x(i),o={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}function KA(e,...t){for(let n of t)for(let i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&je(e,i,n[i]);return e}function Gn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??He,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Fe(e,t,n,i,r){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:r}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(r);return Object.assign(n,o),!0}function pe(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let f=s.schema,g=t.processors[r.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);g(e,t,f,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),pe(d,t,l),t.seen.get(d).isParent=!0)}let A=t.metadataRegistry.get(e);return A&&KA(s.schema,A),t.io==="input"&&ct(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ZU(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Vn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let A=i.get(a);if(A&&A!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let r=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,f=e.external.uri??(p=>p);if(d)return{ref:f(d)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${f("__shared")}#/${a}/${ZU(g)}`}}let A="#",c=`${A}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:A};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+ZU(l)}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:A,defId:c}=r(s);a.def={...a.schema},c&&(a.defId=c);let l=a.schema;for(let d in l)delete l[d];l.$ref=A};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
187
187
|
|
|
188
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}a.count>1&&e.reused==="ref"&&o(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function e$(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;e$(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var t$=new Set(["type","properties","required","additionalProperties"]),KU=["oneOf","anyOf"];function XU(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function UC(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!t$.has(s))return null;t.push(o)}let n={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let c of t){let l=c.properties?.[s]??XU(c);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let A=a.length===1?a[0]:UC(a)??{allOf:a};je(n,s,A)}for(let s of o.required??[])i.add(s)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(o=>o.additionalProperties===!1))r.additionalProperties=!1;else{let o=[];for(let s of t){let a=XU(s);a&&!o.some(A=>JSON.stringify(A)===JSON.stringify(a))&&o.push(a)}o.length===1?r.additionalProperties=o[0]:o.length>1&&(r.additionalProperties={allOf:o})}return r}function r8(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of t$)if(r in e)return;let n=t.filter(r=>KU.some(o=>Array.isArray(r[o]))),i=null;if(!n.length)i=UC(t);else{let r=n[0],o=KU.find(A=>Array.isArray(r[A]));if(Object.keys(r).length!==1)return;let s=t.filter(A=>A!==r),a=r[o].map(A=>UC([...s,A]));if(a.some(A=>!A))return;i={[o]:a}}i&&(delete e.allOf,KA(e,i))}function Jn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let A=e.seen.get(a);if(A.ref===null)return;let c=A.def??A.schema,l={...c},d=A.ref;if(A.ref=null,d){i(d);let g=e.seen.get(d),p=g.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):KA(c,p),KA(c,l),a._zod.parent===d)for(let E in c)E==="$ref"||E==="allOf"||E in l||delete c[E];if(p.$ref&&g.def)for(let E in c)E==="$ref"||E==="allOf"||E in g.def&&JSON.stringify(c[E])===JSON.stringify(g.def[E])&&delete c[E]}let f=a._zod.parent;if(f&&f!==d){i(f);let g=e.seen.get(f);if(g?.schema.$ref&&(c.$ref=g.schema.$ref,g.def))for(let p in c)p==="$ref"||p==="allOf"||p in g.def&&JSON.stringify(c[p])===JSON.stringify(g.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:A.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())e$(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let A of e.seen.values())for(let c of[A.schema,A.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(c):a.set(l,[c])}for(let A of e.intersections)for(let c of a.get(A)??[])r8(c)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}KA(r,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let A=a[1];A.def&&A.defId&&(A.def.id===A.defId&&delete A.def.id,je(s,A.defId,A.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ys(t,"input",e.processors),output:Ys(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ct(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return ct(i.element,n);if(i.type==="set")return ct(i.valueType,n);if(i.type==="lazy")return ct(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return ct(i.innerType,n);if(i.type==="intersection")return ct(i.left,n)||ct(i.right,n);if(i.type==="record"||i.type==="map")return ct(i.keyType,n)||ct(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ct(i.in,n)||ct(i.out,n);if(i.type==="object"){for(let r in i.shape)if(ct(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(ct(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(ct(r,n))return!0;return!!(i.rest&&ct(i.rest,n))}return!1}var $C=(e,t={})=>n=>{let i=Gn({...n,processors:t});return pe(e,i),Vn(i,e),Jn(i,e)},Ys=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},s=Gn({...r??{},target:o,io:t,processors:n});return pe(e,s),Vn(s,e),Jn(s,e)};var js=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Hs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},r$=(e,t)=>{js(e,"minimum",t),Hs(e,"maximum",t)},s$=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},a$=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},A$=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},c$=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},n$=(e,t)=>js(e,"minimum",t.minimum),i$=(e,t)=>Hs(e,"maximum",t.maximum),o$=e=>(t,n)=>{c$(t,n.format);let[i,r]=e[n.format];js(t,"minimum",i),Hs(t,"maximum",r)},n8={greater_than:(e,t)=>js(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Hs(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>s$(e,t.value),number_format:o$(EA),bigint_format:o$(yA),min_length:n$,max_length:i$,length_equals:(e,t)=>r$(e,t.length),min_size:n$,max_size:i$,size_equals:(e,t)=>r$(e,t.size),string_format:(e,t)=>{c$(e,t.format),t.pattern&&a$(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>A$(e,t.mime)};function Me(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of i)n8[o._zod.def.check]?.(t,o._zod.def);let r=e._zod.bag;r.minimum!==void 0&&js(t,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&js(t,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Hs(t,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Hs(t,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&s$(t,r.multipleOf),r.format!==void 0&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&A$(t,r.mime);for(let o of r.patterns??[])a$(t,o);return t}var i8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o8=new Map([[fd,OI],[FA,zI]]),u$=e=>o8.get(e)??e,MC=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:s,format:a,patterns:A,contentEncoding:c,laxFormat:l}=Me(e);if(typeof o=="number"&&(r.minLength=o),typeof s=="number"&&(r.maxLength=s),a&&(r.format=i8[a]??a,r.format===""&&delete r.format,(a==="time"||l)&&delete r.format),c&&(r.contentEncoding=c),A&&A.size>0){let d=[...A].map(u$);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},LC=(e,t,n,i)=>{let r=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:A,exclusiveMinimum:c,isInt:l}=Me(e);r.type=l?"integer":"number";let d=typeof c=="number"&&c>=(o??Number.NEGATIVE_INFINITY),f=typeof A=="number"&&A<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d?g?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:typeof o=="number"&&(r.minimum=o),f?g?(r.maximum=A,r.exclusiveMaximum=!0):r.exclusiveMaximum=A:typeof s=="number"&&(r.maximum=s),a){let p=new Set;for(let m of a)Number.isFinite(m)&&m!==0?p.add(Math.abs(m)):Fe(e,t,r,i,`A multipleOf divisor of ${m} cannot be represented in JSON Schema`);let[h,...E]=p;h!==void 0&&(r.multipleOf=h),E.length&&(r.allOf=[...r.allOf??[],...E.map(m=>({multipleOf:m}))])}},PC=(e,t,n,i)=>{n.type="boolean"},OC=(e,t,n,i)=>{Fe(e,t,n,i,"BigInt cannot be represented in JSON Schema")},zC=(e,t,n,i)=>{Fe(e,t,n,i,"Symbols cannot be represented in JSON Schema")},GC=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},VC=(e,t,n,i)=>{Fe(e,t,n,i,"Undefined cannot be represented in JSON Schema")},JC=(e,t,n,i)=>{Fe(e,t,n,i,"Void cannot be represented in JSON Schema")},YC=(e,t,n,i)=>{n.not={}},jC=(e,t,n,i)=>{},HC=(e,t,n,i)=>{},qC=(e,t,n,i)=>{Fe(e,t,n,i,"Date cannot be represented in JSON Schema")},WC=(e,t,n,i)=>{let r=e._zod.def,o=Is(r.entries);if(o.length===0){n.not={};return}o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},ZC=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let o=[];for(let s of r.values)if(s===void 0){if(Fe(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Fe(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),o.every(s=>typeof s=="boolean")&&(n.type="boolean"),o.every(s=>s===null)&&(n.type="null"),n.enum=o},KC=(e,t,n,i)=>{Fe(e,t,n,i,"NaN cannot be represented in JSON Schema")},XC=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},eB=(e,t,n,i)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=Me(e);o!==void 0&&(r.minLength=o),s!==void 0&&(r.maxLength=s),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(A=>({contentMediaType:A})))},tB=(e,t,n,i)=>{n.type="boolean"},rB=(e,t,n,i)=>{Fe(e,t,n,i,"Custom types cannot be represented in JSON Schema")},nB=(e,t,n,i)=>{Fe(e,t,n,i,"Function types cannot be represented in JSON Schema")},iB=(e,t,n,i)=>{Fe(e,t,n,i,"Transforms cannot be represented in JSON Schema")},oB=(e,t,n,i)=>{Fe(e,t,n,i,"Map cannot be represented in JSON Schema")},sB=(e,t,n,i)=>{Fe(e,t,n,i,"Set cannot be represented in JSON Schema")},aB=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:s,maximum:a}=Me(e);typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=pe(o.element,t,{...i,path:[...i.path,"items"]})};function XA(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?XA(t.out):t.type==="catch"?XA(t.innerType):e._zod.optin}var AB=(e,t,n,i)=>{let r=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&Fe(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let c in s)je(r.properties,c,pe(s[c],t,{...i,path:[...i.path,"properties",c]}));let A=[];for(let c of Object.keys(s)){let l=o.shape[c];(t.io==="input"?XA(l)===void 0:l._zod.optout===void 0)&&A.push(c)}A.length>0&&(r.required=A),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=pe(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},lf=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,s=r.options.map((a,A)=>pe(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",A]}));o?n.oneOf=s:n.anyOf=s},cB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.left,t,{...i,path:[...i.path,"allOf",0]}),s=pe(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,A=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=A,t.intersections.push(A)},uB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",A=o.items.map((h,E)=>pe(h,t,{...i,path:[...i.path,s,E]})),c=o.rest?pe(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?XA(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(r.prefixItems=A,f?r.items=!1:c&&(r.items=c),l>0&&(r.minItems=l),f&&(r.maxItems=d)):t.target==="openapi-3.0"?(r.items={anyOf:A},c&&r.items.anyOf.push(c),l>0&&(r.minItems=l),f&&(r.maxItems=d)):(r.items=A,f?r.additionalItems=!1:c&&(r.additionalItems=c),l>0&&(r.minItems=l),f&&(r.maxItems=d));let{minimum:g,maximum:p}=Me(e);typeof g=="number"&&(r.minItems=g),typeof p=="number"&&(r.maxItems=p)};function TC(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let p=e.get(t)?.def;if(!p)return t;let h=TC(e,p,n);return h===p?t:h}for(let p of["anyOf","oneOf"]){let h=t[p];if(!Array.isArray(h))continue;let E=h.map(m=>TC(e,m,n));E.some((m,C)=>m!==h[C])&&(t={...t,[p]:E})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(p=>p==="number"||p==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!o?.some(p=>typeof p=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:A,exclusiveMaximum:c,multipleOf:l,format:d,id:f,...g}=t;return g.enum?g.enum=g.enum.map(p=>typeof p=="number"?String(p):p):typeof g.const=="number"&&(g.const=String(g.const)),r&&(g.type="string",o||(g.pattern=(i.includes("number")?un:RA).source)),g}var FC=new WeakMap;function s8(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of FC.get(e)??[]){let r=e.seen.get(i),o=(r?.def??r?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=TC(t,o,new Set);s!==o&&n.set(o,s)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}var lB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let s=o.keyType,a=Me(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=pe(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)je(r.patternProperties,u$(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=pe(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let l=FC.get(t);l||(l=[],FC.set(t,l),t.deferred.push(()=>s8(t))),l.push(e)}r.additionalProperties=pe(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let A=s._zod.values,c=t.io==="input"&&XA(o.valueType)!==void 0;if(A&&!o.partial&&!c){let l=[...A].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(r.required=l.map(String))}},dB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},fB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},gB=Symbol();function l$(e,t,n,i,r){let o=!1,s=JSON.stringify(e,(a,A)=>typeof A!="bigint"?A:(o=!0,null));return o?(Fe(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),gB):JSON.parse(s)}var pB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s=l$(r.defaultValue,e,t,n,i);s!==gB&&(n.default=s)},hB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);if(o.ref=r.innerType,t.io!=="input")return;let s=l$(r.defaultValue,e,t,n,i);s!==gB&&(n._prefault=s)},mB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{Fe(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},IB=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?r.out:r.in:r.out;pe(s,t,i);let a=t.seen.get(e);a.ref=s},EB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},yB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},df=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},CB=(e,t,n,i)=>{let r=e._zod.innerType;pe(r,t,i);let o=t.seen.get(e);o.ref=r},uf={string:MC,number:LC,boolean:PC,bigint:OC,symbol:zC,null:GC,undefined:VC,void:JC,never:YC,any:jC,unknown:HC,date:qC,enum:WC,literal:ZC,nan:KC,template_literal:XC,file:eB,success:tB,custom:rB,function:nB,transform:iB,map:oB,set:sB,array:aB,object:AB,union:lf,intersection:cB,tuple:uB,record:lB,nullable:dB,nonoptional:fB,default:pB,prefault:hB,catch:mB,pipe:IB,readonly:EB,promise:yB,optional:df,lazy:CB};function ff(e,t){if("_idmap"in e){let i=e,r=Gn({...t,processors:uf}),o={};for(let A of i._idmap.entries()){let[c,l]=A;pe(l,r)}let s={},a={registry:i,uri:t?.uri,defs:o};r.external=a;for(let A of i._idmap.entries()){let[c,l]=A;Vn(r,l),je(s,c,Jn(r,l))}if(Object.keys(o).length>0){let A=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[A]:o}}return{schemas:s}}let n=Gn({...t,processors:uf});return pe(e,n),Vn(n,e),Jn(n,e)}var gf=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Gn({processors:uf,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return pe(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Vn(this.ctx,t);let i=Jn(this.ctx,t),{"~standard":r,...o}=i;return o}};var d$={};var ra={};Br(ra,{ZodAny:()=>GB,ZodArray:()=>jB,ZodBase64:()=>Nf,ZodBase64URL:()=>Uf,ZodBigInt:()=>ea,ZodBigIntFormat:()=>Ff,ZodBoolean:()=>Xs,ZodCIDRv4:()=>Df,ZodCIDRv6:()=>_f,ZodCUID:()=>vf,ZodCUID2:()=>wf,ZodCatch:()=>gQ,ZodCodec:()=>cc,ZodCreditCard:()=>$B,ZodCustom:()=>uc,ZodCustomStringFormat:()=>ao,ZodDate:()=>nc,ZodDefault:()=>AQ,ZodDiscriminatedUnion:()=>qB,ZodE164:()=>$f,ZodEmail:()=>yf,ZodEmoji:()=>Bf,ZodEnum:()=>Ws,ZodExactOptional:()=>Of,ZodFile:()=>iQ,ZodFunction:()=>vQ,ZodGUID:()=>Cf,ZodIBAN:()=>TB,ZodIPv4:()=>xf,ZodIPv6:()=>Rf,ZodISODate:()=>jn,ZodISODateTime:()=>Yn,ZodISODuration:()=>qn,ZodISOTime:()=>Hn,ZodInstanceOf:()=>kQ,ZodIntersection:()=>WB,ZodJWT:()=>Tf,ZodKSUID:()=>Sf,ZodLazy:()=>CQ,ZodLiteral:()=>nQ,ZodMAC:()=>UB,ZodMap:()=>tQ,ZodNaN:()=>hQ,ZodNanoID:()=>Qf,ZodNever:()=>JB,ZodNonOptional:()=>zf,ZodNull:()=>OB,ZodNullable:()=>aQ,ZodNumber:()=>Ks,ZodNumberFormat:()=>Ao,ZodObject:()=>oc,ZodOptional:()=>ac,ZodPipe:()=>Ac,ZodPrefault:()=>uQ,ZodPreprocess:()=>mQ,ZodPromise:()=>QQ,ZodReadonly:()=>IQ,ZodRecord:()=>qs,ZodSet:()=>rQ,ZodString:()=>Zs,ZodStringFormat:()=>me,ZodSuccess:()=>fQ,ZodSymbol:()=>LB,ZodTemplateLiteral:()=>yQ,ZodTransform:()=>oQ,ZodTuple:()=>KB,ZodType:()=>ee,ZodULID:()=>bf,ZodURL:()=>rc,ZodUUID:()=>Gr,ZodUndefined:()=>PB,ZodUnion:()=>sc,ZodUnknown:()=>VB,ZodVoid:()=>YB,ZodXID:()=>kf,ZodXor:()=>HB,_ZodString:()=>Ef,_default:()=>cQ,_function:()=>vT,any:()=>tT,array:()=>ic,base64:()=>$$,base64url:()=>T$,bigint:()=>W$,boolean:()=>MB,catch:()=>pQ,check:()=>wT,cidrv4:()=>N$,cidrv6:()=>U$,codec:()=>yT,creditCard:()=>M$,cuid:()=>w$,cuid2:()=>b$,currencyCode:()=>V$,custom:()=>bT,date:()=>nT,describe:()=>kT,discriminatedUnion:()=>cT,e164:()=>F$,email:()=>p$,emoji:()=>Q$,enum:()=>Lf,exactOptional:()=>sQ,file:()=>hT,float32:()=>Y$,float64:()=>j$,function:()=>vT,guid:()=>h$,hash:()=>J$,hex:()=>G$,hostname:()=>z$,httpUrl:()=>B$,iban:()=>L$,instanceof:()=>xT,int:()=>mf,int32:()=>H$,int64:()=>Z$,intersection:()=>ZB,invertCodec:()=>CT,ipv4:()=>R$,ipv6:()=>_$,json:()=>DT,jwt:()=>P$,keyof:()=>iT,ksuid:()=>x$,lazy:()=>BQ,literal:()=>pT,looseObject:()=>aT,looseRecord:()=>lT,mac:()=>D$,map:()=>dT,meta:()=>ST,nan:()=>ET,nanoid:()=>v$,nativeEnum:()=>gT,never:()=>Mf,nonoptional:()=>dQ,null:()=>zB,nullable:()=>tc,nullish:()=>mT,number:()=>FB,object:()=>oT,optional:()=>oo,partialRecord:()=>uT,pipe:()=>If,prefault:()=>lQ,preprocess:()=>_T,promise:()=>QT,readonly:()=>EQ,record:()=>eQ,refine:()=>wQ,set:()=>fT,strictObject:()=>sT,string:()=>ec,stringFormat:()=>O$,stringbool:()=>RT,success:()=>IT,superRefine:()=>bQ,symbol:()=>X$,templateLiteral:()=>BT,transform:()=>Pf,tuple:()=>XB,uint32:()=>q$,uint64:()=>K$,ulid:()=>k$,undefined:()=>eT,union:()=>ta,unknown:()=>io,url:()=>C$,uuid:()=>m$,uuidv4:()=>I$,uuidv6:()=>E$,uuidv7:()=>y$,void:()=>rT,xid:()=>S$,xor:()=>AT});var pf={};Br(pf,{endsWith:()=>Ms,gt:()=>Or,gte:()=>Mt,includes:()=>Ts,length:()=>ro,lowercase:()=>Us,lt:()=>Pr,lte:()=>Ft,maxLength:()=>to,maxSize:()=>zn,mime:()=>Ps,minLength:()=>ln,minSize:()=>zr,multipleOf:()=>On,negative:()=>sf,nonnegative:()=>Af,nonpositive:()=>af,normalize:()=>Os,overwrite:()=>Ir,positive:()=>of,properties:()=>Ls,property:()=>cf,regex:()=>Ns,size:()=>eo,slugify:()=>Js,startsWith:()=>Fs,toLowerCase:()=>Gs,toUpperCase:()=>Vs,trim:()=>zs,uppercase:()=>$s});var f$=new WeakSet([Object.prototype,Error.prototype]);function hf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var g$=(e,t)=>{CI.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);f$.has(n)||(f$.add(n),hf(n,"format",i=>r=>bA(i,r)),hf(n,"flatten",i=>r=>wA(i,r)),hf(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Es,2)}),hf(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Es,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},A8=I("ZodError",g$),vt=I("ZodError",g$,void 0,{Parent:Error});var BB=vs(vt),QB=ws(vt),vB=bs(vt),wB=ks(vt),bB=Vl(vt),kB=Jl(vt),SB=Yl(vt),xB=jl(vt),RB=Hl(vt),DB=ql(vt),_B=Wl(vt),NB=Zl(vt);function u8(){ze.localeError||De(xd())}function so(){ze.memoizer||De({memoizer:VA()})}var ee=I("ZodType",(e,t)=>(u8(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wQ(e,t))},superRefine(e,t){return this.check(bQ(e,t))},overwrite(e){return this.check(Ir(e))},optional(){return oo(this)},exactOptional(){return sQ(this)},nullable(){return tc(this)},nullish(){return oo(tc(this))},nonoptional(e){return dQ(this,e)},array(){return ic(this)},or(e){return ta([this,e])},and(e){return ZB(this,e)},transform(e){return If(this,Pf(e))},default(e){return cQ(this,e)},prefault(e){return lQ(this,e)},catch(e){return pQ(this,e)},pipe(e){return If(this,e)},readonly(){return EQ(this)},describe(e){let t=this.clone();return He.add(t,{description:e}),t},meta(...e){if(e.length===0)return He.get(this);let t=this.clone();return He.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return B.hide(this,"~standard",{...Ad(this),jsonSchema:{input:Ys(this,"input"),output:Ys(this,"output")}})},set"~standard"(e){B.own(this,"~standard",e)},parse:function e(t,n){return BB(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await QB(this,t,n,{callee:e})},safeParse(e,t){return vB(this,e,t)},async safeParseAsync(e,t){return wB(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B.own(this,"spa",e)},validate(e,t){return kA(this,e,t)},validateAsync(e,t){return SA(this,e,t)},encode:function e(t,n){return bB(this,t,n,{callee:e})},decode:function e(t,n){return kB(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await SB(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await xB(this,t,n,{callee:e})},safeEncode(e,t){return RB(this,e,t)},safeDecode(e,t){return DB(this,e,t)},async safeEncodeAsync(e,t){return _B(this,e,t)},async safeDecodeAsync(e,t){return NB(this,e,t)},toJSONSchema(e){return $C(this,{})(e)},get description(){return He.get(this)?.description},get _def(){return this._zod.def}}),Ef=I("_ZodString",(e,t)=>{Wi.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>MC(e,n,i,r)},B.derived({format:e=>Me(e).format??null,minLength:e=>Me(e).minimum??null,maxLength:e=>Me(e).maximum??null},{regex(...e){return this.check(Ns(...e))},includes(...e){return this.check(Ts(...e))},startsWith(...e){return this.check(Fs(...e))},endsWith(...e){return this.check(Ms(...e))},min(...e){return this.check(ln(...e))},max(...e){return this.check(to(...e))},length(...e){return this.check(ro(...e))},nonempty(...e){return this.check(ln(1,...e))},lowercase(e){return this.check(Us(e))},uppercase(e){return this.check($s(e))},trim(){return this.check(zs())},normalize(...e){return this.check(Os(...e))},toLowerCase(){return this.check(Gs())},toUpperCase(){return this.check(Vs())},slugify(){return this.check(Js())}})),Zs=I("ZodString",(e,t)=>{Wi.init(e,t),Ef.init(e,t)},{email(e){return this.check(Fd(yf,e))},url(e){return this.check(jA(rc,e))},jwt(e){return this.check(nf(Tf,e))},emoji(e){return this.check(Gd(Bf,e))},guid(e){return this.check(Md(Cf,e))},uuid(e){return this.check(Ld(Gr,e))},uuidv4(e){return this.check(Pd(Gr,e))},uuidv6(e){return this.check(Od(Gr,e))},uuidv7(e){return this.check(zd(Gr,e))},nanoid(e){return this.check(Vd(Qf,e))},cuid(e){return this.check(Jd(vf,e))},cuid2(e){return this.check(Yd(wf,e))},ulid(e){return this.check(jd(bf,e))},base64(e){return this.check(ef(Nf,e))},base64url(e){return this.check(tf(Uf,e))},xid(e){return this.check(Hd(kf,e))},ksuid(e){return this.check(qd(Sf,e))},ipv4(e){return this.check(Wd(xf,e))},ipv6(e){return this.check(Zd(Rf,e))},cidrv4(e){return this.check(Kd(Df,e))},cidrv6(e){return this.check(Xd(_f,e))},e164(e){return this.check(rf($f,e))},datetime(e){return this.check(HA(Yn,e))},date(e){return this.check(qA(jn,e))},time(e){return this.check(WA(Hn,e))},duration(e){return this.check(ZA(qn,e))}});function ec(e){return Zy(Zs,e)}var me=I("ZodStringFormat",(e,t)=>{ge.init(e,t),Ef.init(e,t)}),Yn=I("ZodISODateTime",(e,t)=>{OE.init(e,t),me.init(e,t)}),jn=I("ZodISODate",(e,t)=>{zE.init(e,t),me.init(e,t)}),Hn=I("ZodISOTime",(e,t)=>{GE.init(e,t),me.init(e,t)}),qn=I("ZodISODuration",(e,t)=>{VE.init(e,t),me.init(e,t)}),yf=I("ZodEmail",(e,t)=>{RE.init(e,t),me.init(e,t)});function p$(e){return Fd(yf,e)}var Cf=I("ZodGUID",(e,t)=>{SE.init(e,t),me.init(e,t)});function h$(e){return Md(Cf,e)}var Gr=I("ZodUUID",(e,t)=>{xE.init(e,t),me.init(e,t)});function m$(e){return Ld(Gr,e)}function I$(e){return Pd(Gr,e)}function E$(e){return Od(Gr,e)}function y$(e){return zd(Gr,e)}var rc=I("ZodURL",(e,t)=>{NE.init(e,t),me.init(e,t)});function C$(e){return jA(rc,e)}function B$(e){return jA(rc,{protocol:xA,hostname:VI,...B.normalizeParams(e)})}var Bf=I("ZodEmoji",(e,t)=>{UE.init(e,t),me.init(e,t)});function Q$(e){return Gd(Bf,e)}var Qf=I("ZodNanoID",(e,t)=>{$E.init(e,t),me.init(e,t)});function v$(e){return Vd(Qf,e)}var vf=I("ZodCUID",(e,t)=>{TE.init(e,t),me.init(e,t)});function w$(e){return Jd(vf,e)}var wf=I("ZodCUID2",(e,t)=>{FE.init(e,t),me.init(e,t)});function b$(e){return Yd(wf,e)}var bf=I("ZodULID",(e,t)=>{ME.init(e,t),me.init(e,t)});function k$(e){return jd(bf,e)}var kf=I("ZodXID",(e,t)=>{LE.init(e,t),me.init(e,t)});function S$(e){return Hd(kf,e)}var Sf=I("ZodKSUID",(e,t)=>{PE.init(e,t),me.init(e,t)});function x$(e){return qd(Sf,e)}var xf=I("ZodIPv4",(e,t)=>{JE.init(e,t),me.init(e,t)});function R$(e){return Wd(xf,e)}var UB=I("ZodMAC",(e,t)=>{jE.init(e,t),me.init(e,t)});function D$(e){return Xy(UB,e)}var Rf=I("ZodIPv6",(e,t)=>{YE.init(e,t),me.init(e,t)});function _$(e){return Zd(Rf,e)}var Df=I("ZodCIDRv4",(e,t)=>{HE.init(e,t),me.init(e,t)});function N$(e){return Kd(Df,e)}var _f=I("ZodCIDRv6",(e,t)=>{qE.init(e,t),me.init(e,t)});function U$(e){return Xd(_f,e)}var Nf=I("ZodBase64",(e,t)=>{WE.init(e,t),me.init(e,t)});function $$(e){return ef(Nf,e)}var Uf=I("ZodBase64URL",(e,t)=>{ZE.init(e,t),me.init(e,t)});function T$(e){return tf(Uf,e)}var $f=I("ZodE164",(e,t)=>{KE.init(e,t),me.init(e,t)});function F$(e){return rf($f,e)}var $B=I("ZodCreditCard",(e,t)=>{XE.init(e,t),me.init(e,t)});function M$(e){return eC($B,e)}var TB=I("ZodIBAN",(e,t)=>{ey.init(e,t),me.init(e,t)});function L$(e){return tC(TB,e)}var Tf=I("ZodJWT",(e,t)=>{ty.init(e,t),me.init(e,t)});function P$(e){return nf(Tf,e)}var ao=I("ZodCustomStringFormat",(e,t)=>{ry.init(e,t),me.init(e,t)});function O$(e,t,n={}){return no(ao,e,t,n)}function z$(e){return no(ao,"hostname",GI,e)}function G$(e){return no(ao,"hex",iE,e)}function V$(e){return no(ao,"currency_code",YI,e)}function J$(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=Xt[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return no(ao,i,r,t)}var Ks=I("ZodNumber",(e,t)=>{Id.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>LC(e,n,i,r),e.isFinite=!0},B.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Me(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Me(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=Me(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Me(e).format??null},{gt(e,t){return this.check(Or(e,t))},gte(e,t){return this.check(Mt(e,t))},min(e,t){return this.check(Mt(e,t))},lt(e,t){return this.check(Pr(e,t))},lte(e,t){return this.check(Ft(e,t))},max(e,t){return this.check(Ft(e,t))},int(e){return this.check(mf(e))},safe(e){return this.check(mf(e))},positive(e){return this.check(Or(0,e))},nonnegative(e){return this.check(Mt(0,e))},negative(e){return this.check(Pr(0,e))},nonpositive(e){return this.check(Ft(0,e))},multipleOf(e,t){return this.check(On(e,t))},step(e,t){return this.check(On(e,t))},finite(){return this}}));function FB(e){return nC(Ks,e)}var Ao=I("ZodNumberFormat",(e,t)=>{ny.init(e,t),Ks.init(e,t)});function mf(e){return oC(Ao,e)}function Y$(e){return sC(Ao,e)}function j$(e){return aC(Ao,e)}function H$(e){return AC(Ao,e)}function q$(e){return cC(Ao,e)}var Xs=I("ZodBoolean",(e,t)=>{MA.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>PC(e,n,i,r)});function MB(e){return uC(Xs,e)}var ea=I("ZodBigInt",(e,t)=>{Ed.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>OC(e,n,i,r)},B.derived({minValue:e=>Me(e).minimum??null,maxValue:e=>Me(e).maximum??null,format:e=>Me(e).format??null},{gte(e,t){return this.check(Mt(e,t))},min(e,t){return this.check(Mt(e,t))},gt(e,t){return this.check(Or(e,t))},lt(e,t){return this.check(Pr(e,t))},lte(e,t){return this.check(Ft(e,t))},max(e,t){return this.check(Ft(e,t))},positive(e){return this.check(Or(BigInt(0),e))},negative(e){return this.check(Pr(BigInt(0),e))},nonpositive(e){return this.check(Ft(BigInt(0),e))},nonnegative(e){return this.check(Mt(BigInt(0),e))},multipleOf(e,t){return this.check(On(e,t))}}));function W$(e){return dC(ea,e)}var Ff=I("ZodBigIntFormat",(e,t)=>{iy.init(e,t),ea.init(e,t)});function Z$(e){return gC(Ff,e)}function K$(e){return pC(Ff,e)}var LB=I("ZodSymbol",(e,t)=>{oy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zC(e,n,i,r)});function X$(e){return hC(LB,e)}var PB=I("ZodUndefined",(e,t)=>{sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>VC(e,n,i,r)});function eT(e){return mC(PB,e)}var OB=I("ZodNull",(e,t)=>{ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>GC(e,n,i,r)});function zB(e){return IC(OB,e)}var GB=I("ZodAny",(e,t)=>{Ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jC(e,n,i,r)});function tT(){return EC(GB)}var VB=I("ZodUnknown",(e,t)=>{cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>HC(e,n,i,r)});function io(){return yC(VB)}var JB=I("ZodNever",(e,t)=>{uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>YC(e,n,i,r)});function Mf(e){return CC(JB,e)}var YB=I("ZodVoid",(e,t)=>{ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>JC(e,n,i,r)});function rT(e){return BC(YB,e)}var nc=I("ZodDate",(e,t)=>{dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qC(e,n,i,r),e.min=(n,i)=>e.check(Mt(n,i)),e.max=(n,i)=>e.check(Ft(n,i))},B.derived({minDate:e=>{let{minimum:t}=Me(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Me(e);return t?new Date(t):null}},{}));function nT(e){return QC(nc,e)}var jB=I("ZodArray",(e,t)=>{so(),gy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>aB(e,n,i,r),e.element=t.element},{min(e,t){return this.check(ln(e,t))},nonempty(e){return this.check(ln(1,e))},max(e,t){return this.check(to(e,t))},length(e,t){return this.check(ro(e,t))},unwrap(){return this.element}});function ic(e,t){return bC(jB,e,t)}function iT(e){let t=e._zod.def.shape;return Lf(Object.keys(t))}var oc=I("ZodObject",(e,t)=>{so(),py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>AB(e,n,i,r),B.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Lf(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},loose(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},strict(){return this.clone(B.mergeDefs(this._zod.def,{catchall:Mf()}))},strip(){return this.clone(B.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return B.extend(this,e)},safeExtend(e){return B.safeExtend(this,e)},merge(e){return B.merge(this,e)},pick(e){return B.pick(this,e)},omit(e){return B.omit(this,e)},partial(...e){return B.partial(ac,this,e[0])},exactPartial(...e){return B.partial(Of,this,e[0],"exactPartial")},required(...e){return B.required(zf,this,e[0])}});function oT(e,t){let n={type:"object",shape:e??{},...B.normalizeParams(t)};return new oc(n)}function sT(e,t){return new oc({type:"object",shape:e,catchall:Mf(),...B.normalizeParams(t)})}function aT(e,t){return new oc({type:"object",shape:e,catchall:io(),...B.normalizeParams(t)})}var sc=I("ZodUnion",(e,t)=>{LA.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lf(e,n,i,r),e.options=t.options});function ta(e,t){return new sc({type:"union",options:e,...B.normalizeParams(t)})}var HB=I("ZodXor",(e,t)=>{sc.init(e,t),hy.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lf(e,n,i,r),e.options=t.options});function AT(e,t){return new HB({type:"union",options:e,inclusive:!1,...B.normalizeParams(t)})}var qB=I("ZodDiscriminatedUnion",(e,t)=>{sc.init(e,t),Iy.init(e,t)});function cT(e,t,n){return new qB({type:"union",options:t,discriminator:e,...B.normalizeParams(n)})}var WB=I("ZodIntersection",(e,t)=>{Ey.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>cB(e,n,i,r)});function ZB(e,t){return new WB({type:"intersection",left:e,right:t})}var KB=I("ZodTuple",(e,t)=>{so(),yd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>uB(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ac({type:"optional",innerType:t}))})}});function XB(e,t,n){let i=t instanceof Z,r=i?n:t,o=i?t:null;return new KB({type:"tuple",items:e,rest:o,...B.normalizeParams(r)})}var qs=I("ZodRecord",(e,t)=>{so(),yy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function eQ(e,t,n){return!t||!t._zod?new qs({type:"record",keyType:ec(),valueType:e,...B.normalizeParams(t)}):new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n)})}function uT(e,t,n){return new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n),partial:!0})}function lT(e,t,n){return new qs({type:"record",keyType:e,valueType:t,mode:"loose",...B.normalizeParams(n)})}var tQ=I("ZodMap",(e,t)=>{so(),Cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>oB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(zr(...n)),e.nonempty=n=>e.check(zr(1,n)),e.max=(...n)=>e.check(zn(...n)),e.size=(...n)=>e.check(eo(...n))});function dT(e,t,n){return new tQ({type:"map",keyType:e,valueType:t,...B.normalizeParams(n)})}var rQ=I("ZodSet",(e,t)=>{so(),By.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>sB(e,n,i,r),e.min=(...n)=>e.check(zr(...n)),e.nonempty=n=>e.check(zr(1,n)),e.max=(...n)=>e.check(zn(...n)),e.size=(...n)=>e.check(eo(...n))});function fT(e,t){return new rQ({type:"set",valueType:e,...B.normalizeParams(t)})}var Ws=I("ZodEnum",(e,t)=>{Qy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(i,r,o)=>WC(e,i,r,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})}});function Lf(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Ws({type:"enum",entries:n,...B.normalizeParams(t)})}function gT(e,t){return new Ws({type:"enum",entries:e,...B.normalizeParams(t)})}var nQ=I("ZodLiteral",(e,t)=>{vy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ZC(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pT(e,t){return new nQ({type:"literal",values:Array.isArray(e)?e:[e],...B.normalizeParams(t)})}var iQ=I("ZodFile",(e,t)=>{wy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>eB(e,n,i,r),e.min=(n,i)=>e.check(zr(n,i)),e.max=(n,i)=>e.check(zn(n,i)),e.mime=(n,i)=>e.check(Ps(Array.isArray(n)?n:[n],i))});function hT(e){return kC(iQ,e)}var oQ=I("ZodTransform",(e,t)=>{so(),by.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>iB(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Ln(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(B.issue(o,n.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(B.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function Pf(e){return new oQ({type:"transform",transform:e})}var ac=I("ZodOptional",(e,t)=>{Cd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>df(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new ac({type:"optional",innerType:e})}var Of=I("ZodExactOptional",(e,t)=>{ky.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>df(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function sQ(e){return new Of({type:"optional",innerType:e})}var aQ=I("ZodNullable",(e,t)=>{Sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>dB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new aQ({type:"nullable",innerType:e})}function mT(e){return oo(tc(e))}var AQ=I("ZodDefault",(e,t)=>{xy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>pB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cQ(e,t){return new AQ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var uQ=I("ZodPrefault",(e,t)=>{Ry.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function lQ(e,t){return new uQ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var zf=I("ZodNonOptional",(e,t)=>{Dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function dQ(e,t){return new zf({type:"nonoptional",innerType:e,...B.normalizeParams(t)})}var fQ=I("ZodSuccess",(e,t)=>{_y.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function IT(e){return new fQ({type:"success",innerType:e})}var gQ=I("ZodCatch",(e,t)=>{Ny.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>mB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pQ(e,t){return new gQ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:B.constantCatch(t)})}var hQ=I("ZodNaN",(e,t)=>{Uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>KC(e,n,i,r)});function ET(e){return wC(hQ,e)}var Ac=I("ZodPipe",(e,t)=>{Bd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>IB(e,n,i,r),e.in=t.in,e.out=t.out});function If(e,t){return new Ac({type:"pipe",in:e,out:t})}var cc=I("ZodCodec",(e,t)=>{Ac.init(e,t),PA.init(e,t)});function yT(e,t,n){return new cc({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function CT(e){let t=e._zod.def;return new cc({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var mQ=I("ZodPreprocess",(e,t)=>{Ac.init(e,t),$y.init(e,t)}),IQ=I("ZodReadonly",(e,t)=>{Ty.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>EB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function EQ(e){return new IQ({type:"readonly",innerType:e})}var yQ=I("ZodTemplateLiteral",(e,t)=>{Fy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>XC(e,n,i,r)});function BT(e,t){return new yQ({type:"template_literal",parts:e,...B.normalizeParams(t)})}var CQ=I("ZodLazy",(e,t)=>{OA.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>CB(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function BQ(e){return new CQ({type:"lazy",getter:e})}var QQ=I("ZodPromise",(e,t)=>{Ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function QT(e){return new QQ({type:"promise",innerType:e})}var vQ=I("ZodFunction",(e,t)=>{My.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>nB(e,n,i,r)});function vT(e){return new vQ({type:"function",input:Array.isArray(e?.input)?XB(e?.input):e?.input??ic(io()),output:e?.output??io()})}var uc=I("ZodCustom",(e,t)=>{Py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>rB(e,n,i,r)});function wT(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function bT(e,t){return SC(uc,e??(()=>!0),t)}function wQ(e,t={}){return xC(uc,e,t)}function bQ(e,t){return RC(e,t)}var kT=DC,ST=_C,kQ=I("ZodInstanceOf",(e,t)=>{uc.init(e,t)},{properties(e,t){return this.check(Ls(e,t))}});function xT(e,t={}){let n=new kQ({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...B.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var RT=(...e)=>NC({Codec:cc,Boolean:Xs,String:Zs},...e);function DT(e){let t=BQ(()=>ta([ec(e),FB(),MB(),zB(),ic(t),eQ(ec(),t)]));return t}function _T(e,t){return new mQ({type:"pipe",in:Pf(e),out:t})}var l8={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"};function d8(e){De({customError:e})}function f8(){return De().customError}var SQ;SQ||(SQ={});var lc={};Br(lc,{ZodISODate:()=>jn,ZodISODateTime:()=>Yn,ZodISODuration:()=>qn,ZodISOTime:()=>Hn,date:()=>p8,datetime:()=>g8,duration:()=>m8,time:()=>h8});function g8(e){return HA(Yn,e)}function p8(e){return qA(jn,e)}function h8(e){return WA(Hn,e)}function m8(e){return ZA(qn,e)}var N={...ra,...pf,iso:lc},I8=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function E8(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function NT(e,t){return e.map((n,i)=>i<t?n:n.optional())}function y8(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function C8(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:y8(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function B8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let o=Object.getOwnPropertyNames(r);if(t.minProperties!==void 0&&o.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:r,inst:e,continue:!0}),t.maxProperties!==void 0&&o.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:r,inst:e,continue:!0}),t.keySchema)for(let s of o){let a=t.keySchema.safeParse(s);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function xQ(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let i=String(e);return`${n[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let o=[];for(let s of e){let a=xQ(s,t);if(a===null)return null;o.push(a)}return`a${o.length}:[${o.join(",")}]`}let i=Object.keys(e).sort(),r=[];for(let o of i){let s=xQ(e[o],t);if(s===null)return null;r.push(`${o.length}:${o}=${s}`)}return`o${r.length}:{${r.join(",")}}`}finally{t.delete(e)}}var Q8=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),v8=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function dc(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(dc):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Q8.has(t)?dc(n):!v8.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(dc))}function UT(e){return e===1?"element":"elements"}function w8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(t.uniqueItems===!0){let o=new Map;for(let s=0;s<r.length;s++){let a=xQ(r[s],new Set);if(a===null)continue;let A=o.get(a);if(A===void 0){o.set(a,s);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${A}`,input:r,path:[s],continue:!0})}}if(t.containsSchema){let o=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let A of r)if(t.containsSchema.safeParse(A).success&&++a>=s)break;a<o&&i.issues.push({code:"custom",message:`Array must contain at least ${o} matching ${UT(o)}; found ${a}`,input:r,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${UT(t.maxContains)}`,input:r,continue:!0})}}}).pipe(e)}function $T(e,t){if(e!==!1)return e===void 0||e===!0?N.any():ut(e,t)}var b8=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function TT(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return N.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return N.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=C8(r,t),s=ut(o,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return N.null();if(r.length===0)return N.never();if(r.length===1)return N.literal(r[0]);if(r.every(s=>typeof s=="string"))return N.enum(r);let o=r.map(s=>N.literal(s));return o.length<2?o[0]:N.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return N.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let s={...e,type:o};return TT(s,t)});return r.length===0?N.never():r.length===1?r[0]:N.union(r)}if(!n)return N.any();let i;switch(n){case"string":{let r=N.string();if(e.format){let o=e.format;o==="email"?r=r.check(N.email()):o==="uri"||o==="uri-reference"?r=r.check(N.url()):o==="uuid"||o==="guid"?r=r.check(N.uuid()):o==="date-time"?r=r.check(N.iso.datetime({offset:!0})):o==="date"?r=r.check(N.iso.date()):o==="time"?r=r.check(N.regex(b8)):o==="duration"?r=r.check(N.iso.duration()):o==="hostname"?r=r.check(N.hostname()):o==="ipv4"?r=r.check(N.ipv4()):o==="ipv6"?r=r.check(N.ipv6()):o==="mac"?r=r.check(N.mac()):o==="cidr"?r=r.check(N.cidrv4()):o==="cidr-v6"?r=r.check(N.cidrv6()):o==="base64"?r=r.check(N.base64()):o==="base64url"?r=r.check(N.base64url()):o==="e164"?r=r.check(N.e164()):o==="credit_card"?r=r.check(N.creditCard()):o==="iban"?r=r.check(N.iban()):o==="jwt"?r=r.check(N.jwt()):o==="emoji"?r=r.check(N.emoji()):o==="nanoid"?r=r.check(N.nanoid()):o==="cuid"?r=r.check(N.cuid()):o==="cuid2"?r=r.check(N.cuid2()):o==="ulid"?r=r.check(N.ulid()):o==="xid"?r=r.check(N.xid()):o==="ksuid"&&(r=r.check(N.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?N.number().int():N.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=N.boolean();break}case"null":{i=N.null();break}case"object":{let r={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?ut(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(o)){let g=ut(f,t);je(r,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),g=[];for(let h of f){let E=ut(d[h],t),m=N.string().regex(new RegExp(h));g.push(N.looseRecord(m,E))}let p=[];if(Object.keys(r).length>0&&p.push(N.object(r).passthrough()),p.push(...g),p.length===0)i=N.object({}).passthrough();else if(p.length===1)i=p[0];else{let h=N.intersection(p[0],p[1]);for(let E=2;E<p.length;E++)h=N.intersection(h,p[E]);i=h}if(e.additionalProperties===!1){let h=Object.keys(r),E=f.map(C=>new RegExp(C)),m=i;i=i.check(C=>{if(!Zt(C.value))return;let w=[];for(let b of Object.keys(C.value))h.includes(b)||E.some(T=>T.test(b))||w.push(b);w.length&&C.issues.push({code:"unrecognized_keys",keys:w,input:C.value,inst:m})})}}else{let d=N.object(r);e.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let A=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(A||c!==void 0||l!==void 0){let d;if(A){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ut(f,t)}i=B8(i,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let s=typeof e.minItems=="number"?e.minItems:0,a=r.map(d=>ut(d,t)),A=NT(a,s),c=Array.isArray(o)?void 0:$T(o,t),l=N.tuple(A);i=c?l.rest(c):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>ut(d,t)),A=NT(a,s),c=$T(e.additionalItems,t),l=N.tuple(A);i=c?l.rest(c):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(o!==void 0){let s=ut(o,t),a=N.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=N.array(N.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=w8(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ut(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return i}function ut(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n=TT(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(c=>ut(c,t)),A=N.union(a);n=i?N.intersection(n,A):A}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(c=>ut(c,t)),A=N.xor(a);n=i?N.intersection(n,A):A}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:N.any();else{let a=i?n:ut(e.allOf[0],t),A=i?0:1;for(let c=A;c<e.allOf.length;c++)a=N.intersection(a,ut(e.allOf[c],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=N.nullable(n)),e.readOnly===!0&&(n=N.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!dc(e.propertyNames)&&(r.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(r[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!dc(e.contains)&&(r.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(r[a]=e[a])}for(let a of Object.keys(e))I8.has(a)||je(r,a,e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function FT(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=E8(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??He};return ut(n,o)}var MT=Symbol("z.visit/resolving");function fc(e,t){let n=typeof t=="function"?t:(s,a)=>{let A=t[s._zod.def.type];return A?A(s,a):s},i=new Map;function r(s){let a=i.get(s);if(a===MT)return new OA({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,MT);let A=o(s),c=n(A,A!==s);return i.set(s,c),c}function o(s){let a=s._zod.def,A=a.type;switch(A){case"object":{let c=a.shape,l=Object.keys(c),d=!1,f={};for(let p of l){let h=r(c[p]);h!==c[p]&&(d=!0),f[p]=h}let g=a.catchall;return a.catchall&&(g=r(a.catchall),g!==a.catchall&&(d=!0)),d?fe(s,{...a,shape:f,catchall:g}):s}case"array":{let c=r(a.element);return c===a.element?s:fe(s,{...a,element:c})}case"tuple":{let c=a.items,l=!1,d=[];for(let g of c){let p=r(g);p!==g&&(l=!0),d.push(p)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(l=!0)),l?fe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let c=r(a.keyType),l=r(a.valueType);return c===a.keyType&&l===a.valueType?s:fe(s,{...a,keyType:c,valueType:l})}case"set":{let c=r(a.valueType);return c===a.valueType?s:fe(s,{...a,valueType:c})}case"union":{let c=a.options,l=!1,d=[];for(let f of c){let g=r(f);g!==f&&(l=!0),d.push(g)}return l?fe(s,{...a,options:d}):s}case"intersection":{let c=r(a.left),l=r(a.right);return c===a.left&&l===a.right?s:fe(s,{...a,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=r(a.innerType);return c===a.innerType?s:fe(s,{...a,innerType:c})}case"pipe":{let c=r(a.in),l=r(a.out);return c===a.in&&l===a.out?s:fe(s,{...a,in:c,out:l})}case"function":{let c=r(a.input),l=r(a.output);return c===a.input&&l===a.output?s:fe(s,{...a,input:c,output:l})}case"lazy":{let c=a.getter,{_cachedInner:l,...d}=a;return fe(s,{...d,getter:()=>r(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return r(e)}function LT(e){return fc(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:ta(n.options)}})}function k8(e,t){if(!t?.length)return e;let n=e._zod.def;return fe(e,hr(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function PT(e){return k8(e.out,e.checks)}function S8(e){return e.in._zod.traits.has("$ZodTransform")?PT(e):e.in}function OT(e){return fc(e,{pipe:t=>S8(t._zod.def),default:(t,n)=>n?oo(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function zT(e){return fc(e,{pipe:t=>PT(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var RQ={};Br(RQ,{bigint:()=>_8,boolean:()=>D8,date:()=>N8,number:()=>R8,string:()=>x8});function x8(e){return Ky(Zs,e)}function R8(e){return iC(Ks,e)}function D8(e){return lC(Xs,e)}function _8(e){return fC(ea,e)}function N8(e){return vC(nc,e)}var GT=require("async_hooks");var Joe=new GT.AsyncLocalStorage;var cse=new Set(Object.values(Aa));var use=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var M8=["generate-unit","native-run"],fse=["preflight","plan","write",...M8,"report","deliver"];var JT=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(JT||{}),L8=Object.values(JT);var Qse=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var YT=(n=>(n.Full="full",n.Static="static",n))(YT||{}),jT=(i=>(i.Contract="contract",i.Integration="integration",i.Ui="ui",i))(jT||{}),DQ=(o=>(o.OwnSurface="own_surface",o.StateReadBack="state_read_back",o.Referential="referential",o.Lifecycle="lifecycle",o.Boundaries="boundaries",o))(DQ||{}),HT=(r=>(r.Update="update",r.Regenerate="regenerate",r.Delete="delete",r.Verify="verify",r))(HT||{}),qT=(c=>(c.Equals="equals",c.NotEquals="not_equals",c.GreaterThan="greater_than",c.LessThan="less_than",c.Contains="contains",c.NotContains="not_contains",c.Matches="matches",c.Absent="absent",c.Present="present",c))(qT||{});var Lt=u.string().trim().min(1),O8=u.object({subject:Lt.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(qT),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),z8=u.object({test:Lt.describe("existing test path, relative to its repository"),repository:Lt.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(HT),evidence:Lt.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers"),staleOnBase:u.boolean().optional().describe("[derived] the plan found the test already wrong on the base branch: it is left as it is and re-run")});var G8=u.object({surface:Lt.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(DQ)}),V8=u.object({id:Lt.describe("short-slug, unique across generate[]"),type:u.nativeEnum(jT),target:Lt.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:G8.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Lt.describe("why this test matters"),expected_observable:Lt.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:O8.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Lt.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),J8=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),i=typeof e.abstain=="string";if(n===i)return void t.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),i&&!e.abstain.trim()&&t.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Y8=u.object({surface:Lt.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(DQ).map(e=>[e,J8])))}),Rse=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(YT),maintenance:u.array(z8),generate:u.array(V8),surfaces:u.array(Y8).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Lt}),summary:Lt.describe("one paragraph")});function _Q(e){return e.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"")}var Zse=z.object({mode:z.string().optional(),entries:z.array(z.object({entityUrl:z.string().optional(),tornDown:z.boolean().optional(),id:z.union([z.string(),z.number()]).optional(),testExecution:z.string().optional(),readAt:z.array(z.string()).optional(),deleteAnswered:z.boolean().optional(),deleteStatus:z.number().int().optional()})).optional(),blocks:z.array(z.object({method:z.string().optional(),url:z.string().optional(),rule:z.string().optional(),count:z.number().nonnegative().optional()})).optional(),unparsedCreates:z.array(z.object({url:z.string().optional(),rule:z.string().optional()})).optional()});var Kse=z.object({id:z.string().regex(/^(legacy|unknown|session-[0-9a-f-]{36})$/),stage:z.string(),browserUsed:z.boolean()});var Xse=z.object({environmentId:z.string().uuid().optional(),environmentAddress:z.string().url().optional(),persistentDataPolicy:z.custom(e=>kl.safeParse(e).success,"invalid persistent-data policy").optional(),components:z.array(z.object({name:z.string().min(1),url:z.string().min(1),repository:z.string().min(1).optional(),expectedRevision:z.string().min(1).optional(),revisionUrl:z.string().url().optional()}).strict()).min(1),dependencies:z.array(z.object({name:z.string().min(1),url:z.string().nullable(),versionUrl:z.string().nullable(),notes:z.string().nullable()}).strict()).default([]),allowMutation:z.boolean().optional(),offLimits:z.array(z.string().min(1)).optional(),allowedEgress:z.array(z.string().min(1)).optional()}).strict();var gc=e=>Array.isArray(e.ledger)?e.ledger:[],W8=5,Z8=["classify","shouldCaptureCreateBody","recordResponse","noteEntityResponse","noteRedirect","recordBlock","ensureLedgerWritable","flush"];function eF(e){if(e)try{let t=(0,KT.createRequire)(e)(e),n=t.DataSafetyGuard;return typeof n!="function"||typeof t.parseDataSafetyConfig!="function"||typeof t.blockReason!="function"||!Z8.every(i=>typeof n.prototype[i]=="function")?void 0:t}catch{return}}var WT=new Set(["GET","HEAD","OPTIONS"]),K8=new Set(["api.anthropic.com:443","github.com:443","api.github.com:443","raw.githubusercontent.com:443","objects.githubusercontent.com:443","codeload.github.com:443","release-assets.githubusercontent.com:443","registry.npmjs.org:443","pypi.org:443","pypi.python.org:443","files.pythonhosted.org:443","cdn.playwright.dev:443","playwright.download.prss.microsoft.com:443"]),X8="storage.googleapis.com",tF=`${X8}:443`,eX=/^\/chrome-for-testing-public\/\d+\.\d+\.\d+\.\d+\/[a-z0-9-]+\/chrome(?:-headless-shell)?-[a-z0-9-]+\.zip$/;function NQ(e){return e.protocol==="https:"&&pc(e)===tF}var FQ=new Le.BlockList;for(let[e,t]of[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.168.0.0",16],["198.18.0.0",15],["224.0.0.0",4],["240.0.0.0",4]])FQ.addSubnet(e,t,"ipv4");for(let[e,t]of[["::",128],["::1",128],["fc00::",7],["fe80::",10],["ff00::",8]])FQ.addSubnet(e,t,"ipv6");var Gf=64*1024*1024,Vf=3e3,tX=[250,750],rF=1e4,kae=Vf+rF+Vf,rX=8;var nX=500,iX=/^(content-|if-|expect$|x-http-method|x-method-override$)/,oX=/^(_method|x-http-method(-override)?|x-method-override)$/i;function sX(e,t,n,i){return e===410||e===404&&(t||n&&i)}function ZT(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,"").split("/");if(n.length<2||!n.at(-1))return;let i=[...new Set(t.searchParams.keys())].sort();return`${t.origin}${n.slice(0,-1).join("/")}/*${i.length?`?${i.join("&")}`:""}`}catch{return}}var nF=e=>e!==void 0&&e>=200&&e<300;function aX(e){let t=0,n=[];return async i=>{t>=e?await new Promise(r=>n.push(r)):t++;try{return await i()}finally{let r=n.shift();r?r():t--}}}function AX(e,t){return nF(e.responseStatus)&&!!e.entityUrl&&tr(e.entityUrl)===t}function cX(e){let t=new URL(e);for(let n of[...t.searchParams.keys()])oX.test(n)&&t.searchParams.delete(n);return t}function er(e,t,n,i){let o=`${[n==="blocked"?"Blocked by data safety":"Data safety could not check or record this request",i].filter(Boolean).join(": ")}. Do not retry it.
|
|
188
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}a.count>1&&e.reused==="ref"&&o(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function e$(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;e$(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var t$=new Set(["type","properties","required","additionalProperties"]),KU=["oneOf","anyOf"];function XU(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function UC(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!t$.has(s))return null;t.push(o)}let n={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let c of t){let l=c.properties?.[s]??XU(c);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let A=a.length===1?a[0]:UC(a)??{allOf:a};je(n,s,A)}for(let s of o.required??[])i.add(s)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(o=>o.additionalProperties===!1))r.additionalProperties=!1;else{let o=[];for(let s of t){let a=XU(s);a&&!o.some(A=>JSON.stringify(A)===JSON.stringify(a))&&o.push(a)}o.length===1?r.additionalProperties=o[0]:o.length>1&&(r.additionalProperties={allOf:o})}return r}function r8(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of t$)if(r in e)return;let n=t.filter(r=>KU.some(o=>Array.isArray(r[o]))),i=null;if(!n.length)i=UC(t);else{let r=n[0],o=KU.find(A=>Array.isArray(r[A]));if(Object.keys(r).length!==1)return;let s=t.filter(A=>A!==r),a=r[o].map(A=>UC([...s,A]));if(a.some(A=>!A))return;i={[o]:a}}i&&(delete e.allOf,KA(e,i))}function Jn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let A=e.seen.get(a);if(A.ref===null)return;let c=A.def??A.schema,l={...c},d=A.ref;if(A.ref=null,d){i(d);let g=e.seen.get(d),p=g.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):KA(c,p),KA(c,l),a._zod.parent===d)for(let E in c)E==="$ref"||E==="allOf"||E in l||delete c[E];if(p.$ref&&g.def)for(let E in c)E==="$ref"||E==="allOf"||E in g.def&&JSON.stringify(c[E])===JSON.stringify(g.def[E])&&delete c[E]}let f=a._zod.parent;if(f&&f!==d){i(f);let g=e.seen.get(f);if(g?.schema.$ref&&(c.$ref=g.schema.$ref,g.def))for(let p in c)p==="$ref"||p==="allOf"||p in g.def&&JSON.stringify(c[p])===JSON.stringify(g.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:A.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())e$(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let A of e.seen.values())for(let c of[A.schema,A.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(c):a.set(l,[c])}for(let A of e.intersections)for(let c of a.get(A)??[])r8(c)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}KA(r,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let A=a[1];A.def&&A.defId&&(A.def.id===A.defId&&delete A.def.id,je(s,A.defId,A.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ys(t,"input",e.processors),output:Ys(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ct(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return ct(i.element,n);if(i.type==="set")return ct(i.valueType,n);if(i.type==="lazy")return ct(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return ct(i.innerType,n);if(i.type==="intersection")return ct(i.left,n)||ct(i.right,n);if(i.type==="record"||i.type==="map")return ct(i.keyType,n)||ct(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ct(i.in,n)||ct(i.out,n);if(i.type==="object"){for(let r in i.shape)if(ct(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(ct(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(ct(r,n))return!0;return!!(i.rest&&ct(i.rest,n))}return!1}var $C=(e,t={})=>n=>{let i=Gn({...n,processors:t});return pe(e,i),Vn(i,e),Jn(i,e)},Ys=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},s=Gn({...r??{},target:o,io:t,processors:n});return pe(e,s),Vn(s,e),Jn(s,e)};var js=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Hs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},r$=(e,t)=>{js(e,"minimum",t),Hs(e,"maximum",t)},s$=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},a$=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},A$=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},c$=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},n$=(e,t)=>js(e,"minimum",t.minimum),i$=(e,t)=>Hs(e,"maximum",t.maximum),o$=e=>(t,n)=>{c$(t,n.format);let[i,r]=e[n.format];js(t,"minimum",i),Hs(t,"maximum",r)},n8={greater_than:(e,t)=>js(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Hs(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>s$(e,t.value),number_format:o$(EA),bigint_format:o$(yA),min_length:n$,max_length:i$,length_equals:(e,t)=>r$(e,t.length),min_size:n$,max_size:i$,size_equals:(e,t)=>r$(e,t.size),string_format:(e,t)=>{c$(e,t.format),t.pattern&&a$(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>A$(e,t.mime)};function Me(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of i)n8[o._zod.def.check]?.(t,o._zod.def);let r=e._zod.bag;r.minimum!==void 0&&js(t,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&js(t,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Hs(t,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Hs(t,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&s$(t,r.multipleOf),r.format!==void 0&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&A$(t,r.mime);for(let o of r.patterns??[])a$(t,o);return t}var i8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o8=new Map([[fd,OI],[FA,zI]]),u$=e=>o8.get(e)??e,MC=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:s,format:a,patterns:A,contentEncoding:c,laxFormat:l}=Me(e);if(typeof o=="number"&&(r.minLength=o),typeof s=="number"&&(r.maxLength=s),a&&(r.format=i8[a]??a,r.format===""&&delete r.format,(a==="time"||l)&&delete r.format),c&&(r.contentEncoding=c),A&&A.size>0){let d=[...A].map(u$);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},LC=(e,t,n,i)=>{let r=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:A,exclusiveMinimum:c,isInt:l}=Me(e);r.type=l?"integer":"number";let d=typeof c=="number"&&c>=(o??Number.NEGATIVE_INFINITY),f=typeof A=="number"&&A<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d?g?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:typeof o=="number"&&(r.minimum=o),f?g?(r.maximum=A,r.exclusiveMaximum=!0):r.exclusiveMaximum=A:typeof s=="number"&&(r.maximum=s),a){let p=new Set;for(let m of a)Number.isFinite(m)&&m!==0?p.add(Math.abs(m)):Fe(e,t,r,i,`A multipleOf divisor of ${m} cannot be represented in JSON Schema`);let[h,...E]=p;h!==void 0&&(r.multipleOf=h),E.length&&(r.allOf=[...r.allOf??[],...E.map(m=>({multipleOf:m}))])}},PC=(e,t,n,i)=>{n.type="boolean"},OC=(e,t,n,i)=>{Fe(e,t,n,i,"BigInt cannot be represented in JSON Schema")},zC=(e,t,n,i)=>{Fe(e,t,n,i,"Symbols cannot be represented in JSON Schema")},GC=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},VC=(e,t,n,i)=>{Fe(e,t,n,i,"Undefined cannot be represented in JSON Schema")},JC=(e,t,n,i)=>{Fe(e,t,n,i,"Void cannot be represented in JSON Schema")},YC=(e,t,n,i)=>{n.not={}},jC=(e,t,n,i)=>{},HC=(e,t,n,i)=>{},qC=(e,t,n,i)=>{Fe(e,t,n,i,"Date cannot be represented in JSON Schema")},WC=(e,t,n,i)=>{let r=e._zod.def,o=Is(r.entries);if(o.length===0){n.not={};return}o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},ZC=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let o=[];for(let s of r.values)if(s===void 0){if(Fe(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Fe(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),o.every(s=>typeof s=="boolean")&&(n.type="boolean"),o.every(s=>s===null)&&(n.type="null"),n.enum=o},KC=(e,t,n,i)=>{Fe(e,t,n,i,"NaN cannot be represented in JSON Schema")},XC=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},eB=(e,t,n,i)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=Me(e);o!==void 0&&(r.minLength=o),s!==void 0&&(r.maxLength=s),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(A=>({contentMediaType:A})))},tB=(e,t,n,i)=>{n.type="boolean"},rB=(e,t,n,i)=>{Fe(e,t,n,i,"Custom types cannot be represented in JSON Schema")},nB=(e,t,n,i)=>{Fe(e,t,n,i,"Function types cannot be represented in JSON Schema")},iB=(e,t,n,i)=>{Fe(e,t,n,i,"Transforms cannot be represented in JSON Schema")},oB=(e,t,n,i)=>{Fe(e,t,n,i,"Map cannot be represented in JSON Schema")},sB=(e,t,n,i)=>{Fe(e,t,n,i,"Set cannot be represented in JSON Schema")},aB=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:s,maximum:a}=Me(e);typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=pe(o.element,t,{...i,path:[...i.path,"items"]})};function XA(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?XA(t.out):t.type==="catch"?XA(t.innerType):e._zod.optin}var AB=(e,t,n,i)=>{let r=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&Fe(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let c in s)je(r.properties,c,pe(s[c],t,{...i,path:[...i.path,"properties",c]}));let A=[];for(let c of Object.keys(s)){let l=o.shape[c];(t.io==="input"?XA(l)===void 0:l._zod.optout===void 0)&&A.push(c)}A.length>0&&(r.required=A),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=pe(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},lf=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,s=r.options.map((a,A)=>pe(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",A]}));o?n.oneOf=s:n.anyOf=s},cB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.left,t,{...i,path:[...i.path,"allOf",0]}),s=pe(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,A=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=A,t.intersections.push(A)},uB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",A=o.items.map((h,E)=>pe(h,t,{...i,path:[...i.path,s,E]})),c=o.rest?pe(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?XA(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(r.prefixItems=A,f?r.items=!1:c&&(r.items=c),l>0&&(r.minItems=l),f&&(r.maxItems=d)):t.target==="openapi-3.0"?(r.items={anyOf:A},c&&r.items.anyOf.push(c),l>0&&(r.minItems=l),f&&(r.maxItems=d)):(r.items=A,f?r.additionalItems=!1:c&&(r.additionalItems=c),l>0&&(r.minItems=l),f&&(r.maxItems=d));let{minimum:g,maximum:p}=Me(e);typeof g=="number"&&(r.minItems=g),typeof p=="number"&&(r.maxItems=p)};function TC(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let p=e.get(t)?.def;if(!p)return t;let h=TC(e,p,n);return h===p?t:h}for(let p of["anyOf","oneOf"]){let h=t[p];if(!Array.isArray(h))continue;let E=h.map(m=>TC(e,m,n));E.some((m,C)=>m!==h[C])&&(t={...t,[p]:E})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(p=>p==="number"||p==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!o?.some(p=>typeof p=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:A,exclusiveMaximum:c,multipleOf:l,format:d,id:f,...g}=t;return g.enum?g.enum=g.enum.map(p=>typeof p=="number"?String(p):p):typeof g.const=="number"&&(g.const=String(g.const)),r&&(g.type="string",o||(g.pattern=(i.includes("number")?un:RA).source)),g}var FC=new WeakMap;function s8(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of FC.get(e)??[]){let r=e.seen.get(i),o=(r?.def??r?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=TC(t,o,new Set);s!==o&&n.set(o,s)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}var lB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let s=o.keyType,a=Me(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=pe(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)je(r.patternProperties,u$(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=pe(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let l=FC.get(t);l||(l=[],FC.set(t,l),t.deferred.push(()=>s8(t))),l.push(e)}r.additionalProperties=pe(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let A=s._zod.values,c=t.io==="input"&&XA(o.valueType)!==void 0;if(A&&!o.partial&&!c){let l=[...A].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(r.required=l.map(String))}},dB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},fB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},gB=Symbol();function l$(e,t,n,i,r){let o=!1,s=JSON.stringify(e,(a,A)=>typeof A!="bigint"?A:(o=!0,null));return o?(Fe(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),gB):JSON.parse(s)}var pB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s=l$(r.defaultValue,e,t,n,i);s!==gB&&(n.default=s)},hB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);if(o.ref=r.innerType,t.io!=="input")return;let s=l$(r.defaultValue,e,t,n,i);s!==gB&&(n._prefault=s)},mB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{Fe(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},IB=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?r.out:r.in:r.out;pe(s,t,i);let a=t.seen.get(e);a.ref=s},EB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},yB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},df=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},CB=(e,t,n,i)=>{let r=e._zod.innerType;pe(r,t,i);let o=t.seen.get(e);o.ref=r},uf={string:MC,number:LC,boolean:PC,bigint:OC,symbol:zC,null:GC,undefined:VC,void:JC,never:YC,any:jC,unknown:HC,date:qC,enum:WC,literal:ZC,nan:KC,template_literal:XC,file:eB,success:tB,custom:rB,function:nB,transform:iB,map:oB,set:sB,array:aB,object:AB,union:lf,intersection:cB,tuple:uB,record:lB,nullable:dB,nonoptional:fB,default:pB,prefault:hB,catch:mB,pipe:IB,readonly:EB,promise:yB,optional:df,lazy:CB};function ff(e,t){if("_idmap"in e){let i=e,r=Gn({...t,processors:uf}),o={};for(let A of i._idmap.entries()){let[c,l]=A;pe(l,r)}let s={},a={registry:i,uri:t?.uri,defs:o};r.external=a;for(let A of i._idmap.entries()){let[c,l]=A;Vn(r,l),je(s,c,Jn(r,l))}if(Object.keys(o).length>0){let A=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[A]:o}}return{schemas:s}}let n=Gn({...t,processors:uf});return pe(e,n),Vn(n,e),Jn(n,e)}var gf=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Gn({processors:uf,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return pe(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Vn(this.ctx,t);let i=Jn(this.ctx,t),{"~standard":r,...o}=i;return o}};var d$={};var ra={};Br(ra,{ZodAny:()=>GB,ZodArray:()=>jB,ZodBase64:()=>Nf,ZodBase64URL:()=>Uf,ZodBigInt:()=>ea,ZodBigIntFormat:()=>Ff,ZodBoolean:()=>Xs,ZodCIDRv4:()=>Df,ZodCIDRv6:()=>_f,ZodCUID:()=>vf,ZodCUID2:()=>wf,ZodCatch:()=>gQ,ZodCodec:()=>cc,ZodCreditCard:()=>$B,ZodCustom:()=>uc,ZodCustomStringFormat:()=>ao,ZodDate:()=>nc,ZodDefault:()=>AQ,ZodDiscriminatedUnion:()=>qB,ZodE164:()=>$f,ZodEmail:()=>yf,ZodEmoji:()=>Bf,ZodEnum:()=>Ws,ZodExactOptional:()=>Of,ZodFile:()=>iQ,ZodFunction:()=>vQ,ZodGUID:()=>Cf,ZodIBAN:()=>TB,ZodIPv4:()=>xf,ZodIPv6:()=>Rf,ZodISODate:()=>jn,ZodISODateTime:()=>Yn,ZodISODuration:()=>qn,ZodISOTime:()=>Hn,ZodInstanceOf:()=>kQ,ZodIntersection:()=>WB,ZodJWT:()=>Tf,ZodKSUID:()=>Sf,ZodLazy:()=>CQ,ZodLiteral:()=>nQ,ZodMAC:()=>UB,ZodMap:()=>tQ,ZodNaN:()=>hQ,ZodNanoID:()=>Qf,ZodNever:()=>JB,ZodNonOptional:()=>zf,ZodNull:()=>OB,ZodNullable:()=>aQ,ZodNumber:()=>Ks,ZodNumberFormat:()=>Ao,ZodObject:()=>oc,ZodOptional:()=>ac,ZodPipe:()=>Ac,ZodPrefault:()=>uQ,ZodPreprocess:()=>mQ,ZodPromise:()=>QQ,ZodReadonly:()=>IQ,ZodRecord:()=>qs,ZodSet:()=>rQ,ZodString:()=>Zs,ZodStringFormat:()=>me,ZodSuccess:()=>fQ,ZodSymbol:()=>LB,ZodTemplateLiteral:()=>yQ,ZodTransform:()=>oQ,ZodTuple:()=>KB,ZodType:()=>ee,ZodULID:()=>bf,ZodURL:()=>rc,ZodUUID:()=>Gr,ZodUndefined:()=>PB,ZodUnion:()=>sc,ZodUnknown:()=>VB,ZodVoid:()=>YB,ZodXID:()=>kf,ZodXor:()=>HB,_ZodString:()=>Ef,_default:()=>cQ,_function:()=>vT,any:()=>tT,array:()=>ic,base64:()=>$$,base64url:()=>T$,bigint:()=>W$,boolean:()=>MB,catch:()=>pQ,check:()=>wT,cidrv4:()=>N$,cidrv6:()=>U$,codec:()=>yT,creditCard:()=>M$,cuid:()=>w$,cuid2:()=>b$,currencyCode:()=>V$,custom:()=>bT,date:()=>nT,describe:()=>kT,discriminatedUnion:()=>cT,e164:()=>F$,email:()=>p$,emoji:()=>Q$,enum:()=>Lf,exactOptional:()=>sQ,file:()=>hT,float32:()=>Y$,float64:()=>j$,function:()=>vT,guid:()=>h$,hash:()=>J$,hex:()=>G$,hostname:()=>z$,httpUrl:()=>B$,iban:()=>L$,instanceof:()=>xT,int:()=>mf,int32:()=>H$,int64:()=>Z$,intersection:()=>ZB,invertCodec:()=>CT,ipv4:()=>R$,ipv6:()=>_$,json:()=>DT,jwt:()=>P$,keyof:()=>iT,ksuid:()=>x$,lazy:()=>BQ,literal:()=>pT,looseObject:()=>aT,looseRecord:()=>lT,mac:()=>D$,map:()=>dT,meta:()=>ST,nan:()=>ET,nanoid:()=>v$,nativeEnum:()=>gT,never:()=>Mf,nonoptional:()=>dQ,null:()=>zB,nullable:()=>tc,nullish:()=>mT,number:()=>FB,object:()=>oT,optional:()=>oo,partialRecord:()=>uT,pipe:()=>If,prefault:()=>lQ,preprocess:()=>_T,promise:()=>QT,readonly:()=>EQ,record:()=>eQ,refine:()=>wQ,set:()=>fT,strictObject:()=>sT,string:()=>ec,stringFormat:()=>O$,stringbool:()=>RT,success:()=>IT,superRefine:()=>bQ,symbol:()=>X$,templateLiteral:()=>BT,transform:()=>Pf,tuple:()=>XB,uint32:()=>q$,uint64:()=>K$,ulid:()=>k$,undefined:()=>eT,union:()=>ta,unknown:()=>io,url:()=>C$,uuid:()=>m$,uuidv4:()=>I$,uuidv6:()=>E$,uuidv7:()=>y$,void:()=>rT,xid:()=>S$,xor:()=>AT});var pf={};Br(pf,{endsWith:()=>Ms,gt:()=>Or,gte:()=>Mt,includes:()=>Ts,length:()=>ro,lowercase:()=>Us,lt:()=>Pr,lte:()=>Ft,maxLength:()=>to,maxSize:()=>zn,mime:()=>Ps,minLength:()=>ln,minSize:()=>zr,multipleOf:()=>On,negative:()=>sf,nonnegative:()=>Af,nonpositive:()=>af,normalize:()=>Os,overwrite:()=>Ir,positive:()=>of,properties:()=>Ls,property:()=>cf,regex:()=>Ns,size:()=>eo,slugify:()=>Js,startsWith:()=>Fs,toLowerCase:()=>Gs,toUpperCase:()=>Vs,trim:()=>zs,uppercase:()=>$s});var f$=new WeakSet([Object.prototype,Error.prototype]);function hf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var g$=(e,t)=>{CI.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);f$.has(n)||(f$.add(n),hf(n,"format",i=>r=>bA(i,r)),hf(n,"flatten",i=>r=>wA(i,r)),hf(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Es,2)}),hf(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Es,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},A8=I("ZodError",g$),vt=I("ZodError",g$,void 0,{Parent:Error});var BB=vs(vt),QB=ws(vt),vB=bs(vt),wB=ks(vt),bB=Vl(vt),kB=Jl(vt),SB=Yl(vt),xB=jl(vt),RB=Hl(vt),DB=ql(vt),_B=Wl(vt),NB=Zl(vt);function u8(){ze.localeError||De(xd())}function so(){ze.memoizer||De({memoizer:VA()})}var ee=I("ZodType",(e,t)=>(u8(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wQ(e,t))},superRefine(e,t){return this.check(bQ(e,t))},overwrite(e){return this.check(Ir(e))},optional(){return oo(this)},exactOptional(){return sQ(this)},nullable(){return tc(this)},nullish(){return oo(tc(this))},nonoptional(e){return dQ(this,e)},array(){return ic(this)},or(e){return ta([this,e])},and(e){return ZB(this,e)},transform(e){return If(this,Pf(e))},default(e){return cQ(this,e)},prefault(e){return lQ(this,e)},catch(e){return pQ(this,e)},pipe(e){return If(this,e)},readonly(){return EQ(this)},describe(e){let t=this.clone();return He.add(t,{description:e}),t},meta(...e){if(e.length===0)return He.get(this);let t=this.clone();return He.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return B.hide(this,"~standard",{...Ad(this),jsonSchema:{input:Ys(this,"input"),output:Ys(this,"output")}})},set"~standard"(e){B.own(this,"~standard",e)},parse:function e(t,n){return BB(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await QB(this,t,n,{callee:e})},safeParse(e,t){return vB(this,e,t)},async safeParseAsync(e,t){return wB(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B.own(this,"spa",e)},validate(e,t){return kA(this,e,t)},validateAsync(e,t){return SA(this,e,t)},encode:function e(t,n){return bB(this,t,n,{callee:e})},decode:function e(t,n){return kB(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await SB(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await xB(this,t,n,{callee:e})},safeEncode(e,t){return RB(this,e,t)},safeDecode(e,t){return DB(this,e,t)},async safeEncodeAsync(e,t){return _B(this,e,t)},async safeDecodeAsync(e,t){return NB(this,e,t)},toJSONSchema(e){return $C(this,{})(e)},get description(){return He.get(this)?.description},get _def(){return this._zod.def}}),Ef=I("_ZodString",(e,t)=>{Wi.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>MC(e,n,i,r)},B.derived({format:e=>Me(e).format??null,minLength:e=>Me(e).minimum??null,maxLength:e=>Me(e).maximum??null},{regex(...e){return this.check(Ns(...e))},includes(...e){return this.check(Ts(...e))},startsWith(...e){return this.check(Fs(...e))},endsWith(...e){return this.check(Ms(...e))},min(...e){return this.check(ln(...e))},max(...e){return this.check(to(...e))},length(...e){return this.check(ro(...e))},nonempty(...e){return this.check(ln(1,...e))},lowercase(e){return this.check(Us(e))},uppercase(e){return this.check($s(e))},trim(){return this.check(zs())},normalize(...e){return this.check(Os(...e))},toLowerCase(){return this.check(Gs())},toUpperCase(){return this.check(Vs())},slugify(){return this.check(Js())}})),Zs=I("ZodString",(e,t)=>{Wi.init(e,t),Ef.init(e,t)},{email(e){return this.check(Fd(yf,e))},url(e){return this.check(jA(rc,e))},jwt(e){return this.check(nf(Tf,e))},emoji(e){return this.check(Gd(Bf,e))},guid(e){return this.check(Md(Cf,e))},uuid(e){return this.check(Ld(Gr,e))},uuidv4(e){return this.check(Pd(Gr,e))},uuidv6(e){return this.check(Od(Gr,e))},uuidv7(e){return this.check(zd(Gr,e))},nanoid(e){return this.check(Vd(Qf,e))},cuid(e){return this.check(Jd(vf,e))},cuid2(e){return this.check(Yd(wf,e))},ulid(e){return this.check(jd(bf,e))},base64(e){return this.check(ef(Nf,e))},base64url(e){return this.check(tf(Uf,e))},xid(e){return this.check(Hd(kf,e))},ksuid(e){return this.check(qd(Sf,e))},ipv4(e){return this.check(Wd(xf,e))},ipv6(e){return this.check(Zd(Rf,e))},cidrv4(e){return this.check(Kd(Df,e))},cidrv6(e){return this.check(Xd(_f,e))},e164(e){return this.check(rf($f,e))},datetime(e){return this.check(HA(Yn,e))},date(e){return this.check(qA(jn,e))},time(e){return this.check(WA(Hn,e))},duration(e){return this.check(ZA(qn,e))}});function ec(e){return Zy(Zs,e)}var me=I("ZodStringFormat",(e,t)=>{ge.init(e,t),Ef.init(e,t)}),Yn=I("ZodISODateTime",(e,t)=>{OE.init(e,t),me.init(e,t)}),jn=I("ZodISODate",(e,t)=>{zE.init(e,t),me.init(e,t)}),Hn=I("ZodISOTime",(e,t)=>{GE.init(e,t),me.init(e,t)}),qn=I("ZodISODuration",(e,t)=>{VE.init(e,t),me.init(e,t)}),yf=I("ZodEmail",(e,t)=>{RE.init(e,t),me.init(e,t)});function p$(e){return Fd(yf,e)}var Cf=I("ZodGUID",(e,t)=>{SE.init(e,t),me.init(e,t)});function h$(e){return Md(Cf,e)}var Gr=I("ZodUUID",(e,t)=>{xE.init(e,t),me.init(e,t)});function m$(e){return Ld(Gr,e)}function I$(e){return Pd(Gr,e)}function E$(e){return Od(Gr,e)}function y$(e){return zd(Gr,e)}var rc=I("ZodURL",(e,t)=>{NE.init(e,t),me.init(e,t)});function C$(e){return jA(rc,e)}function B$(e){return jA(rc,{protocol:xA,hostname:VI,...B.normalizeParams(e)})}var Bf=I("ZodEmoji",(e,t)=>{UE.init(e,t),me.init(e,t)});function Q$(e){return Gd(Bf,e)}var Qf=I("ZodNanoID",(e,t)=>{$E.init(e,t),me.init(e,t)});function v$(e){return Vd(Qf,e)}var vf=I("ZodCUID",(e,t)=>{TE.init(e,t),me.init(e,t)});function w$(e){return Jd(vf,e)}var wf=I("ZodCUID2",(e,t)=>{FE.init(e,t),me.init(e,t)});function b$(e){return Yd(wf,e)}var bf=I("ZodULID",(e,t)=>{ME.init(e,t),me.init(e,t)});function k$(e){return jd(bf,e)}var kf=I("ZodXID",(e,t)=>{LE.init(e,t),me.init(e,t)});function S$(e){return Hd(kf,e)}var Sf=I("ZodKSUID",(e,t)=>{PE.init(e,t),me.init(e,t)});function x$(e){return qd(Sf,e)}var xf=I("ZodIPv4",(e,t)=>{JE.init(e,t),me.init(e,t)});function R$(e){return Wd(xf,e)}var UB=I("ZodMAC",(e,t)=>{jE.init(e,t),me.init(e,t)});function D$(e){return Xy(UB,e)}var Rf=I("ZodIPv6",(e,t)=>{YE.init(e,t),me.init(e,t)});function _$(e){return Zd(Rf,e)}var Df=I("ZodCIDRv4",(e,t)=>{HE.init(e,t),me.init(e,t)});function N$(e){return Kd(Df,e)}var _f=I("ZodCIDRv6",(e,t)=>{qE.init(e,t),me.init(e,t)});function U$(e){return Xd(_f,e)}var Nf=I("ZodBase64",(e,t)=>{WE.init(e,t),me.init(e,t)});function $$(e){return ef(Nf,e)}var Uf=I("ZodBase64URL",(e,t)=>{ZE.init(e,t),me.init(e,t)});function T$(e){return tf(Uf,e)}var $f=I("ZodE164",(e,t)=>{KE.init(e,t),me.init(e,t)});function F$(e){return rf($f,e)}var $B=I("ZodCreditCard",(e,t)=>{XE.init(e,t),me.init(e,t)});function M$(e){return eC($B,e)}var TB=I("ZodIBAN",(e,t)=>{ey.init(e,t),me.init(e,t)});function L$(e){return tC(TB,e)}var Tf=I("ZodJWT",(e,t)=>{ty.init(e,t),me.init(e,t)});function P$(e){return nf(Tf,e)}var ao=I("ZodCustomStringFormat",(e,t)=>{ry.init(e,t),me.init(e,t)});function O$(e,t,n={}){return no(ao,e,t,n)}function z$(e){return no(ao,"hostname",GI,e)}function G$(e){return no(ao,"hex",iE,e)}function V$(e){return no(ao,"currency_code",YI,e)}function J$(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=Xt[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return no(ao,i,r,t)}var Ks=I("ZodNumber",(e,t)=>{Id.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>LC(e,n,i,r),e.isFinite=!0},B.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Me(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Me(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=Me(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Me(e).format??null},{gt(e,t){return this.check(Or(e,t))},gte(e,t){return this.check(Mt(e,t))},min(e,t){return this.check(Mt(e,t))},lt(e,t){return this.check(Pr(e,t))},lte(e,t){return this.check(Ft(e,t))},max(e,t){return this.check(Ft(e,t))},int(e){return this.check(mf(e))},safe(e){return this.check(mf(e))},positive(e){return this.check(Or(0,e))},nonnegative(e){return this.check(Mt(0,e))},negative(e){return this.check(Pr(0,e))},nonpositive(e){return this.check(Ft(0,e))},multipleOf(e,t){return this.check(On(e,t))},step(e,t){return this.check(On(e,t))},finite(){return this}}));function FB(e){return nC(Ks,e)}var Ao=I("ZodNumberFormat",(e,t)=>{ny.init(e,t),Ks.init(e,t)});function mf(e){return oC(Ao,e)}function Y$(e){return sC(Ao,e)}function j$(e){return aC(Ao,e)}function H$(e){return AC(Ao,e)}function q$(e){return cC(Ao,e)}var Xs=I("ZodBoolean",(e,t)=>{MA.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>PC(e,n,i,r)});function MB(e){return uC(Xs,e)}var ea=I("ZodBigInt",(e,t)=>{Ed.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>OC(e,n,i,r)},B.derived({minValue:e=>Me(e).minimum??null,maxValue:e=>Me(e).maximum??null,format:e=>Me(e).format??null},{gte(e,t){return this.check(Mt(e,t))},min(e,t){return this.check(Mt(e,t))},gt(e,t){return this.check(Or(e,t))},lt(e,t){return this.check(Pr(e,t))},lte(e,t){return this.check(Ft(e,t))},max(e,t){return this.check(Ft(e,t))},positive(e){return this.check(Or(BigInt(0),e))},negative(e){return this.check(Pr(BigInt(0),e))},nonpositive(e){return this.check(Ft(BigInt(0),e))},nonnegative(e){return this.check(Mt(BigInt(0),e))},multipleOf(e,t){return this.check(On(e,t))}}));function W$(e){return dC(ea,e)}var Ff=I("ZodBigIntFormat",(e,t)=>{iy.init(e,t),ea.init(e,t)});function Z$(e){return gC(Ff,e)}function K$(e){return pC(Ff,e)}var LB=I("ZodSymbol",(e,t)=>{oy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zC(e,n,i,r)});function X$(e){return hC(LB,e)}var PB=I("ZodUndefined",(e,t)=>{sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>VC(e,n,i,r)});function eT(e){return mC(PB,e)}var OB=I("ZodNull",(e,t)=>{ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>GC(e,n,i,r)});function zB(e){return IC(OB,e)}var GB=I("ZodAny",(e,t)=>{Ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jC(e,n,i,r)});function tT(){return EC(GB)}var VB=I("ZodUnknown",(e,t)=>{cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>HC(e,n,i,r)});function io(){return yC(VB)}var JB=I("ZodNever",(e,t)=>{uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>YC(e,n,i,r)});function Mf(e){return CC(JB,e)}var YB=I("ZodVoid",(e,t)=>{ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>JC(e,n,i,r)});function rT(e){return BC(YB,e)}var nc=I("ZodDate",(e,t)=>{dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qC(e,n,i,r),e.min=(n,i)=>e.check(Mt(n,i)),e.max=(n,i)=>e.check(Ft(n,i))},B.derived({minDate:e=>{let{minimum:t}=Me(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Me(e);return t?new Date(t):null}},{}));function nT(e){return QC(nc,e)}var jB=I("ZodArray",(e,t)=>{so(),gy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>aB(e,n,i,r),e.element=t.element},{min(e,t){return this.check(ln(e,t))},nonempty(e){return this.check(ln(1,e))},max(e,t){return this.check(to(e,t))},length(e,t){return this.check(ro(e,t))},unwrap(){return this.element}});function ic(e,t){return bC(jB,e,t)}function iT(e){let t=e._zod.def.shape;return Lf(Object.keys(t))}var oc=I("ZodObject",(e,t)=>{so(),py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>AB(e,n,i,r),B.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Lf(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},loose(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},strict(){return this.clone(B.mergeDefs(this._zod.def,{catchall:Mf()}))},strip(){return this.clone(B.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return B.extend(this,e)},safeExtend(e){return B.safeExtend(this,e)},merge(e){return B.merge(this,e)},pick(e){return B.pick(this,e)},omit(e){return B.omit(this,e)},partial(...e){return B.partial(ac,this,e[0])},exactPartial(...e){return B.partial(Of,this,e[0],"exactPartial")},required(...e){return B.required(zf,this,e[0])}});function oT(e,t){let n={type:"object",shape:e??{},...B.normalizeParams(t)};return new oc(n)}function sT(e,t){return new oc({type:"object",shape:e,catchall:Mf(),...B.normalizeParams(t)})}function aT(e,t){return new oc({type:"object",shape:e,catchall:io(),...B.normalizeParams(t)})}var sc=I("ZodUnion",(e,t)=>{LA.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lf(e,n,i,r),e.options=t.options});function ta(e,t){return new sc({type:"union",options:e,...B.normalizeParams(t)})}var HB=I("ZodXor",(e,t)=>{sc.init(e,t),hy.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lf(e,n,i,r),e.options=t.options});function AT(e,t){return new HB({type:"union",options:e,inclusive:!1,...B.normalizeParams(t)})}var qB=I("ZodDiscriminatedUnion",(e,t)=>{sc.init(e,t),Iy.init(e,t)});function cT(e,t,n){return new qB({type:"union",options:t,discriminator:e,...B.normalizeParams(n)})}var WB=I("ZodIntersection",(e,t)=>{Ey.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>cB(e,n,i,r)});function ZB(e,t){return new WB({type:"intersection",left:e,right:t})}var KB=I("ZodTuple",(e,t)=>{so(),yd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>uB(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ac({type:"optional",innerType:t}))})}});function XB(e,t,n){let i=t instanceof Z,r=i?n:t,o=i?t:null;return new KB({type:"tuple",items:e,rest:o,...B.normalizeParams(r)})}var qs=I("ZodRecord",(e,t)=>{so(),yy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function eQ(e,t,n){return!t||!t._zod?new qs({type:"record",keyType:ec(),valueType:e,...B.normalizeParams(t)}):new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n)})}function uT(e,t,n){return new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n),partial:!0})}function lT(e,t,n){return new qs({type:"record",keyType:e,valueType:t,mode:"loose",...B.normalizeParams(n)})}var tQ=I("ZodMap",(e,t)=>{so(),Cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>oB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(zr(...n)),e.nonempty=n=>e.check(zr(1,n)),e.max=(...n)=>e.check(zn(...n)),e.size=(...n)=>e.check(eo(...n))});function dT(e,t,n){return new tQ({type:"map",keyType:e,valueType:t,...B.normalizeParams(n)})}var rQ=I("ZodSet",(e,t)=>{so(),By.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>sB(e,n,i,r),e.min=(...n)=>e.check(zr(...n)),e.nonempty=n=>e.check(zr(1,n)),e.max=(...n)=>e.check(zn(...n)),e.size=(...n)=>e.check(eo(...n))});function fT(e,t){return new rQ({type:"set",valueType:e,...B.normalizeParams(t)})}var Ws=I("ZodEnum",(e,t)=>{Qy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(i,r,o)=>WC(e,i,r,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})}});function Lf(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Ws({type:"enum",entries:n,...B.normalizeParams(t)})}function gT(e,t){return new Ws({type:"enum",entries:e,...B.normalizeParams(t)})}var nQ=I("ZodLiteral",(e,t)=>{vy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ZC(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pT(e,t){return new nQ({type:"literal",values:Array.isArray(e)?e:[e],...B.normalizeParams(t)})}var iQ=I("ZodFile",(e,t)=>{wy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>eB(e,n,i,r),e.min=(n,i)=>e.check(zr(n,i)),e.max=(n,i)=>e.check(zn(n,i)),e.mime=(n,i)=>e.check(Ps(Array.isArray(n)?n:[n],i))});function hT(e){return kC(iQ,e)}var oQ=I("ZodTransform",(e,t)=>{so(),by.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>iB(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Ln(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(B.issue(o,n.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(B.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function Pf(e){return new oQ({type:"transform",transform:e})}var ac=I("ZodOptional",(e,t)=>{Cd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>df(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new ac({type:"optional",innerType:e})}var Of=I("ZodExactOptional",(e,t)=>{ky.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>df(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function sQ(e){return new Of({type:"optional",innerType:e})}var aQ=I("ZodNullable",(e,t)=>{Sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>dB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new aQ({type:"nullable",innerType:e})}function mT(e){return oo(tc(e))}var AQ=I("ZodDefault",(e,t)=>{xy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>pB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cQ(e,t){return new AQ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var uQ=I("ZodPrefault",(e,t)=>{Ry.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function lQ(e,t){return new uQ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var zf=I("ZodNonOptional",(e,t)=>{Dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function dQ(e,t){return new zf({type:"nonoptional",innerType:e,...B.normalizeParams(t)})}var fQ=I("ZodSuccess",(e,t)=>{_y.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function IT(e){return new fQ({type:"success",innerType:e})}var gQ=I("ZodCatch",(e,t)=>{Ny.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>mB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pQ(e,t){return new gQ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:B.constantCatch(t)})}var hQ=I("ZodNaN",(e,t)=>{Uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>KC(e,n,i,r)});function ET(e){return wC(hQ,e)}var Ac=I("ZodPipe",(e,t)=>{Bd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>IB(e,n,i,r),e.in=t.in,e.out=t.out});function If(e,t){return new Ac({type:"pipe",in:e,out:t})}var cc=I("ZodCodec",(e,t)=>{Ac.init(e,t),PA.init(e,t)});function yT(e,t,n){return new cc({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function CT(e){let t=e._zod.def;return new cc({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var mQ=I("ZodPreprocess",(e,t)=>{Ac.init(e,t),$y.init(e,t)}),IQ=I("ZodReadonly",(e,t)=>{Ty.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>EB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function EQ(e){return new IQ({type:"readonly",innerType:e})}var yQ=I("ZodTemplateLiteral",(e,t)=>{Fy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>XC(e,n,i,r)});function BT(e,t){return new yQ({type:"template_literal",parts:e,...B.normalizeParams(t)})}var CQ=I("ZodLazy",(e,t)=>{OA.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>CB(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function BQ(e){return new CQ({type:"lazy",getter:e})}var QQ=I("ZodPromise",(e,t)=>{Ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function QT(e){return new QQ({type:"promise",innerType:e})}var vQ=I("ZodFunction",(e,t)=>{My.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>nB(e,n,i,r)});function vT(e){return new vQ({type:"function",input:Array.isArray(e?.input)?XB(e?.input):e?.input??ic(io()),output:e?.output??io()})}var uc=I("ZodCustom",(e,t)=>{Py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>rB(e,n,i,r)});function wT(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function bT(e,t){return SC(uc,e??(()=>!0),t)}function wQ(e,t={}){return xC(uc,e,t)}function bQ(e,t){return RC(e,t)}var kT=DC,ST=_C,kQ=I("ZodInstanceOf",(e,t)=>{uc.init(e,t)},{properties(e,t){return this.check(Ls(e,t))}});function xT(e,t={}){let n=new kQ({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...B.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var RT=(...e)=>NC({Codec:cc,Boolean:Xs,String:Zs},...e);function DT(e){let t=BQ(()=>ta([ec(e),FB(),MB(),zB(),ic(t),eQ(ec(),t)]));return t}function _T(e,t){return new mQ({type:"pipe",in:Pf(e),out:t})}var l8={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"};function d8(e){De({customError:e})}function f8(){return De().customError}var SQ;SQ||(SQ={});var lc={};Br(lc,{ZodISODate:()=>jn,ZodISODateTime:()=>Yn,ZodISODuration:()=>qn,ZodISOTime:()=>Hn,date:()=>p8,datetime:()=>g8,duration:()=>m8,time:()=>h8});function g8(e){return HA(Yn,e)}function p8(e){return qA(jn,e)}function h8(e){return WA(Hn,e)}function m8(e){return ZA(qn,e)}var N={...ra,...pf,iso:lc},I8=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function E8(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function NT(e,t){return e.map((n,i)=>i<t?n:n.optional())}function y8(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function C8(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:y8(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function B8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let o=Object.getOwnPropertyNames(r);if(t.minProperties!==void 0&&o.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:r,inst:e,continue:!0}),t.maxProperties!==void 0&&o.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:r,inst:e,continue:!0}),t.keySchema)for(let s of o){let a=t.keySchema.safeParse(s);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function xQ(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let i=String(e);return`${n[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let o=[];for(let s of e){let a=xQ(s,t);if(a===null)return null;o.push(a)}return`a${o.length}:[${o.join(",")}]`}let i=Object.keys(e).sort(),r=[];for(let o of i){let s=xQ(e[o],t);if(s===null)return null;r.push(`${o.length}:${o}=${s}`)}return`o${r.length}:{${r.join(",")}}`}finally{t.delete(e)}}var Q8=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),v8=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function dc(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(dc):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Q8.has(t)?dc(n):!v8.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(dc))}function UT(e){return e===1?"element":"elements"}function w8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(t.uniqueItems===!0){let o=new Map;for(let s=0;s<r.length;s++){let a=xQ(r[s],new Set);if(a===null)continue;let A=o.get(a);if(A===void 0){o.set(a,s);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${A}`,input:r,path:[s],continue:!0})}}if(t.containsSchema){let o=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let A of r)if(t.containsSchema.safeParse(A).success&&++a>=s)break;a<o&&i.issues.push({code:"custom",message:`Array must contain at least ${o} matching ${UT(o)}; found ${a}`,input:r,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${UT(t.maxContains)}`,input:r,continue:!0})}}}).pipe(e)}function $T(e,t){if(e!==!1)return e===void 0||e===!0?N.any():ut(e,t)}var b8=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function TT(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return N.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return N.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=C8(r,t),s=ut(o,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return N.null();if(r.length===0)return N.never();if(r.length===1)return N.literal(r[0]);if(r.every(s=>typeof s=="string"))return N.enum(r);let o=r.map(s=>N.literal(s));return o.length<2?o[0]:N.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return N.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let s={...e,type:o};return TT(s,t)});return r.length===0?N.never():r.length===1?r[0]:N.union(r)}if(!n)return N.any();let i;switch(n){case"string":{let r=N.string();if(e.format){let o=e.format;o==="email"?r=r.check(N.email()):o==="uri"||o==="uri-reference"?r=r.check(N.url()):o==="uuid"||o==="guid"?r=r.check(N.uuid()):o==="date-time"?r=r.check(N.iso.datetime({offset:!0})):o==="date"?r=r.check(N.iso.date()):o==="time"?r=r.check(N.regex(b8)):o==="duration"?r=r.check(N.iso.duration()):o==="hostname"?r=r.check(N.hostname()):o==="ipv4"?r=r.check(N.ipv4()):o==="ipv6"?r=r.check(N.ipv6()):o==="mac"?r=r.check(N.mac()):o==="cidr"?r=r.check(N.cidrv4()):o==="cidr-v6"?r=r.check(N.cidrv6()):o==="base64"?r=r.check(N.base64()):o==="base64url"?r=r.check(N.base64url()):o==="e164"?r=r.check(N.e164()):o==="credit_card"?r=r.check(N.creditCard()):o==="iban"?r=r.check(N.iban()):o==="jwt"?r=r.check(N.jwt()):o==="emoji"?r=r.check(N.emoji()):o==="nanoid"?r=r.check(N.nanoid()):o==="cuid"?r=r.check(N.cuid()):o==="cuid2"?r=r.check(N.cuid2()):o==="ulid"?r=r.check(N.ulid()):o==="xid"?r=r.check(N.xid()):o==="ksuid"&&(r=r.check(N.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?N.number().int():N.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=N.boolean();break}case"null":{i=N.null();break}case"object":{let r={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?ut(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(o)){let g=ut(f,t);je(r,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),g=[];for(let h of f){let E=ut(d[h],t),m=N.string().regex(new RegExp(h));g.push(N.looseRecord(m,E))}let p=[];if(Object.keys(r).length>0&&p.push(N.object(r).passthrough()),p.push(...g),p.length===0)i=N.object({}).passthrough();else if(p.length===1)i=p[0];else{let h=N.intersection(p[0],p[1]);for(let E=2;E<p.length;E++)h=N.intersection(h,p[E]);i=h}if(e.additionalProperties===!1){let h=Object.keys(r),E=f.map(C=>new RegExp(C)),m=i;i=i.check(C=>{if(!Zt(C.value))return;let w=[];for(let b of Object.keys(C.value))h.includes(b)||E.some(T=>T.test(b))||w.push(b);w.length&&C.issues.push({code:"unrecognized_keys",keys:w,input:C.value,inst:m})})}}else{let d=N.object(r);e.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let A=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(A||c!==void 0||l!==void 0){let d;if(A){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ut(f,t)}i=B8(i,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let s=typeof e.minItems=="number"?e.minItems:0,a=r.map(d=>ut(d,t)),A=NT(a,s),c=Array.isArray(o)?void 0:$T(o,t),l=N.tuple(A);i=c?l.rest(c):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>ut(d,t)),A=NT(a,s),c=$T(e.additionalItems,t),l=N.tuple(A);i=c?l.rest(c):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(o!==void 0){let s=ut(o,t),a=N.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=N.array(N.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=w8(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ut(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return i}function ut(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n=TT(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(c=>ut(c,t)),A=N.union(a);n=i?N.intersection(n,A):A}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(c=>ut(c,t)),A=N.xor(a);n=i?N.intersection(n,A):A}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:N.any();else{let a=i?n:ut(e.allOf[0],t),A=i?0:1;for(let c=A;c<e.allOf.length;c++)a=N.intersection(a,ut(e.allOf[c],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=N.nullable(n)),e.readOnly===!0&&(n=N.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!dc(e.propertyNames)&&(r.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(r[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!dc(e.contains)&&(r.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(r[a]=e[a])}for(let a of Object.keys(e))I8.has(a)||je(r,a,e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function FT(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=E8(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??He};return ut(n,o)}var MT=Symbol("z.visit/resolving");function fc(e,t){let n=typeof t=="function"?t:(s,a)=>{let A=t[s._zod.def.type];return A?A(s,a):s},i=new Map;function r(s){let a=i.get(s);if(a===MT)return new OA({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,MT);let A=o(s),c=n(A,A!==s);return i.set(s,c),c}function o(s){let a=s._zod.def,A=a.type;switch(A){case"object":{let c=a.shape,l=Object.keys(c),d=!1,f={};for(let p of l){let h=r(c[p]);h!==c[p]&&(d=!0),f[p]=h}let g=a.catchall;return a.catchall&&(g=r(a.catchall),g!==a.catchall&&(d=!0)),d?fe(s,{...a,shape:f,catchall:g}):s}case"array":{let c=r(a.element);return c===a.element?s:fe(s,{...a,element:c})}case"tuple":{let c=a.items,l=!1,d=[];for(let g of c){let p=r(g);p!==g&&(l=!0),d.push(p)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(l=!0)),l?fe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let c=r(a.keyType),l=r(a.valueType);return c===a.keyType&&l===a.valueType?s:fe(s,{...a,keyType:c,valueType:l})}case"set":{let c=r(a.valueType);return c===a.valueType?s:fe(s,{...a,valueType:c})}case"union":{let c=a.options,l=!1,d=[];for(let f of c){let g=r(f);g!==f&&(l=!0),d.push(g)}return l?fe(s,{...a,options:d}):s}case"intersection":{let c=r(a.left),l=r(a.right);return c===a.left&&l===a.right?s:fe(s,{...a,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=r(a.innerType);return c===a.innerType?s:fe(s,{...a,innerType:c})}case"pipe":{let c=r(a.in),l=r(a.out);return c===a.in&&l===a.out?s:fe(s,{...a,in:c,out:l})}case"function":{let c=r(a.input),l=r(a.output);return c===a.input&&l===a.output?s:fe(s,{...a,input:c,output:l})}case"lazy":{let c=a.getter,{_cachedInner:l,...d}=a;return fe(s,{...d,getter:()=>r(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return r(e)}function LT(e){return fc(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:ta(n.options)}})}function k8(e,t){if(!t?.length)return e;let n=e._zod.def;return fe(e,hr(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function PT(e){return k8(e.out,e.checks)}function S8(e){return e.in._zod.traits.has("$ZodTransform")?PT(e):e.in}function OT(e){return fc(e,{pipe:t=>S8(t._zod.def),default:(t,n)=>n?oo(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function zT(e){return fc(e,{pipe:t=>PT(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var RQ={};Br(RQ,{bigint:()=>_8,boolean:()=>D8,date:()=>N8,number:()=>R8,string:()=>x8});function x8(e){return Ky(Zs,e)}function R8(e){return iC(Ks,e)}function D8(e){return lC(Xs,e)}function _8(e){return fC(ea,e)}function N8(e){return vC(nc,e)}var GT=require("async_hooks");var Joe=new GT.AsyncLocalStorage;var cse=new Set(Object.values(Aa));var use=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var M8=["generate-unit","native-run"],fse=["preflight","plan","write",...M8,"report","deliver"];var JT=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(JT||{}),L8=Object.values(JT);var Qse=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var YT=(n=>(n.Full="full",n.Static="static",n))(YT||{}),jT=(i=>(i.Contract="contract",i.Integration="integration",i.Ui="ui",i))(jT||{}),DQ=(o=>(o.OwnSurface="own_surface",o.StateReadBack="state_read_back",o.Referential="referential",o.Lifecycle="lifecycle",o.Boundaries="boundaries",o))(DQ||{}),HT=(r=>(r.Update="update",r.Regenerate="regenerate",r.Delete="delete",r.Verify="verify",r))(HT||{}),qT=(c=>(c.Equals="equals",c.NotEquals="not_equals",c.GreaterThan="greater_than",c.LessThan="less_than",c.Contains="contains",c.NotContains="not_contains",c.Matches="matches",c.Absent="absent",c.Present="present",c))(qT||{});var Lt=u.string().trim().min(1),O8=u.object({subject:Lt.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(qT),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),z8=u.object({test:Lt.describe("existing test path, relative to its repository"),repository:Lt.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(HT),evidence:Lt.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers"),staleOnBase:u.boolean().optional().describe("[derived] the plan found the test already wrong on the base branch: it is left as it is and re-run")});var G8=u.object({surface:Lt.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(DQ)}),V8=u.object({id:Lt.describe("short-slug, unique across generate[]"),type:u.nativeEnum(jT),target:Lt.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:G8.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Lt.describe("why this test matters"),expected_observable:Lt.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:O8.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Lt.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),J8=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),i=typeof e.abstain=="string";if(n===i)return void t.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),i&&!e.abstain.trim()&&t.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Y8=u.object({surface:Lt.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(DQ).map(e=>[e,J8])))}),Rse=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(YT),maintenance:u.array(z8),generate:u.array(V8),surfaces:u.array(Y8).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Lt}),summary:Lt.describe("one paragraph")});function _Q(e){return e.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"")}var Zse=M.object({mode:M.string().optional(),entries:M.array(M.object({entityUrl:M.string().optional(),tornDown:M.boolean().optional(),id:M.union([M.string(),M.number()]).optional(),createdAt:M.number().optional(),testExecution:M.string().optional(),readAt:M.array(M.string()).optional(),deleteAnswered:M.boolean().optional(),deleteStatus:M.number().int().optional(),readBack:M.object({status:M.number().int().optional(),end:M.string().optional()}).passthrough().optional()})).optional(),blocks:M.array(M.object({method:M.string().optional(),url:M.string().optional(),rule:M.string().optional(),count:M.number().nonnegative().optional()})).optional(),unparsedCreates:M.array(M.object({url:M.string().optional(),rule:M.string().optional()})).optional()});var Kse=M.object({id:M.string().regex(/^(legacy|unknown|session-[0-9a-f-]{36})$/),stage:M.string(),browserUsed:M.boolean()});var Xse=M.object({environmentId:M.string().uuid().optional(),environmentAddress:M.string().url().optional(),persistentDataPolicy:M.custom(e=>kl.safeParse(e).success,"invalid persistent-data policy").optional(),components:M.array(M.object({name:M.string().min(1),url:M.string().min(1),repository:M.string().min(1).optional(),expectedRevision:M.string().min(1).optional(),revisionUrl:M.string().url().optional()}).strict()).min(1),dependencies:M.array(M.object({name:M.string().min(1),url:M.string().nullable(),versionUrl:M.string().nullable(),notes:M.string().nullable()}).strict()).default([]),allowMutation:M.boolean().optional(),offLimits:M.array(M.string().min(1)).optional(),allowedEgress:M.array(M.string().min(1)).optional()}).strict();var gc=e=>Array.isArray(e.ledger)?e.ledger:[],W8=5,Z8=["classify","shouldCaptureCreateBody","recordResponse","noteEntityResponse","noteRedirect","recordBlock","ensureLedgerWritable","flush"];function eF(e){if(e)try{let t=(0,KT.createRequire)(e)(e),n=t.DataSafetyGuard;return typeof n!="function"||typeof t.parseDataSafetyConfig!="function"||typeof t.blockReason!="function"||!Z8.every(i=>typeof n.prototype[i]=="function")?void 0:t}catch{return}}var WT=new Set(["GET","HEAD","OPTIONS"]),K8=new Set(["api.anthropic.com:443","github.com:443","api.github.com:443","raw.githubusercontent.com:443","objects.githubusercontent.com:443","codeload.github.com:443","release-assets.githubusercontent.com:443","registry.npmjs.org:443","pypi.org:443","pypi.python.org:443","files.pythonhosted.org:443","cdn.playwright.dev:443","playwright.download.prss.microsoft.com:443"]),X8="storage.googleapis.com",tF=`${X8}:443`,eX=/^\/chrome-for-testing-public\/\d+\.\d+\.\d+\.\d+\/[a-z0-9-]+\/chrome(?:-headless-shell)?-[a-z0-9-]+\.zip$/;function NQ(e){return e.protocol==="https:"&&pc(e)===tF}var FQ=new Le.BlockList;for(let[e,t]of[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.168.0.0",16],["198.18.0.0",15],["224.0.0.0",4],["240.0.0.0",4]])FQ.addSubnet(e,t,"ipv4");for(let[e,t]of[["::",128],["::1",128],["fc00::",7],["fe80::",10],["ff00::",8]])FQ.addSubnet(e,t,"ipv6");var Gf=64*1024*1024,Vf=3e3,tX=[250,750],rF=1e4,kae=Vf+rF+Vf,rX=8;var nX=500,iX=/^(content-|if-|expect$|x-http-method|x-method-override$)/,oX=/^(_method|x-http-method(-override)?|x-method-override)$/i;function sX(e,t,n,i){return e===410||e===404&&(t||n&&i)}function ZT(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,"").split("/");if(n.length<2||!n.at(-1))return;let i=[...new Set(t.searchParams.keys())].sort();return`${t.origin}${n.slice(0,-1).join("/")}/*${i.length?`?${i.join("&")}`:""}`}catch{return}}var nF=e=>e!==void 0&&e>=200&&e<300;function aX(e){let t=0,n=[];return async i=>{t>=e?await new Promise(r=>n.push(r)):t++;try{return await i()}finally{let r=n.shift();r?r():t--}}}function AX(e,t){return nF(e.responseStatus)&&!!e.entityUrl&&tr(e.entityUrl)===t}function cX(e){let t=new URL(e);for(let n of[...t.searchParams.keys()])oX.test(n)&&t.searchParams.delete(n);return t}function er(e,t,n,i){let o=`${[n==="blocked"?"Blocked by data safety":"Data safety could not check or record this request",i].filter(Boolean).join(": ")}. Do not retry it.
|
|
189
189
|
`,s={"content-type":"text/plain; charset=utf-8","x-skyramp-data-safety":n};if(e instanceof Wn.ServerResponse){e.writeHead(t,s).end(o);return}let a=Object.entries({...s,connection:"close"}).map(([A,c])=>`${A}: ${c}`);e.end(`HTTP/1.1 ${t} ${Wn.STATUS_CODES[t]??""}\r
|
|
190
190
|
${a.join(`\r
|
|
191
191
|
`)}\r
|