@zuplo/runtime 7.14.5 → 7.14.6
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/out/esm/chunk-AEVCZW3D.js +26 -0
- package/out/esm/chunk-AEVCZW3D.js.map +1 -0
- package/out/esm/{chunk-C32OTSKW.js → chunk-G2O2ZIL3.js} +2 -2
- package/out/esm/chunk-JORDKCQ5.js +429 -0
- package/out/esm/chunk-JORDKCQ5.js.map +1 -0
- package/out/esm/{chunk-AENEWA54.js → chunk-LDA754KZ.js} +2 -2
- package/out/esm/chunk-VIH2ISEH.js +37 -0
- package/out/esm/{chunk-UFTMOJ7K.js.map → chunk-VIH2ISEH.js.map} +1 -1
- package/out/esm/index.js +1 -1
- package/out/esm/mcp/messages/index.js +1 -1
- package/out/esm/mcp-gateway/index.js +12 -12
- package/out/esm/mcp-gateway/index.js.map +1 -1
- package/out/esm/mocks/index.js +1 -1
- package/out/esm/sdks/aws/index.js +1 -1
- package/out/types/index.d.ts +121 -8
- package/out/types/internal/index.d.ts +123 -10
- package/package.json +1 -1
- package/out/esm/chunk-7RNZS3GX.js +0 -26
- package/out/esm/chunk-7RNZS3GX.js.map +0 -1
- package/out/esm/chunk-UFTMOJ7K.js +0 -37
- package/out/esm/chunk-UGZSO3CK.js +0 -414
- package/out/esm/chunk-UGZSO3CK.js.map +0 -1
- /package/out/esm/{chunk-C32OTSKW.js.map → chunk-G2O2ZIL3.js.map} +0 -0
- /package/out/esm/{chunk-UGZSO3CK.js.LEGAL.txt → chunk-JORDKCQ5.js.LEGAL.txt} +0 -0
- /package/out/esm/{chunk-AENEWA54.js.map → chunk-LDA754KZ.js.map} +0 -0
- /package/out/esm/{chunk-UFTMOJ7K.js.LEGAL.txt → chunk-VIH2ISEH.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Zuplo, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This software and associated documentation files (the "Software") is intended to be used
|
|
6
|
+
* only by Zuplo customers solely to develop and test applications that will be deployed
|
|
7
|
+
* to Zuplo hosted services. You and others in your organization may use these files on your
|
|
8
|
+
* Development Devices solely for the above stated purpose.
|
|
9
|
+
*
|
|
10
|
+
* Outside of uses stated above, no license is granted for any other purpose including
|
|
11
|
+
* without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
12
|
+
* sublicense, host, and/or sell copies of the Software.
|
|
13
|
+
*
|
|
14
|
+
* The software may include third party components with separate legal notices or governed by
|
|
15
|
+
* other agreements, as described in licenses either embedded in or accompanying the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
18
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
19
|
+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
20
|
+
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21
|
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
22
|
+
* DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*--------------------------------------------------------------------------------------------*/
|
|
24
|
+
|
|
25
|
+
import{a as g}from"./chunk-A3QGJZO7.js";import{$ as T}from"./chunk-VIH2ISEH.js";import{a as r}from"./chunk-TYV53J3B.js";var P=class e extends Request{static{r(this,"ZuploRequest")}#t=void 0;#e;#n;constructor(t,n,s){super(t,n);let o=n?.params;this.#n=s,o?this.#e=o:t instanceof e?this.#e=t.#e:this.#e={};let a=n?.user;a?this.user=a:t instanceof e&&(this.user=t.user)}get originalRequest(){return this.#n??null}get query(){if(this.#t===void 0){let t={},n=new URL(this.url).searchParams;for(let[s,o]of n.entries())t[s]=o;this.#t=t}return g(this.#t)}get params(){return g(this.#e)}user};function h(){return T.instance.build.COMPATIBILITY_FLAGS.mcpProtocolVersion20260728===!0}r(h,"isMcp20260728Enabled");var S="2026-07-28",A="io.modelcontextprotocol/protocolVersion",U="io.modelcontextprotocol/clientCapabilities",B="io.modelcontextprotocol/clientInfo",W="io.modelcontextprotocol/serverInfo",Z=-32022,Q=/^\d{4}-\d{2}-\d{2}$/;function I(e){return typeof e=="string"&&Q.test(e)&&e>=S}r(I,"isModernProtocolVersion");function f(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}r(f,"isRecord");function k(e){if(!f(e)||!f(e.params))return;let t=e.params._meta;return f(t)?t:void 0}r(k,"readRequestMeta");function L(e){let t=k(e)?.[A];return typeof t=="string"?t:void 0}r(L,"readEnvelopeProtocolVersion");function X(e){let t=k(e)?.[U];return f(t)?t:void 0}r(X,"readEnvelopeClientCapabilities");function x(e,t){if(Array.isArray(t))return!1;let n=e.get("mcp-protocol-version"),s=L(t);return n!==null&&I(n)||s!==void 0&&I(s)}r(x,"isModernMcpRequest");var ee="zuplo_upstream_connect";var M="2.0",R=-32600,N=-32602,re=-32603,oe=-32001,b=10*1024*1024;function c(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}r(c,"isRecord");function y(e){return typeof e=="string"||typeof e=="number"}r(y,"isRequestId");function p(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?JSON.stringify(e.length>40?`${e.slice(0,40)}\u2026`:e):String(e)}r(p,"describeValue");function i(e){if(!(e===void 0||c(e)))return`params must be an object when present (got ${p(e)}).`}r(i,"optionalObjectParams");function u(e,t){return n=>{if(!c(n))return`params must be an object with a string \`${e}\` (got ${p(n)}). Example: ${t}`;if(typeof n[e]!="string")return`params.${e} must be a string (got ${p(n[e])}). Example: ${t}`}}r(u,"requireStringField");var v={initialize:i,ping:i,"tools/list":i,"tools/call":u("name",'{"name":"my_tool","arguments":{}}'),"prompts/list":i,"prompts/get":u("name",'{"name":"my_prompt"}'),"resources/list":i,"resources/templates/list":i,"resources/read":u("uri",'{"uri":"file:///a.txt"}'),"resources/subscribe":u("uri",'{"uri":"file:///a.txt"}'),"resources/unsubscribe":u("uri",'{"uri":"file:///a.txt"}'),"completion/complete":i,"logging/setLevel":u("level",'{"level":"info"}'),"server/discover":i,"subscriptions/listen":i,"tasks/get":u("taskId",'{"taskId":"task-123"}'),"tasks/update":u("taskId",'{"taskId":"task-123"}'),"tasks/cancel":u("taskId",'{"taskId":"task-123"}')},C={"notifications/initialized":i,"notifications/cancelled":i,"notifications/progress":i,"notifications/roots/list_changed":i,"notifications/subscriptions/acknowledged":i},j=new Set(["server/discover","subscriptions/listen","tasks/get","tasks/update","tasks/cancel"]),$=new Set(["notifications/subscriptions/acknowledged"]);function V(e,t){return Object.hasOwn(v,e)&&(t||!j.has(e))}r(V,"isKnownRequestMethod");function w(e,t){return Object.hasOwn(C,e)&&(t||!$.has(e))}r(w,"isKnownNotificationMethod");function l(e){return{type:"invalid",...e.method===void 0?{}:{method:e.method},id:e.id,error:{code:e.code,message:e.message},raw:e.raw}}r(l,"invalidMessage");function m(e){return y(e)?e:null}r(m,"usableId");function K(e,t,n,s){if(V(t,s)){let o=v[t](e.params);if(o!==void 0)return l({raw:e,method:t,id:n,code:N,message:`Invalid params for \`${t}\`: ${o}`});let a=e.params===void 0?{}:e.params;return{type:"request",method:t,id:n,params:a,raw:e}}return{type:"request",method:t,id:n,params:e.params,raw:e}}r(K,"classifyRequest");function Y(e,t,n){if(w(t,n)){let s=C[t](e.params);if(s!==void 0)return l({raw:e,method:t,id:null,code:N,message:`Invalid params for \`${t}\`: ${s}`});let o=e.params===void 0?{}:e.params;return{type:"notification",method:t,params:o,raw:e}}return{type:"notification",method:t,params:e.params,raw:e}}r(Y,"classifyNotification");function _(e,t=!1){if(!c(e)||e.jsonrpc!==M)return l({raw:e,id:m(c(e)?e.id:void 0),code:R,message:`Invalid Request: batch member is not a JSON-RPC 2.0 message (got ${p(e)}). Every member must include \`"jsonrpc":"2.0"\`.`});let n=e.method;if(typeof n=="string"){if(!("id"in e))return Y(e,n,t);let s=e.id;return y(s)?K(e,n,s,t):l({raw:e,method:n,id:null,code:R,message:`Invalid Request: request id must be a string or number (got ${p(s)}). The gateway cannot correlate a reply to this id \u2014 omit \`id\` to send a notification instead.`})}if(n!==void 0)return l({raw:e,id:m(e.id),code:R,message:`Invalid Request: method must be a string (got ${p(n)}).`});if("result"in e&&y(e.id)&&c(e.result))return{type:"result",id:e.id,result:e.result,raw:e};if("error"in e){let s=e.error;if(c(s)&&typeof s.code=="number"&&typeof s.message=="string"){let o={code:s.code,message:s.message,...s.data===void 0?{}:{data:s.data}};return{type:"error",id:m(e.id),error:o,raw:e}}}return l({raw:e,id:m(e.id),code:R,message:"Invalid Request: message has no `method` and is not a valid JSON-RPC result or error."})}r(_,"classifyMember");var D=new WeakMap,q=new WeakMap;function ie(e){return q.get(e)}r(ie,"getEnvelopeText");async function G(e){let t=e.headers.get("content-type");if(t===null||!t.toLowerCase().includes("json"))return null;let n=e.headers.get("content-length");if(n!==null&&Number(n)>b)return null;let s;try{s=await e.clone().text()}catch{return null}if(s.length>b)return null;let o;try{o=JSON.parse(s)}catch{return null}let a=e.headers.get("mcp-protocol-version");if(Array.isArray(o)){if(o.length>0&&!o.some(d=>c(d)&&d.jsonrpc===M))return null;let O={transport:"json",shape:"batch",messages:o.map(d=>_(d)),...a===null?{}:{protocolVersion:a}};return q.set(O,s),O}if(!c(o)||o.jsonrpc!==M)return null;let E={transport:"json",shape:"single",messages:[_(o,h()&&x(e.headers,o))],...a===null?{}:{protocolVersion:a}};return q.set(E,s),E}r(G,"parseEnvelope");function ae(e){let t=D.get(e);return t===void 0&&(t=G(e),D.set(e,t)),t}r(ae,"getRequest");export{P as a,h as b,S as c,A as d,U as e,B as f,W as g,Z as h,I as i,L as j,X as k,x as l,ee as m,M as n,R as o,re as p,oe as q,c as r,y as s,ie as t,ae as u};
|
|
26
|
+
//# sourceMappingURL=chunk-AEVCZW3D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@zuplo/runtime/request.ts","@zuplo/runtime/mcp-gateway/v2/runtime-utils/mcp-modern-protocol.ts","@zuplo/runtime/mcp/messages/parse.ts"],"mappings":"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","names":["ZuploRequest","_ZuploRequest","__name","#query","#params","#originalRequest","input","init","originalRequest","params","user","query","searchParams","key","value","deepFreeze","isMcp20260728Enabled","Environment","__name","MCP_MODERN_PROTOCOL_VERSION","MCP_PROTOCOL_VERSION_META_KEY","MCP_CLIENT_CAPABILITIES_META_KEY","MCP_CLIENT_INFO_META_KEY","MCP_SERVER_INFO_META_KEY","MCP_UNSUPPORTED_PROTOCOL_VERSION_CODE","PROTOCOL_REVISION_PATTERN","isModernProtocolVersion","version","isRecord","value","readRequestMeta","message","meta","readEnvelopeProtocolVersion","readEnvelopeClientCapabilities","capabilities","isModernMcpRequest","headers","header","claim","CONNECT_INPUT_REQUEST_KEY","JSONRPC_VERSION","INVALID_REQUEST","INVALID_PARAMS","INTERNAL_ERROR","NOT_PROCESSED","MAX_BODY_CHARS","isRecord","value","__name","isRequestId","describeValue","optionalObjectParams","params","requireStringField","field","example","REQUEST_PARAM_CHECKS","NOTIFICATION_PARAM_CHECKS","MODERN_ONLY_REQUEST_METHODS","MODERN_ONLY_NOTIFICATION_METHODS","isKnownRequestMethod","method","modern","isKnownNotificationMethod","invalidMessage","input","usableId","classifyRequest","raw","id","problem","classifyNotification","classifyMember","error","detail","envelopeCache","envelopeText","getEnvelopeText","envelope","parseEnvelope","request","contentType","contentLength","text","body","protocolVersion","member","isMcp20260728Enabled","isModernMcpRequest","getRequest","cached"]}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{a as Hd}from"./chunk-UKQQD2JN.js";import{$ as qd,aa as Hr,c as me,d as it,e as Xd}from"./chunk-
|
|
25
|
+
import{a as Hd}from"./chunk-UKQQD2JN.js";import{$ as qd,aa as Hr,c as me,d as it,e as Xd}from"./chunk-VIH2ISEH.js";import{a as u,c as be}from"./chunk-TYV53J3B.js";var co="__zuplo-expiry-header",Yr=class{static{u(this,"ZoneCache")}constructor(r,i){this.#n=r,this.#t=i}#t;#n;#r;async#e(){return this.#r||(this.#r=await caches.open(this.#n)),this.#r}#i(r){return new Request(`https://zone-cache.zuplo.app/${encodeURIComponent(r)}`)}async get(r){try{let i=await this.#e(),o=this.#i(r),t=await i.match(o);if(!t)return;let n=t.headers.get(co);if(!n){try{await i.delete(o)}catch(s){this.logDebug("Handled failure to delete with CF cache because of missing expiryHeader",s),await this.deleteFallback(r)}return}let a=parseInt(n,10);if(Date.now()>=a){try{await i.delete(o)}catch(s){this.logDebug("Handled failure to delete with CF cache because of expiration",s),await this.deleteFallback(r)}return}return await t.json()}catch(i){this.logDebug(i)}}async put(r,i,o){let t=new Headers({"cache-control":`s-maxage=${o}, must-revalidate`,"content-type":"application/json"});t.set(co,`${Date.now()+o*1e3}`);let n=await this.#e(),a=this.#i(r),c=new Response(JSON.stringify(i),{headers:t});await n.put(a,c)}async delete(r){let i=await this.#e(),o=this.#i(r);try{await i.delete(o)}catch(t){this.logDebug("Handled failure to delete with CF cache due to explicit delete call",t),await this.deleteFallback(r)}}async deleteFallback(r){let i=new Headers({"Cache-Control":"s-maxage=0, must-revalidate"});i.set(co,`${Date.now()}`);let o=await this.#e(),t=this.#i(r),n=new Response("",{headers:i});await o.put(t,n)}logDebug(...r){"logger"in this.#t?this.#t.logger?.debug(`Error in ZoneCache: '${this.#n}'`,r):"log"in this.#t&&this.#t.log.debug(`Error in ZoneCache: '${this.#n}'`,r)}};var Yd=new Map,so=class{static{u(this,"LruTtlCache")}constructor(r){this.#t=r.maxSize}#t;#n=0;#r=new Map;#e=[];get(r){let i=this.#r.get(r);if(!i)return;let o=Date.now();if(o>i.expiresAt){this.delete(r);return}i.lastUsed=o;let t=this.#e.indexOf(r);return t>=0&&(this.#e.splice(t,1),this.#e.push(r)),this.#i(),i?.data}put(r,i,o){if(o<=0)return;let t=this.#e.indexOf(r),n=t>=0;if(n)this.#e.splice(t,1);else if(this.#r.size>=this.#t){let s=this.#e.shift();s&&this.#r.delete(s)}let a=Date.now(),c={created:n?this.#r.get(r).created:a,lastUsed:a,expiresAt:a+o*1e3,data:i};this.#e.push(r),this.#r.set(r,c)}delete(r){let i=this.#e.indexOf(r);i>=0&&this.#e.splice(i,1),this.#r.delete(r)}get size(){return this.#r.size}#i(){let r=Date.now();r>this.#n+1e4&&(this.purge(),this.#n=r)}purge(){let r=Date.now(),i=[];this.#r.forEach((o,t)=>{r>o.expiresAt&&i.push(t)}),i.forEach(o=>this.delete(o))}},Wt=class{static{u(this,"MemoryCache")}constructor(r,i={maxSize:1e3}){this.name=r;let o=Yd.get(r);o||(o=new so(i),Yd.set(r,o)),this.#t=o}name;#t;get(r){return this.#t.get(r)}put(r,i,o){return this.#t.put(r,i,o)}delete(r){return this.#t.delete(r)}get size(){return this.#t.size}purge(){this.#t.purge()}};var Qr=class{static{u(this,"MemoryZoneReadThroughCache")}constructor(r,i,o){let t=`f6726488-fd18-4b7f-9c30-6070565e8042-${r}`;this.#t=r,this.#n=o?new Wt(t,o):new Wt(t),this.#r=new Yr(t,i),this.#e=i}#t;#n;#r;#e;async get(r){let i=this.#n.get(r);if(i)return i;let o=await this.#r.get(r);if(o){let t=Math.floor((o.expires-Date.now())/1e3);if(t>0)return this.#n.put(r,o.data,t),o.data}}put(r,i,o){this.#n.put(r,i,o);let t={data:i,expires:Date.now()+o*1e3},n=this.#r.put(r,t,o).catch(a=>{this.#e.log.error(`Error in MemoryZoneReadThroughCache: '${this.#t}'`,a)});this.#e.waitUntil(n)}async delete(r){this.#n.delete(r),await this.#r.delete(r)}};var mg=Symbol("zuplo-aws-credential-provider"),Qd=new Hd(mg);function O_(e,r){Qd.set(e,r)}u(O_,"setAwsCredentialProvider");function ef(e){return Qd.get(e)}u(ef,"getAwsCredentialProvider");var pg=Xd("zuplo:runtime"),fo=new TextEncoder,tf={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},gg=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"];function vg(e){let r=new ArrayBuffer(e.byteLength);return new Uint8Array(r).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),r}u(vg,"copyArrayBufferView");function hg(e){return typeof e=="string"?fo.encode(e):e instanceof ArrayBuffer?e:vg(e)}u(hg,"toCryptoBufferSource");var en=class e{static{u(this,"AwsClient")}service;region;cache;#t;#n;#r;#e;#i;#o;constructor(r){let{accessKeyId:i,secretAccessKey:o,sessionToken:t,credentials:n,service:a,region:c,cache:s,retries:l,initRetryMs:d}=r;if(typeof n=="function")this.#e=n;else if(n){let f=n;this.#e=()=>Promise.resolve(f)}else this.#t=i,this.#n=o,this.#r=t;this.service=a,this.region=c,this.cache=s||new Map,this.#i=l??0,this.#o=d||50}static fromContext(r,i){let o=ef(r);if(!o)throw new it("No AWS credentials are available on the request context. Attach an 'upstream-aws-service-auth' or 'upstream-aws-federated-auth' policy to this route (or run one via context.invokeInboundPolicy) before calling AwsClient.fromContext().");return new e({credentials:o,service:i?.service,region:i?.region})}async#a(){if(this.#e)return this.#e();if(this.#t==null||this.#n==null)throw new it("AwsClient requires either 'credentials' or both 'accessKeyId' and 'secretAccessKey'.");return{accessKeyId:this.#t,secretAccessKey:this.#n,sessionToken:this.#r}}async sign(r,i){let o=await this.#a(),t=new mo(Object.assign({url:r},i,{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey,sessionToken:o.sessionToken,service:this.service,region:this.region,cache:this.cache},i?.aws)),n=Object.assign({},i,await t.sign());return delete n.aws,{url:n.url.toString(),request:n}}async fetch(r,i){pg("AWS fetch",r);for(let o=0;o<=this.#i;o++){let{url:t,request:n}=await this.sign(r,i),a=Hr.fetch(t,n);if(o===this.#i)return a;let c=await a;if(c.status<500&&c.status!==429)return c;await new Promise(s=>setTimeout(s,Math.random()*this.#o*2**o))}throw new it("An unknown error occurred, ensure retries is not negative")}},mo=class{static{u(this,"AwsV4Signer")}method;url;headers;body;accessKeyId;secretAccessKey;sessionToken;service;region;cache;datetime;signQuery;appendSessionToken;signableHeaders;signedHeaders;canonicalHeaders;credentialString;encodedPath;encodedSearch;constructor({method:r,url:i,headers:o,body:t,accessKeyId:n,secretAccessKey:a,sessionToken:c,service:s,region:l,cache:d,datetime:f,signQuery:m,appendSessionToken:p,allHeaders:h,singleEncode:b}){if(i==null)throw new TypeError("url is a required option");if(n==null)throw new TypeError("accessKeyId is a required option");if(a==null)throw new TypeError("secretAccessKey is a required option");this.method=r||(t?"POST":"GET"),this.url=new URL(i),this.headers=new Headers(o||{}),this.body=t,this.accessKeyId=n,this.secretAccessKey=a,this.sessionToken=c;let k,z;(!s||!l)&&([k,z]=$g(this.url,this.headers)),this.service=s||k||"",this.region=l||z||"us-east-1",this.cache=d||new Map,this.datetime=f||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=m,this.appendSessionToken=p||this.service==="iotdevicegateway",this.headers.delete("Host");let w=this.signQuery?this.url.searchParams:this.headers;if(this.service==="s3"&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD"),w.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&w.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(P=>h||!gg.includes(P)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(P=>P+":"+(P==="host"?this.url.host:(this.headers.get(P)||"").replace(/\s+/g," "))).join(`
|
|
26
26
|
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&(this.service==="s3"&&!w.has("X-Amz-Expires")&&w.set("X-Amz-Expires","86400"),w.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),w.set("X-Amz-Credential",`${this.accessKeyId}/${this.credentialString}`),w.set("X-Amz-SignedHeaders",this.signedHeaders)),this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch{this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");b||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=nf(this.encodedPath);let O=new Set;this.encodedSearch=[...this.url.searchParams].filter(([P])=>{if(!P)return!1;if(this.service==="s3"){if(O.has(P))return!1;O.add(P)}return!0}).map(P=>P.map(Z=>nf(encodeURIComponent(Z)))).sort(([P,Z],[T,J])=>P<T?-1:P>T?1:Z<J?-1:Z>J?1:0).map(P=>P.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,`SignedHeaders=${this.signedHeaders}`,`Signature=${await this.signature()}`].join(", ")}async signature(){let r=this.datetime.slice(0,8),i=[this.secretAccessKey,r,this.region,this.service].join(),o=this.cache.get(i);if(!o){let t=await Gt(`AWS4${this.secretAccessKey}`,r),n=await Gt(t,this.region),a=await Gt(n,this.service);o=await Gt(a,"aws4_request"),this.cache.set(i,o)}return lo(await Gt(o,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,lo(await rf(await this.canonicalString()))].join(`
|
|
27
27
|
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,`${this.canonicalHeaders}
|
|
28
28
|
`,this.signedHeaders,await this.hexBodyHash()].join(`
|
|
@@ -88,4 +88,4 @@ ${s}
|
|
|
88
88
|
}`,m;try{m=new d(...a,f)(...c)}catch(p){throw new U(`this schema (generated code failed to evaluate: ${p.message})`)}return r?.debug&&(m.code=l),m.definite=o.definite,m}u(ei,"compileFn");function D(e,r){for(let[o,t]of e.constants)if(t===r)return o;let i=`c${e.constantCounter++}`;return e.constants.set(i,r),i}u(D,"addConstant");function We(e,r){return e.definite=!1,D(e,r)}u(We,"addUserConstant");function S(e){return`v${e.varCounter++}`}u(S,"newVar");function p$(e,r){let i=e._zod.run({value:r,issues:[]},{});if(i&&typeof i.then=="function")return ee;let o=i;return o.issues.length===0?o.value:ee}u(p$,"runtimeRun");function q(e,r,i,o,t=!0){let n=e.content.length,a=r.constants.size,c=r.constantCounter,s=r.varCounter;try{return F(e,r,i,o,t)}catch(l){if(!(l instanceof U)||!l.islandable)throw l;if(e.content.length=n,r.constants.size>a){let d=Array.from(r.constants.keys()).slice(a);for(let f of d)r.constants.delete(f)}return r.constantCounter=c,r.varCounter=s,g$(e,r,i,o)}}u(q,"compileChild");function g$(e,r,i,o){r.definite=!1;let t=D(r,i),n=D(r,p$),a=S(r);return e.write(`const ${a} = ${n}(${t}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}u(g$,"emitRuntimeIsland");var v$=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function h$(e,r,i,o){let t=i._zod.def.checks;if(!t||t.length===0)return o;let n=o;for(let a of t){let c=a._zod.def;if(c.when&&!v$.has(c.check))throw new U('check with a custom "when" condition');switch(c.check){case"greater_than":$$(e,r,c,n);break;case"less_than":y$(e,r,c,n);break;case"multiple_of":_$(e,r,c,n);break;case"number_format":um(e,c,n);break;case"min_length":{let s=Oe(c.minimum,"min_length"),l=us(e,r,n,`${n}.length >= ${s} && ${n}.length < ${c.minimum*2}`);e.write(`if (${l} < ${s}) return INVALID;`);break}case"max_length":{let s=Oe(c.maximum,"max_length"),l=us(e,r,n,`${n}.length > ${s}`);e.write(`if (${l} > ${s}) return INVALID;`);break}case"length_equals":{let s=Oe(c.length,"length_equals"),l=us(e,r,n,`${n}.length >= ${s} && ${n}.length <= ${c.length*2}`);e.write(`if (${l} !== ${s}) return INVALID;`);break}case"min_size":e.write(`if (${n}.size < ${Oe(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${n}.size > ${Oe(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${n}.size !== ${Oe(c.size,"size_equals")}) return INVALID;`);break;case"string_format":n=cm(e,r,c,n);break;case"custom":n=S$(e,r,a,n);break;case"bigint_format":b$(e,c,n);break;case"mime_type":x$(e,r,c,n);break;case"property":I$(e,r,c,n);break;case"properties":k$(e,r,c,n);break;case"overwrite":{let s=S(r);w$(e,r,a,n,s),n=s;break}default:throw new U(`check type ${c.check}`)}}return n}u(h$,"generateChecks");function us(e,r,i,o){let t=D(r,Fe),n=S(r);return e.write(`const ${n} = typeof ${i} === "string" && ${o} ? ${t}(${i}) : ${i}.length;`),n}u(us,"codePointLengthVar");function Oe(e,r){if(typeof e!="number"||!Number.isFinite(e))throw new U(`${r} bound of type ${typeof e}`);return`${e}`}u(Oe,"numericOperand");function am(e,r){if(typeof r=="bigint")return`${r}n`;if(typeof r=="number"){if(Number.isNaN(r))throw new U("comparison check with NaN bound");return`${r}`}if(r instanceof Date){if(Number.isNaN(r.getTime()))throw new U("comparison check with Invalid Date bound");return D(e,r)}throw new U(`comparison check bound of type ${typeof r}`)}u(am,"comparisonOperand");function $$(e,r,i,o){let t=i.inclusive?"<":"<=";e.write(`if (${o} ${t} ${am(r,i.value)}) return INVALID;`)}u($$,"generateGreaterThanCheck");function y$(e,r,i,o){let t=i.inclusive?">":">=";e.write(`if (${o} ${t} ${am(r,i.value)}) return INVALID;`)}u(y$,"generateLessThanCheck");function _$(e,r,i,o){if(typeof i.value=="bigint"){if(i.value===BigInt(0))throw new U("multiple_of check with a zero divisor");e.write(`if (${o} % ${i.value}n !== 0n) return INVALID;`)}else{let t=D(r,qt);e.write(`if (${t}(${o}, ${Oe(i.value,"multiple_of")}) !== 0) return INVALID;`)}}u(_$,"generateMultipleOfCheck");function um(e,r,i){let o=r.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${i})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${i}) || ${i} < -2147483648 || ${i} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${i}) || ${i} < 0 || ${i} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${i}) || ${i} < -3.4028234663852886e38 || ${i} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${i})) return INVALID;`);break;default:throw new U(`number format ${o}`)}}u(um,"generateNumberFormatCheck");function b$(e,r,i){let o=r.format;if(o)switch(o){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break;default:throw new U(`bigint format ${o}`)}}u(b$,"generateBigIntFormatCheck");function x$(e,r,i,o){let t=i.mime;if(t&&t.length>0){let n=D(r,new Set(t));e.write(`if (!${n}.has(${o}.type)) return INVALID;`)}}u(x$,"generateMimeTypeCheck");function k$(e,r,i,o){if(i.when)throw new U('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let t=i.shape;for(let n of Reflect.ownKeys(t)){let a=typeof n=="symbol"?D(r,n):Y(n),c=S(r);e.write(`const ${c} = ${o}[${a}];`),q(e,r,t[n],c,!1)}}u(k$,"generatePropertiesChecks");function I$(e,r,i,o){let t=`${o}[${JSON.stringify(i.property)}]`;F(e,r,i.schema,t)}u(I$,"generatePropertyCheck");function w$(e,r,i,o,t){let n=i._zod.def.tx;if(!n)throw new U("overwrite check without a transform function");if(Ge(n))throw new ge("z.compile: async overwrite transforms are not supported");let a=D(r,n);e.write(`const ${t} = ${a}(${o});`)}u(w$,"generateOverwriteCheck");function cs(){throw new oe}u(cs,"throwAsync");function ds(e){this.issues.push(e)}u(ds,"pushIssue");function S$(e,r,i,o){let t=i._zod.def;if(t.fn){if(Ge(t.fn))throw new ge("z.compile: async .refine() predicates are not supported");let n=We(r,t.fn),a=D(r,cs),c=S(r);return e.write(`const ${c} = ${n}(${o});`),e.write(`if (${c} instanceof Promise) ${a}();`),e.write(`if (!${c}) return INVALID;`),o}if(i._zod.check){if(Ge(i._zod.check))throw new ge("z.compile: async .superRefine() / check functions are not supported");let n=i._zod.check,c=We(r,u(l=>{let d={value:l,issues:[],addIssue:ds};return n(d)instanceof Promise&&cs(),d.issues.length===0?d.value:ee},"helperFn")),s=S(r);return e.write(`const ${s} = ${c}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}throw new U("custom check without a predicate or check function")}u(S$,"generateCustomRefineCheck");var z$=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 cm(e,r,i,o,t=!0){let n=i.format;if(n==="base64"){let l=D(r,vr);return e.write(`if (!${l}(${o})) return INVALID;`),o}if(n==="base64url"){let l=D(r,Zn);return e.write(`if (!${l}(${o})) return INVALID;`),o}if(n==="jwt"){let l=D(r,Ln),d=D(r,i.alg??null);return e.write(`if (!${l}(${o}, ${d})) return INVALID;`),o}if(n==="ipv6"){let l=D(r,gr);return e.write(`if (!${l}(${o})) return INVALID;`),o}if(n==="cidrv6"){let l=D(r,Un);return e.write(`if (!${l}(${o})) return INVALID;`),o}if(n==="credit_card"){let l=D(r,En);return e.write(`if (!${l}(${o})) return INVALID;`),o}if(n==="iban"){let l=D(r,Cn);return e.write(`if (!${l}(${o})) return INVALID;`),o}let a=i;if(n==="url"||n==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let l=D(r,jn),d=D(r,i),f=S(r),m=S(r);if(e.write(`const ${f} = ${o}.trim();`),e.write(`const ${m} = ${l}(${f}, ${d});`),e.write(`if (typeof ${m} === "number") return INVALID;`),a.hostname!==void 0){let b=D(r,An);e.write(`if (!${b}(${m}, ${d}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let b=D(r,Nn);e.write(`if (!${b}(${m}, ${d}.protocol)) return INVALID;`)}if(!t)return null;let p=S(r),h=a.normalize?`${m}.href`:`${D(r,pr)}(${f})`;return e.write(`const ${p} = ${h};`),p}let c=i.fn;if(c){if(Ge(c))throw new U(`async string format ${n}`);let l=D(r,c);return e.write(`if (!${l}(${o})) return INVALID;`),o}if(z$.has(n)&&i.pattern){let l=D(r,i.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${o})) return INVALID;`),o}let s=i.format;switch(s){case"regex":throw new U("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${Y(i.includes)})) return INVALID;`);break;case"starts_with":{let l=i.prefix;e.write(`if (${o}.slice(0, ${l.length}) !== ${Y(l)}) return INVALID;`);break}case"ends_with":{let l=i.suffix;e.write(`if (${o}.slice(-${l.length}) !== ${Y(l)}) return INVALID;`);break}default:throw new U(`string format ${s}`)}return o}u(cm,"generateStringFormatCheck");function F(e,r,i,o,t=!0){let n=i._zod.def,a=n.type;if(n.coerce)throw new U(`coercion (z.coerce.${a}())`);let c=t||!!n.checks?.length,s;switch(a){case"string":s=P$(e,r,i,o,c);break;case"number":s=D$(e,i,o);break;case"boolean":s=O$(e,o);break;case"bigint":s=j$(e,i,o);break;case"symbol":s=A$(e,o);break;case"undefined":s=N$(e,o);break;case"null":s=U$(e,o);break;case"any":case"unknown":s=o;break;case"never":e.write("return INVALID;"),s=o;break;case"void":s=T$(e,o);break;case"nan":s=Z$(e,o);break;case"date":s=E$(e,o);break;case"object":s=C$(e,r,i,o,c);break;case"optional":s=L$(e,r,i,o,c);break;case"nullable":s=F$(e,r,i,o,c);break;case"array":s=M$(e,r,i,o,c);break;case"literal":s=J$(e,r,i,o);break;case"enum":s=B$(e,r,i,o);break;case"readonly":{let l=nm(e,r,i,o),d=S(r);e.write(`const ${d} = Object.freeze(${l});`),s=d;break}case"success":nm(e,r,i,o),s="true";break;case"default":case"prefault":s=K$(e,r,i,o);break;case"nonoptional":s=W$(e,r,i,o);break;case"tuple":s=G$(e,r,i,o);break;case"union":s=X$(e,r,i,o);break;case"intersection":s=Y$(e,r,i,o);break;case"record":s=Q$(e,r,i,o);break;case"map":s=ty(e,r,i,o);break;case"set":s=ry(e,r,i,o);break;case"file":s=ny(e,o);break;case"template_literal":s=iy(e,r,i,o);break;case"lazy":s=oy(e,r,i,o);break;case"pipe":s=ay(e,r,i,o);break;case"custom":s=uy(e,r,i,o);break;case"transform":s=ly(e,r,i,o);break;case"catch":s=sy(e,r,i,o);break;default:throw new U(`schema type ${a}`)}return s===null?null:h$(e,r,i,s)}u(F,"generateCheck");function P$(e,r,i,o,t=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let n=i._zod.def;return n.format===void 0?o:cm(e,r,n,o,t)}u(P$,"generateStringCheck");function D$(e,r,i){e.write(`if (typeof ${i} !== "number" || !Number.isFinite(${i})) return INVALID;`);let o=r._zod.def;return o.check==="number_format"&&o.format&&um(e,{format:o.format},i),i}u(D$,"generateNumberCheck");function O$(e,r){return e.write(`if (typeof ${r} !== "boolean") return INVALID;`),r}u(O$,"generateBooleanCheck");function j$(e,r,i){e.write(`if (typeof ${i} !== "bigint") return INVALID;`);let o=r._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break}return i}u(j$,"generateBigIntCheck");function A$(e,r){return e.write(`if (typeof ${r} !== "symbol") return INVALID;`),r}u(A$,"generateSymbolCheck");function N$(e,r){return e.write(`if (${r} !== undefined) return INVALID;`),r}u(N$,"generateUndefinedCheck");function U$(e,r){return e.write(`if (${r} !== null) return INVALID;`),r}u(U$,"generateNullCheck");function T$(e,r){return e.write(`if (${r} !== undefined) return INVALID;`),r}u(T$,"generateVoidCheck");function Z$(e,r){return e.write(`if (typeof ${r} !== "number" || !Number.isNaN(${r})) return INVALID;`),r}u(Z$,"generateNaNCheck");function E$(e,r){return e.write(`if (!(${r} instanceof Date) || Number.isNaN(${r}.getTime())) return INVALID;`),r}u(E$,"generateDateCheck");function C$(e,r,i,o,t=!0){let n=i._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=n.shape,c=Object.keys(a),s=Object.getOwnPropertySymbols(a),l=s.length?[...c,...s]:c,d=u(w=>typeof w=="symbol"?D(r,w):Y(w),"keyExpr"),f=u(w=>typeof w=="symbol"?`[${d(w)}]`:Y(w),"propKey"),m=a;if(c.includes("__proto__"))throw new U('object shape key "__proto__"');let p=new Map;for(let w of l){let O=m[w],P=d(w),Z=S(r);if(e.write(`const ${Z} = ${o}[${P}];`),O._zod.optin!==void 0){let T=S(r);e.write(`let ${T} = (() => {`),e.indented(J=>{let Kt=q(J,r,O,Z);J.write(`return ${Kt};`)}),e.write("})();"),O._zod.optout==="optional"?(e.write(`if (${T} === INVALID) {`),e.indented(J=>{J.write(`if (${P} in ${o}) return INVALID;`),J.write(`${T} = undefined;`)}),e.write("}")):e.write(`if (${T} === INVALID) return INVALID;`),p.set(w,T)}else{V$(O)&&e.write(`if (!(${P} in ${o})) return INVALID;`);let T=q(e,r,O,Z,t);T!==null&&p.set(w,T)}}let h=n.catchall,b="none";if(h){let w=h._zod.def.type;if(w==="never"){let O=c.map(P=>`k !== ${Y(P)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(P=>{P.write(`if (${O}) return INVALID;`)}),e.write("}")}else(w==="unknown"||w==="any")&&!h._zod.def.checks?.length?b="passthrough":b="schema"}let k=S(r),z=l.some(w=>rm(m[w])||ss(m[w]));if(!t){if(b==="schema"){let w=c.length>0?D(r,new Set(c)):null;e.write(`for (const k in ${o}) {`),e.indented(O=>{O.write('if (k === "__proto__") continue;'),w&&O.write(`if (${w}.has(k)) continue;`);let P=S(r);O.write(`const ${P} = ${o}[k];`),q(O,r,h,P,!1)}),e.write("}")}return null}if(z){e.write(`const ${k} = {};`);for(let w of l){let O=d(w),P=p.get(w);ss(m[w])?e.write(`if (${O} in ${o}) ${k}[${O}] = ${P};`):rm(m[w])?e.write(`if (${P} !== undefined || ${O} in ${o}) ${k}[${O}] = ${P};`):e.write(`${k}[${O}] = ${P};`)}}else{let w=l.map(O=>`${f(O)}: ${p.get(O)}`).join(", ");e.write(`const ${k} = { ${w} };`)}if(b!=="none"){let w=c.length>0?D(r,new Set(c)):null;e.write(`for (const k in ${o}) {`),e.indented(O=>{if(O.write('if (k === "__proto__") continue;'),w&&O.write(`if (${w}.has(k)) continue;`),b==="passthrough")O.write(`${k}[k] = ${o}[k];`);else{let P=S(r);O.write(`const ${P} = ${o}[k];`);let Z=q(O,r,h,P);O.write(`${k}[k] = ${Z};`)}}),e.write("}")}return k}u(C$,"generateObjectCheck");function L$(e,r,i,o,t=!0){let n=i._zod.def;if(R$(i))return F(e,r,n.innerType,o,t);if(n.innerType._zod.optin==="defaulted"){let c=S(r),s=S(r);return e.write(`let ${c};`),e.write(`if (${o} === undefined) {`),e.indented(l=>{l.write(`const ${s} = (() => {`),l.indented(d=>{let f=F(d,r,n.innerType,o);d.write(`return ${f};`)}),l.write("})();"),l.write(`if (${s} !== INVALID) ${c} = ${s};`)}),e.write("} else {"),e.indented(l=>{let d=F(l,r,n.innerType,o);l.write(`${c} = ${d};`)}),e.write("}"),c}let a=t?S(r):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(c=>{let s=F(c,r,n.innerType,o,t);a&&s!==null&&c.write(`${a} = ${s};`)}),e.write("}"),a}u(L$,"generateOptionalCheck");function R$(e){return e._zod.traits?.has("$ZodExactOptional")===!0}u(R$,"isExactOptional");function V$(e){return e._zod.optin===void 0&&Ke(e)}u(V$,"requiresPresenceCheck");function Ke(e){if(e._zod.def.coerce)return!0;let r=e._zod.def;switch(r.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 r.innerType?Ke(r.innerType):!1;case"literal":return!!r.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return r.innerType?Ke(r.innerType):!0;case"catch":return!0;case"union":return r.options?r.options.some(Ke):!0;case"intersection":return!r.left||!r.right?!0:Ke(r.left)&&Ke(r.right);case"pipe":return r.in?Ke(r.in):!0;default:return!0}}u(Ke,"fastPathAcceptsAbsence");function ss(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}u(ss,"dropsWhenAbsent");function rm(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&bt(e)}u(rm,"mayOmitUndefined");function bt(e){let r=e._zod.def;switch(r.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!!r.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return r.innerType?bt(r.innerType):!0;case"union":return r.options?r.options.some(bt):!0;case"intersection":return!r.left||!r.right||bt(r.left)||bt(r.right);case"pipe":return r.out?bt(r.out):!0;default:return!0}}u(bt,"mayOutputUndefined");function F$(e,r,i,o,t=!0){let n=i._zod.def,a=t?S(r):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(c=>{let s=F(c,r,n.innerType,o,t);a&&s!==null&&c.write(`${a} = ${s};`)}),e.write("}"),a}u(F$,"generateNullableCheck");function fs(e,r,i){for(let[o,t]of dt(r._zod.def.checks))e.write(`if (${i} > ${Oe(o,t._zod.def.check)}) return INVALID;`)}u(fs,"generateSizeGate");function M$(e,r,i,o,t=!0){let n=i._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`),fs(e,i,`${o}.length`);let a=t?S(r):null,c=S(r),s=S(r);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${c} = 0; ${c} < ${o}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${s} = ${o}[${c}];`);let d=q(l,r,n.element,s,t);a&&d!==null&&l.write(`${a}[${c}] = ${d};`)}),e.write("}"),a}u(M$,"generateArrayCheck");function J$(e,r,i,o){let n=i._zod.def.values;if(n.length!==1){let c=D(r,new Set(n));return e.write(`if (!${c}.has(${o})) return INVALID;`),o}let a=n[0];if(typeof a=="number"&&Number.isNaN(a)){let c=D(r,new Set(n));return e.write(`if (!${c}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${Y(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new U(`literal type ${typeof a}`);return o}u(J$,"generateLiteralCheck");function B$(e,r,i,o){let t=i._zod.values;if(!t)throw new U("enum schema without enumerated values");let n=D(r,t);return e.write(`if (!${n}.has(${o})) return INVALID;`),o}u(B$,"generateEnumCheck");function nm(e,r,i,o){let t=i._zod.def;return F(e,r,t.innerType,o)}u(nm,"generateWrapperCheck");function K$(e,r,i,o){let t=i._zod.def,a=Object.getOwnPropertyDescriptor(i._zod.def,"defaultValue")?()=>i._zod.def.defaultValue:void 0;if(i._zod.def.type==="prefault"){if(!a)return F(e,r,t.innerType,o);let s=D(r,a),l=S(r);return e.write(`let ${l} = ${o};`),e.write(`if (${o} === undefined) ${l} = ${s}();`),F(e,r,t.innerType,l)}let c=S(r);if(a){let s=D(r,a),l=D(r,Ht);e.write(`let ${c};`),e.write(`if (${o} === undefined) {`),e.indented(d=>{d.write(`${c} = ${l}(${s}());`)}),e.write("} else {"),e.indented(d=>{let f=F(d,r,t.innerType,o);d.write(`${c} = ${f} === undefined ? ${l}(${s}()) : ${f};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let l=F(s,r,t.innerType,o);s.write(`${c} = ${l};`)}),e.write("}");return c}u(K$,"generateDefaultCheck");function W$(e,r,i,o){let t=i._zod.def,n=F(e,r,t.innerType,o),a=S(r);return e.write(`const ${a} = ${n};`),e.write(`if (${a} === undefined) return INVALID;`),a}u(W$,"generateNonOptionalCheck");function G$(e,r,i,o){let t=i._zod.def,n=t.items,a=t.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let c=im(n,"optin"),s=im(n,"optout");a?e.write(`if (${o}.length < ${c}) return INVALID;`):e.write(`if (${o}.length < ${c} || ${o}.length > ${n.length}) return INVALID;`);let l=S(r);e.write(`const ${l} = [];`);for(let d=0;d<n.length;d++){let f=n[d];if(d>=s)e.write(`if (${l}.length === ${d}) {`),e.indented(m=>{m.write(`if (${d} < ${o}.length) {`),m.indented(p=>{let h=S(r);p.write(`const ${h} = ${o}[${d}];`);let b=q(p,r,f,h);p.write(`${l}[${d}] = ${b};`)}),m.write("} else {"),m.indented(p=>{if(ss(f)){p.write(`${l}.length = ${d};`);return}let h=S(r),b=S(r);p.write(`const ${h} = undefined;`),p.write(`const ${b} = (() => {`),p.indented(k=>{let z=q(k,r,f,h);k.write(`return ${z};`)}),p.write("})();"),p.write(`if (${b} === INVALID || ${b} === undefined) ${l}.length = ${d};`),p.write(`else ${l}[${d}] = ${b};`)}),m.write("}")}),e.write("}");else{let m=S(r);e.write(`const ${m} = ${o}[${d}];`);let p=q(e,r,f,m);e.write(`${l}[${d}] = ${p};`)}}if(a){let d=S(r),f=S(r);e.write(`for (let ${d} = ${n.length}; ${d} < ${o}.length; ${d}++) {`),e.indented(m=>{m.write(`const ${f} = ${o}[${d}];`);let p=q(m,r,a,f);m.write(`${l}[${d}] = ${p};`)}),e.write("}")}return l}u(G$,"generateTupleCheck");function im(e,r){for(let i=e.length-1;i>=0;i--)if(!(r==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}u(im,"getTupleOptStart");function X$(e,r,i,o){let t=i._zod.def,n=t.options;if(t.discriminator)return q$(e,r,t,o);if(t.inclusive===!1)throw new U("exclusive unions (z.xor)");if(n.length===0)return e.write("return INVALID;"),o;if(n.length===1)return F(e,r,n[0],o);if(n.every(s=>s._zod.def.type==="literal"&&!s._zod.def.checks?.length)){let s=new Set(n.flatMap(d=>d._zod.def.values)),l=D(r,s);return e.write(`if (!${l}.has(${o})) return INVALID;`),o}let c=S(r);e.write(`let ${c};`);for(let s=0;s<n.length;s++){let l=n[s];s===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(d=>{let f=F(d,r,l,o);d.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}u(X$,"generateUnionCheck");function q$(e,r,i,o){if(i.unionFallback)throw new U("discriminated union with unionFallback");if(i.options.length===0)return e.write("return INVALID;"),o;let t=S(r),n=S(r);e.write(`const ${t} = ${o}?.[${Y(i.discriminator)}];`),e.write(`let ${n};`);let a=!0,c=new Set;for(let s of i.options){let l=s._zod.propValues?.[i.discriminator];if(!l||l.size===0)throw new U("discriminated union option without static discriminator values");for(let m of l){if(c.has(m))throw new U(`duplicate discriminator value ${String(m)}`);c.add(m)}let d=Array.from(l,m=>H$(r,t,m)),f=a?"if":"else if";e.write(`${f} (${d.join(" || ")}) {`),e.indented(m=>{let p=F(m,r,s,o);m.write(`${n} = ${p};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),n}u(q$,"generateDiscriminatedUnionCheck");function H$(e,r,i){if(typeof i=="string")return`${r} === ${Y(i)}`;if(typeof i=="number")return Number.isNaN(i)?`Number.isNaN(${r})`:`${r} === ${i}`;if(typeof i=="boolean")return`${r} === ${i}`;if(i===null)return`${r} === null`;if(i===void 0)return`${r} === undefined`;if(typeof i=="bigint")return`${r} === ${i}n`;if(typeof i=="symbol"){let o=D(e,i);return`${r} === ${o}`}throw new U(`literal discriminator value ${String(i)}`)}u(H$,"literalEquality");function Y$(e,r,i,o){let t=i._zod.def;r.definite=!1;let n=q(e,r,t.left,o),a=q(e,r,t.right,o),c=D(r,$t),s=S(r);return e.write(`const ${s} = ${c}(${n}, ${a});`),e.write(`if (!${s}.valid) return INVALID;`),`${s}.data`}u(Y$,"generateIntersectionCheck");function Q$(e,r,i,o){let t=i._zod.def,n=D(r,le);e.write(`if (!${n}(${o})) return INVALID;`);let a=S(r),c=S(r),s=S(r);e.write(`const ${a} = {};`);let l=t,d=l.partial?void 0:t.keyType._zod.values;if(d){let p=[];for(let b of d){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new U(`record key value ${String(b)}`);let k=typeof b=="number"?b.toString():b;if(k==="__proto__")throw new U('record key "__proto__"');p.push(k);let z=D(r,b),w=F(e,r,t.keyType,z),O=S(r);e.write(`const ${O} = ${o}[${ey(r,k)}];`);let P=q(e,r,t.valueType,O);e.write(`${a}[${w}] = ${P};`)}let h=D(r,new Set(p));return e.write(`for (const ${c} in ${o}) {`),e.indented(b=>{b.write(`if (${h}.has(${c})) continue;`),l.mode==="loose"?b.write(`if (${c} !== "__proto__") ${a}[${c}] = ${o}[${c}];`):b.write("return INVALID;")}),e.write("}"),a}let f=t.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let p=t.mode==="loose",h=ei(t.keyType);h.definite===!1&&(r.definite=!1);let b=D(r,h),k=D(r,Ie),z=S(r);return om(e,r,o,c,w=>{w.write(`let ${z} = ${b}(${c});`),w.write(`if (${z} === INVALID && typeof ${c} === "string" && ${k}.test(${c})) ${z} = ${b}(Number(${c}));`),p?w.write(`if (${z} === INVALID) { ${a}[${c}] = ${o}[${c}]; continue; }`):w.write(`if (${z} === INVALID) return INVALID;`),w.write(`if (${z} === "__proto__") continue;`);let O=S(r);w.write(`const ${O} = ${o}[${c}];`);let P=q(w,r,t.valueType,O);w.write(`${a}[${z}] = ${P};`)}),a}return om(e,r,o,c,p=>{p.write(`const ${s} = ${o}[${c}];`);let h=q(p,r,t.valueType,s);p.write(`${a}[${c}] = ${h};`)},"return INVALID;"),a}u(Q$,"generateRecordCheck");function om(e,r,i,o,t,n){let a=D(r,Object.prototype.propertyIsEnumerable),c=S(r),s=S(r),l=S(r);e.write(`const ${c} = Object.getOwnPropertySymbols(${i});`),e.write(`const ${s} = Object.getOwnPropertyNames(${i});`),e.write(`for (let ${l} = 0; ${l} < ${s}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${o} = ${s}[${l}];`),d.write(`if (${o} === "__proto__" || !${a}.call(${i}, ${o})) continue;`),t(d)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${o} = ${c}[${l}];`),d.write(`if (!${a}.call(${i}, ${o})) continue;`),n?d.write(n):t(d)}),e.write("}")}u(om,"emitOwnKeys");function ey(e,r){return typeof r=="string"?Y(r):D(e,r)}u(ey,"literalPropertyKey");function ty(e,r,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`),fs(e,i,`${o}.size`);let n=S(r),a=S(r),c=S(r);return e.write(`const ${n} = new Map();`),e.write(`for (const [${a}, ${c}] of ${o}) {`),e.indented(s=>{let l=F(s,r,t.keyType,a),d=F(s,r,t.valueType,c);s.write(`${n}.set(${l}, ${d});`)}),e.write("}"),n}u(ty,"generateMapCheck");function ry(e,r,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`),fs(e,i,`${o}.size`);let n=S(r),a=S(r);return e.write(`const ${n} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(c=>{let s=F(c,r,t.valueType,a);c.write(`${n}.add(${s});`)}),e.write("}"),n}u(ry,"generateSetCheck");function ny(e,r){return e.write(`if (!(${r} instanceof File)) return INVALID;`),r}u(ny,"generateFileCheck");function iy(e,r,i,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let t=i._zod.pattern;if(t){let n=D(r,t);e.write(`${n}.lastIndex = 0;`),e.write(`if (!${n}.test(${o})) return INVALID;`)}return o}u(iy,"generateTemplateLiteralCheck");function oy(e,r,i,o){let t=i._zod.def,n=We(r,t.getter),a=D(r,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(s=>{s.write(`const inner = ${n}();`),s.write(`${a}.parser = function(input) {`),s.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),s.write("};")}),e.write("}");let c=S(r);return e.write(`const ${c} = ${a}.parser(${o});`),e.write(`if (${c} === INVALID) return INVALID;`),c}u(oy,"generateLazyCheck");function ay(e,r,i,o){let t=i._zod.def,n=F(e,r,t.in,o);if(t.transform){if(Ge(t.transform))throw new ge("z.compile: async transforms in pipes are not supported");let a=t.transform,s=We(r,u(d=>{let f={value:d,issues:[],addIssue:ds},m=a(d,f);return m instanceof Promise?ee:f.issues.length===0?m:ee},"helperFn")),l=S(r);return e.write(`const ${l} = ${s}(${n});`),e.write(`if (${l} === INVALID) return INVALID;`),F(e,r,t.out,l)}else return F(e,r,t.out,n)}u(ay,"generatePipeCheck");function Ge(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}u(Ge,"isAsyncFunction");function uy(e,r,i,o){let t=i._zod.def;if(t.fn){if(Ge(t.fn))throw new ge("z.compile: async custom predicates are not supported");let n=We(r,t.fn),a=D(r,cs),c=S(r);e.write(`const ${c} = ${n}(${o});`),e.write(`if (${c} instanceof Promise) ${a}();`),e.write(`if (!${c}) return INVALID;`)}else throw new U("custom schema without a predicate function");return o}u(uy,"generateCustomCheck");function cy(e,r,i){let o=e._zod.run({value:i,issues:[]},{});if(o&&typeof o.then=="function")return ee;let t=o;return t.issues.length===0?t.value:r()}u(cy,"runtimeCatch");function sy(e,r,i,o){let t=i._zod.def;if(!t.catchValue[cn])throw new U("catch with a callback (only a constant catch value compiles)",!1);let n=S(r);e.write(`let ${n} = (() => {`),e.indented(l=>{let d=q(l,r,t.innerType,o);l.write(`return ${d};`)}),e.write("})();");let a=D(r,t.innerType),c=We(r,t.catchValue),s=D(r,cy);return e.write(`if (${n} === INVALID) {`),e.indented(l=>{l.write(`${n} = ${s}(${a}, ${c}, ${o});`),l.write(`if (${n} === INVALID) return INVALID;`)}),e.write("}"),n}u(sy,"generateCatchCheck");function ly(e,r,i,o){let t=i._zod.def;if(t.transform){if(Ge(t.transform))throw new ge("z.compile: async transforms are not supported");let n=t.transform,c=We(r,u(l=>{let d={value:l,issues:[],addIssue:ds},f=n(l,d);return f instanceof Promise?ee:d.issues.length===0?f:ee},"helperFn")),s=S(r);return e.write(`const ${s} = ${c}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}return o}u(ly,"generateTransformCheck");function ti(e){return e.checks&&(e.checks=[...e.checks]),e}u(ti,"snapshotChecks");function ms(e,r){return new e(ti({type:"string",...x(r)}))}u(ms,"_string");function ps(e,r){return new e(ti({type:"string",coerce:!0,...x(r)}))}u(ps,"_coercedString");function ri(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(r)})}u(ri,"_email");function ni(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(r)})}u(ni,"_guid");function ii(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(r)})}u(ii,"_uuid");function oi(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(r)})}u(oi,"_uuidv4");function ai(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(r)})}u(ai,"_uuidv6");function ui(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(r)})}u(ui,"_uuidv7");function Or(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(r)})}u(Or,"_url");function ci(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(r)})}u(ci,"_emoji");function si(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(r)})}u(si,"_nanoid");function li(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(r)})}u(li,"_cuid");function di(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(r)})}u(di,"_cuid2");function fi(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(r)})}u(fi,"_ulid");function mi(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(r)})}u(mi,"_xid");function pi(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(r)})}u(pi,"_ksuid");function gi(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(r)})}u(gi,"_ipv4");function vi(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(r)})}u(vi,"_ipv6");function gs(e,r){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...x(r)})}u(gs,"_mac");function hi(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(r)})}u(hi,"_cidrv4");function $i(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(r)})}u($i,"_cidrv6");function yi(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(r)})}u(yi,"_base64");function _i(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(r)})}u(_i,"_base64url");function bi(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(r)})}u(bi,"_e164");function vs(e,r){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...x(r)})}u(vs,"_creditCard");function hs(e,r){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...x(r)})}u(hs,"_iban");function xi(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(r)})}u(xi,"_jwt");var $s={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function jr(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(r)})}u(jr,"_isoDateTime");function Ar(e,r){return new e({type:"string",format:"date",check:"string_format",...x(r)})}u(Ar,"_isoDate");function Nr(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(r)})}u(Nr,"_isoTime");function Ur(e,r){return new e({type:"string",format:"duration",check:"string_format",...x(r)})}u(Ur,"_isoDuration");function ys(e,r){return new e(ti({type:"number",checks:[],...x(r)}))}u(ys,"_number");function _s(e,r){return new e(ti({type:"number",coerce:!0,checks:[],...x(r)}))}u(_s,"_coercedNumber");function bs(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(r)})}u(bs,"_int");function xs(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...x(r)})}u(xs,"_float32");function ks(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...x(r)})}u(ks,"_float64");function Is(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...x(r)})}u(Is,"_int32");function ws(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...x(r)})}u(ws,"_uint32");function Ss(e,r){return new e({type:"boolean",...x(r)})}u(Ss,"_boolean");function zs(e,r){return new e({type:"boolean",coerce:!0,...x(r)})}u(zs,"_coercedBoolean");function Ps(e,r){return new e({type:"bigint",...x(r)})}u(Ps,"_bigint");function Ds(e,r){return new e({type:"bigint",coerce:!0,...x(r)})}u(Ds,"_coercedBigint");function Os(e,r){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...x(r)})}u(Os,"_int64");function js(e,r){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...x(r)})}u(js,"_uint64");function As(e,r){return new e({type:"symbol",...x(r)})}u(As,"_symbol");function Ns(e,r){return new e({type:"undefined",...x(r)})}u(Ns,"_undefined");function Us(e,r){return new e({type:"null",...x(r)})}u(Us,"_null");function Ts(e){return new e({type:"any"})}u(Ts,"_any");function Zs(e){return new e({type:"unknown"})}u(Zs,"_unknown");function Es(e,r){return new e({type:"never",...x(r)})}u(Es,"_never");function Cs(e,r){return new e({type:"void",...x(r)})}u(Cs,"_void");function Ls(e,r){return new e({type:"date",...x(r)})}u(Ls,"_date");function Rs(e,r){return new e({type:"date",coerce:!0,...x(r)})}u(Rs,"_coercedDate");function Vs(e,r){return new e({type:"nan",...x(r)})}u(Vs,"_nan");function he(e,r){return new In({check:"less_than",...x(r),value:e,inclusive:!1})}u(he,"_lt");function ce(e,r){return new In({check:"less_than",...x(r),value:e,inclusive:!0})}u(ce,"_lte");function $e(e,r){return new wn({check:"greater_than",...x(r),value:e,inclusive:!1})}u($e,"_gt");function se(e,r){return new wn({check:"greater_than",...x(r),value:e,inclusive:!0})}u(se,"_gte");function ki(e){return $e(0,e)}u(ki,"_positive");function Ii(e){return he(0,e)}u(Ii,"_negative");function wi(e){return ce(0,e)}u(wi,"_nonpositive");function Si(e){return se(0,e)}u(Si,"_nonnegative");function je(e,r){return new ha({check:"multiple_of",...x(r),value:e})}u(je,"_multipleOf");function Ae(e,r){return new _a({check:"max_size",...x(r),maximum:e})}u(Ae,"_maxSize");function ye(e,r){return new ba({check:"min_size",...x(r),minimum:e})}u(ye,"_minSize");function Xe(e,r){return new xa({check:"size_equals",...x(r),size:e})}u(Xe,"_size");function qe(e,r){return new ka({check:"max_length",...x(r),maximum:e})}u(qe,"_maxLength");function we(e,r){return new Ia({check:"min_length",...x(r),minimum:e})}u(we,"_minLength");function He(e,r){return new wa({check:"length_equals",...x(r),length:e})}u(He,"_length");function xt(e,r){return new Sa({check:"string_format",format:"regex",...x(r),pattern:e})}u(xt,"_regex");function kt(e){return new za({check:"string_format",format:"lowercase",...x(e)})}u(kt,"_lowercase");function It(e){return new Pa({check:"string_format",format:"uppercase",...x(e)})}u(It,"_uppercase");function wt(e,r){return new Da({check:"string_format",format:"includes",...x(r),includes:e})}u(wt,"_includes");function St(e,r){return new Oa({check:"string_format",format:"starts_with",...x(r),prefix:e})}u(St,"_startsWith");function zt(e,r){return new ja({check:"string_format",format:"ends_with",...x(r),suffix:e})}u(zt,"_endsWith");function zi(e,r,i){return new Aa({check:"property",property:e,schema:r,...x(i)})}u(zi,"_property");function Pt(e,r){return new Na({check:"properties",shape:e,...x(r)})}u(Pt,"_properties");function Dt(e,r){return new Ua({check:"mime_type",mime:e,...x(r)})}u(Dt,"_mime");function ve(e){return new Ta({check:"overwrite",tx:e})}u(ve,"_overwrite");function Ot(e){return ve(r=>r.normalize(e))}u(Ot,"_normalize");function jt(){return ve(e=>e.trim())}u(jt,"_trim");function At(){return ve(e=>e.toLowerCase())}u(At,"_toLowerCase");function Nt(){return ve(e=>e.toUpperCase())}u(Nt,"_toUpperCase");function Ut(){return ve(e=>yo(e))}u(Ut,"_slugify");function Fs(e,r,i){return new e({type:"array",element:r,...x(i)})}u(Fs,"_array");function dy(e,r,i){return new e({type:"union",options:r,...x(i)})}u(dy,"_union");function fy(e,r,i){return new e({type:"union",options:r,inclusive:!1,...x(i)})}u(fy,"_xor");function my(e,r,i,o){return new e({type:"union",options:i,discriminator:r,...x(o)})}u(my,"_discriminatedUnion");function py(e,r,i){return new e({type:"intersection",left:r,right:i})}u(py,"_intersection");function gy(e,r,i,o){let t=i instanceof j,n=t?o:i,a=t?i:null;return new e({type:"tuple",items:r,rest:a,...x(n)})}u(gy,"_tuple");function vy(e,r,i,o){return new e({type:"record",keyType:r,valueType:i,...x(o)})}u(vy,"_record");function hy(e,r,i,o){return new e({type:"map",keyType:r,valueType:i,...x(o)})}u(hy,"_map");function $y(e,r,i){return new e({type:"set",valueType:r,...x(i)})}u($y,"_set");function yy(e,r,i){let o=Array.isArray(r)?Object.fromEntries(r.map(t=>[t,t])):r;return new e({type:"enum",entries:o,...x(i)})}u(yy,"_enum");function _y(e,r,i){return new e({type:"enum",entries:r,...x(i)})}u(_y,"_nativeEnum");function by(e,r,i){return new e({type:"literal",values:Array.isArray(r)?r:[r],...x(i)})}u(by,"_literal");function Ms(e,r){return new e({type:"file",...x(r)})}u(Ms,"_file");function xy(e,r){return new e({type:"transform",transform:r})}u(xy,"_transform");function ky(e,r){return new e({type:"optional",innerType:r})}u(ky,"_optional");function Iy(e,r){return new e({type:"nullable",innerType:r})}u(Iy,"_nullable");function wy(e,r,i){return new e({type:"default",innerType:r,get defaultValue(){return typeof i=="function"?i():Ht(i)}})}u(wy,"_default");function Sy(e,r,i){return new e({type:"nonoptional",innerType:r,...x(i)})}u(Sy,"_nonoptional");function zy(e,r){return new e({type:"success",innerType:r})}u(zy,"_success");function Py(e,r,i){return new e({type:"catch",innerType:r,catchValue:typeof i=="function"?i:wo(i)})}u(Py,"_catch");function Dy(e,r,i){return new e({type:"pipe",in:r,out:i})}u(Dy,"_pipe");function Oy(e,r){return new e({type:"readonly",innerType:r})}u(Oy,"_readonly");function jy(e,r,i){return new e({type:"template_literal",parts:r,...x(i)})}u(jy,"_templateLiteral");function Ay(e,r){return new e({type:"lazy",getter:r})}u(Ay,"_lazy");function Ny(e,r){return new e({type:"promise",innerType:r})}u(Ny,"_promise");function Js(e,r,i){let o=x(i);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:r,...o})}u(Js,"_custom");function Bs(e,r,i){return new e({type:"custom",check:"custom",fn:r,...x(i)})}u(Bs,"_refine");function Ks(e,r){let i=sm(o=>(o.addIssue=t=>{if(typeof t=="string")o.issues.push(ft(t,o.value,i._zod.def));else{let n=t;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),"input"in n||(n.input=o.value),n.inst??(n.inst=i),n.continue??(n.continue=!i._zod.def.abort),o.issues.push(ft(n))}},e(o.value,o)),r);return i}u(Ks,"_superRefine");function sm(e,r){let i=new V({check:"custom",...x(r)});return i._zod.check=e,i}u(sm,"_check");function Ws(e){let r=new V({check:"describe"});return r._zod.onattach=[i=>{let o=X.get(i)??{};X.add(i,{...o,description:e})}],r._zod.check=()=>{},r}u(Ws,"describe");function Gs(e){let r=new V({check:"meta"});return r._zod.onattach=[i=>{let o=X.get(i)??{};X.add(i,{...o,...e})}],r._zod.check=()=>{},r}u(Gs,"meta");function Xs(e,r){let i=x(r),o=i.truthy??["true","1","yes","on","y","enabled"],t=i.falsy??["false","0","no","off","n","disabled"];i.case!=="sensitive"&&(o=o.map(p=>typeof p=="string"?p.toLowerCase():p),t=t.map(p=>typeof p=="string"?p.toLowerCase():p));let n=new Set(o),a=new Set(t),c=e.Codec??_r,s=e.Boolean??$r,l=e.String??Be,d=new l({type:"string",error:i.error}),f=new s({type:"boolean",error:i.error}),m=new c({type:"pipe",in:d,out:f,transform:u(((p,h)=>{let b=p;return i.case!=="sensitive"&&(b=b.toLowerCase()),n.has(b)?!0:a.has(b)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...n,...a],input:h.value,inst:m,continue:!1}),{})}),"transform"),reverseTransform:u(((p,h)=>p===!0?o[0]||"true":t[0]||"false"),"reverseTransform"),error:i.error});return m._zod.bag.truthy=o,m._zod.bag.falsy=t,m._zod.bag.case=i.case??"insensitive",m}u(Xs,"_stringbool");function Ye(e,r,i,o={}){let t=x(o),n={check:"string_format",type:"string",format:r,fn:typeof i=="function"?i:c=>i.test(c),...t};return i instanceof RegExp&&(n.pattern=i),new e(n)}u(Ye,"_stringFormat");function Tr(e,...r){for(let i of r)for(let o of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,o)&&G(e,o,i[o]);return e}u(Tr,"assignProps");function Ne(e){let r=e?.target??"draft-2020-12";return r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??X,target:r,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}}u(Ne,"initializeContext");function B(e,r,i,o,t){let n=typeof r.unrepresentable=="function"?r.unrepresentable({zodSchema:e,path:o.path,message:t}):r.unrepresentable;if(n==="any")return!1;if(n===void 0||n==="throw")throw new Error(t);return Object.assign(i,n),!0}u(B,"handleUnrepresentable");function L(e,r,i={path:[],schemaPath:[]}){var o;let t=e._zod.def,n=r.seen.get(e);if(n)return n.count++,i.schemaPath.includes(e)&&(n.cycle=i.path),n.schema;let a={schema:{},count:1,cycle:void 0,path:i.path};r.seen.set(e,a),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,a.schema,d);else{let m=a.schema,p=r.processors[t.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${t.type}`);p(e,r,m,d)}let f=e._zod.parent;f&&(a.ref||(a.ref=f),L(f,r,d),r.seen.get(f).isParent=!0)}let s=r.metadataRegistry.get(e);return s&&Tr(a.schema,s),r.io==="input"&&te(e)&&(delete a.schema.examples,delete a.schema.default),r.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,r.seen.get(e).schema}u(L,"processSchema");function lm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}u(lm,"encodeJSONPointerSegment");function Ue(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let s=o.get(c);if(s&&s!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,a[0])}}let t=u(a=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(a[0])?.id,m=e.external.uri??(h=>h);if(f)return{ref:m(f)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${m("__shared")}#/${c}/${lm(p)}`}}let s="#",l=`${s}/${c}/`;if(a[1]===i&&!a[1].schema.id)return{ref:s};let d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+lm(d)}},"makeURI"),n=u(a=>{if(a[1].schema.$ref)return;let c=a[1],{ref:s,defId:l}=t(a);c.def={...c.schema},l&&(c.defId=l);let d=c.schema;for(let f in d)delete d[f];d.$ref=s},"extractToDef");if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
89
89
|
|
|
90
90
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(r===a[0]){n(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(r!==a[0]&&l){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(c.cycle){n(a);continue}c.count>1&&e.reused==="ref"&&n(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}u(Ue,"extractDefs");function mm(e){let r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;let i=[];for(let o of r){if(!o||typeof o!="object")return;mm(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let n=o.type;for(let a of Array.isArray(n)?n:[n]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}u(mm,"compactTypeUnion");var pm=new Set(["type","properties","required","additionalProperties"]),dm=["oneOf","anyOf"];function fm(e){let r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}u(fm,"undeclaredConstraint");function qs(e){let r=[];for(let n of e){if(typeof n!="object"||n.type!=="object")return null;for(let a in n)if(!pm.has(a))return null;r.push(n)}let i={},o=new Set;for(let n of r){for(let a in n.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let c=[];for(let l of r){let d=l.properties?.[a]??fm(l);d!=null&&(c.some(f=>JSON.stringify(f)===JSON.stringify(d))||c.push(d))}let s=c.length===1?c[0]:qs(c)??{allOf:c};G(i,a,s)}for(let a of n.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),r.every(n=>n.additionalProperties===!1))t.additionalProperties=!1;else{let n=[];for(let a of r){let c=fm(a);c&&!n.some(s=>JSON.stringify(s)===JSON.stringify(c))&&n.push(c)}n.length===1?t.additionalProperties=n[0]:n.length>1&&(t.additionalProperties={allOf:n})}return t}u(qs,"foldObjects");function Uy(e){let r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(let t of pm)if(t in e)return;let i=r.filter(t=>dm.some(n=>Array.isArray(t[n]))),o=null;if(!i.length)o=qs(r);else{let t=i[0],n=dm.find(s=>Array.isArray(t[s]));if(Object.keys(t).length!==1)return;let a=r.filter(s=>s!==t),c=t[n].map(s=>qs([...a,s]));if(c.some(s=>!s))return;o={[n]:c}}o&&(delete e.allOf,Tr(e,o))}u(Uy,"foldIntersection");function Te(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=u(c=>{let s=e.seen.get(c);if(s.ref===null)return;let l=s.def??s.schema,d={...l},f=s.ref;if(s.ref=null,f){o(f);let p=e.seen.get(f),h=p.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(h)):Tr(l,h),Tr(l,d),c._zod.parent===f)for(let k in l)k==="$ref"||k==="allOf"||k in d||delete l[k];if(h.$ref&&p.def)for(let k in l)k==="$ref"||k==="allOf"||k in p.def&&JSON.stringify(l[k])===JSON.stringify(p.def[k])&&delete l[k]}let m=c._zod.parent;if(m&&m!==f){o(m);let p=e.seen.get(m);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let h in l)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(l[h])===JSON.stringify(p.def[h])&&delete l[h]}e.override({zodSchema:c,jsonSchema:l,path:s.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())mm(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let s of e.seen.values())for(let l of[s.schema,s.def]){let d=l?.allOf;if(!Array.isArray(d))continue;let f=c.get(d);f?f.push(l):c.set(d,[l])}for(let s of e.intersections)for(let l of c.get(s)??[])Uy(l)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(r)?.id;if(!c)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(c)}Tr(t,i.defId?i.schema:i.def??i.schema);let n=e.metadataRegistry.get(r)?.id;n!==void 0&&t.id===n&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let s=c[1];s.def&&s.defId&&(s.def.id===s.defId&&delete s.def.id,G(a,s.defId,s.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let c=JSON.parse(JSON.stringify(t));return Object.defineProperty(c,"~standard",{value:{...r["~standard"],jsonSchema:{input:Tt(r,"input",e.processors),output:Tt(r,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}u(Te,"finalize");function te(e,r){let i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return te(o.element,i);if(o.type==="set")return te(o.valueType,i);if(o.type==="lazy")return te(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return te(o.innerType,i);if(o.type==="intersection")return te(o.left,i)||te(o.right,i);if(o.type==="record"||o.type==="map")return te(o.keyType,i)||te(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:te(o.in,i)||te(o.out,i);if(o.type==="object"){for(let t in o.shape)if(te(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(te(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(te(t,i))return!0;return!!(o.rest&&te(o.rest,i))}return!1}u(te,"isTransforming");var Hs=u((e,r={})=>i=>{let o=Ne({...i,processors:r});return L(e,o),Ue(o,e),Te(o,e)},"createToJSONSchemaMethod"),Tt=u((e,r,i={})=>o=>{let{libraryOptions:t,target:n}=o??{},a=Ne({...t??{},target:n,io:r,processors:i});return L(e,a),Ue(a,e),Te(a,e)},"createStandardJSONSchemaMethod");var Zt=u((e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},"narrowMin"),Et=u((e,r,i)=>{(e[r]===void 0||i<e[r])&&(e[r]=i)},"narrowMax"),gm=u((e,r)=>{Zt(e,"minimum",r),Et(e,"maximum",r)},"narrowBoth"),ym=u((e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},"addDivisor"),_m=u((e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},"addPattern"),bm=u((e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},"intersectMime"),xm=u((e,r)=>{e.format=r,r.includes("int")&&(e.isInt=!0)},"setFormat"),vm=u((e,r)=>Zt(e,"minimum",r.minimum),"minContributor"),hm=u((e,r)=>Et(e,"maximum",r.maximum),"maxContributor"),$m=u(e=>(r,i)=>{xm(r,i.format);let[o,t]=e[i.format];Zt(r,"minimum",o),Et(r,"maximum",t)},"formatContributor"),Ty={greater_than:u((e,r)=>Zt(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),"greater_than"),less_than:u((e,r)=>Et(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),"less_than"),multiple_of:u((e,r)=>ym(e,r.value),"multiple_of"),number_format:$m(Qt),bigint_format:$m(er),min_length:vm,max_length:hm,length_equals:u((e,r)=>gm(e,r.length),"length_equals"),min_size:vm,max_size:hm,size_equals:u((e,r)=>gm(e,r.size),"size_equals"),string_format:u((e,r)=>{xm(e,r.format),r.pattern&&_m(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},"string_format"),mime_type:u((e,r)=>bm(e,r.mime),"mime_type")};function K(e){let r={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let n of o)Ty[n._zod.def.check]?.(r,n._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Zt(r,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Zt(r,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&Et(r,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&Et(r,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&ym(r,t.multipleOf),t.format!==void 0&&(r.format??(r.format=t.format),t.format.includes("int")&&(r.isInt=!0)),t.mime&&bm(r,t.mime);for(let n of t.patterns??[])_m(r,n);return r}u(K,"aggregateChecks");var Zy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ey=new Map([[Tn,Ho],[hr,Yo]]),km=u(e=>Ey.get(e)??e,"exactPattern"),el=u((e,r,i,o)=>{let t=i;t.type="string";let{minimum:n,maximum:a,format:c,patterns:s,contentEncoding:l,laxFormat:d}=K(e);if(typeof n=="number"&&(t.minLength=n),typeof a=="number"&&(t.maxLength=a),c&&(t.format=Zy[c]??c,t.format===""&&delete t.format,(c==="time"||d)&&delete t.format),l&&(t.contentEncoding=l),s&&s.size>0){let f=[...s].map(km);f.length===1?t.pattern=f[0].source:f.length>1&&(t.allOf=[...f.map(m=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},"stringProcessor"),tl=u((e,r,i,o)=>{let t=i,{minimum:n,maximum:a,multipleOf:c,exclusiveMaximum:s,exclusiveMinimum:l,isInt:d}=K(e);t.type=d?"integer":"number";let f=typeof l=="number"&&l>=(n??Number.NEGATIVE_INFINITY),m=typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY),p=r.target==="draft-04"||r.target==="openapi-3.0";if(f?p?(t.minimum=l,t.exclusiveMinimum=!0):t.exclusiveMinimum=l:typeof n=="number"&&(t.minimum=n),m?p?(t.maximum=s,t.exclusiveMaximum=!0):t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),c){let h=new Set;for(let z of c)Number.isFinite(z)&&z!==0?h.add(Math.abs(z)):B(e,r,t,o,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[b,...k]=h;b!==void 0&&(t.multipleOf=b),k.length&&(t.allOf=[...t.allOf??[],...k.map(z=>({multipleOf:z}))])}},"numberProcessor"),rl=u((e,r,i,o)=>{i.type="boolean"},"booleanProcessor"),nl=u((e,r,i,o)=>{B(e,r,i,o,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),il=u((e,r,i,o)=>{B(e,r,i,o,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),ol=u((e,r,i,o)=>{r.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},"nullProcessor"),al=u((e,r,i,o)=>{B(e,r,i,o,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),ul=u((e,r,i,o)=>{B(e,r,i,o,"Void cannot be represented in JSON Schema")},"voidProcessor"),cl=u((e,r,i,o)=>{i.not={}},"neverProcessor"),sl=u((e,r,i,o)=>{},"anyProcessor"),ll=u((e,r,i,o)=>{},"unknownProcessor"),dl=u((e,r,i,o)=>{B(e,r,i,o,"Date cannot be represented in JSON Schema")},"dateProcessor"),fl=u((e,r,i,o)=>{let t=e._zod.def,n=ut(t.entries);if(n.length===0){i.not={};return}n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),i.enum=n},"enumProcessor"),ml=u((e,r,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let n=[];for(let a of t.values)if(a===void 0){if(B(e,r,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(B(e,r,i,o,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(a))}else n.push(a);if(n.length!==0)if(n.length===1){let a=n[0];i.type=a===null?"null":typeof a,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[a]:i.const=a}else n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),n.every(a=>typeof a=="boolean")&&(i.type="boolean"),n.every(a=>a===null)&&(i.type="null"),i.enum=n},"literalProcessor"),pl=u((e,r,i,o)=>{B(e,r,i,o,"NaN cannot be represented in JSON Schema")},"nanProcessor"),gl=u((e,r,i,o)=>{let t=i,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},"templateLiteralProcessor"),vl=u((e,r,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:n,maximum:a,mime:c}=K(e);n!==void 0&&(t.minLength=n),a!==void 0&&(t.maxLength=a),c&&(c.length===0?t.not={}:c.length===1?t.contentMediaType=c[0]:t.anyOf=c.map(s=>({contentMediaType:s})))},"fileProcessor"),hl=u((e,r,i,o)=>{i.type="boolean"},"successProcessor"),$l=u((e,r,i,o)=>{B(e,r,i,o,"Custom types cannot be represented in JSON Schema")},"customProcessor"),yl=u((e,r,i,o)=>{B(e,r,i,o,"Function types cannot be represented in JSON Schema")},"functionProcessor"),_l=u((e,r,i,o)=>{B(e,r,i,o,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),bl=u((e,r,i,o)=>{B(e,r,i,o,"Map cannot be represented in JSON Schema")},"mapProcessor"),xl=u((e,r,i,o)=>{B(e,r,i,o,"Set cannot be represented in JSON Schema")},"setProcessor"),kl=u((e,r,i,o)=>{let t=i,n=e._zod.def,{minimum:a,maximum:c}=K(e);typeof a=="number"&&(t.minItems=a),typeof c=="number"&&(t.maxItems=c),t.type="array",t.items=L(n.element,r,{...o,path:[...o.path,"items"]})},"arrayProcessor");function Zr(e){let r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?Zr(r.out):r.type==="catch"?Zr(r.innerType):e._zod.optin}u(Zr,"inputOptin");var Il=u((e,r,i,o)=>{let t=i,n=e._zod.def,a=n.shape;if(Object.getOwnPropertySymbols(a).length&&B(e,r,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let l in a)G(t.properties,l,L(a[l],r,{...o,path:[...o.path,"properties",l]}));let s=[];for(let l of Object.keys(a)){let d=n.shape[l];(r.io==="input"?Zr(d)===void 0:d._zod.optout===void 0)&&s.push(l)}s.length>0&&(t.required=s),n.catchall?._zod.def.type==="never"?t.additionalProperties=!1:n.catchall?n.catchall&&(t.additionalProperties=L(n.catchall,r,{...o,path:[...o.path,"additionalProperties"]})):r.io==="output"&&(t.additionalProperties=!1)},"objectProcessor"),Di=u((e,r,i,o)=>{let t=e._zod.def,n=t.inclusive===!1,a=t.options.map((c,s)=>L(c,r,{...o,path:[...o.path,n?"oneOf":"anyOf",s]}));n?i.oneOf=a:i.anyOf=a},"unionProcessor"),wl=u((e,r,i,o)=>{let t=e._zod.def,n=L(t.left,r,{...o,path:[...o.path,"allOf",0]}),a=L(t.right,r,{...o,path:[...o.path,"allOf",1]}),c=u(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),s=[...c(n)?n.allOf:[n],...c(a)?a.allOf:[a]];i.allOf=s,r.intersections.push(s)},"intersectionProcessor"),Sl=u((e,r,i,o)=>{let t=i,n=e._zod.def;t.type="array";let a=r.target==="draft-2020-12"?"prefixItems":"items",c=r.target==="draft-2020-12"||r.target==="openapi-3.0"?"items":"additionalItems",s=n.items.map((b,k)=>L(b,r,{...o,path:[...o.path,a,k]})),l=n.rest?L(n.rest,r,{...o,path:[...o.path,c,...r.target==="openapi-3.0"?[n.items.length]:[]]}):null,d=n.items.length;for(;d>0;){let b=n.items[d-1];if(!(r.io==="input"?Zr(b)!==void 0:b._zod.optout==="optional"))break;d--}let f=n.items.length,m=!n.rest;r.target==="draft-2020-12"?(t.prefixItems=s,m?t.items=!1:l&&(t.items=l),d>0&&(t.minItems=d),m&&(t.maxItems=f)):r.target==="openapi-3.0"?(t.items={anyOf:s},l&&t.items.anyOf.push(l),d>0&&(t.minItems=d),m&&(t.maxItems=f)):(t.items=s,m?t.additionalItems=!1:l&&(t.additionalItems=l),d>0&&(t.minItems=d),m&&(t.maxItems=f));let{minimum:p,maximum:h}=K(e);typeof p=="number"&&(t.minItems=p),typeof h=="number"&&(t.maxItems=h)},"tupleProcessor");function Ys(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);let h=e.get(r)?.def;if(!h)return r;let b=Ys(e,h,i);return b===h?r:b}for(let h of["anyOf","oneOf"]){let b=r[h];if(!Array.isArray(b))continue;let k=b.map(z=>Ys(e,z,i));k.some((z,w)=>z!==b[w])&&(r={...r,[h]:k})}let o=Array.isArray(r.type)?r.type:[r.type],t=!o.includes("string")&&o.some(h=>h==="number"||h==="integer"),n=r.enum??(r.const!==void 0?[r.const]:void 0);if(!t&&!n?.some(h=>typeof h=="number"))return r;let{minimum:a,maximum:c,exclusiveMinimum:s,exclusiveMaximum:l,multipleOf:d,format:f,id:m,...p}=r;return p.enum?p.enum=p.enum.map(h=>typeof h=="number"?String(h):h):typeof p.const=="number"&&(p.const=String(p.const)),t&&(p.type="string",n||(p.pattern=(o.includes("number")?Ie:lr).source)),p}u(Ys,"stringifyKeyNames");var Qs=new WeakMap;function Cy(e){let r=new Map;for(let o of e.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let i=new Map;for(let o of Qs.get(e)??[]){let t=e.seen.get(o),n=(t?.def??t?.schema)?.propertyNames;if(!n||n===!0||i.has(n))continue;let a=Ys(r,n,new Set);a!==n&&i.set(n,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let n=t&&i.get(t.propertyNames);n&&(t.propertyNames=n)}}u(Cy,"rewriteKeyNames");var zl=u((e,r,i,o)=>{let t=i,n=e._zod.def;t.type="object";let a=n.keyType,c=K(a).patterns;if(n.mode==="loose"&&c&&c.size>0){let d=L(n.valueType,r,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let f of c)G(t.patternProperties,km(f).source,d)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){t.propertyNames=L(n.keyType,r,{...o,path:[...o.path,"propertyNames"]});let d=Qs.get(r);d||(d=[],Qs.set(r,d),r.deferred.push(()=>Cy(r))),d.push(e)}t.additionalProperties=L(n.valueType,r,{...o,path:[...o.path,"additionalProperties"]})}let s=a._zod.values,l=r.io==="input"&&Zr(n.valueType)!==void 0;if(s&&!n.partial&&!l){let d=[...s].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(t.required=d.map(String))}},"recordProcessor"),Pl=u((e,r,i,o)=>{let t=e._zod.def,n=L(t.innerType,r,o),a=r.seen.get(e);r.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[n,{type:"null"}]},"nullableProcessor"),Dl=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},"nonoptionalProcessor"),Ol=Symbol();function Im(e,r,i,o,t){let n=!1,a=JSON.stringify(e,(c,s)=>typeof s!="bigint"?s:(n=!0,null));return n?(B(r,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),Ol):JSON.parse(a)}u(Im,"serializeDefaultValue");var jl=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a=Im(t.defaultValue,e,r,i,o);a!==Ol&&(i.default=a)},"defaultProcessor"),Al=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);if(n.ref=t.innerType,r.io!=="input")return;let a=Im(t.defaultValue,e,r,i,o);a!==Ol&&(i._prefault=a)},"prefaultProcessor"),Nl=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{B(e,r,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},"catchProcessor"),Ul=u((e,r,i,o)=>{let t=e._zod.def,n=t.in._zod.traits.has("$ZodTransform"),a=r.io==="input"?n?t.out:t.in:t.out;L(a,r,o);let c=r.seen.get(e);c.ref=a},"pipeProcessor"),Tl=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType,i.readOnly=!0},"readonlyProcessor"),Zl=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},"promiseProcessor"),Oi=u((e,r,i,o)=>{let t=e._zod.def;L(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},"optionalProcessor"),El=u((e,r,i,o)=>{let t=e._zod.innerType;L(t,r,o);let n=r.seen.get(e);n.ref=t},"lazyProcessor"),Pi={string:el,number:tl,boolean:rl,bigint:nl,symbol:il,null:ol,undefined:al,void:ul,never:cl,any:sl,unknown:ll,date:dl,enum:fl,literal:ml,nan:pl,template_literal:gl,file:vl,success:hl,custom:$l,function:yl,transform:_l,map:bl,set:xl,array:kl,object:Il,union:Di,intersection:wl,tuple:Sl,record:zl,nullable:Pl,nonoptional:Dl,default:jl,prefault:Al,catch:Nl,pipe:Ul,readonly:Tl,promise:Zl,optional:Oi,lazy:El};function ji(e,r){if("_idmap"in e){let o=e,t=Ne({...r,processors:Pi}),n={};for(let s of o._idmap.entries()){let[l,d]=s;L(d,t)}let a={},c={registry:o,uri:r?.uri,defs:n};t.external=c;for(let s of o._idmap.entries()){let[l,d]=s;Ue(t,d),G(a,l,Te(t,d))}if(Object.keys(n).length>0){let s=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:n}}return{schemas:a}}let i=Ne({...r,processors:Pi});return L(e,i),Ue(i,e),Te(i,e)}u(ji,"toJSONSchema");var Ai=class{static{u(this,"JSONSchemaGenerator")}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(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=Ne({processors:Pi,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return L(r,this.ctx,i)}emit(r,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ue(this.ctx,r);let o=Te(this.ctx,r),{"~standard":t,...n}=o;return n}};var wm={};var Bt={};be(Bt,{ZodAny:()=>od,ZodArray:()=>sd,ZodBase64:()=>Hi,ZodBase64URL:()=>Yi,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>to,ZodBoolean:()=>Ft,ZodCIDRv4:()=>Xi,ZodCIDRv6:()=>qi,ZodCUID:()=>Fi,ZodCUID2:()=>Mi,ZodCatch:()=>Od,ZodCodec:()=>Kr,ZodCreditCard:()=>Hl,ZodCustom:()=>Wr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Rr,ZodDefault:()=>Id,ZodDiscriminatedUnion:()=>dd,ZodE164:()=>Qi,ZodEmail:()=>Ci,ZodEmoji:()=>Ri,ZodEnum:()=>Lt,ZodExactOptional:()=>oo,ZodFile:()=>_d,ZodFunction:()=>Rd,ZodGUID:()=>Li,ZodIBAN:()=>Yl,ZodIPv4:()=>Wi,ZodIPv6:()=>Gi,ZodISODate:()=>Ee,ZodISODateTime:()=>Ze,ZodISODuration:()=>Le,ZodISOTime:()=>Ce,ZodInstanceOf:()=>Md,ZodIntersection:()=>fd,ZodJWT:()=>eo,ZodKSUID:()=>Ki,ZodLazy:()=>Ed,ZodLiteral:()=>yd,ZodMAC:()=>ql,ZodMap:()=>hd,ZodNaN:()=>Ad,ZodNanoID:()=>Vi,ZodNever:()=>ud,ZodNonOptional:()=>ao,ZodNull:()=>nd,ZodNullable:()=>kd,ZodNumber:()=>Vt,ZodNumberFormat:()=>nt,ZodObject:()=>Fr,ZodOptional:()=>Jr,ZodPipe:()=>Br,ZodPrefault:()=>Sd,ZodPreprocess:()=>Nd,ZodPromise:()=>Ld,ZodReadonly:()=>Ud,ZodRecord:()=>Ct,ZodSet:()=>$d,ZodString:()=>Rt,ZodStringFormat:()=>R,ZodSuccess:()=>Dd,ZodSymbol:()=>td,ZodTemplateLiteral:()=>Zd,ZodTransform:()=>bd,ZodTuple:()=>pd,ZodType:()=>A,ZodULID:()=>Ji,ZodURL:()=>Lr,ZodUUID:()=>_e,ZodUndefined:()=>rd,ZodUnion:()=>Mr,ZodUnknown:()=>ad,ZodVoid:()=>cd,ZodXID:()=>Bi,ZodXor:()=>ld,_ZodString:()=>Ei,_default:()=>wd,_function:()=>Ep,any:()=>pp,array:()=>Vr,base64:()=>Gm,base64url:()=>Xm,bigint:()=>sp,boolean:()=>ed,catch:()=>jd,check:()=>Cp,cidrv4:()=>Km,cidrv6:()=>Wm,codec:()=>Np,creditCard:()=>Hm,cuid:()=>Cm,cuid2:()=>Lm,currencyCode:()=>np,custom:()=>Lp,date:()=>vp,describe:()=>Rp,discriminatedUnion:()=>xp,e164:()=>qm,email:()=>Pm,emoji:()=>Zm,enum:()=>no,exactOptional:()=>xd,file:()=>Dp,float32:()=>op,float64:()=>ap,function:()=>Ep,guid:()=>Dm,hash:()=>ip,hex:()=>rp,hostname:()=>tp,httpUrl:()=>Tm,iban:()=>Ym,instanceof:()=>Fp,int:()=>Ti,int32:()=>up,int64:()=>lp,intersection:()=>md,invertCodec:()=>Up,ipv4:()=>Mm,ipv6:()=>Bm,json:()=>Jp,jwt:()=>Qm,keyof:()=>hp,ksuid:()=>Fm,lazy:()=>Cd,literal:()=>Pp,looseObject:()=>_p,looseRecord:()=>Ip,mac:()=>Jm,map:()=>wp,meta:()=>Vp,nan:()=>Ap,nanoid:()=>Em,nativeEnum:()=>zp,never:()=>ro,nonoptional:()=>Pd,null:()=>id,nullable:()=>Cr,nullish:()=>Op,number:()=>Ql,object:()=>$p,optional:()=>et,partialRecord:()=>kp,pipe:()=>Zi,prefault:()=>zd,preprocess:()=>Bp,promise:()=>Zp,readonly:()=>Td,record:()=>vd,refine:()=>Vd,set:()=>Sp,strictObject:()=>yp,string:()=>Er,stringFormat:()=>ep,stringbool:()=>Mp,success:()=>jp,superRefine:()=>Fd,symbol:()=>fp,templateLiteral:()=>Tp,transform:()=>io,tuple:()=>gd,uint32:()=>cp,uint64:()=>dp,ulid:()=>Rm,undefined:()=>mp,union:()=>Jt,unknown:()=>Qe,url:()=>Um,uuid:()=>Om,uuidv4:()=>jm,uuidv6:()=>Am,uuidv7:()=>Nm,void:()=>gp,xid:()=>Vm,xor:()=>bp});var Ni={};be(Ni,{endsWith:()=>zt,gt:()=>$e,gte:()=>se,includes:()=>wt,length:()=>He,lowercase:()=>kt,lt:()=>he,lte:()=>ce,maxLength:()=>qe,maxSize:()=>Ae,mime:()=>Dt,minLength:()=>we,minSize:()=>ye,multipleOf:()=>je,negative:()=>Ii,nonnegative:()=>Si,nonpositive:()=>wi,normalize:()=>Ot,overwrite:()=>ve,positive:()=>ki,properties:()=>Pt,property:()=>zi,regex:()=>xt,size:()=>Xe,slugify:()=>Ut,startsWith:()=>St,toLowerCase:()=>At,toUpperCase:()=>Nt,trim:()=>jt,uppercase:()=>It});var Sm=new WeakSet([Object.prototype,Error.prototype]);function Ui(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0})}})}u(Ui,"_lazyMethod");var zm=u((e,r)=>{jo.init(e,r),e.name="ZodError";let i=Object.getPrototypeOf(e);Sm.has(i)||(Sm.add(i),Ui(i,"format",o=>t=>ar(o,t)),Ui(i,"flatten",o=>t=>or(o,t)),Ui(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,ct,2)}),Ui(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,ct,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),Ry=g("ZodError",zm),ue=g("ZodError",zm,void 0,{Parent:Error});var Cl=mt(ue),Ll=pt(ue),Rl=gt(ue),Vl=vt(ue),Fl=fn(ue),Ml=mn(ue),Jl=pn(ue),Bl=gn(ue),Kl=vn(ue),Wl=hn(ue),Gl=$n(ue),Xl=yn(ue);function Fy(){W.localeError||M(wr())}u(Fy,"_ensureDefaultLocale");function tt(){W.memoizer||M({memoizer:Ir()})}u(tt,"_ensureDefaultMemoizer");var A=g("ZodType",(e,r)=>(Fy(),j.init(e,r),e.def=r,e.type=r.type,e),{check(...e){let r=this.def;return this.clone($.mergeDefs(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return E(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(Vd(e,r))},superRefine(e,r){return this.check(Fd(e,r))},overwrite(e){return this.check(ve(e))},optional(){return et(this)},exactOptional(){return xd(this)},nullable(){return Cr(this)},nullish(){return et(Cr(this))},nonoptional(e){return Pd(this,e)},array(){return Vr(this)},or(e){return Jt([this,e])},and(e){return md(this,e)},transform(e){return Zi(this,io(e))},default(e){return wd(this,e)},prefault(e){return zd(this,e)},catch(e){return jd(this,e)},pipe(e){return Zi(this,e)},readonly(){return Td(this)},describe(e){let r=this.clone();return X.add(r,{description:e}),r},meta(...e){if(e.length===0)return X.get(this);let r=this.clone();return X.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return $.hide(this,"~standard",{...On(this),jsonSchema:{input:Tt(this,"input"),output:Tt(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:u(function e(r,i){return Cl(this,r,i,{callee:e})},"_parse"),parseAsync:u(async function e(r,i){return await Ll(this,r,i,{callee:e})},"_parseAsync"),safeParse(e,r){return Rl(this,e,r)},async safeParseAsync(e,r){return Vl(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,r){return ur(this,e,r)},validateAsync(e,r){return cr(this,e,r)},encode:u(function e(r,i){return Fl(this,r,i,{callee:e})},"_encode"),decode:u(function e(r,i){return Ml(this,r,i,{callee:e})},"_decode"),encodeAsync:u(async function e(r,i){return await Jl(this,r,i,{callee:e})},"_encodeAsync"),decodeAsync:u(async function e(r,i){return await Bl(this,r,i,{callee:e})},"_decodeAsync"),safeEncode(e,r){return Kl(this,e,r)},safeDecode(e,r){return Wl(this,e,r)},async safeEncodeAsync(e,r){return Gl(this,e,r)},async safeDecodeAsync(e,r){return Xl(this,e,r)},toJSONSchema(e){return Hs(this,{})(e)},get description(){return X.get(this)?.description},get _def(){return this._zod.def}}),Ei=g("_ZodString",(e,r)=>{Be.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>el(e,i,o,t)},$.derived({format:u(e=>K(e).format??null,"format"),minLength:u(e=>K(e).minimum??null,"minLength"),maxLength:u(e=>K(e).maximum??null,"maxLength")},{regex(...e){return this.check(xt(...e))},includes(...e){return this.check(wt(...e))},startsWith(...e){return this.check(St(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(we(...e))},max(...e){return this.check(qe(...e))},length(...e){return this.check(He(...e))},nonempty(...e){return this.check(we(1,...e))},lowercase(e){return this.check(kt(e))},uppercase(e){return this.check(It(e))},trim(){return this.check(jt())},normalize(...e){return this.check(Ot(...e))},toLowerCase(){return this.check(At())},toUpperCase(){return this.check(Nt())},slugify(){return this.check(Ut())}})),Rt=g("ZodString",(e,r)=>{Be.init(e,r),Ei.init(e,r)},{email(e){return this.check(ri(Ci,e))},url(e){return this.check(Or(Lr,e))},jwt(e){return this.check(xi(eo,e))},emoji(e){return this.check(ci(Ri,e))},guid(e){return this.check(ni(Li,e))},uuid(e){return this.check(ii(_e,e))},uuidv4(e){return this.check(oi(_e,e))},uuidv6(e){return this.check(ai(_e,e))},uuidv7(e){return this.check(ui(_e,e))},nanoid(e){return this.check(si(Vi,e))},cuid(e){return this.check(li(Fi,e))},cuid2(e){return this.check(di(Mi,e))},ulid(e){return this.check(fi(Ji,e))},base64(e){return this.check(yi(Hi,e))},base64url(e){return this.check(_i(Yi,e))},xid(e){return this.check(mi(Bi,e))},ksuid(e){return this.check(pi(Ki,e))},ipv4(e){return this.check(gi(Wi,e))},ipv6(e){return this.check(vi(Gi,e))},cidrv4(e){return this.check(hi(Xi,e))},cidrv6(e){return this.check($i(qi,e))},e164(e){return this.check(bi(Qi,e))},datetime(e){return this.check(jr(Ze,e))},date(e){return this.check(Ar(Ee,e))},time(e){return this.check(Nr(Ce,e))},duration(e){return this.check(Ur(Le,e))}});function Er(e){return ms(Rt,e)}u(Er,"string");var R=g("ZodStringFormat",(e,r)=>{C.init(e,r),Ei.init(e,r)}),Ze=g("ZodISODateTime",(e,r)=>{Ha.init(e,r),R.init(e,r)}),Ee=g("ZodISODate",(e,r)=>{Ya.init(e,r),R.init(e,r)}),Ce=g("ZodISOTime",(e,r)=>{Qa.init(e,r),R.init(e,r)}),Le=g("ZodISODuration",(e,r)=>{eu.init(e,r),R.init(e,r)}),Ci=g("ZodEmail",(e,r)=>{Ra.init(e,r),R.init(e,r)});function Pm(e){return ri(Ci,e)}u(Pm,"email");var Li=g("ZodGUID",(e,r)=>{Ca.init(e,r),R.init(e,r)});function Dm(e){return ni(Li,e)}u(Dm,"guid");var _e=g("ZodUUID",(e,r)=>{La.init(e,r),R.init(e,r)});function Om(e){return ii(_e,e)}u(Om,"uuid");function jm(e){return oi(_e,e)}u(jm,"uuidv4");function Am(e){return ai(_e,e)}u(Am,"uuidv6");function Nm(e){return ui(_e,e)}u(Nm,"uuidv7");var Lr=g("ZodURL",(e,r)=>{Ma.init(e,r),R.init(e,r)});function Um(e){return Or(Lr,e)}u(Um,"url");function Tm(e){return Or(Lr,{protocol:sr,hostname:ea,...$.normalizeParams(e)})}u(Tm,"httpUrl");var Ri=g("ZodEmoji",(e,r)=>{Ja.init(e,r),R.init(e,r)});function Zm(e){return ci(Ri,e)}u(Zm,"emoji");var Vi=g("ZodNanoID",(e,r)=>{Ba.init(e,r),R.init(e,r)});function Em(e){return si(Vi,e)}u(Em,"nanoid");var Fi=g("ZodCUID",(e,r)=>{Ka.init(e,r),R.init(e,r)});function Cm(e){return li(Fi,e)}u(Cm,"cuid");var Mi=g("ZodCUID2",(e,r)=>{Wa.init(e,r),R.init(e,r)});function Lm(e){return di(Mi,e)}u(Lm,"cuid2");var Ji=g("ZodULID",(e,r)=>{Ga.init(e,r),R.init(e,r)});function Rm(e){return fi(Ji,e)}u(Rm,"ulid");var Bi=g("ZodXID",(e,r)=>{Xa.init(e,r),R.init(e,r)});function Vm(e){return mi(Bi,e)}u(Vm,"xid");var Ki=g("ZodKSUID",(e,r)=>{qa.init(e,r),R.init(e,r)});function Fm(e){return pi(Ki,e)}u(Fm,"ksuid");var Wi=g("ZodIPv4",(e,r)=>{tu.init(e,r),R.init(e,r)});function Mm(e){return gi(Wi,e)}u(Mm,"ipv4");var ql=g("ZodMAC",(e,r)=>{nu.init(e,r),R.init(e,r)});function Jm(e){return gs(ql,e)}u(Jm,"mac");var Gi=g("ZodIPv6",(e,r)=>{ru.init(e,r),R.init(e,r)});function Bm(e){return vi(Gi,e)}u(Bm,"ipv6");var Xi=g("ZodCIDRv4",(e,r)=>{iu.init(e,r),R.init(e,r)});function Km(e){return hi(Xi,e)}u(Km,"cidrv4");var qi=g("ZodCIDRv6",(e,r)=>{ou.init(e,r),R.init(e,r)});function Wm(e){return $i(qi,e)}u(Wm,"cidrv6");var Hi=g("ZodBase64",(e,r)=>{au.init(e,r),R.init(e,r)});function Gm(e){return yi(Hi,e)}u(Gm,"base64");var Yi=g("ZodBase64URL",(e,r)=>{uu.init(e,r),R.init(e,r)});function Xm(e){return _i(Yi,e)}u(Xm,"base64url");var Qi=g("ZodE164",(e,r)=>{cu.init(e,r),R.init(e,r)});function qm(e){return bi(Qi,e)}u(qm,"e164");var Hl=g("ZodCreditCard",(e,r)=>{su.init(e,r),R.init(e,r)});function Hm(e){return vs(Hl,e)}u(Hm,"creditCard");var Yl=g("ZodIBAN",(e,r)=>{lu.init(e,r),R.init(e,r)});function Ym(e){return hs(Yl,e)}u(Ym,"iban");var eo=g("ZodJWT",(e,r)=>{du.init(e,r),R.init(e,r)});function Qm(e){return xi(eo,e)}u(Qm,"jwt");var rt=g("ZodCustomStringFormat",(e,r)=>{fu.init(e,r),R.init(e,r)});function ep(e,r,i={}){return Ye(rt,e,r,i)}u(ep,"stringFormat");function tp(e){return Ye(rt,"hostname",Qo,e)}u(tp,"hostname");function rp(e){return Ye(rt,"hex",pa,e)}u(rp,"hex");function np(e){return Ye(rt,"currency_code",ra,e)}u(np,"currencyCode");function ip(e,r){let i=r?.enc??"hex",o=`${e}_${i}`,t=fe[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return Ye(rt,o,t,r)}u(ip,"hash");var Vt=g("ZodNumber",(e,r)=>{Rn.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>tl(e,i,o,t),e.isFinite=!0},$.derived({minValue:u(e=>{let{minimum:r,exclusiveMinimum:i}=K(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:u(e=>{let{maximum:r,exclusiveMaximum:i}=K(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},"maxValue"),isInt:u(e=>{let{isInt:r,multipleOf:i}=K(e);return!!r||!!i?.some(Number.isSafeInteger)},"isInt"),format:u(e=>K(e).format??null,"format")},{gt(e,r){return this.check($e(e,r))},gte(e,r){return this.check(se(e,r))},min(e,r){return this.check(se(e,r))},lt(e,r){return this.check(he(e,r))},lte(e,r){return this.check(ce(e,r))},max(e,r){return this.check(ce(e,r))},int(e){return this.check(Ti(e))},safe(e){return this.check(Ti(e))},positive(e){return this.check($e(0,e))},nonnegative(e){return this.check(se(0,e))},negative(e){return this.check(he(0,e))},nonpositive(e){return this.check(ce(0,e))},multipleOf(e,r){return this.check(je(e,r))},step(e,r){return this.check(je(e,r))},finite(){return this}}));function Ql(e){return ys(Vt,e)}u(Ql,"number");var nt=g("ZodNumberFormat",(e,r)=>{mu.init(e,r),Vt.init(e,r)});function Ti(e){return bs(nt,e)}u(Ti,"int");function op(e){return xs(nt,e)}u(op,"float32");function ap(e){return ks(nt,e)}u(ap,"float64");function up(e){return Is(nt,e)}u(up,"int32");function cp(e){return ws(nt,e)}u(cp,"uint32");var Ft=g("ZodBoolean",(e,r)=>{$r.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>rl(e,i,o,t)});function ed(e){return Ss(Ft,e)}u(ed,"boolean");var Mt=g("ZodBigInt",(e,r)=>{Vn.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>nl(e,i,o,t)},$.derived({minValue:u(e=>K(e).minimum??null,"minValue"),maxValue:u(e=>K(e).maximum??null,"maxValue"),format:u(e=>K(e).format??null,"format")},{gte(e,r){return this.check(se(e,r))},min(e,r){return this.check(se(e,r))},gt(e,r){return this.check($e(e,r))},lt(e,r){return this.check(he(e,r))},lte(e,r){return this.check(ce(e,r))},max(e,r){return this.check(ce(e,r))},positive(e){return this.check($e(BigInt(0),e))},negative(e){return this.check(he(BigInt(0),e))},nonpositive(e){return this.check(ce(BigInt(0),e))},nonnegative(e){return this.check(se(BigInt(0),e))},multipleOf(e,r){return this.check(je(e,r))}}));function sp(e){return Ps(Mt,e)}u(sp,"bigint");var to=g("ZodBigIntFormat",(e,r)=>{pu.init(e,r),Mt.init(e,r)});function lp(e){return Os(to,e)}u(lp,"int64");function dp(e){return js(to,e)}u(dp,"uint64");var td=g("ZodSymbol",(e,r)=>{gu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>il(e,i,o,t)});function fp(e){return As(td,e)}u(fp,"symbol");var rd=g("ZodUndefined",(e,r)=>{vu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>al(e,i,o,t)});function mp(e){return Ns(rd,e)}u(mp,"_undefined");var nd=g("ZodNull",(e,r)=>{hu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ol(e,i,o,t)});function id(e){return Us(nd,e)}u(id,"_null");var od=g("ZodAny",(e,r)=>{$u.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>sl(e,i,o,t)});function pp(){return Ts(od)}u(pp,"any");var ad=g("ZodUnknown",(e,r)=>{yu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ll(e,i,o,t)});function Qe(){return Zs(ad)}u(Qe,"unknown");var ud=g("ZodNever",(e,r)=>{_u.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>cl(e,i,o,t)});function ro(e){return Es(ud,e)}u(ro,"never");var cd=g("ZodVoid",(e,r)=>{bu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ul(e,i,o,t)});function gp(e){return Cs(cd,e)}u(gp,"_void");var Rr=g("ZodDate",(e,r)=>{xu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>dl(e,i,o,t),e.min=(i,o)=>e.check(se(i,o)),e.max=(i,o)=>e.check(ce(i,o))},$.derived({minDate:u(e=>{let{minimum:r}=K(e);return r?new Date(r):null},"minDate"),maxDate:u(e=>{let{maximum:r}=K(e);return r?new Date(r):null},"maxDate")},{}));function vp(e){return Ls(Rr,e)}u(vp,"date");var sd=g("ZodArray",(e,r)=>{tt(),Iu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>kl(e,i,o,t),e.element=r.element},{min(e,r){return this.check(we(e,r))},nonempty(e){return this.check(we(1,e))},max(e,r){return this.check(qe(e,r))},length(e,r){return this.check(He(e,r))},unwrap(){return this.element}});function Vr(e,r){return Fs(sd,e,r)}u(Vr,"array");function hp(e){let r=e._zod.def.shape;return no(Object.keys(r))}u(hp,"keyof");var Fr=g("ZodObject",(e,r)=>{tt(),wu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Il(e,i,o,t),$.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return no(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:Qe()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:Qe()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:ro()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(Jr,this,e[0])},exactPartial(...e){return $.partial(oo,this,e[0],"exactPartial")},required(...e){return $.required(ao,this,e[0])}});function $p(e,r){let i={type:"object",shape:e??{},...$.normalizeParams(r)};return new Fr(i)}u($p,"object");function yp(e,r){return new Fr({type:"object",shape:e,catchall:ro(),...$.normalizeParams(r)})}u(yp,"strictObject");function _p(e,r){return new Fr({type:"object",shape:e,catchall:Qe(),...$.normalizeParams(r)})}u(_p,"looseObject");var Mr=g("ZodUnion",(e,r)=>{yr.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Di(e,i,o,t),e.options=r.options});function Jt(e,r){return new Mr({type:"union",options:e,...$.normalizeParams(r)})}u(Jt,"union");var ld=g("ZodXor",(e,r)=>{Mr.init(e,r),Su.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Di(e,i,o,t),e.options=r.options});function bp(e,r){return new ld({type:"union",options:e,inclusive:!1,...$.normalizeParams(r)})}u(bp,"xor");var dd=g("ZodDiscriminatedUnion",(e,r)=>{Mr.init(e,r),Pu.init(e,r)});function xp(e,r,i){return new dd({type:"union",options:r,discriminator:e,...$.normalizeParams(i)})}u(xp,"discriminatedUnion");var fd=g("ZodIntersection",(e,r)=>{Du.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>wl(e,i,o,t)});function md(e,r){return new fd({type:"intersection",left:e,right:r})}u(md,"intersection");var pd=g("ZodTuple",(e,r)=>{tt(),Fn.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Sl(e,i,o,t)},{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(r=>new Jr({type:"optional",innerType:r}))})}});function gd(e,r,i){let o=r instanceof j,t=o?i:r,n=o?r:null;return new pd({type:"tuple",items:e,rest:n,...$.normalizeParams(t)})}u(gd,"tuple");var Ct=g("ZodRecord",(e,r)=>{tt(),Ou.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>zl(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType});function vd(e,r,i){return!r||!r._zod?new Ct({type:"record",keyType:Er(),valueType:e,...$.normalizeParams(r)}):new Ct({type:"record",keyType:e,valueType:r,...$.normalizeParams(i)})}u(vd,"record");function kp(e,r,i){return new Ct({type:"record",keyType:e,valueType:r,...$.normalizeParams(i),partial:!0})}u(kp,"partialRecord");function Ip(e,r,i){return new Ct({type:"record",keyType:e,valueType:r,mode:"loose",...$.normalizeParams(i)})}u(Ip,"looseRecord");var hd=g("ZodMap",(e,r)=>{tt(),ju.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>bl(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType,e.min=(...i)=>e.check(ye(...i)),e.nonempty=i=>e.check(ye(1,i)),e.max=(...i)=>e.check(Ae(...i)),e.size=(...i)=>e.check(Xe(...i))});function wp(e,r,i){return new hd({type:"map",keyType:e,valueType:r,...$.normalizeParams(i)})}u(wp,"map");var $d=g("ZodSet",(e,r)=>{tt(),Au.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>xl(e,i,o,t),e.min=(...i)=>e.check(ye(...i)),e.nonempty=i=>e.check(ye(1,i)),e.max=(...i)=>e.check(Ae(...i)),e.size=(...i)=>e.check(Xe(...i))});function Sp(e,r){return new $d({type:"set",valueType:e,...$.normalizeParams(r)})}u(Sp,"set");var Lt=g("ZodEnum",(e,r)=>{Nu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(o,t,n)=>fl(e,o,t,n),e.enum=r.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(r.entries));e.extract=(o,t)=>{let n={};for(let a of o)if(i.has(a))n[a]=r.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Lt({...r,checks:[],...$.normalizeParams(t),entries:n})},e.exclude=(o,t)=>{let n={...r.entries};for(let a of o)if(i.has(a))delete n[a];else throw new Error(`Key ${a} not found in enum`);return new Lt({...r,checks:[],...$.normalizeParams(t),entries:n})}});function no(e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Lt({type:"enum",entries:i,...$.normalizeParams(r)})}u(no,"_enum");function zp(e,r){return new Lt({type:"enum",entries:e,...$.normalizeParams(r)})}u(zp,"nativeEnum");var yd=g("ZodLiteral",(e,r)=>{Uu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ml(e,i,o,t),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function Pp(e,r){return new yd({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(r)})}u(Pp,"literal");var _d=g("ZodFile",(e,r)=>{Tu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vl(e,i,o,t),e.min=(i,o)=>e.check(ye(i,o)),e.max=(i,o)=>e.check(Ae(i,o)),e.mime=(i,o)=>e.check(Dt(Array.isArray(i)?i:[i],o))});function Dp(e){return Ms(_d,e)}u(Dp,"file");var bd=g("ZodTransform",(e,r)=>{tt(),Zu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>_l(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new De(e.constructor.name);i.addIssue=n=>{if(typeof n=="string")i.issues.push($.issue(n,i.value,r));else{let a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push($.issue(a))}};let t=r.transform(i.value,i);return t instanceof Promise?t.then(n=>(i.value=n,i)):(i.value=t,i)}});function io(e){return new bd({type:"transform",transform:e})}u(io,"transform");var Jr=g("ZodOptional",(e,r)=>{Mn.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Oi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function et(e){return new Jr({type:"optional",innerType:e})}u(et,"optional");var oo=g("ZodExactOptional",(e,r)=>{Eu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Oi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function xd(e){return new oo({type:"optional",innerType:e})}u(xd,"exactOptional");var kd=g("ZodNullable",(e,r)=>{Cu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Pl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Cr(e){return new kd({type:"nullable",innerType:e})}u(Cr,"nullable");function Op(e){return et(Cr(e))}u(Op,"nullish");var Id=g("ZodDefault",(e,r)=>{Lu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>jl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function wd(e,r){return new Id({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}u(wd,"_default");var Sd=g("ZodPrefault",(e,r)=>{Ru.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Al(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function zd(e,r){return new Sd({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}u(zd,"prefault");var ao=g("ZodNonOptional",(e,r)=>{Vu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Dl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Pd(e,r){return new ao({type:"nonoptional",innerType:e,...$.normalizeParams(r)})}u(Pd,"nonoptional");var Dd=g("ZodSuccess",(e,r)=>{Fu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>hl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new Dd({type:"success",innerType:e})}u(jp,"success");var Od=g("ZodCatch",(e,r)=>{Mu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Nl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jd(e,r){return new Od({type:"catch",innerType:e,catchValue:typeof r=="function"?r:$.constantCatch(r)})}u(jd,"_catch");var Ad=g("ZodNaN",(e,r)=>{Ju.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>pl(e,i,o,t)});function Ap(e){return Vs(Ad,e)}u(Ap,"nan");var Br=g("ZodPipe",(e,r)=>{Jn.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ul(e,i,o,t),e.in=r.in,e.out=r.out});function Zi(e,r){return new Br({type:"pipe",in:e,out:r})}u(Zi,"pipe");var Kr=g("ZodCodec",(e,r)=>{Br.init(e,r),_r.init(e,r)});function Np(e,r,i){return new Kr({type:"pipe",in:e,out:r,transform:i.decode,reverseTransform:i.encode})}u(Np,"codec");function Up(e){let r=e._zod.def;return new Kr({type:"pipe",in:r.out,out:r.in,transform:r.reverseTransform,reverseTransform:r.transform})}u(Up,"invertCodec");var Nd=g("ZodPreprocess",(e,r)=>{Br.init(e,r),Bu.init(e,r)}),Ud=g("ZodReadonly",(e,r)=>{Ku.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Tl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Td(e){return new Ud({type:"readonly",innerType:e})}u(Td,"readonly");var Zd=g("ZodTemplateLiteral",(e,r)=>{Wu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gl(e,i,o,t)});function Tp(e,r){return new Zd({type:"template_literal",parts:e,...$.normalizeParams(r)})}u(Tp,"templateLiteral");var Ed=g("ZodLazy",(e,r)=>{br.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>El(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function Cd(e){return new Ed({type:"lazy",getter:e})}u(Cd,"lazy");var Ld=g("ZodPromise",(e,r)=>{Xu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Zl(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Zp(e){return new Ld({type:"promise",innerType:e})}u(Zp,"promise");var Rd=g("ZodFunction",(e,r)=>{Gu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>yl(e,i,o,t)});function Ep(e){return new Rd({type:"function",input:Array.isArray(e?.input)?gd(e?.input):e?.input??Vr(Qe()),output:e?.output??Qe()})}u(Ep,"_function");var Wr=g("ZodCustom",(e,r)=>{qu.init(e,r),A.init(e,r),e._zod.processJSONSchema=(i,o,t)=>$l(e,i,o,t)});function Cp(e){let r=new V({check:"custom"});return r._zod.check=e,r}u(Cp,"check");function Lp(e,r){return Js(Wr,e??(()=>!0),r)}u(Lp,"custom");function Vd(e,r={}){return Bs(Wr,e,r)}u(Vd,"refine");function Fd(e,r){return Ks(e,r)}u(Fd,"superRefine");var Rp=Ws,Vp=Gs,Md=g("ZodInstanceOf",(e,r)=>{Wr.init(e,r)},{properties(e,r){return this.check(Pt(e,r))}});function Fp(e,r={}){let i=new Md({type:"custom",check:"custom",fn:u(o=>o instanceof e,"fn"),abort:!0,...$.normalizeParams(r)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}u(Fp,"_instanceof");var Mp=u((...e)=>Xs({Codec:Kr,Boolean:Ft,String:Rt},...e),"stringbool");function Jp(e){let r=Cd(()=>Jt([Er(e),Ql(),ed(),id(),Vr(r),vd(Er(),r)]));return r}u(Jp,"json");function Bp(e,r){return new Nd({type:"pipe",in:io(e),out:r})}u(Bp,"preprocess");var My={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 Jy(e){M({customError:e})}u(Jy,"setErrorMap");function By(){return M().customError}u(By,"getErrorMap");var Jd;Jd||(Jd={});var Gr={};be(Gr,{ZodISODate:()=>Ee,ZodISODateTime:()=>Ze,ZodISODuration:()=>Le,ZodISOTime:()=>Ce,date:()=>Wy,datetime:()=>Ky,duration:()=>Xy,time:()=>Gy});function Ky(e){return jr(Ze,e)}u(Ky,"datetime");function Wy(e){return Ar(Ee,e)}u(Wy,"date");function Gy(e){return Nr(Ce,e)}u(Gy,"time");function Xy(e){return Ur(Le,e)}u(Xy,"duration");var I={...Bt,...Ni,iso:Gr},qy=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 Hy(e,r){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":r??"draft-2020-12"}u(Hy,"detectVersion");function Kp(e,r){return e.map((i,o)=>o<r?i:i.optional())}u(Kp,"applyMinItems");function Yy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}u(Yy,"decodeJSONPointerSegment");function Qy(e,r){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return r.rootSchema;let o=r.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===o){let t=i[1]===void 0?void 0:Yy(i[1]);if(!t||!r.defs[t])throw new Error(`Reference not found: ${e}`);return r.defs[t]}throw new Error(`Reference not found: ${e}`)}u(Qy,"resolveRef");function e_(e,r){return I.transform(o=>o).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.getOwnPropertyNames(t);if(r.minProperties!==void 0&&n.length<r.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:r.minProperties,inclusive:!0,message:`Too small: expected object to have >=${r.minProperties} properties`,input:t,inst:e,continue:!0}),r.maxProperties!==void 0&&n.length>r.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:r.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${r.maxProperties} properties`,input:t,inst:e,continue:!0}),r.keySchema)for(let a of n){let c=r.keySchema.safeParse(a);c.success||o.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}u(e_,"checkObjectGuards");function Bd(e,r){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(r.has(e))return null;r.add(e);try{if(Array.isArray(e)){let n=[];for(let a of e){let c=Bd(a,r);if(c===null)return null;n.push(c)}return`a${n.length}:[${n.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let n of o){let a=Bd(e[n],r);if(a===null)return null;t.push(`${n.length}:${n}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{r.delete(e)}}u(Bd,"canonicalKey");var t_=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),r_=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Xr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Xr):typeof e.$ref=="string"?!0:Object.entries(e).some(([r,i])=>t_.has(r)?Xr(i):!r_.has(r)||typeof i!="object"||i===null?!1:Object.values(i).some(Xr))}u(Xr,"containsRef");function Wp(e){return e===1?"element":"elements"}u(Wp,"plural");function n_(e,r){return I.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(r.uniqueItems===!0){let n=new Map;for(let a=0;a<t.length;a++){let c=Bd(t[a],new Set);if(c===null)continue;let s=n.get(c);if(s===void 0){n.set(c,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${s}`,input:t,path:[a],continue:!0})}}if(r.containsSchema){let n=r.minContains??1,a=r.maxContains!==void 0?r.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let s of t)if(r.containsSchema.safeParse(s).success&&++c>=a)break;c<n&&o.issues.push({code:"custom",message:`Array must contain at least ${n} matching ${Wp(n)}; found ${c}`,input:t,continue:!0}),r.maxContains!==void 0&&c>r.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${r.maxContains} matching ${Wp(r.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}u(n_,"checkArrayGuards");function Gp(e,r){if(e!==!1)return e===void 0||e===!0?I.any():re(e,r)}u(Gp,"getTupleRest");var i_=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Xp(e,r){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return I.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 t=e.$ref;if(r.refs.has(t))return r.refs.get(t);if(r.processing.has(t))return I.lazy(()=>{if(!r.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return r.refs.get(t)});r.processing.add(t);let n=Qy(t,r),a=re(n,r);return r.refs.set(t,a),r.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(r.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return I.null();if(t.length===0)return I.never();if(t.length===1)return I.literal(t[0]);if(t.every(a=>typeof a=="string"))return I.enum(t);let n=t.map(a=>I.literal(a));return n.length<2?n[0]:I.union([n[0],n[1],...n.slice(2)])}if(e.const!==void 0)return I.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(n=>{let a={...e,type:n};return Xp(a,r)});return t.length===0?I.never():t.length===1?t[0]:I.union(t)}if(!i)return I.any();let o;switch(i){case"string":{let t=I.string();if(e.format){let n=e.format;n==="email"?t=t.check(I.email()):n==="uri"||n==="uri-reference"?t=t.check(I.url()):n==="uuid"||n==="guid"?t=t.check(I.uuid()):n==="date-time"?t=t.check(I.iso.datetime({offset:!0})):n==="date"?t=t.check(I.iso.date()):n==="time"?t=t.check(I.regex(i_)):n==="duration"?t=t.check(I.iso.duration()):n==="hostname"?t=t.check(I.hostname()):n==="ipv4"?t=t.check(I.ipv4()):n==="ipv6"?t=t.check(I.ipv6()):n==="mac"?t=t.check(I.mac()):n==="cidr"?t=t.check(I.cidrv4()):n==="cidr-v6"?t=t.check(I.cidrv6()):n==="base64"?t=t.check(I.base64()):n==="base64url"?t=t.check(I.base64url()):n==="e164"?t=t.check(I.e164()):n==="credit_card"?t=t.check(I.creditCard()):n==="iban"?t=t.check(I.iban()):n==="jwt"?t=t.check(I.jwt()):n==="emoji"?t=t.check(I.emoji()):n==="nanoid"?t=t.check(I.nanoid()):n==="cuid"?t=t.check(I.cuid()):n==="cuid2"?t=t.check(I.cuid2()):n==="ulid"?t=t.check(I.ulid()):n==="xid"?t=t.check(I.xid()):n==="ksuid"&&(t=t.check(I.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?I.number().int():I.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=I.boolean();break}case"null":{o=I.null();break}case"object":{let t={},n=e.properties||{},a=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?re(e.additionalProperties,r):void 0;for(let[f,m]of Object.entries(n)){let p=re(m,r);G(t,f,a.has(f)?p:p.optional())}if(e.patternProperties){let f=e.patternProperties,m=Object.keys(f),p=[];for(let b of m){let k=re(f[b],r),z=I.string().regex(new RegExp(b));p.push(I.looseRecord(z,k))}let h=[];if(Object.keys(t).length>0&&h.push(I.object(t).passthrough()),h.push(...p),h.length===0)o=I.object({}).passthrough();else if(h.length===1)o=h[0];else{let b=I.intersection(h[0],h[1]);for(let k=2;k<h.length;k++)b=I.intersection(b,h[k]);o=b}if(e.additionalProperties===!1){let b=Object.keys(t),k=m.map(w=>new RegExp(w)),z=o;o=o.check(w=>{if(!le(w.value))return;let O=[];for(let P of Object.keys(w.value))b.includes(P)||k.some(Z=>Z.test(P))||O.push(P);O.length&&w.issues.push({code:"unrecognized_keys",keys:O,input:w.value,inst:z})})}}else{let f=I.object(t);e.additionalProperties===!1?o=f.strict():c?o=f.catchall(c):o=f.passthrough()}let s=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,d=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(s||l!==void 0||d!==void 0){let f;if(s){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=re(m,r)}o=e_(o,{keySchema:f,minProperties:l,maxProperties:d})}break}case"array":{let t=e.prefixItems,n=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,c=t.map(f=>re(f,r)),s=Kp(c,a),l=Array.isArray(n)?void 0:Gp(n,r),d=I.tuple(s);o=l?d.rest(l):d,typeof e.minItems=="number"&&(o=o.check(I.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(I.maxLength(e.maxItems)))}else if(Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,c=n.map(f=>re(f,r)),s=Kp(c,a),l=Gp(e.additionalItems,r),d=I.tuple(s);o=l?d.rest(l):d,typeof e.minItems=="number"&&(o=o.check(I.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(I.maxLength(e.maxItems)))}else if(n!==void 0){let a=re(n,r),c=I.array(a);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),o=c}else o=I.array(I.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=n_(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?re(e.contains,r):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: ${i}`)}return o}u(Xp,"convertBaseSchema");function re(e,r){if(typeof e=="boolean")return e?I.any():I.never();let i=Xp(e,r),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>re(l,r)),s=I.union(c);i=o?I.intersection(i,s):s}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>re(l,r)),s=I.xor(c);i=o?I.intersection(i,s):s}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:I.any();else{let c=o?i:re(e.allOf[0],r),s=o?0:1;for(let l=s;l<e.allOf.length;l++)c=I.intersection(c,re(e.allOf[l],r));i=c}e.nullable===!0&&r.version==="openapi-3.0"&&(i=I.nullable(i)),e.readOnly===!0&&(i=I.readonly(i)),e.default!==void 0&&(i=i.default(e.default));let t={},n=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of n)c in e&&(t[c]=e[c]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let c of a)c in e&&(t[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Xr(e.propertyNames)&&(t.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(t[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Xr(e.contains)&&(t.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(t[c]=e[c])}for(let c of Object.keys(e))qy.has(c)||G(t,c,e[c]);return Object.keys(t).length>0&&r.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}u(re,"convertSchema");function qp(e,r){if(typeof e=="boolean")return e?I.any():I.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Hy(i,r?.defaultTarget),t=i.$defs||i.definitions||{},n={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:r?.registry??X};return re(i,n)}u(qp,"fromJSONSchema");var Hp=Symbol("z.visit/resolving");function qr(e,r){let i=typeof r=="function"?r:(a,c)=>{let s=r[a._zod.def.type];return s?s(a,c):a},o=new Map;function t(a){let c=o.get(a);if(c===Hp)return new br({type:"lazy",getter:u(()=>o.get(a),"getter")});if(c!==void 0)return c;o.set(a,Hp);let s=n(a),l=i(s,s!==a);return o.set(a,l),l}u(t,"run");function n(a){let c=a._zod.def,s=c.type;switch(s){case"object":{let l=c.shape,d=Object.keys(l),f=!1,m={};for(let h of d){let b=t(l[h]);b!==l[h]&&(f=!0),m[h]=b}let p=c.catchall;return c.catchall&&(p=t(c.catchall),p!==c.catchall&&(f=!0)),f?E(a,{...c,shape:m,catchall:p}):a}case"array":{let l=t(c.element);return l===c.element?a:E(a,{...c,element:l})}case"tuple":{let l=c.items,d=!1,f=[];for(let p of l){let h=t(p);h!==p&&(d=!0),f.push(h)}let m=c.rest;return c.rest&&(m=t(c.rest),m!==c.rest&&(d=!0)),d?E(a,{...c,items:f,rest:m}):a}case"record":case"map":{let l=t(c.keyType),d=t(c.valueType);return l===c.keyType&&d===c.valueType?a:E(a,{...c,keyType:l,valueType:d})}case"set":{let l=t(c.valueType);return l===c.valueType?a:E(a,{...c,valueType:l})}case"union":{let l=c.options,d=!1,f=[];for(let m of l){let p=t(m);p!==m&&(d=!0),f.push(p)}return d?E(a,{...c,options:f}):a}case"intersection":{let l=t(c.left),d=t(c.right);return l===c.left&&d===c.right?a:E(a,{...c,left:l,right:d})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=t(c.innerType);return l===c.innerType?a:E(a,{...c,innerType:l})}case"pipe":{let l=t(c.in),d=t(c.out);return l===c.in&&d===c.out?a:E(a,{...c,in:l,out:d})}case"function":{let l=t(c.input),d=t(c.output);return l===c.input&&d===c.output?a:E(a,{...c,input:l,output:d})}case"lazy":{let l=c.getter,{_cachedInner:d,...f}=c;return E(a,{...f,getter:u(()=>t(l()),"getter")})}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 a;default:return a}}return u(n,"mapInner"),t(e)}u(qr,"visit");function Yp(e){return qr(e,{object:u(r=>r.partial(),"object"),union:u(r=>{let i=r._zod.def;return i.discriminator===void 0?r:Jt(i.options)},"union")})}u(Yp,"deepPartial");function o_(e,r){if(!r?.length)return e;let i=e._zod.def;return E(e,pe(i,{checks:[...i.checks??[],...r]}),{parent:!0})}u(o_,"withChecks");function Qp(e){return o_(e.out,e.checks)}u(Qp,"outSide");function a_(e){return e.in._zod.traits.has("$ZodTransform")?Qp(e):e.in}u(a_,"inSide");function eg(e){return qr(e,{pipe:u(r=>a_(r._zod.def),"pipe"),default:u((r,i)=>i?et(r._zod.def.innerType):r,"default"),catch:u((r,i)=>i?r._zod.def.innerType:r,"catch")})}u(eg,"input");function tg(e){return qr(e,{pipe:u(r=>Qp(r._zod.def),"pipe"),prefault:u((r,i)=>i?r._zod.def.innerType:r,"prefault")})}u(tg,"output");var Kd={};be(Kd,{bigint:()=>l_,boolean:()=>s_,date:()=>d_,number:()=>c_,string:()=>u_});function u_(e){return ps(Rt,e)}u(u_,"string");function c_(e){return _s(Vt,e)}u(c_,"number");function s_(e){return zs(Ft,e)}u(s_,"boolean");function l_(e){return Ds(Mt,e)}u(l_,"bigint");function d_(e){return Rs(Rr,e)}u(d_,"date");var rg="2011-06-15",ng=H.object({AccessKeyId:H.string(),SecretAccessKey:H.string(),SessionToken:H.string(),Expiration:H.union([H.number(),H.string()])}),f_=H.object({AssumeRoleResponse:H.object({AssumeRoleResult:H.object({Credentials:ng})})}),m_=H.object({AssumeRoleWithWebIdentityResponse:H.object({AssumeRoleWithWebIdentityResult:H.object({Credentials:ng})})});function ig(e,r){return r||`https://sts.${e}.amazonaws.com/`}u(ig,"stsEndpoint");function p_(e){return typeof e=="number"?new Date(e*1e3):new Date(e)}u(p_,"normalizeExpiration");function g_(e){return{accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.SessionToken,expiration:p_(e.Expiration)}}u(g_,"toAwsCredentials");async function og(e,r,i,o,t){let n=await e.text();if(!e.ok){t?.error({status:e.status,body:n},`AWS STS ${o} request failed`);let s="";throw n.includes("ValidationError")&&n.includes("DurationSeconds")?s=" If 'durationSeconds' exceeds the role's maximum session duration, lower it or raise the role's MaxSessionDuration.":n.includes("AccessDenied")?s=" Check that the role's trust policy allows this principal to assume it.":n.includes("InvalidIdentityToken")&&(s=" The web identity token was rejected. Verify the IAM OIDC provider and that the token audience matches a configured client ID."),new me(`Could not get AWS credentials from STS.${s}`,{cause:new Error(`AWS STS ${o} failed (${e.status}): ${n}`)})}let a;try{a=JSON.parse(n)}catch(s){throw t?.error({body:n},`AWS STS ${o} returned non-JSON`),new me("The response returned from AWS STS is not in the expected format.",{cause:s})}let c=r.safeParse(a);if(!c.success)throw t?.error({body:n,issues:c.error.issues},`AWS STS ${o} response missing credentials`),new me("The response returned from AWS STS is not in the expected format.");return g_(i(c.data))}u(og,"parseStsResponse");async function ag(e,r){let i=new URLSearchParams({Action:"AssumeRoleWithWebIdentity",Version:rg,RoleArn:e.roleArn,RoleSessionName:e.roleSessionName,WebIdentityToken:e.webIdentityToken,DurationSeconds:String(e.durationSeconds)}),o=await rn({retries:r.retries,retryDelayMs:r.retryDelayMs,logger:r.logger},ig(e.region,e.stsEndpoint),{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded",accept:"application/json"},body:i});return og(o,m_,t=>t.AssumeRoleWithWebIdentityResponse.AssumeRoleWithWebIdentityResult.Credentials,"AssumeRoleWithWebIdentity",r.logger)}u(ag,"assumeRoleWithWebIdentity");async function ug(e){let r=new URLSearchParams({Action:"AssumeRole",Version:rg,RoleArn:e.roleArn,RoleSessionName:e.roleSessionName,DurationSeconds:String(e.durationSeconds)});e.externalId&&r.set("ExternalId",e.externalId);let o=await new en({accessKeyId:e.credentials.accessKeyId,secretAccessKey:e.credentials.secretAccessKey,sessionToken:e.credentials.sessionToken,service:"sts",region:e.region,retries:e.retries}).fetch(ig(e.region,e.stsEndpoint),{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded",accept:"application/json"},body:r.toString()});return og(o,f_,t=>t.AssumeRoleResponse.AssumeRoleResult.Credentials,"AssumeRole",e.logger)}u(ug,"assumeRole");var cg="zuplo-gateway",sg=3600,$_="sts.amazonaws.com";function lg(e,r){return{retries:e?.retries??3,retryDelayMs:e?.retryDelayMs??10,logger:r}}u(lg,"resolveRetry");function RS(e){let r=typeof e.masterCredentials=="function"?e.masterCredentials:()=>Promise.resolve(e.masterCredentials),i=lg(e.retry,e.logger);return po(async()=>{let o=await r();return ug({region:e.region,roleArn:e.roleArn,roleSessionName:e.roleSessionName??cg,durationSeconds:e.durationSeconds??sg,externalId:e.externalId,stsEndpoint:e.stsEndpoint,credentials:o,retries:i.retries,logger:i.logger})},{expirationOffsetSeconds:e.expirationOffsetSeconds})}u(RS,"fromTemporaryCredentials");function y_(e){let r=lg(e.retry,e.logger);return po(async()=>{let i=typeof e.webIdentityToken=="function"?await e.webIdentityToken():e.webIdentityToken;return ag({region:e.region,roleArn:e.roleArn,webIdentityToken:i,roleSessionName:e.roleSessionName??cg,durationSeconds:e.durationSeconds??sg,stsEndpoint:e.stsEndpoint},r)},{expirationOffsetSeconds:e.expirationOffsetSeconds})}u(y_,"fromWebToken");function VS(e){return y_({region:e.region,roleArn:e.roleArn,webIdentityToken:u(()=>nn.getIDToken(e.context,{audience:e.audience??$_}),"webIdentityToken"),roleSessionName:e.roleSessionName,durationSeconds:e.durationSeconds,stsEndpoint:e.stsEndpoint,expirationOffsetSeconds:e.expirationOffsetSeconds,retry:e.retry,logger:e.logger})}u(VS,"fromZuploIdentity");export{zo as a,ji as b,Rl as c,Er as d,Pm as e,Um as f,Ql as g,ed as h,id as i,pp as j,Qe as k,Vr as l,$p as m,_p as n,Jt as o,xp as p,md as q,vd as r,no as s,Pp as t,et as u,Cd as v,Bp as w,My as x,Gr as y,Kd as z,H as A,of as B,cf as C,Wt as D,Yr as E,Qr as F,rn as G,O_ as H,ef as I,en as J,mo as K,sf as L,nn as M,RS as N,y_ as O,VS as P};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-G2O2ZIL3.js.map
|