PageSourceSearch

https://account.scaleway.com/assets/common-UNFZt-qi.js

js scaleway.com collected 2026-10-02 02:15:07 UTC 65,787 bytes, 55 lines download raw bytes

1import{n as e}from"./rolldown-runtime-BJS_XihH.js";import{$ as t,At as n,Bt as r,Ct as i,Dt as a,Et as o,Ft as s,It as c,Jt as l,Nt as u,Pt as d,Rt as f,Tt as p,Ut as m,Vt as h,Wt as g,_t as v,a as y,at as ee,bt as te,ct as ne,dt as re,en as ie,et as ae,ft as oe,gt as se,ht as ce,i as le,in as ue,it as de,jt as b,lt as fe,mt as pe,nt as me,ot as he,pt as ge,qt as x,r as S,rn as _e,rt as ve,st as ye,tt as C,vt as be,wt as xe,xt as Se,yt as Ce}from"./common-DIQlBIn1.js";function newError(e){let t=E;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return E=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function $constructor(e,t,n,r){let i={};function Internals(e){this.def=e,this.constr=_,this.traits=/* @__PURE__ */ new Set}Internals.prototype=i;let a=n,o=a&&/* @__PURE__ */ new WeakSet;function init(n,r){if(!n._zod){T.value=new Internals(r);try{Object.defineProperty(n,"_zod",T)}finally{T.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),o){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;o.has(i)||(o.add(i),g(i,a))}let i=_.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let s=r?.Parent??Object;class Definition extends s{}Object.defineProperty(Definition,"name",{value:e});function _(e){let t=r?.Parent?newError(Definition):this;init(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(_,"init",{value:init}),Object.defineProperty(_,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(_,"name",{value:e}),_}function config(e){return e&&Object.assign(D,e),D}var w,T,E,$ZodAsyncError,$ZodEncodeError,D;function init_core(){return(init_core=e((()=>{f(),T={value:void 0,enumerable:!1},E=`captureStackTrace`in Error?Error:null,$ZodAsyncError=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$ZodEncodeError=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(w=globalThis).__zod_globalConfig??(w.__zod_globalConfig={}),D=globalThis.__zod_globalConfig})))()}function _getMessage(){let e=this._zod;return e.message??=JSON.stringify(e.def,m,2),e.message}function _setMessage(e){this._zod.message=e}function node(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function flattenError(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?node(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function formatError(e,t=e=>e.message){let n={_errors:[]},processError=(e,r=[])=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>processError({issues:e},[...r,...i.path]));else if(i.code===`invalid_key`)processError({issues:i.issues},[...r,...i.path]);else if(i.code===`invalid_element`)processError({issues:i.issues},[...r,...i.path]);else{let e=[...r,...i.path];if(e.length===0)n._errors.push(t(i));else{let r=n,a=0;for(;a<e.length;){let n=e[a],o=a===e.length-1;if(n===`_errors`){o&&r._errors.push(t(i)),a++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(i)),r=s,a++}}}};return processError(e),n}var O,k,A,initializer,j;function init_errors(){return(init_errors=e((()=>{init_core(),f(),O={get:_getMessage,set:_setMessage,enumerable:!0,configurable:!0},k={value:void 0,enumerable:!1},A=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),initializer=(e,t)=>{e.name=`$ZodError`,k.value=t,Object.defineProperty(e,"issues",k),k.value=void 0,Object.defineProperty(e,"message",O);let n=Object.getPrototypeOf(e);
1A.has(n)||(A.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let value=()=>this.message;return Object.defineProperty(this,"toString",{value,configurable:!0,writable:!0}),value},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},j=$constructor(`$ZodError`,initializer),$constructor(`$ZodError`,initializer,void 0,{Parent:Error})})))()}function finalizeParams(e,t){return{callee:t?.callee??e,Err:t?.Err}}function failure(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>u(e,n,config()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}function validateFallback(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[N]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new $ZodAsyncError;return a.issues.length===0}var _parse,_parseAsync,_safeParse,_safeParseAsync,M,N,validate,validateAsync,_encode,_decode,_encodeAsync,_decodeAsync,_safeEncode,_safeDecode,_safeEncodeAsync,_safeDecodeAsync;function init_parse(){return(init_parse=e((()=>{init_core(),f(),_parse=e=>{let fn=(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new $ZodAsyncError;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>u(e,a,config())));throw p(t,i?.callee??fn),t}return o.value};return fn},_parseAsync=e=>{let fn=async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>u(e,a,config())));throw p(t,i?.callee??fn),t}return o.value};return fn},_safeParse=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $ZodAsyncError;return a.issues.length?failure(e,a.issues,i):{success:!0,data:a.value}},_safeParseAsync=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?failure(e,a.issues,i):{success:!0,data:a.value}},M=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),N=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),validate=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==M)return!0;if(r.definite===!0&&n===void 0)return!1}return validateFallback(e,t,n)}),validateAsync=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},_encode=e=>{let t=_parse(e),fn=(e,n,r,i)=>{let a=r?{...r,direction:`backward`}:{direction:`backward`};return t(e,n,a,finalizeParams(fn,i))};return fn},_decode=e=>{let t=_parse(e),fn=(e,n,r,i)=>t(e,n,r,finalizeParams(fn,i));return fn},_encodeAsync=e=>{let t=_parseAsync(e),fn=async(e,n,r,i)=>{let a=r?{...r,direction:`backward`}:{direction:`backward`};return await t(e,n,a,finalizeParams(fn,i))};return fn},_decodeAsync=e=>{let t=_parseAsync(e),fn=async(e,n,r,i)=>await t(e,n,r,finalizeParams(fn,i));return fn},_safeEncode=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _safeParse(e)(t,n,i)},_safeDecode=e=>(t,n,r)=>_safeParse(e)(t,n,r),_safeEncodeAsync=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return _safeParseAsync(e)(t,n,i)},_safeDecodeAsync=e=>async(t,n,r)=>_safeParseAsync(e)(t,n,r)})))()}var P,_whenHasLength,F,I,L,R,z,B,V,we,H,Te,Ee,De,Oe,ke;function init_checks(){return(init_checks=e((()=>{init_core(),v(),f(),P=/*@__PURE__*/ $constructor(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_whenHasLength=e=>{let t=e.value;return!l(t)&&t.length!==void 0},F={number:`number`,bigint:`bigint`,object:`date`},I=/*@__PURE__*/ $constructor(`$ZodCheckLessThan`,(e,t)=>{P.init(e,t);let n=F[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:F[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),L=/*@__PURE__*/ $constructor(`$ZodCheckGreaterThan`,(e,t)=>{P.init(e,t);let n=F[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:F[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),R=/*@__PURE__*/ $constructor(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=_whenHasLength),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?a(r):i)<=t.maximum)return;let o=c(r);n.issues.push({origin:o,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),z=/*@__PURE__*/ $constructor(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=_whenHasLength),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?a(r):i)>=t.minimum)return;let o=c(r);n.issues.push({origin:o,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),B=/*@__PURE__*/ $constructor(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=_whenHasLength),e._zod.check=n=>{let r=n.value,i=r.length,o=typeof r==`string`&&i>=t.length&&i<=t.length*2?a(r):i;if(o===t.length)return;let s=c(r),l=o>t.length;n.issues.push({origin:s,...l?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),V=/*@__PURE__*/ $constructor(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),we=/*@__PURE__*/ $constructor(`$ZodCheckRegex`,(e,t)=>{V.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),H=/*@__PURE__*/ $constructor(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=be,V.init(e,t)}),Te=/*@__PURE__*/ $constructor(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=te,V.init(e,t)}),Ee=/*@__PURE__*/ $constructor(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=b(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>
1{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),De=/*@__PURE__*/ $constructor(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${b(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Oe=/*@__PURE__*/ $constructor(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${b(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ke=/*@__PURE__*/ $constructor(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})))()}var Doc;function init_doc(){return(init_doc=e((()=>{Doc=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3`)}\n};`)(...Object.values(this.closed))}}})))()}function isRef(e){return typeof e==`object`&&!!e}function cloneIssues(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}function isRecursive(e,t,n){let r=G.get(e);if(r!==void 0)return r?J:K;if(t.has(e))return J;t.add(e);let i=K,check=e=>{if(i!==J&&e?._zod){let r=isRecursive(e,t,n);r>i&&(i=r)}},shape=(e,r)=>{let i=K;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?q:o.value?._zod?isRecursive(o.value,t,n):K;s>i&&(i=s)}return i},merge=e=>{e>i&&(i=e)},a=e._zod.def;switch(a.type){case`object`:{let e=ie(a);merge(e?shape(e,!0):q),check(a.catchall);break}case`array`:check(a.element);break;case`tuple`:for(let e of a.items)check(e);check(a.rest);break;case`record`:case`map`:check(a.keyType),check(a.valueType);break;case`set`:check(a.valueType);break;case`union`:for(let e of a.options)check(e);break;case`intersection`:check(a.left),check(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:check(a.innerType);break;case`pipe`:check(a.in),check(a.out);break;case`function`:check(a.input),check(a.output);break;case`lazy`:{let r=a._cachedInner??(n?e._zod.innerType:void 0);merge(r?isRecursive(r,t,!1):q);break}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`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)check(n);else if(Array.isArray(n))for(let e of n)check(e)}}}return t.delete(e),settle(e,i)}function settle(e,t){return t!==q&&G.set(e,t===J),t}function isRecursiveSchema(e){return isRecursive(e,/* @__PURE__ */ new Set,!0)!==K}function bucketFor(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}function memoizer(){return Ae}function isBackEdge(e,t){let n=e[U]?.backEdges;return n!==void 0&&isRef(t)&&n.has(t)}var $ZodCyclicError,U,W,G,K,q,J,Y,X,Ae;function init_memoizer(){return(init_memoizer=e((()=>{f(),$ZodCyclicError=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},U=`~memo`,W=[],G=/*@__PURE__*/ new WeakMap,K=0,q=1,J=2,X=[],Ae={alloc(e,t,n){let r=Y;if(!r)return n;Y=void 0;let i={value:n,issues:null};return r.set(t.value,i),X.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,wrapped=(e,n)=>{if(n.direction!==`backward`&&isBackEdge(n,e.value))throw new $ZodCyclicError;return t(e,n)};e._zod.parse=wrapped,e._zod.run===t&&(e._zod.run=wrapped)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,wrapped=(o,s)=>{if(n===void 0){let i=isRecursive(e,/* @__PURE__ */ new Set,!1);if(i===K)return e._zod.parse=t,e._zod.run===wrapped&&(e._zod.run=t),t(o,s);i===J||r?n=!0:r=!0}let c=o.value;if(!isRef(c))return t(o,s);let l=s[U];l||(l={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},s[U]=l);let u;i===s?u=a:(u=bucketFor(l,e),i=s,a=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...cloneIssues(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=/* @__PURE__ */ new WeakSet),l.backEdges.add(d.value)),o;Y=u;let f=X.length,p=t(o,s);Y=void 0;let m=X.length>f?X.pop():void 0;
3return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?cloneIssues(e.issues):W),e)):(m&&(m.issues=p.issues.length?cloneIssues(p.issues):W),p)};e._zod.parse=wrapped,e._zod.run===t&&(e._zod.run=wrapped)})}}})))()}function compileValidator(e,t){try{return compileFn(e,{assertOnly:!0})}catch{return t}}function compile(e,t){try{let t=compileFn(e),n=withParser(e,t);return n._zod.bag.validator=compileValidator(e,t),n}catch(n){if(t?.strict)throw n;return e}}function withParser(e,t){if(isRecursiveSchema(e))throw new ZodCompileUnsupportedError(`a schema whose subtree contains a reference cycle`);let n=o(e),r=e._zod.run,i=r.__originalRun??r,wrapped=(e,n)=>{if(n?.async||n?.direction===`backward`||n?.skipChecks||n?.[Q]||n&&isBackEdge(n,e.value))return i(e,n);let r=t(e.value);return r===Z?(n&&(n[Q]=!0),i(e,n)):(e.value=r,e)};return wrapped.__originalRun=i,n._zod.bag.fallbackRun=i,n._zod.bag.validator=t,n._zod.run=wrapped,r.__originalRun||installCompiledUserMethods(n,e,t),n}function installCompiledUserMethods(e,t,n){let r=e,i=t;if(typeof i.safeParse==`function`){let e=i.safeParse;r.safeParse=(t,r)=>{let i=n(t);return i===Z?e(t,r):{success:!0,data:i}}}if(typeof i.parse==`function`){let e=i.parse;r.parse=(t,r)=>{let i=n(t);return i===Z?e(t,r):i}}}function compileFn(e,t){let n=!0;try{n=isRecursiveSchema(e)}catch{}if(n)throw new ZodCompileUnsupportedError(`a schema whose subtree contains a reference cycle`);let r={constants:/* @__PURE__ */ new Map,constantCounter:0,varCounter:0,definite:!0},i=new Doc([`input`]),a=generateCheck(i,r,e,`input`,!t?.assertOnly);i.write(a===null?`return true;`:`return ${a};`);let o=[`INVALID`,...r.constants.keys()],s=[Z,...r.constants.values()],c=i.content.join(`
4`),l=t?.debug?o.length>0?`// Constants: ${o.join(`, `)}\n${c}`:c:``,u=Function,d=`return (input) => {\n${c}\n}`,f;try{f=new u(...o,d)(...s)}catch(e){throw new ZodCompileUnsupportedError(`this schema (generated code failed to evaluate: ${e.message})`)}return t?.debug&&(f.code=l),f.definite=r.definite,f}function addConstant(e,t){for(let[n,r]of e.constants)if(r===t)return n;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function addUserConstant(e,t){return e.definite=!1,addConstant(e,t)}function newVar(e){return`v${e.varCounter++}`}function runtimeRun(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then==`function`)return Z;let r=n;return r.issues.length===0?r.value:Z}function compileChild(e,t,n,r,i=!0){let a=e.content.length,o=t.constants.size,s=t.constantCounter,c=t.varCounter;try{return generateCheck(e,t,n,r,i)}catch(i){if(!(i instanceof ZodCompileUnsupportedError)||!i.islandable)throw i;if(e.content.length=a,t.constants.size>o){let e=Array.from(t.constants.keys()).slice(o);for(let n of e)t.constants.delete(n)}return t.constantCounter=s,t.varCounter=c,emitRuntimeIsland(e,t,n,r)}}function emitRuntimeIsland(e,t,n,r){t.definite=!1;let i=addConstant(t,n),a=addConstant(t,runtimeRun),o=newVar(t);return e.write(`const ${o} = ${a}(${i}, ${r});`),e.write(`if (${o} === INVALID) return INVALID;`),o}function generateChecks(e,t,n,r){let i=n._zod.def.checks;if(!i||i.length===0)return r;let a=r;for(let n of i){let r=n._zod.def;if(r.when&&!je.has(r.check))throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);switch(r.check){case`greater_than`:generateGreaterThanCheck(e,t,r,a);break;case`less_than`:generateLessThanCheck(e,t,r,a);break;case`multiple_of`:generateMultipleOfCheck(e,t,r,a);break;case`number_format`:generateNumberFormatCheck(e,r,a);break;case`min_length`:{let n=numericOperand(r.minimum,`min_length`),i=codePointLengthVar(e,t,a,`${a}.length >= ${n} && ${a}.length < ${r.minimum*2}`);e.write(`if (${i} < ${n}) return INVALID;`);break}case`max_length`:{let n=numericOperand(r.maximum,`max_length`),i=codePointLengthVar(e,t,a,`${a}.length > ${n}`);e.write(`if (${i} > ${n}) return INVALID;`);break}case`length_equals`:{let n=numericOperand(r.length,`length_equals`),i=codePointLengthVar(e,t,a,`${a}.length >= ${n} && ${a}.length <= ${r.length*2}`);e.write(`if (${i} !== ${n}) return INVALID;`);break}case`min_size`:e.write(`if (${a}.size < ${numericOperand(r.minimum,`min_size`)}) return INVALID;`);break;case`max_size`:e.write(`if (${a}.size > ${numericOperand(r.maximum,`max_size`)}) return INVALID;`);break;case`size_equals`:e.write(`if (${a}.size !== ${numericOperand(r.size,`size_equals`)}) return INVALID;`);break;case`string_format`:a=generateStringFormatCheck(e,t,r,a);break;case`custom`:a=generateCustomRefineCheck(e,t,n,a);break;case`bigint_format`:generateBigIntFormatCheck(e,r,a);break;case`mime_type`:generateMimeTypeCheck(e,t,r,a);break;case`property`:generatePropertyCheck(e,t,r,a);break;case`properties`:generatePropertiesChecks(e,t,r,a);break;case`overwrite`:{let r=newVar(t);generateOverwriteCheck(e,t,n,a,r),a=r;break}default:throw new ZodCompileUnsupportedError(`check type ${r.check}`)}}return a}function codePointLengthVar(e,t,n,r){let i=addConstant(t,a),o=newVar(t);return e.write(`const ${o} = typeof ${n} === "string" && ${r} ? ${i}(${n}) : ${n}.length;`),o}function numericOperand(e,t){if(typeof e!=`number`||!Number.isFinite(e))throw new ZodCompileUnsupportedError(`${t} bound of type ${typeof e}`);return`${e}`}function comparisonOperand(e,t){if(typeof t==`bigint`)return`${t}n`;if(typeof t==`number`){if(Number.isNaN(t))throw new ZodCompileUnsupportedError(`comparison check with NaN bound`);return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new ZodCompileUnsupportedError(`comparison check with Invalid Date bound`);return addConstant(e,t)}throw new ZodCompileUnsupportedError(`comparison check bound of type ${typeof t}`)}function generateGreaterThanCheck(e,t,n,r){let i=n.inclusive?`<`:`<=`;e.write(`if (${r} ${i} ${comparisonOperand(t,n.value)}) return INVALID;`)}function generateLessThanCheck(e,t,n,r){let i=n.inclusive?`>`:`>=`;e.write(`if (${r} ${i} ${comparisonOperand(t,n.value)}) return INVALID;`)}function generateMultipleOfCheck(e,t,n,r){if(typeof n.value==`bigint`){if(n.value===BigInt(0))throw new ZodCompileUnsupportedError(`multiple_of check with a zero divisor`);e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let i=addConstant(t,d);e.write(`if (${i}(${r}, ${numericOperand(n.value,`multiple_of`)}) !== 0) return INVALID;`)}}function generateNumberFormatCheck(e,t,n){let r=t.format;switch(r){case`safeint`:e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case`int32`:e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case`uint32`:e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case`float32`:e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case`float64`:e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new ZodCompileUnsupportedError(`number format ${r}`)}}function generateBigIntFormatCheck(e,t,n){let r=t.format;if(r)switch(r){case`int64`:e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case`uint64`:e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new ZodCompileUnsupportedError(`bigint format ${r}`)}}function generateMimeTypeCheck(e,t,n,r){let i=n.mime;if(i&&i.length>0){let n=addConstant(t,new Set(i));e.write(`if (!${n}.has(${r}.type)) return INVALID;`)}}function generatePropertiesChecks(e,t,r,i){if(r.when)throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);e.write(`if (${i} == null) return INVALID;`);let a=r.shape;for(let r of Reflect.ownKeys(a)){let o=typeof r==`symbol`?addConstant(t,r):n(r),s=newVar(t);e.write(`const ${s} = ${i}[${o}];`),compileChild(e,t,a[r],s,!1)}}function generatePropertyCheck(e,t,n,r){let i=`${r}[${JSON.stringify(n.property)}]`;generateCheck(e,t,n.schema,i)}function generateOverwriteCheck(e,t,n,r,i){let a=n._zod.def.tx;if(!a)throw new ZodCompileUnsupportedError(`overwrite check without a transform function`);if(isAsyncFunction(a))throw new ZodCompileAsyncError(`z.compile: async overwrite transforms are not supported`);let o=addConstant(t,a);e.write(`const ${i} = ${o}(${r});`)}function throwAsync(){throw new $ZodAsyncError}function pushIssue(e){this.issues.push(e)}function generateCustomRefineCheck(e,t,n,r){let i=n._zod.def;if(i.fn){if(isAsyncFunction(i.fn))throw new ZodCompileAsyncError(`z.compile: async .refine() predicates are not supported`);let n=addUserConstant(t,i.fn),a=addConstant(t,throwAsync),o=newVar(t);return e.write(`const ${o} = ${n}(${r});`),e.write(`if (${o} instanceof Promise) ${a}();`),e.write(`if (!${o}) return INVALID;`),r}if(n._zod.check){if(isAsyncFunction(n._zod.check))throw new ZodCompileAsyncError(`z.compile: async .superRefine() / check functions are not supported`);let i=n._zod.check,helperFn=e=>{let t={value:e,issues:[],addIssue:pushIssue};return i(t)instanceof Promise&&throwAsync(),t.issues.length===0?t.value:Z},a=addUserConstant(t,helperFn),o=newVar(t);return e.write(`const ${o} = ${a}(${r});`),e.write(`if (${o} === INVALID) return INVALID;`),o}throw new ZodCompileUnsupportedError(`custom check without a predicate or check function`)}function generateStringFormatCheck(e,t,r,i,a=!0){let o=r.format;if(o===`base64`){let n=addConstant(t,me);return e.write(`if (!${n}(${i})) return INVALID;`),i}if(o===`base64url`){let n=addConstant(t,ve);return e.write(`if (!${n}(${i})) return INVALID;`),i}if(o===`jwt`){let n=addConstant(t,ne),a=addConstant(t,r.alg??null);return e.write(`if (!${n}(${i}, ${a})) return INVALID;`),i}if(o===`ipv6`){let n=addConstant(t,ye);return e.write(`if (!${n}(${i})) return INVALID;`),i}if(o===`cidrv6`){let n=addConstant(t,de);return e.write(`if (!${n}(${i})) return INVALID;`),i}if(o===`credit_card`){let n=addConstant(t,ee);return e.write(`if (!${n}(${i})) return INVALID;`),i}if(o===`iban`){let n=addConstant(t,he);return e.write(`if (!${n}(${i})) return INVALID;`),i}let s=r;if(o===`url`||o===`httpurl`||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let n=addConstant(t,pe),o=addConstant(t,r),c=newVar(t),l=newVar(t);if(e.write(`const ${c} = ${i}.trim();`),e.write(`const ${l} = ${n}(${c}, ${o});`),e.write(`if (typeof ${l} === "number") return INVALID;`),s.hostname!==void 0){let n=addConstant(t,oe);e.write(`if (!${n}(${l}, ${o}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let n=addConstant(t,ge);e.write(`if (!${n}(${l}, ${o}.protocol)) return INVALID;`)}if(!a)return null;let u=newVar(t),d=s.normalize?`${l}.href`:`${addConstant(t,re)}(${c})`;return e.write(`const ${u} = ${d};`),u}let c=r.fn;if(c){if(isAsyncFunction(c))throw new ZodCompileUnsupportedError(`async string format ${o}`);let n=addConstant(t,c);return e.write(`if (!${n}(${i})) return INVALID;`),i}if(Me.has(o)&&r.pattern){let n=addConstant(t,r.pattern);return e.write(`${n}.lastIndex = 0;`),e.write(`if (!${n}.test(${i})) return INVALID;`),i}let l=r.format;switch(l){case`regex`:throw new ZodCompileUnsupportedError(`regex format without a pattern`);case`lowercase`:e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case`uppercase`:e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case`includes`:e.write(`if (!${i}.includes(${n(r.includes)})) return INVALID;`);break;case`starts_with`:{let t=r.prefix;e.write(`if (${i}.slice(0, ${t.length}) !== ${n(t)}) return INVALID;`);break}case`ends_with`:{let t=r.suffix;e.write(`if (${i}.slice(-${t.length}) !== ${n(t)}) return INVALID;`);break}default:throw new ZodCompileUnsupportedError(`string format ${l}`)}return i}function generateCheck(e,t,n,r,i=!0){let a=n._zod.def,o=a.type;if(a.coerce)throw new ZodCompileUnsupportedError(`coercion (z.coerce.${o}())`);let s=i||!!a.checks?.length,c;
4switch(o){case`string`:c=generateStringCheck(e,t,n,r,s);break;case`number`:c=generateNumberCheck(e,n,r);break;case`boolean`:c=generateBooleanCheck(e,r);break;case`bigint`:c=generateBigIntCheck(e,n,r);break;case`symbol`:c=generateSymbolCheck(e,r);break;case`undefined`:c=generateUndefinedCheck(e,r);break;case`null`:c=generateNullCheck(e,r);break;case`any`:case`unknown`:c=r;break;case`never`:e.write(`return INVALID;`),c=r;break;case`void`:c=generateVoidCheck(e,r);break;case`nan`:c=generateNaNCheck(e,r);break;case`date`:c=generateDateCheck(e,r);break;case`object`:c=generateObjectCheck(e,t,n,r,s);break;case`optional`:c=generateOptionalCheck(e,t,n,r,s);break;case`nullable`:c=generateNullableCheck(e,t,n,r,s);break;case`array`:c=generateArrayCheck(e,t,n,r,s);break;case`literal`:c=generateLiteralCheck(e,t,n,r);break;case`enum`:c=generateEnumCheck(e,t,n,r);break;case`readonly`:{let i=generateWrapperCheck(e,t,n,r),a=newVar(t);e.write(`const ${a} = Object.freeze(${i});`),c=a;break}case`success`:generateWrapperCheck(e,t,n,r),c=`true`;break;case`default`:case`prefault`:c=generateDefaultCheck(e,t,n,r);break;case`nonoptional`:c=generateNonOptionalCheck(e,t,n,r);break;case`tuple`:c=generateTupleCheck(e,t,n,r);break;case`union`:c=generateUnionCheck(e,t,n,r);break;case`intersection`:c=generateIntersectionCheck(e,t,n,r);break;case`record`:c=generateRecordCheck(e,t,n,r);break;case`map`:c=generateMapCheck(e,t,n,r);break;case`set`:c=generateSetCheck(e,t,n,r);break;case`file`:c=generateFileCheck(e,r);break;case`template_literal`:c=generateTemplateLiteralCheck(e,t,n,r);break;case`lazy`:c=generateLazyCheck(e,t,n,r);break;case`pipe`:c=generatePipeCheck(e,t,n,r);break;case`custom`:c=generateCustomCheck(e,t,n,r);break;case`transform`:c=generateTransformCheck(e,t,n,r);break;case`catch`:c=generateCatchCheck(e,t,n,r);break;default:throw new ZodCompileUnsupportedError(`schema type ${o}`)}return c===null?null:generateChecks(e,t,n,c)}function generateStringCheck(e,t,n,r,i=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let a=n._zod.def;return a.format===void 0?r:generateStringFormatCheck(e,t,a,r,i)}function generateNumberCheck(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check===`number_format`&&r.format&&generateNumberFormatCheck(e,{format:r.format},n),n}function generateBooleanCheck(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function generateBigIntCheck(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case`int64`:e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case`uint64`:e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`)}return n}function generateSymbolCheck(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function generateUndefinedCheck(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function generateNullCheck(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function generateVoidCheck(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function generateNaNCheck(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function generateDateCheck(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function generateObjectCheck(e,t,r,i,a=!0){let o=r._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,c=Object.keys(s),l=Object.getOwnPropertySymbols(s),u=l.length?[...c,...l]:c,keyExpr=e=>typeof e==`symbol`?addConstant(t,e):n(e),propKey=e=>typeof e==`symbol`?`[${keyExpr(e)}]`:n(e),d=s;if(c.includes(`__proto__`))throw new ZodCompileUnsupportedError(`object shape key "__proto__"`);let f=/* @__PURE__ */ new Map;for(let n of u){let r=d[n],o=keyExpr(n),s=newVar(t);if(e.write(`const ${s} = ${i}[${o}];`),r._zod.optin!==void 0){let a=newVar(t);e.write(`let ${a} = (() => {`),e.indented(e=>{let n=compileChild(e,t,r,s);e.write(`return ${n};`)}),e.write(`})();`),r._zod.optout===`optional`?(e.write(`if (${a} === INVALID) {`),e.indented(e=>{e.write(`if (${o} in ${i}) return INVALID;`),e.write(`${a} = undefined;`)}),e.write(`}`)):e.write(`if (${a} === INVALID) return INVALID;`),f.set(n,a)}else{requiresPresenceCheck(r)&&e.write(`if (!(${o} in ${i})) return INVALID;`);let c=compileChild(e,t,r,s,a);c!==null&&f.set(n,c)}}let p=o.catchall,m=`none`;if(p){let t=p._zod.def.type;if(t===`never`){let t=c.map(e=>`k !== ${n(e)}`).join(` && `)||`true`;e.write(`for (const k in ${i}) {`),e.indented(e=>{e.write(`if (${t}) return INVALID;`)}),e.write(`}`)}else m=(t===`unknown`||t===`any`)&&!p._zod.def.checks?.length?`passthrough`:`schema`}let h=newVar(t),g=u.some(e=>mayOmitUndefined(d[e])||dropsWhenAbsent(d[e]));if(!a){if(m===`schema`){let n=c.length>0?addConstant(t,new Set(c)):null;e.write(`for (const k in ${i}) {`),e.indented(e=>{e.write(`if (k === "__proto__") continue;`),n&&e.write(`if (${n}.has(k)) continue;`);let r=newVar(t);e.write(`const ${r} = ${i}[k];`),compileChild(e,t,p,r,!1)}),e.write(`}`)}return null}if(g){e.write(`const ${h} = {};`);for(let t of u){let n=keyExpr(t),r=f.get(t);dropsWhenAbsent(d[t])?e.write(`if (${n} in ${i}) ${h}[${n}] = ${r};`):mayOmitUndefined(d[t])?e.write(`if (${r} !== undefined || ${n} in ${i}) ${h}[${n}] = ${r};`):e.write(`${h}[${n}] = ${r};`)}}else{let t=u.map(e=>`${propKey(e)}: ${f.get(e)}`).join(`, `);e.write(`const ${h} = { ${t} };`)}if(m!==`none`){let n=c.length>0?addConstant(t,new Set(c)):null;e.write(`for (const k in ${i}) {`),e.indented(e=>{if(e.write(`if (k === "__proto__") continue;`),n&&e.write(`if (${n}.has(k)) continue;`),m===`passthrough`)e.write(`${h}[k] = ${i}[k];`);else{let n=newVar(t);e.write(`const ${n} = ${i}[k];`);let r=compileChild(e,t,p,n);e.write(`${h}[k] = ${r};`)}}),e.write(`}`)}return h}function generateOptionalCheck(e,t,n,r,i=!0){let a=n._zod.def;if(isExactOptional(n))return generateCheck(e,t,a.innerType,r,i);if(a.innerType._zod.optin===`defaulted`){let n=newVar(t),i=newVar(t);return e.write(`let ${n};`),e.write(`if (${r} === undefined) {`),e.indented(e=>{e.write(`const ${i} = (() => {`),e.indented(e=>{let n=generateCheck(e,t,a.innerType,r);e.write(`return ${n};`)}),e.write(`})();`),e.write(`if (${i} !== INVALID) ${n} = ${i};`)}),e.write(`} else {`),e.indented(e=>{let i=generateCheck(e,t,a.innerType,r);e.write(`${n} = ${i};`)}),e.write(`}`),n}let o=i?newVar(t):null;return o&&e.write(`let ${o};`),e.write(`if (${r} !== undefined) {`),e.indented(e=>{let n=generateCheck(e,t,a.innerType,r,i);o&&n!==null&&e.write(`${o} = ${n};`)}),e.write(`}`),o}function isExactOptional(e){return e._zod.traits?.has(`$ZodExactOptional`)===!0}function requiresPresenceCheck(e){return e._zod.optin===void 0&&fastPathAcceptsAbsence(e)}function fastPathAcceptsAbsence(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case`any`:case`unknown`:case`undefined`:case`void`:case`default`:case`prefault`:case`transform`:case`custom`:case`lazy`:return!0;case`string`:case`number`:case`boolean`:case`bigint`:case`symbol`:case`null`:case`never`:case`nan`:case`date`:case`object`:case`array`:case`tuple`:case`record`:case`map`:case`set`:case`file`:case`template_literal`:return!1;case`nonoptional`:return t.innerType?fastPathAcceptsAbsence(t.innerType):!1;case`literal`:return!!t.values?.includes(void 0);case`enum`:return!!e._zod.values?.has(void 0);case`optional`:case`nullable`:case`readonly`:case`success`:return!t.innerType||fastPathAcceptsAbsence(t.innerType);case`catch`:return!0;case`union`:return!t.options||t.options.some(fastPathAcceptsAbsence);case`intersection`:return!t.left||!t.right||fastPathAcceptsAbsence(t.left)&&fastPathAcceptsAbsence(t.right);case`pipe`:return!t.in||fastPathAcceptsAbsence(t.in);default:return!0}}function dropsWhenAbsent(e){return e._zod.optin===`optional`&&e._zod.optout===`optional`}function mayOmitUndefined(e){return(e._zod.optin!==`defaulted`||e._zod.optout===`optional`)&&mayOutputUndefined(e)}function mayOutputUndefined(e){let t=e._zod.def;switch(t.type){case`string`:case`number`:case`boolean`:case`bigint`:case`symbol`:case`null`:case`nan`:case`date`:case`object`:case`array`:case`tuple`:case`record`:case`map`:case`set`:case`file`:case`template_literal`:case`never`:case`success`:return!1;case`literal`:return!!t.values?.includes(void 0);case`enum`:return!!e._zod.values?.has(void 0);case`optional`:return!0;case`nullable`:case`readonly`:case`nonoptional`:return!t.innerType||mayOutputUndefined(t.innerType);case`union`:return!t.options||t.options.some(mayOutputUndefined);case`intersection`:return!t.left||!t.right||mayOutputUndefined(t.left)||mayOutputUndefined(t.right);case`pipe`:return!t.out||mayOutputUndefined(t.out);default:return!0}}function generateNullableCheck(e,t,n,r,i=!0){let a=n._zod.def,o=i?newVar(t):null;return o&&e.write(`let ${o} = null;`),e.write(`if (${r} !== null) {`),e.indented(e=>{let n=generateCheck(e,t,a.innerType,r,i);o&&n!==null&&e.write(`${o} = ${n};`)}),e.write(`}`),o}function generateArrayCheck(e,t,n,r,i=!0){let a=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`);let o=i?newVar(t):null,s=newVar(t),c=newVar(t);return o&&e.write(`const ${o} = new Array(${r}.length);`),e.write(`for (let ${s} = 0; ${s} < ${r}.length; ${s}++) {`),e.indented(e=>{e.write(`const ${c} = ${r}[${s}];`);let n=compileChild(e,t,a.element,c,i);o&&n!==null&&e.write(`${o}[${s}] = ${n};`)}),e.write(`}`),o}function generateLiteralCheck(e,t,r,i){let a=r._zod.def.values;
4if(a.length!==1){let n=addConstant(t,new Set(a));return e.write(`if (!${n}.has(${i})) return INVALID;`),i}let o=a[0];if(typeof o==`number`&&Number.isNaN(o)){let n=addConstant(t,new Set(a));return e.write(`if (!${n}.has(${i})) return INVALID;`),i}if(typeof o==`string`)e.write(`if (${i} !== ${n(o)}) return INVALID;`);else if(typeof o==`number`||typeof o==`boolean`)e.write(`if (${i} !== ${o}) return INVALID;`);else if(o===null)e.write(`if (${i} !== null) return INVALID;`);else if(o===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof o==`bigint`)e.write(`if (${i} !== ${o}n) return INVALID;`);else throw new ZodCompileUnsupportedError(`literal type ${typeof o}`);return i}function generateEnumCheck(e,t,n,r){let i=n._zod.values;if(!i)throw new ZodCompileUnsupportedError(`enum schema without enumerated values`);let a=addConstant(t,i);return e.write(`if (!${a}.has(${r})) return INVALID;`),r}function generateWrapperCheck(e,t,n,r){let i=n._zod.def;return generateCheck(e,t,i.innerType,r)}function generateDefaultCheck(e,t,n,r){let i=n._zod.def,a=Object.getOwnPropertyDescriptor(n._zod.def,`defaultValue`)?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type===`prefault`){if(!a)return generateCheck(e,t,i.innerType,r);let n=addConstant(t,a),o=newVar(t);return e.write(`let ${o} = ${r};`),e.write(`if (${r} === undefined) ${o} = ${n}();`),generateCheck(e,t,i.innerType,o)}let o=newVar(t);if(a){let n=addConstant(t,a),s=addConstant(t,_e);e.write(`let ${o};`),e.write(`if (${r} === undefined) {`),e.indented(e=>{e.write(`${o} = ${s}(${n}());`)}),e.write(`} else {`),e.indented(e=>{let a=generateCheck(e,t,i.innerType,r);e.write(`${o} = ${a} === undefined ? ${s}(${n}()) : ${a};`)}),e.write(`}`)}else e.write(`let ${o};`),e.write(`if (${r} !== undefined) {`),e.indented(e=>{let n=generateCheck(e,t,i.innerType,r);e.write(`${o} = ${n};`)}),e.write(`}`);return o}function generateNonOptionalCheck(e,t,n,r){let i=n._zod.def,a=generateCheck(e,t,i.innerType,r),o=newVar(t);return e.write(`const ${o} = ${a};`),e.write(`if (${o} === undefined) return INVALID;`),o}function generateTupleCheck(e,t,n,r){let i=n._zod.def,a=i.items,o=i.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let s=getTupleOptStart(a,`optin`),c=getTupleOptStart(a,`optout`);o?e.write(`if (${r}.length < ${s}) return INVALID;`):e.write(`if (${r}.length < ${s} || ${r}.length > ${a.length}) return INVALID;`);let l=newVar(t);e.write(`const ${l} = [];`);for(let n=0;n<a.length;n++){let i=a[n];if(n>=c)e.write(`if (${l}.length === ${n}) {`),e.indented(e=>{e.write(`if (${n} < ${r}.length) {`),e.indented(e=>{let a=newVar(t);e.write(`const ${a} = ${r}[${n}];`);let o=compileChild(e,t,i,a);e.write(`${l}[${n}] = ${o};`)}),e.write(`} else {`),e.indented(e=>{if(dropsWhenAbsent(i)){e.write(`${l}.length = ${n};`);return}let r=newVar(t),a=newVar(t);e.write(`const ${r} = undefined;`),e.write(`const ${a} = (() => {`),e.indented(e=>{let n=compileChild(e,t,i,r);e.write(`return ${n};`)}),e.write(`})();`),e.write(`if (${a} === INVALID || ${a} === undefined) ${l}.length = ${n};`),e.write(`else ${l}[${n}] = ${a};`)}),e.write(`}`)}),e.write(`}`);else{let a=newVar(t);e.write(`const ${a} = ${r}[${n}];`);let o=compileChild(e,t,i,a);e.write(`${l}[${n}] = ${o};`)}}if(o){let n=newVar(t),i=newVar(t);e.write(`for (let ${n} = ${a.length}; ${n} < ${r}.length; ${n}++) {`),e.indented(e=>{e.write(`const ${i} = ${r}[${n}];`);let a=compileChild(e,t,o,i);e.write(`${l}[${n}] = ${a};`)}),e.write(`}`)}return l}function getTupleOptStart(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function generateUnionCheck(e,t,n,r){let i=n._zod.def,a=i.options;if(i.discriminator)return generateDiscriminatedUnionCheck(e,t,i,r);if(i.inclusive===!1)throw new ZodCompileUnsupportedError(`exclusive unions (z.xor)`);if(a.length===0)return e.write(`return INVALID;`),r;if(a.length===1)return generateCheck(e,t,a[0],r);if(a.every(e=>e._zod.def.type===`literal`&&!e._zod.def.checks?.length)){let n=addConstant(t,new Set(a.flatMap(e=>e._zod.def.values)));return e.write(`if (!${n}.has(${r})) return INVALID;`),r}let o=newVar(t);e.write(`let ${o};`);for(let n=0;n<a.length;n++){let i=a[n];n===0?e.write(`${o} = (() => {`):e.write(`if (${o} === INVALID) ${o} = (() => {`),e.indented(e=>{let n=generateCheck(e,t,i,r);e.write(`return ${n};`)}),e.write(`})();`)}return e.write(`if (${o} === INVALID) return INVALID;`),o}function generateDiscriminatedUnionCheck(e,t,r,i){if(r.unionFallback)throw new ZodCompileUnsupportedError(`discriminated union with unionFallback`);if(r.options.length===0)return e.write(`return INVALID;`),i;let a=newVar(t),o=newVar(t);e.write(`const ${a} = ${i}?.[${n(r.discriminator)}];`),e.write(`let ${o};`);let s=!0,c=/* @__PURE__ */ new Set;for(let n of r.options){let l=n._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new ZodCompileUnsupportedError(`discriminated union option without static discriminator values`);for(let e of l){if(c.has(e))throw new ZodCompileUnsupportedError(`duplicate discriminator value ${String(e)}`);c.add(e)}let u=Array.from(l,e=>literalEquality(t,a,e)),d=s?`if`:`else if`;e.write(`${d} (${u.join(` || `)}) {`),e.indented(e=>{let r=generateCheck(e,t,n,i);e.write(`${o} = ${r};`)}),e.write(`}`),s=!1}return e.write(`else { return INVALID; }`),o}function literalEquality(e,t,r){if(typeof r==`string`)return`${t} === ${n(r)}`;if(typeof r==`number`)return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r==`boolean`)return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r==`bigint`)return`${t} === ${r}n`;if(typeof r==`symbol`)return`${t} === ${addConstant(e,r)}`;throw new ZodCompileUnsupportedError(`literal discriminator value ${String(r)}`)}function generateIntersectionCheck(e,t,n,r){let i=n._zod.def;t.definite=!1;let a=compileChild(e,t,i.left,r),o=compileChild(e,t,i.right,r),s=addConstant(t,fe),c=newVar(t);return e.write(`const ${c} = ${s}(${a}, ${o});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function generateRecordCheck(e,t,n,i){let a=n._zod.def,o=addConstant(t,r);e.write(`if (!${o}(${i})) return INVALID;`);let s=newVar(t),c=newVar(t),l=newVar(t);e.write(`const ${s} = {};`);let u=a,d=u.partial?void 0:a.keyType._zod.values;if(d){let n=[];for(let r of d){if(typeof r!=`string`&&typeof r!=`number`&&typeof r!=`symbol`)throw new ZodCompileUnsupportedError(`record key value ${String(r)}`);let o=typeof r==`number`?r.toString():r;if(o===`__proto__`)throw new ZodCompileUnsupportedError(`record key "__proto__"`);n.push(o);let c=addConstant(t,r),l=generateCheck(e,t,a.keyType,c),u=newVar(t);e.write(`const ${u} = ${i}[${literalPropertyKey(t,o)}];`);let d=compileChild(e,t,a.valueType,u);e.write(`${s}[${l}] = ${d};`)}let r=addConstant(t,new Set(n));return e.write(`for (const ${c} in ${i}) {`),e.indented(e=>{e.write(`if (${r}.has(${c})) continue;`),u.mode===`loose`?e.write(`if (${c} !== "__proto__") ${s}[${c}] = ${i}[${c}];`):e.write(`return INVALID;`)}),e.write(`}`),s}
4let f=a.keyType._zod.def;if(f.type!==`string`||f.format!==void 0||f.coerce||(f.checks?.length??0)!==0){let n=a.mode===`loose`,r=compileFn(a.keyType);r.definite===!1&&(t.definite=!1);let o=addConstant(t,r),l=addConstant(t,Ce),u=newVar(t);return emitOwnKeys(e,t,i,c,e=>{e.write(`let ${u} = ${o}(${c});`),e.write(`if (${u} === INVALID && typeof ${c} === "string" && ${l}.test(${c})) ${u} = ${o}(Number(${c}));`),n?e.write(`if (${u} === INVALID) { ${s}[${c}] = ${i}[${c}]; continue; }`):e.write(`if (${u} === INVALID) return INVALID;`),e.write(`if (${u} === "__proto__") continue;`);let r=newVar(t);e.write(`const ${r} = ${i}[${c}];`);let d=compileChild(e,t,a.valueType,r);e.write(`${s}[${u}] = ${d};`)}),s}return emitOwnKeys(e,t,i,c,e=>{e.write(`const ${l} = ${i}[${c}];`);let n=compileChild(e,t,a.valueType,l);e.write(`${s}[${c}] = ${n};`)},`return INVALID;`),s}function emitOwnKeys(e,t,n,r,i,a){let o=addConstant(t,Object.prototype.propertyIsEnumerable),s=newVar(t),c=newVar(t),l=newVar(t);e.write(`const ${s} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(e=>{e.write(`const ${r} = ${c}[${l}];`),e.write(`if (${r} === "__proto__" || !${o}.call(${n}, ${r})) continue;`),i(e)}),e.write(`}`),e.write(`for (let ${l} = 0; ${l} < ${s}.length; ${l}++) {`),e.indented(e=>{e.write(`const ${r} = ${s}[${l}];`),e.write(`if (!${o}.call(${n}, ${r})) continue;`),a?e.write(a):i(e)}),e.write(`}`)}function literalPropertyKey(e,t){return typeof t==`string`?n(t):addConstant(e,t)}function generateMapCheck(e,t,n,r){let i=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`);let a=newVar(t),o=newVar(t),s=newVar(t);return e.write(`const ${a} = new Map();`),e.write(`for (const [${o}, ${s}] of ${r}) {`),e.indented(e=>{let n=generateCheck(e,t,i.keyType,o),r=generateCheck(e,t,i.valueType,s);e.write(`${a}.set(${n}, ${r});`)}),e.write(`}`),a}function generateSetCheck(e,t,n,r){let i=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`);let a=newVar(t),o=newVar(t);return e.write(`const ${a} = new Set();`),e.write(`for (const ${o} of ${r}) {`),e.indented(e=>{let n=generateCheck(e,t,i.valueType,o);e.write(`${a}.add(${n});`)}),e.write(`}`),a}function generateFileCheck(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function generateTemplateLiteralCheck(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.pattern;if(i){let n=addConstant(t,i);e.write(`${n}.lastIndex = 0;`),e.write(`if (!${n}.test(${r})) return INVALID;`)}return r}function generateLazyCheck(e,t,n,r){let i=n._zod.def,a=addUserConstant(t,i.getter),o=addConstant(t,{parser:null});e.write(`if (!${o}.parser) {`),e.indented(e=>{e.write(`const inner = ${a}();`),e.write(`${o}.parser = function(input) {`),e.indented(e=>{e.write(`const result = inner._zod.run({ value: input, issues: [] }, {});`),e.write(`return result.issues.length === 0 ? result.value : INVALID;`)}),e.write(`};`)}),e.write(`}`);let s=newVar(t);return e.write(`const ${s} = ${o}.parser(${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function generatePipeCheck(e,t,n,r){let i=n._zod.def,a=generateCheck(e,t,i.in,r);if(i.transform){if(isAsyncFunction(i.transform))throw new ZodCompileAsyncError(`z.compile: async transforms in pipes are not supported`);let n=i.transform,helperFn=e=>{let t={value:e,issues:[],addIssue:pushIssue},r=n(e,t);return r instanceof Promise?Z:t.issues.length===0?r:Z},r=addUserConstant(t,helperFn),o=newVar(t);return e.write(`const ${o} = ${r}(${a});`),e.write(`if (${o} === INVALID) return INVALID;`),generateCheck(e,t,i.out,o)}return generateCheck(e,t,i.out,a)}function isAsyncFunction(e){return typeof e==`function`&&(e.constructor.name===`AsyncFunction`||e[Symbol.toStringTag]===`AsyncFunction`)}function generateCustomCheck(e,t,n,r){let i=n._zod.def;if(i.fn){if(isAsyncFunction(i.fn))throw new ZodCompileAsyncError(`z.compile: async custom predicates are not supported`);let n=addUserConstant(t,i.fn),a=addConstant(t,throwAsync),o=newVar(t);e.write(`const ${o} = ${n}(${r});`),e.write(`if (${o} instanceof Promise) ${a}();`),e.write(`if (!${o}) return INVALID;`)}else throw new ZodCompileUnsupportedError(`custom schema without a predicate function`);return r}
4function runtimeCatch(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then==`function`)return Z;let i=r;return i.issues.length===0?i.value:t()}function generateCatchCheck(e,t,n,r){let i=n._zod.def;if(!i.catchValue[`~constantCatch`])throw new ZodCompileUnsupportedError(`catch with a callback (only a constant catch value compiles)`,!1);let a=newVar(t);e.write(`let ${a} = (() => {`),e.indented(e=>{let n=compileChild(e,t,i.innerType,r);e.write(`return ${n};`)}),e.write(`})();`);let o=addConstant(t,i.innerType),s=addUserConstant(t,i.catchValue),c=addConstant(t,runtimeCatch);return e.write(`if (${a} === INVALID) {`),e.indented(e=>{e.write(`${a} = ${c}(${o}, ${s}, ${r});`),e.write(`if (${a} === INVALID) return INVALID;`)}),e.write(`}`),a}function generateTransformCheck(e,t,n,r){let i=n._zod.def;if(i.transform){if(isAsyncFunction(i.transform))throw new ZodCompileAsyncError(`z.compile: async transforms are not supported`);let n=i.transform,helperFn=e=>{let t={value:e,issues:[],addIssue:pushIssue},r=n(e,t);return r instanceof Promise?Z:t.issues.length===0?r:Z},a=addUserConstant(t,helperFn),o=newVar(t);return e.write(`const ${o} = ${a}(${r});`),e.write(`if (${o} === INVALID) return INVALID;`),o}return r}var Z,Q,ZodCompileAsyncError,ZodCompileUnsupportedError,je,Me;function init_compile(){return(init_compile=e((()=>{init_core(),init_doc(),init_memoizer(),v(),C(),f(),Z=Symbol.for(`zod.compile.invalid`),Q=Symbol.for(`zod.compile.fallback`),ZodCompileAsyncError=class extends Error{constructor(e=`z.compile does not support async refinements, transforms, or checks`){super(e),this.name=`ZodCompileAsyncError`}},ZodCompileUnsupportedError=class extends Error{constructor(e,t=!0){super(`z.compile does not support ${e}; this schema must use the runtime parser`),this.name=`ZodCompileUnsupportedError`,this.islandable=t}},je=/* @__PURE__ */ new Set([`max_size`,`min_size`,`size_equals`,`max_length`,`min_length`,`length_equals`]),Me=/* @__PURE__ */ 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 snapshotChecks(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
5function _string(e,t){return new e(snapshotChecks({type:`string`,...x(t)}))}// @__NO_SIDE_EFFECTS__
6function _email(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
7function _guid(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
8function _uuid(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
9function _uuidv4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}// @__NO_SIDE_EFFECTS__
10function _uuidv6(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}// @__NO_SIDE_EFFECTS__
11function _uuidv7(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}// @__NO_SIDE_EFFECTS__
12function _url(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
13function _emoji(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
14function _nanoid(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
15function _cuid(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
16function _cuid2(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
17function _ulid(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
18function _xid(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
19function _ksuid(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
20function _ipv4(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
21function _ipv6(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
22function _cidrv4(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
23function _cidrv6(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
24function _base64(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
25function _base64url(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
26function _e164(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
27function _jwt(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}// @__NO_SIDE_EFFECTS__
28function _isoDateTime(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}// @__NO_SIDE_EFFECTS__
29function _isoDate(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}// @__NO_SIDE_EFFECTS__
30function _isoTime(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}// @__NO_SIDE_EFFECTS__
31function _isoDuration(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}// @__NO_SIDE_EFFECTS__
32function _unknown(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
33function _never(e,t){return new e({type:`never`,...x(t)})}// @__NO_SIDE_EFFECTS__
34function _date(e,t){return new e({type:`date`,...x(t)})}// @__NO_SIDE_EFFECTS__
35function _lte(e,t){return new I({check:`less_than`,...x(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
36function _gte(e,t){return new L({check:`greater_than`,...x(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
37function _maxLength(e,t){return new R({check:`max_length`,...x(t),maximum:e})}// @__NO_SIDE_EFFECTS__
38function _minLength(e,t){return new z({check:`min_length`,...x(t),minimum:e})}// @__NO_SIDE_EFFECTS__
39function _length(e,t){return new B({check:`length_equals`,...x(t),length:e})}// @__NO_SIDE_EFFECTS__
40function _regex(e,t){return new we({check:`string_format`,format:`regex`,...x(t),pattern:e})}// @__NO_SIDE_EFFECTS__
41function _lowercase(e){return new H({check:`string_format`,format:`lowercase`,...x(e)})}// @__NO_SIDE_EFFECTS__
42function _uppercase(e){return new Te({check:`string_format`,format:`uppercase`,...x(e)})}// @__NO_SIDE_EFFECTS__
43function _includes(e,t){return new Ee({check:`string_format`,format:`includes`,...x(t),includes:e})}// @__NO_SIDE_EFFECTS__
44function _startsWith(e,t){return new De({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}// @__NO_SIDE_EFFECTS__
45function _endsWith(e,t){return new Oe({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}// @__NO_SIDE_EFFECTS__
46function _overwrite(e){return new ke({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
47function _normalize(e){return/* @__PURE__ */ _overwrite(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
48function _trim(){return/* @__PURE__ */ _overwrite(e=>e.trim())}// @__NO_SIDE_EFFECTS__
49function _toLowerCase(){return/* @__PURE__ */ _overwrite(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
50function _toUpperCase(){return/* @__PURE__ */ _overwrite(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
51function _slugify(){return/* @__PURE__ */ _overwrite(e=>ue(e))}// @__NO_SIDE_EFFECTS__
52function _array(e,t,n){return new e({type:`array`,element:t,...x(n)})}// @__NO_SIDE_EFFECTS__
53function _refine(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}// @__NO_SIDE_EFFECTS__
54function _superRefine(e,t){let n=/* @__PURE__ */ _check(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(h(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(h(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
55function _check(e,t){let n=new P({check:`custom`,...x(t)});return n._zod.check=e,n}function init_api(){return(init_api=e((()=>{init_checks(),f()})))()}function aggregateChecks(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Ne[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&narrowMin(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&narrowMin(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&narrowMax(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&narrowMax(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&addDivisor(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&intersectMime(t,i.mime);
55for(let e of i.patterns??[])addPattern(t,e);return t}function inputOptin(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?inputOptin(t.out):t.type===`catch`?inputOptin(t.innerType):e._zod.optin}function serializeDefaultValue(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(S(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),$):JSON.parse(o)}var narrowMin,narrowMax,narrowBoth,addDivisor,addPattern,intersectMime,setFormat,minContributor,maxContributor,formatContributor,Ne,Pe,Fe,exactPattern,stringProcessor,neverProcessor,unknownProcessor,dateProcessor,enumProcessor,customProcessor,transformProcessor,arrayProcessor,objectProcessor,unionProcessor,intersectionProcessor,nullableProcessor,nonoptionalProcessor,$,defaultProcessor,prefaultProcessor,catchProcessor,pipeProcessor,readonlyProcessor,optionalProcessor;function init_json_schema_processors(){return(init_json_schema_processors=e((()=>{v(),C(),le(),f(),narrowMin=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},narrowMax=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},narrowBoth=(e,t)=>{narrowMin(e,`minimum`,t),narrowMax(e,`maximum`,t)},addDivisor=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},addPattern=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},intersectMime=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},setFormat=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},minContributor=(e,t)=>narrowMin(e,`minimum`,t.minimum),maxContributor=(e,t)=>narrowMax(e,`maximum`,t.maximum),formatContributor=e=>(t,n)=>{setFormat(t,n.format);let[r,i]=e[n.format];narrowMin(t,`minimum`,r),narrowMax(t,`maximum`,i)},Ne={greater_than:(e,t)=>narrowMin(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>narrowMax(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>addDivisor(e,t.value),number_format:formatContributor(i),bigint_format:formatContributor(Se),min_length:minContributor,max_length:maxContributor,length_equals:(e,t)=>narrowBoth(e,t.length),min_size:minContributor,max_size:maxContributor,size_equals:(e,t)=>narrowBoth(e,t.size),string_format:(e,t)=>{setFormat(e,t.format),t.pattern&&addPattern(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>intersectMime(e,t.mime)},Pe={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Fe=/* @__PURE__ */ new Map([[t,ce],[ae,se]]),exactPattern=e=>Fe.get(e)??e,stringProcessor=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=aggregateChecks(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Pe[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(exactPattern);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},neverProcessor=(e,t,n,r)=>{n.not={}},unknownProcessor=(e,t,n,r)=>{},dateProcessor=(e,t,n,r)=>{S(e,t,n,r,`Date cannot be represented in JSON Schema`)},enumProcessor=(e,t,n,r)=>{let i=e._zod.def,a=s(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},customProcessor=(e,t,n,r)=>{S(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},transformProcessor=(e,t,n,r)=>{S(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},arrayProcessor=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=aggregateChecks(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=y(a.element,t,{...r,path:[...r.path,`items`]})},objectProcessor=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&S(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)xe(i.properties,e,y(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?inputOptin(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.cat
vendor: 3,650 bytes, line 55
55chall&&(i.additionalProperties=y(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},unionProcessor=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>y(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},intersectionProcessor=(e,t,n,r)=>{let i=e._zod.def,a=y(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=y(i.right,t,{...r,path:[...r.path,`allOf`,1]}),isSimpleIntersection=e=>`allOf`in e&&Object.keys(e).length===1,s=[...isSimpleIntersection(a)?a.allOf:[a],...isSimpleIntersection(o)?o.allOf:[o]];n.allOf=s,t.intersections.push(s)},nullableProcessor=(e,t,n,r)=>{let i=e._zod.def,a=y(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},nonoptionalProcessor=(e,t,n,r)=>{let i=e._zod.def;y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$=Symbol(),defaultProcessor=(e,t,n,r)=>{let i=e._zod.def;y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=serializeDefaultValue(i.defaultValue,e,t,n,r);o!==$&&(n.default=o)},prefaultProcessor=(e,t,n,r)=>{let i=e._zod.def;y(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=serializeDefaultValue(i.defaultValue,e,t,n,r);o!==$&&(n._prefault=o)},catchProcessor=(e,t,n,r)=>{let i=e._zod.def;y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{S(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},pipeProcessor=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;y(o,t,r);let s=t.seen.get(e);s.ref=o},readonlyProcessor=(e,t,n,r)=>{let i=e._zod.def;y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},optionalProcessor=(e,t,n,r)=>{let i=e._zod.def;y(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType}})))()}export{_overwrite as $,_e164 as A,_encode as At,_isoDateTime as B,init_parse as Bt,_base64 as C,Doc as Ct,_cuid as D,init_checks as Dt,_cidrv6 as E,V as Et,_guid as F,_safeDecodeAsync as Ft,_length as G,formatError as Gt,_isoTime as H,validateAsync as Ht,_includes as I,_safeEncode as It,_maxLength as J,$ZodEncodeError as Jt,_lowercase as K,init_errors as Kt,_ipv4 as L,_safeEncodeAsync as Lt,_emoji as M,_parse as Mt,_endsWith as N,_parseAsync as Nt,_cuid2 as O,_decode as Ot,_gte as P,_safeDecode as Pt,_normalize as Q,init_core as Qt,_ipv6 as R,_safeParse as Rt,_array as S,memoizer as St,_cidrv4 as T,P as Tt,_jwt as U,j as Ut,_isoDuration as V,validate as Vt,_ksuid as W,flattenError as Wt,_nanoid as X,config as Xt,_minLength as Y,$constructor as Yt,_never as Z,D as Zt,readonlyProcessor as _,_xid as _t,dateProcessor as a,_superRefine as at,unionProcessor as b,init_compile as bt,init_json_schema_processors as c,_trim as ct,nonoptionalProcessor as d,_uppercase as dt,_refine as et,nullableProcessor as f,_url as ft,prefaultProcessor as g,_uuidv7 as gt,pipeProcessor as h,_uuidv6 as ht,customProcessor as i,_string as it,_email as j,_encodeAsync as jt,_date as k,_decodeAsync as kt,intersectionProcessor as l,_ulid as lt,optionalProcessor as m,_uuidv4 as mt,arrayProcessor as n,_slugify as nt,defaultProcessor as o,_toLowerCase as ot,objectProcessor as p,_uuid as pt,_lte as q,$ZodAsyncError as qt,catchProcessor as r,_startsWith as rt,enumProcessor as s,_toUpperCase as st,aggregateChecks as t,_regex as tt,neverProcessor as u,_unknown as ut,stringProcessor as v,init_api as vt,_base64url as w,init_doc as wt,unknownProcessor as x,init_memoizer as xt,transformProcessor as y,compile as yt,_isoDate as z,_safeParseAsync as zt};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.