game-dev-cli-darwin-arm64 0.25.9 → 0.25.11
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/bin/ai-game-dev +2 -2
- package/package.json +3 -3
- package/runtime/app/daemon/coordinator.cjs +455 -0
- package/runtime/app/daemon/daemon-engine-worker.cjs +385 -0
- package/runtime/app/daemon/daemon-entry.cjs +1819 -0
- package/runtime/app/daemon/daemon-extension-host.cjs +64 -0
- package/runtime/app/daemon/daemon-git-action-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-git-blob-worker.cjs +60 -0
- package/runtime/app/daemon/daemon-git-read-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-git-status-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-project-create-worker.cjs +669 -0
- package/runtime/app/daemon/daemon-replacement-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-search-worker.cjs +59 -0
- package/runtime/app/daemon/daemon-token.cjs +1213 -0
- package/runtime/manifest.json +1 -0
- package/runtime/runtime.json +9 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __aigdRuntimeUrl=require("node:url").pathToFileURL(__filename).href;
|
|
2
|
+
var Rs=require("node:child_process"),Ds=require("node:path"),js=require("node:crypto");function le(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function it(e,t="|"){return e.map((r)=>ut(r)).join(t)}function pe(e,t){if(typeof t==="bigint")return t.toString();return t}class nr{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function ze(e){return new nr(e)}function or(e){return e===null||e===void 0}function $e(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ir(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function M(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function we(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function J(e){return we(e._zod.def)??e._zod.def.shape}function sr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return M(this,t,n),n},enumerable:!0,configurable:!0})}function cr(e,t,r){if(t in e)M(e,t,r);else e[t]=r}function Q(e,t,r,n){let o=J(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)sr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else cr(e,i,n?n(s.value,i):s.value)}}function Us(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)sr(e,r,()=>t[r]);else cr(e,r,n.value)}}function T(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ur(e){return JSON.stringify(e)}function ar(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var st="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var lr=ze(()=>{if(N.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ne(e){if(ae(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ae(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ct(e){if(ne(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var pr=new Set(["string","number","symbol"]);function X(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ut(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function fr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ke=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),at={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Bs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Q(i,e,Ze(e,t)),F(e,T(r,{shape:i,checks:[]}))}function Ze(e,t){let r=J(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Js(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ze(e,t)),s={};return Q(s,e,Reflect.ownKeys(J(e)).filter((c)=>!i.has(c))),F(e,T(r,{shape:s,checks:[]}))}function Gs(e,t){if(!ne(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=J(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return F(e,T(e._zod.def,{shape:dr(e,t)}))}function dr(e,t){let r={};return Q(r,e,Reflect.ownKeys(J(e))),Us(r,t),r}function Ks(e,t){if(!ne(t))throw Error("Invalid input to safeExtend: expected a plain object");return F(e,T(e._zod.def,{shape:dr(e,t)}))}function Vs(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Q(r,e,Reflect.ownKeys(J(e))),Q(r,t,Reflect.ownKeys(J(t)));let n=T(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return F(e,n)}function mr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Ze(t,r)):void 0,u={};return Q(u,t,Reflect.ownKeys(J(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),F(t,T(t._zod.def,{shape:u,checks:[]}))}function Ws(e,t,r){let n=r?new Set(Ze(t,r)):void 0,o={};return Q(o,t,Reflect.ownKeys(J(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),F(t,T(t._zod.def,{shape:o}))}function U(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function hr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Pe(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ue(e){return typeof e==="string"?e:e?.message}function lt(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Se(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function H(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ue(e.inst?._zod.def?.error?.(e))??ue(i?.(e))??ue(t?.error?.(e))??ue(r.customError?.(e))??ue(r.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Xs=/[\uD800-\uDBFF]/;function Oe(e){let t=e.length;if(!Xs.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Ie(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function gr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ee(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function _r(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Hs(e,r,n.value)}}function G(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ae(e,t,r){return G(e,t,r,!1)}function xr(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return G(this,r,n(this))},set(o){G(this,r,o)}})}return t}function Hs(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:G(this,t,r.bind(this))},set(n){G(this,t,n)}})}function Ys(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ot,W=!1,qs={configurable:!0,get(){W=!0;return}};function v(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ot!==e._zod){ot=void 0;return}ot=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,qs);let o=W;W=!1;try{let i=r(this);if(W)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return W=W||o,i}catch(i){throw delete this[t],W=W||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Qs(e,t,r,n){let o=Ys(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var ec="~constantCatch";function yr(e){let t=()=>e;return t[ec]=!0,t}var vr;var pt={value:void 0,enumerable:!1},br="captureStackTrace"in Error?Error:null;function tc(e){let t=br;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return br=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){pt.value=new i(m);try{Object.defineProperty(d,"_zod",pt)}finally{pt.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let x=Object.getPrototypeOf(d),_=d._zod.constr.prototype,b=x;while(b&&b!==_)b=Object.getPrototypeOf(b);let A=b??x;if(!c.has(A))c.add(A),_r(A,s)}let h=f.prototype;for(let x in h){if(!Object.prototype.hasOwnProperty.call(h,x))continue;if(!(x in d))d[x]=h[x].bind(d)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?tc(l):this;u(m,d);let h=m._zod.deferred;if(h){for(let _ of h)_();m._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;if(x)x(m);return m}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(n?.Parent&&d instanceof n.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class B extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(vr=globalThis).__zod_globalConfig??(vr.__zod_globalConfig={});var N=globalThis.__zod_globalConfig;function j(e){if(e)Object.assign(N,e);return N}function rc(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,pe,2)),e.message}function nc(e){this._zod.message=e}var oc={get:rc,set:nc,enumerable:!0,configurable:!0},dt={value:void 0,enumerable:!1},zr=new WeakSet([Object.prototype,Error.prototype]),$r=(e,t)=>{e.name="$ZodError",dt.value=t,Object.defineProperty(e,"issues",dt),dt.value=void 0,Object.defineProperty(e,"message",oc);let r=Object.getPrototypeOf(e);if(!zr.has(r))zr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},wr=p("$ZodError",$r),ta=p("$ZodError",$r,void 0,{Parent:Error});function ic(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function kr(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)ic(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Zr(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let l=c[a],f=a===c.length-1;if(l==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[l];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function Ee(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Te=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new B;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>H(a,s,j())));throw st(u,i?.callee??t),u}return c.value};return t};var Ne=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>H(a,s,j())));throw st(u,i?.callee??t),u}return c.value};return t};var Ce=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new B;return i.issues.length?Pr(e,i.issues,o):{success:!0,data:i.value}};function Pr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>H(o,r,j()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Re=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Pr(e,i.issues,o):{success:!0,data:i.value}};var sc=Symbol.for("zod.compile.invalid"),cc=Symbol.for("zod.compile.fallback"),mt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==sc)return!0;if(n.definite===!0&&r===void 0)return!1}return uc(e,t,r)};function uc(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[cc]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new B;return i.issues.length===0}var ht=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Sr=(e)=>{let t=Te(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Ee(r,s))};return r};var Or=(e)=>{let t=Te(e),r=(n,o,i,s)=>t(n,o,i,Ee(r,s));return r};var Ir=(e)=>{let t=Ne(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Ee(r,s))};return r};var Ar=(e)=>{let t=Ne(e),r=async(n,o,i,s)=>await t(n,o,i,Ee(r,s));return r};var Er=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ce(e)(t,r,o)};var Tr=(e)=>(t,r,n)=>Ce(e)(t,r,n);var Nr=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Re(e)(t,r,o)};var Cr=(e)=>async(t,r,n)=>Re(e)(t,r,n);var Rr=/^[cC][0-9a-z]{6,}$/,Dr=/^[0-9a-z]+$/,jr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Lr=/^[0-9a-vA-V]{20}$/,Mr=/^[A-Za-z0-9]{27}$/,Fr=/^[a-zA-Z0-9_-]{21}$/;function Ur(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Br=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Jr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,_t=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Gr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ac="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Kr(){return new RegExp(ac,"u")}var Vr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Xr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Hr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Qr=/^https?$/,en=/^\+[1-9]\d{6,14}$/;var tn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function lc(e){return new RegExp(`^${e}$`)}var rn=lc(tn);function gt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function nn(e){return new RegExp(`^${gt(e)}$`)}function on(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${gt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${gt({precision:e.precision})}`:r;return new RegExp(`^${tn}T(?:${n})$`)}var sn=/^[\s\S]{0,}$/;var xt=/^-?\d+(?:\.\d+)?$/,cn=/^(?:true|false)$/i;var un=/^[^A-Z]*$/,an=/^[^a-z]*$/;var O=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var yt=(e)=>{let t=e.value;return!or(t)&&t.length!==void 0},De={number:"number",bigint:"bigint",object:"date"},vt=p("$ZodCheckLessThan",(e,t)=>{O.init(e,t);let r=De[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:De[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bt=p("$ZodCheckGreaterThan",(e,t)=>{O.init(e,t);let r=De[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:De[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=p("$ZodCheckMultipleOf",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):ir(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),pn=p("$ZodCheckNumberFormat",(e,t)=>{O.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=ke[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var fn=p("$ZodCheckMaxLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=yt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Oe(o):i)<=t.maximum)return;let c=Ie(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dn=p("$ZodCheckMinLength",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=yt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Oe(o):i)>=t.minimum)return;let c=Ie(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mn=p("$ZodCheckLengthEquals",(e,t)=>{var r;O.init(e,t),(r=e._zod.def).when??(r.when=yt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Oe(o):i;if(s===t.length)return;let c=Ie(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),me=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(O.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),hn=p("$ZodCheckRegex",(e,t)=>{me.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=un),me.init(e,t)}),_n=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=an),me.init(e,t)}),xn=p("$ZodCheckIncludes",(e,t)=>{O.init(e,t);let r=X(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),yn=p("$ZodCheckStartsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`^${X(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vn=p("$ZodCheckEndsWith",(e,t)=>{O.init(e,t);let r=new RegExp(`.*${X(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var bn=p("$ZodCheckOverwrite",(e,t)=>{O.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class zt{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-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
3
|
+
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
|
+
${t.join(`
|
|
5
|
+
`)}
|
|
6
|
+
};`)(...Object.values(this.closed))}}var $n={major:4,minor:6,patch:7};var w=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$n;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=U(c),f;for(let d of u){if(d._zod.def.when){if(hr(c))continue;if(!d._zod.def.when(c))continue}else if(l)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&a?.async===!1)throw new B;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(Se(c.issues,m,e),!l)l=U(c,m)});else{if(c.issues.length===m)continue;if(Se(c.issues,m,e),!l)l=U(c,m)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(U(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new B;return l.then((f)=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,u));return s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new B;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return Ae(this,"~standard",wt(this))},set "~standard"(e){G(this,"~standard",e)}}),Nn=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>H(r,t,j()))}:{value:e.value};async function fc(e,t){let r={async:!0};return Nn(await e._zod.run({value:t,issues:[]},r),r)}function wt(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Nn(n,r)}catch(n){}return fc(e,t)},vendor:"zod",version:1}}var Fe=p("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??sn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),z=p("$ZodStringFormat",(e,t)=>{me.init(e,t),Fe.init(e,t)}),Cn=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Jr),z.init(e,t)}),Rn=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=_t(n))}else t.pattern??(t.pattern=_t());z.init(e,t)}),Dn=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Gr),z.init(e,t)}),jn=1,Le=2;function Ln(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function dc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Ln(e)||Le;return mc(e,t)}function mc(e,t){if(!t.normalize&&t.protocol?.source===Qr.source&&!/^https?:\/\//i.test(e))return jn;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Le}return new URL(e)}catch{return Le}}var hc=/[\t\n\r]/g;function wn(e){return e.replace(hc,"")}function gc(e,t){return t.lastIndex=0,t.test(e.hostname)}function _c(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Mn=p("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=dc(n,t);if(o===jn){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Le){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=wn(n);return}if(t.hostname&&!gc(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!_c(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:wn(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Fn=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Kr()),z.init(e,t)}),Un=p("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Fr:Ur(t.length)),z.init(e,t)}),Bn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rr),z.init(e,t)}),Jn=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Dr),z.init(e,t)}),Gn=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=jr),z.init(e,t)}),Kn=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Lr),z.init(e,t)}),Vn=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mr),z.init(e,t)}),Wn=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=on(t)),z.init(e,t)}),Xn=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rn),z.init(e,t)}),Hn=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=nn(t)),z.init(e,t)}),Yn=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Br),z.init(e,t)}),qn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vr),z.init(e,t)}),xc=/^[0-9a-fA-F:.]+$/;function Qn(e){if(!xc.test(e))return!1;return Ln(`http://[${e}]`)}var eo=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Wr),z.init(e,t),e._zod.check=(r)=>{if(!Qn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var to=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Xr),z.init(e,t)});function yc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Qn(r)}var ro=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Hr),z.init(e,t),e._zod.check=(r)=>{if(!yc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function no(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var kt=/^[0-9a-zA-Z+/]*={0,2}$/,oo=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=kt),z.init(e,t),e._zod.check=(r)=>{if(no(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ue=/^[A-Za-z0-9_-]*$/;function vc(e){if(!Ue.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return no(r)}var io=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ue),z.init(e,t),e._zod.check=(r)=>{if(vc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),so=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=en),z.init(e,t)});function bc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var co=p("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=(r)=>{if(bc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Zt=p("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=xt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),uo=p("$ZodNumberFormat",(e,t)=>{pn.init(e,t),Zt.init(e,t)}),ao=p("$ZodBoolean",(e,t)=>{w.init(e,t),e._zod.pattern=cn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var lo=p("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),po=p("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function zc(e,t){let r=lt(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of lt(e._zod.def.checks))if(c>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,Se(i.issues,l,e),i}}return o(i,s)}}var $c=(e)=>Array.isArray(e)?e.length:-1;function kn(e,t,r){if(e.issues.length)t.issues.push(...Pe(r,e.issues));t.value[r]=e.value}var fo=p("$ZodArray",(e,t)=>{w.init(e,t);let r=N.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>kn(f,n,u)));else if(kn(l,n,u),c&&l.issues.length!==0&&U(l))break}if(s.length)return Promise.all(s).then(()=>n);return n},zc(e,$c)});function Me(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Pe(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var wc=[];function mo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:wc,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=fr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ho(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(U(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let x=a.run({value:t[h],issues:[]},n);if(x instanceof Promise)e.push(x.then((_)=>Me(_,r,h,t,f,d)));else Me(x,r,h,t,f,d)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var kc=p("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ze(()=>mo(t));v(e,"propValues",(a)=>{let l=a.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))M(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=ae,s=t.catchall,c,u=N.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let d=[],m=c.shape,h=l?.abortEarly,x=a.issues.length;for(let _ of c.allKeys){if(h&&a.issues.length!==x){if(U(a,x))break;x=a.issues.length}if(_==="__proto__")continue;let b=m[_],A=b._zod.optin,R=b._zod.optout,V=b._zod.run({value:f[_],issues:[]},l);if(V instanceof Promise)d.push(V.then((Z)=>Me(Z,a,_,f,A,R)));else Me(V,a,_,f,A,R)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return ho(d,f,a,l,o.value,e,h===!0)}}),go=p("$ZodObjectJIT",(e,t)=>{kc.init(e,t);let r=e._zod.parse,n=ze(()=>mo(t)),o=N.memoizer,i=(m)=>{let h=n.value,x=h.symbolKeys,_=new zt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:x}),b=(Z)=>`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`,A=(Z,y)=>`
|
|
7
|
+
let ${Z}_ab = false;
|
|
8
|
+
for (let i = 0; i < ${Z}.issues.length; i++) {
|
|
9
|
+
const iss = ${Z}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${y}, ...iss.path] : [${y}];
|
|
11
|
+
payload.issues.push(iss);
|
|
12
|
+
if (iss.continue !== true) ${Z}_ab = true;
|
|
13
|
+
}
|
|
14
|
+
if (${Z}_ab && ctx && ctx.abortEarly) {
|
|
15
|
+
payload.value = newResult;
|
|
16
|
+
return payload;
|
|
17
|
+
}`;_.write("const input = payload.value;");let R=Object.create(null),V=0;for(let Z of h.allKeys)R[Z]=`key_${V++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let Z of h.allKeys){if(Z==="__proto__")continue;let y=R[Z],E=typeof Z==="symbol"?`syms[${x.indexOf(Z)}]`:ur(Z),rt=`${E} in input`,tr=m[Z],nt=tr?._zod?.optin,rr=nt!==void 0,Ms=tr?._zod?.optout==="optional";if(_.write(`const ${y} = ${b(E)};`),rr&&Ms){let Fs=nt==="optional"?`${y}_present`:`${y}.value !== undefined || ${y}_present`;_.write(`
|
|
18
|
+
const ${y}_present = ${rt};
|
|
19
|
+
if (!${y}.issues.length || ${y}_present) {
|
|
20
|
+
if (${y}.issues.length) {${A(y,E)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${Fs}) {
|
|
24
|
+
newResult[${E}] = ${y}.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`)}else if(!rr)_.write(`
|
|
29
|
+
const ${y}_present = ${rt};
|
|
30
|
+
if (${y}.issues.length) {${A(y,E)}
|
|
31
|
+
}
|
|
32
|
+
if (!${y}_present && !${y}.issues.length) {
|
|
33
|
+
payload.issues.push({
|
|
34
|
+
code: "invalid_type",
|
|
35
|
+
expected: "nonoptional",
|
|
36
|
+
input: undefined,
|
|
37
|
+
path: [${E}]
|
|
38
|
+
});
|
|
39
|
+
if (ctx && ctx.abortEarly) {
|
|
40
|
+
payload.value = newResult;
|
|
41
|
+
return payload;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (${y}_present) {
|
|
46
|
+
newResult[${E}] = ${y}.value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
`);else if(_.write(`
|
|
50
|
+
if (${y}.issues.length) {${A(y,E)}
|
|
51
|
+
}
|
|
52
|
+
`),nt==="defaulted")_.write(`newResult[${E}] = ${y}.value;`);else _.write(`
|
|
53
|
+
if (${y}.value !== undefined || ${rt}) {
|
|
54
|
+
newResult[${E}] = ${y}.value;
|
|
55
|
+
}
|
|
56
|
+
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,c=ae,u=!N.jitless,l=u&&lr.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let x=m.value;if(!c(x))return m.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),m;if(u&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return ho([],x,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function Zn(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!U(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>H(s,n,j())))}),t}var _o=p("$ZodUnion",(e,t)=>{w.init(e,t),v(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),v(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),v(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),v(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>$e(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return Zn(s,n,e,o);return Promise.all(s).then((c)=>Zn(c,n,e,o))}});var xo=p("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>Pn(r,u,a));return Pn(r,i,s)}});function $t(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ne(e)&&ne(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=$t(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=$t(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Pn(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[l]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((l)=>o.keys.includes(l)):[];if(a.length)e.issues.push({...o,keys:a});for(let l of c)if(!a.includes(l)&&i.has(l))e.issues.push(i.get(l))}let u=$t(t.value,r.value);if(!u.valid){if(U(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var yo=p("$ZodEnum",(e,t)=>{w.init(e,t);let r=le(t.entries),n=new Set(r);e._zod.values=n,v(e,"pattern",(o)=>{let i=le(o.def.entries).filter((s)=>pr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>X(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),vo=p("$ZodLiteral",(e,t)=>{w.init(e,t);let r=new Set(t.values);e._zod.values=r,v(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?X(i):i?X(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var bo=p("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",N.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new B;return r.value=o,r}});function Sn(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pt=p("$ZodOptional",(e,t)=>{w.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Sn(r,i));return Sn(r,o)}return t.innerType._zod.run(r,n)}}),zo=p("$ZodExactOptional",(e,t)=>{Pt.init(e,t),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),$o=p("$ZodNullable",(e,t)=>{w.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.source)}|null)$`):void 0}),v(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),wo=p("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>On(i,t));return On(o,t)}});function On(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var ko=p("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Zo=p("$ZodNonOptional",(e,t)=>{w.init(e,t),v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>In(i,e));return In(o,e)}});function In(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function An(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>H(o,n,j()))},input:e.value}),e}var Po=p("$ZodCatch",(e,t)=>{w.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>An(r,i,t,n));return An(r,o,t,n)}});var So=p("$ZodPipe",(e,t)=>{w.init(e,t),v(e,"values",(r)=>r.def.in._zod.values),v(e,"optin",(r)=>r.def.in._zod.optin),v(e,"optout",(r)=>r.def.out._zod.optout),v(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>je(s,t.in,n));return je(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>je(i,t.out,n));return je(o,t.out,n)}});function je(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Oo=p("$ZodReadonly",(e,t)=>{w.init(e,t),v(e,"propValues",(r)=>r.def.innerType._zod.propValues),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"optin",(r)=>r.def.innerType?._zod?.optin),v(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(En);return En(o)}});function En(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Io=p("$ZodCustom",(e,t)=>{O.init(e,t),w.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>Tn(i,r,n,e));Tn(o,r,n,e);return}});function Tn(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ee(o))}}class Eo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Ot="~memo",Ao=[];function To(e){return e!==null&&typeof e==="object"}function St(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var No=new WeakMap,he=0,Ge=1,ge=2;function Ke(e,t,r){let n=No.get(e);if(n!==void 0)return n?ge:he;if(t.has(e))return ge;t.add(e);let o=he,i=(l)=>{if(o!==ge&&l?._zod){let f=Ke(l,t,r);if(f>o)o=f}},s=(l,f)=>{let d=he;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(f&&!h.enumerable)continue;let x=h.get?Ge:h.value?._zod?Ke(h.value,t,r):he;if(x>d)d=x}return d},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=we(u);c(l?s(l,!0):Ge),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let l of u.items)i(l);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let l of u.options)i(l);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);c(l?Ke(l,t,!1):Ge);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 l in u){let f=Object.getOwnPropertyDescriptor(u,l);if(!f||f.get)continue;let d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),Zc(e,o)}function Zc(e,t){if(t!==Ge)No.set(e,t===ge);return t}function Pc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Be,Je=[],Sc={alloc(e,t,r){let n=Be;if(!n)return r;Be=void 0;let o={value:r,issues:null};return n.set(t.value,o),Je.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Oc(i,o.value))throw new Eo;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let b=Ke(e,new Set,!1);if(b===he){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(b===ge||n)r=!0;else n=!0}let l=u.value;if(!To(l))return s(u,a);let f=a[Ot];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[Ot]=f;let d;if(o===a)d=i;else d=Pc(f,e),o=a,i=d;let m=d.get(l);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...St(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}Be=d;let h=Je.length,x=s(u,a);Be=void 0;let _=Je.length>h?Je.pop():void 0;if(x instanceof Promise)return x.then((b)=>{if(_)_.issues=b.issues.length?St(b.issues):Ao;return b});if(_)_.issues=x.issues.length?St(x.issues):Ao;return x};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Co(){return Sc}function Oc(e,t){let r=e[Ot]?.backEdges;return r!==void 0&&To(t)&&r.has(t)}var Ic=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=gr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ut(i.values[0])}`;return`Invalid option: expected one of ${it(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${it(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function It(){return{localeError:Ic()}}var Ro;class Do{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ac(){return new Do}(Ro=globalThis).__zod_globalRegistry??(Ro.__zod_globalRegistry=Ac());var te=globalThis.__zod_globalRegistry;function jo(e){if(e.checks)e.checks=[...e.checks];return e}function Lo(e,t){return new e(jo({type:"string",...g(t)}))}function Mo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Fo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Uo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Jo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Go(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Ko(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Vo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Wo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Xo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Ho(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Yo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function qo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Qo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function ei(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function ti(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function ri(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function ni(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function oi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function ii(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function si(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function ci(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function ui(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function ai(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function li(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function pi(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function fi(e,t){return new e(jo({type:"number",checks:[],...g(t)}))}function di(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function mi(e,t){return new e({type:"boolean",...g(t)})}function hi(e){return new e({type:"unknown"})}function gi(e,t){return new e({type:"never",...g(t)})}function Ve(e,t){return new vt({check:"less_than",...g(t),value:e,inclusive:!1})}function _e(e,t){return new vt({check:"less_than",...g(t),value:e,inclusive:!0})}function We(e,t){return new bt({check:"greater_than",...g(t),value:e,inclusive:!1})}function xe(e,t){return new bt({check:"greater_than",...g(t),value:e,inclusive:!0})}function Xe(e,t){return new ln({check:"multiple_of",...g(t),value:e})}function He(e,t){return new fn({check:"max_length",...g(t),maximum:e})}function oe(e,t){return new dn({check:"min_length",...g(t),minimum:e})}function Ye(e,t){return new mn({check:"length_equals",...g(t),length:e})}function At(e,t){return new hn({check:"string_format",format:"regex",...g(t),pattern:e})}function Et(e){return new gn({check:"string_format",format:"lowercase",...g(e)})}function Tt(e){return new _n({check:"string_format",format:"uppercase",...g(e)})}function Nt(e,t){return new xn({check:"string_format",format:"includes",...g(t),includes:e})}function Ct(e,t){return new yn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Rt(e,t){return new vn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function Y(e){return new bn({check:"overwrite",tx:e})}function Dt(e){return Y((t)=>t.normalize(e))}function jt(){return Y((e)=>e.trim())}function Lt(){return Y((e)=>e.toLowerCase())}function Mt(){return Y((e)=>e.toUpperCase())}function Ft(){return Y((e)=>ar(e))}function _i(e,t,r){return new e({type:"array",element:t,...g(r)})}function xi(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function yi(e,t){let r=Ec((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ee(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ee(i))}},e(n.value,n)),t);return r}function Ec(e,t){let r=new O({check:"custom",...g(t)});return r._zod.check=e,r}function ye(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))M(e,n,r[n]);return e}function Bt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??te,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function K(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function S(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;S(f,t,l),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)ye(s.schema,u);if(t.io==="input"&&I(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function vi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Jt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${vi(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+vi(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let l=c.schema;for(let f in l)delete l[f];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
57
|
+
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function $i(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;$i(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var wi=new Set(["type","properties","required","additionalProperties"]),bi=["oneOf","anyOf"];function zi(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ut(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!wi.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??zi(a);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let u=c.length===1?c[0]:Ut(c)??{allOf:c};M(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=zi(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function Tc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of wi)if(o in e)return;let r=t.filter((o)=>bi.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Ut(t);else{let o=r[0],i=bi.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>Ut([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ye(e,n)}function Gt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,l={...a},f=u.ref;if(u.ref=null,f){n(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(h);else ye(a,h);if(ye(a,l),c._zod.parent===f)for(let _ in a){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete a[_]}if(h.$ref&&m.def)for(let _ in a){if(_==="$ref"||_==="allOf")continue;if(_ in m.def&&JSON.stringify(a[_])===JSON.stringify(m.def[_]))delete a[_]}}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref){if(a.$ref=m.schema.$ref,m.def)for(let h in a){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(a[h])===JSON.stringify(m.def[h]))delete a[h]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())$i(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(a);else c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])Tc(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}ye(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;M(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ve(t,"input",e.processors),output:ve(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function I(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return I(n.element,r);if(n.type==="set")return I(n.valueType,r);if(n.type==="lazy")return I(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return I(n.innerType,r);if(n.type==="intersection")return I(n.left,r)||I(n.right,r);if(n.type==="record"||n.type==="map")return I(n.keyType,r)||I(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return I(n.in,r)||I(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(I(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(I(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(I(o,r))return!0;if(n.rest&&I(n.rest,r))return!0;return!1}return!1}var ki=(e,t={})=>(r)=>{let n=Bt({...r,processors:t});return S(e,n),Jt(n,e),Gt(n,e)},ve=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Bt({...o??{},target:i,io:t,processors:r});return S(e,s),Jt(s,e),Gt(s,e)};var ie=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},se=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Zi=(e,t)=>{ie(e,"minimum",t),se(e,"maximum",t)},Ii=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Ai=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Ei=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ti=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Pi=(e,t)=>ie(e,"minimum",t.minimum),Si=(e,t)=>se(e,"maximum",t.maximum),Oi=(e)=>(t,r)=>{Ti(t,r.format);let[n,o]=e[r.format];ie(t,"minimum",n),se(t,"maximum",o)},Nc={greater_than:(e,t)=>ie(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>se(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ii(e,t.value),number_format:Oi(ke),bigint_format:Oi(at),min_length:Pi,max_length:Si,length_equals:(e,t)=>Zi(e,t.length),min_size:Pi,max_size:Si,size_equals:(e,t)=>Zi(e,t.size),string_format:(e,t)=>{if(Ti(e,t.format),t.pattern)Ai(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Ei(e,t.mime)};function L(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Nc[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ie(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ie(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)se(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)se(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Ii(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Ei(t,o.mime);for(let i of o.patterns??[])Ai(t,i);return t}var Cc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Rc=new Map([[kt,Yr],[Ue,qr]]),Dc=(e)=>Rc.get(e)??e,Ni=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=L(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=Cc[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(Dc);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Ci=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=L(e);o.type=l?"integer":"number";let f=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),d=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(m)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(d)if(m)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.maximum=s;if(c){let h=new Set;for(let b of c)if(Number.isFinite(b)&&b!==0)h.add(Math.abs(b));else K(e,t,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[x,..._]=h;if(x!==void 0)o.multipleOf=x;if(_.length)o.allOf=[...o.allOf??[],..._.map((b)=>({multipleOf:b}))]}},Ri=(e,t,r,n)=>{r.type="boolean"};var Di=(e,t,r,n)=>{r.not={}};var ji=(e,t,r,n)=>{};var Li=(e,t,r,n)=>{let o=e._zod.def,i=le(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},Mi=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}};var Fi=(e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Ui=(e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Bi=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=L(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=S(i.element,t,{...n,path:[...n.path,"items"]})};function Kt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Kt(t.out);if(t.type==="catch")return Kt(t.innerType);return e._zod.optin}var Ji=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)M(o.properties,a,S(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];if(t.io==="input"?Kt(l)===void 0:l._zod.optout===void 0)u.push(a)}if(u.length>0)o.required=u;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=S(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Gi=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>S(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},Ki=(e,t,r,n)=>{let o=e._zod.def,i=S(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=S(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)};var Vi=(e,t,r,n)=>{let o=e._zod.def,i=S(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Wi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Vt=Symbol();function Xi(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Vt}var Hi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Xi(o.defaultValue,e,t,r,n);if(s!==Vt)r.default=s},Yi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Xi(o.defaultValue,e,t,r,n);if(s!==Vt)r._prefault=s},qi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Qi=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;S(s,t,n);let c=t.seen.get(e);c.ref=s},es=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Wt=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var ts=new WeakSet([Object.prototype,Error.prototype]);function qe(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Gc=(e,t)=>{wr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ts.has(r))return;ts.add(r),qe(r,"format",(n)=>(o)=>Zr(n,o)),qe(r,"flatten",(n)=>(o)=>kr(n,o)),qe(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,pe,2)}),qe(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,pe,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var C=p("ZodError",Gc,void 0,{Parent:Error});var rs=Te(C),ns=Ne(C),os=Ce(C),is=Re(C),ss=Sr(C),cs=Or(C),us=Ir(C),as=Ar(C),ls=Er(C),ps=Tr(C),fs=Nr(C),ds=Cr(C);function Vc(){if(!N.localeError)j(It())}function Yt(){if(!N.memoizer)j({memoizer:Co()})}var P=p("ZodType",(e,t)=>(Vc(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return F(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gu(e,t))},superRefine(e,t){return this.check(Ku(e,t))},overwrite(e){return this.check(Y(e))},optional(){return gs(this)},exactOptional(){return Eu(this)},nullable(){return _s(this)},nullish(){return gs(_s(this))},nonoptional(e){return ju(this,e)},array(){return $u(this)},or(e){return Zu([this,e])},and(e){return Su(this,e)},transform(e){return xs(this,Au(e))},default(e){return Cu(this,e)},prefault(e){return Du(this,e)},catch(e){return Mu(this,e)},pipe(e){return xs(this,e)},readonly(){return Bu(this)},describe(e){let t=this.clone();return te.add(t,{description:e}),t},meta(...e){if(e.length===0)return te.get(this);let t=this.clone();return te.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ae(this,"~standard",{...wt(this),jsonSchema:{input:ve(this,"input"),output:ve(this,"output")}})},set "~standard"(e){G(this,"~standard",e)},parse:function e(t,r){return rs(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await ns(this,t,r,{callee:e})},safeParse(e,t){return os(this,e,t)},async safeParseAsync(e,t){return is(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){G(this,"spa",e)},validate(e,t){return mt(this,e,t)},validateAsync(e,t){return ht(this,e,t)},encode:function e(t,r){return ss(this,t,r,{callee:e})},decode:function e(t,r){return cs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await us(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await as(this,t,r,{callee:e})},safeEncode(e,t){return ls(this,e,t)},safeDecode(e,t){return ps(this,e,t)},async safeEncodeAsync(e,t){return fs(this,e,t)},async safeDecodeAsync(e,t){return ds(this,e,t)},toJSONSchema(e){return ki(this,{})(e)},get description(){return te.get(this)?.description},get _def(){return this._zod.def}}),ys=p("_ZodString",(e,t)=>{Fe.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o)},xr({format:(e)=>L(e).format??null,minLength:(e)=>L(e).minimum??null,maxLength:(e)=>L(e).maximum??null},{regex(...e){return this.check(At(...e))},includes(...e){return this.check(Nt(...e))},startsWith(...e){return this.check(Ct(...e))},endsWith(...e){return this.check(Rt(...e))},min(...e){return this.check(oe(...e))},max(...e){return this.check(He(...e))},length(...e){return this.check(Ye(...e))},nonempty(...e){return this.check(oe(1,...e))},lowercase(e){return this.check(Et(e))},uppercase(e){return this.check(Tt(e))},trim(){return this.check(jt())},normalize(...e){return this.check(Dt(...e))},toLowerCase(){return this.check(Lt())},toUpperCase(){return this.check(Mt())},slugify(){return this.check(Ft())}})),Wc=p("ZodString",(e,t)=>{Fe.init(e,t),ys.init(e,t)},{email(e){return this.check(Mo(Qc,e))},url(e){return this.check(Ko(tu,e))},jwt(e){return this.check(ci(gu,e))},emoji(e){return this.check(Vo(ru,e))},guid(e){return this.check(Fo(eu,e))},uuid(e){return this.check(Uo(Qe,e))},uuidv4(e){return this.check(Bo(Qe,e))},uuidv6(e){return this.check(Jo(Qe,e))},uuidv7(e){return this.check(Go(Qe,e))},nanoid(e){return this.check(Wo(nu,e))},cuid(e){return this.check(Xo(ou,e))},cuid2(e){return this.check(Ho(iu,e))},ulid(e){return this.check(Yo(su,e))},base64(e){return this.check(oi(du,e))},base64url(e){return this.check(ii(mu,e))},xid(e){return this.check(qo(cu,e))},ksuid(e){return this.check(Qo(uu,e))},ipv4(e){return this.check(ei(au,e))},ipv6(e){return this.check(ti(lu,e))},cidrv4(e){return this.check(ri(pu,e))},cidrv6(e){return this.check(ni(fu,e))},e164(e){return this.check(si(hu,e))},datetime(e){return this.check(ui(Xc,e))},date(e){return this.check(ai(Hc,e))},time(e){return this.check(li(Yc,e))},duration(e){return this.check(pi(qc,e))}});function ce(e){return Lo(Wc,e)}var k=p("ZodStringFormat",(e,t)=>{z.init(e,t),ys.init(e,t)}),Xc=p("ZodISODateTime",(e,t)=>{Wn.init(e,t),k.init(e,t)}),Hc=p("ZodISODate",(e,t)=>{Xn.init(e,t),k.init(e,t)}),Yc=p("ZodISOTime",(e,t)=>{Hn.init(e,t),k.init(e,t)}),qc=p("ZodISODuration",(e,t)=>{Yn.init(e,t),k.init(e,t)}),Qc=p("ZodEmail",(e,t)=>{Dn.init(e,t),k.init(e,t)});var eu=p("ZodGUID",(e,t)=>{Cn.init(e,t),k.init(e,t)});var Qe=p("ZodUUID",(e,t)=>{Rn.init(e,t),k.init(e,t)});var tu=p("ZodURL",(e,t)=>{Mn.init(e,t),k.init(e,t)});var ru=p("ZodEmoji",(e,t)=>{Fn.init(e,t),k.init(e,t)});var nu=p("ZodNanoID",(e,t)=>{Un.init(e,t),k.init(e,t)});var ou=p("ZodCUID",(e,t)=>{Bn.init(e,t),k.init(e,t)});var iu=p("ZodCUID2",(e,t)=>{Jn.init(e,t),k.init(e,t)});var su=p("ZodULID",(e,t)=>{Gn.init(e,t),k.init(e,t)});var cu=p("ZodXID",(e,t)=>{Kn.init(e,t),k.init(e,t)});var uu=p("ZodKSUID",(e,t)=>{Vn.init(e,t),k.init(e,t)});var au=p("ZodIPv4",(e,t)=>{qn.init(e,t),k.init(e,t)});var lu=p("ZodIPv6",(e,t)=>{eo.init(e,t),k.init(e,t)});var pu=p("ZodCIDRv4",(e,t)=>{to.init(e,t),k.init(e,t)});var fu=p("ZodCIDRv6",(e,t)=>{ro.init(e,t),k.init(e,t)});var du=p("ZodBase64",(e,t)=>{oo.init(e,t),k.init(e,t)});var mu=p("ZodBase64URL",(e,t)=>{io.init(e,t),k.init(e,t)});var hu=p("ZodE164",(e,t)=>{so.init(e,t),k.init(e,t)});var gu=p("ZodJWT",(e,t)=>{co.init(e,t),k.init(e,t)});var vs=p("ZodNumber",(e,t)=>{Zt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ci(e,r,n,o),e.isFinite=!0},xr({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=L(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=L(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=L(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>L(e).format??null},{gt(e,t){return this.check(We(e,t))},gte(e,t){return this.check(xe(e,t))},min(e,t){return this.check(xe(e,t))},lt(e,t){return this.check(Ve(e,t))},lte(e,t){return this.check(_e(e,t))},max(e,t){return this.check(_e(e,t))},int(e){return this.check(ms(e))},safe(e){return this.check(ms(e))},positive(e){return this.check(We(0,e))},nonnegative(e){return this.check(xe(0,e))},negative(e){return this.check(Ve(0,e))},nonpositive(e){return this.check(_e(0,e))},multipleOf(e,t){return this.check(Xe(e,t))},step(e,t){return this.check(Xe(e,t))},finite(){return this}}));function et(e){return fi(vs,e)}var _u=p("ZodNumberFormat",(e,t)=>{uo.init(e,t),vs.init(e,t)});function ms(e){return di(_u,e)}var xu=p("ZodBoolean",(e,t)=>{ao.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ri(e,r,n,o)});function be(e){return mi(xu,e)}var yu=p("ZodUnknown",(e,t)=>{lo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ji(e,r,n,o)});function hs(){return hi(yu)}var vu=p("ZodNever",(e,t)=>{po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Di(e,r,n,o)});function bu(e){return gi(vu,e)}var zu=p("ZodArray",(e,t)=>{Yt(),fo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bi(e,r,n,o),e.element=t.element},{min(e,t){return this.check(oe(e,t))},nonempty(e){return this.check(oe(1,e))},max(e,t){return this.check(He(e,t))},length(e,t){return this.check(Ye(e,t))},unwrap(){return this.element}});function $u(e,t){return _i(zu,e,t)}var wu=p("ZodObject",(e,t)=>{Yt(),go.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ji(e,r,n,o),Qs(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return bs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(T(this._zod.def,{catchall:e}))},passthrough(){return this.clone(T(this._zod.def,{catchall:hs()}))},loose(){return this.clone(T(this._zod.def,{catchall:hs()}))},strict(){return this.clone(T(this._zod.def,{catchall:bu()}))},strip(){return this.clone(T(this._zod.def,{catchall:void 0}))},extend(e){return Gs(this,e)},safeExtend(e){return Ks(this,e)},merge(e){return Vs(this,e)},pick(e){return Bs(this,e)},omit(e){return Js(this,e)},partial(...e){return mr(zs,this,e[0])},exactPartial(...e){return mr($s,this,e[0],"exactPartial")},required(...e){return Ws(ws,this,e[0])}});function tt(e,t){let r={type:"object",shape:e??{},...g(t)};return new wu(r)}var ku=p("ZodUnion",(e,t)=>{_o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gi(e,r,n,o),e.options=t.options});function Zu(e,t){return new ku({type:"union",options:e,...g(t)})}var Pu=p("ZodIntersection",(e,t)=>{xo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ki(e,r,n,o)});function Su(e,t){return new Pu({type:"intersection",left:e,right:t})}var Ht=p("ZodEnum",(e,t)=>{yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Li(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...g(o),entries:i})}});function bs(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Ht({type:"enum",entries:r,...g(t)})}var Ou=p("ZodLiteral",(e,t)=>{vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mi(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function qt(e,t){return new Ou({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var Iu=p("ZodTransform",(e,t)=>{Yt(),bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ui(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ee(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function Au(e){return new Iu({type:"transform",transform:e})}var zs=p("ZodOptional",(e,t)=>{Pt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new zs({type:"optional",innerType:e})}var $s=p("ZodExactOptional",(e,t)=>{zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Eu(e){return new $s({type:"optional",innerType:e})}var Tu=p("ZodNullable",(e,t)=>{$o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _s(e){return new Tu({type:"nullable",innerType:e})}var Nu=p("ZodDefault",(e,t)=>{wo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cu(e,t){return new Nu({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ct(t)}})}var Ru=p("ZodPrefault",(e,t)=>{ko.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Du(e,t){return new Ru({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ct(t)}})}var ws=p("ZodNonOptional",(e,t)=>{Zo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ju(e,t){return new ws({type:"nonoptional",innerType:e,...g(t)})}var Lu=p("ZodCatch",(e,t)=>{Po.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mu(e,t){return new Lu({type:"catch",innerType:e,catchValue:typeof t==="function"?t:yr(t)})}var Fu=p("ZodPipe",(e,t)=>{So.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o),e.in=t.in,e.out=t.out});function xs(e,t){return new Fu({type:"pipe",in:e,out:t})}var Uu=p("ZodReadonly",(e,t)=>{Oo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>es(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Bu(e){return new Uu({type:"readonly",innerType:e})}var Ju=p("ZodCustom",(e,t)=>{Io.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fi(e,r,n,o)});function Gu(e,t={}){return xi(Ju,e,t)}function Ku(e,t){return yi(e,t)}var Wu=bs(["version","top","git-directory","common-directory","head","remotes","numstat-head","numstat-cached","status","index-identity","refs-identity","config-identity"]),ks={version:["--version"],top:["rev-parse","--show-toplevel"],"git-directory":["rev-parse","--absolute-git-dir"],"common-directory":["rev-parse","--path-format=absolute","--git-common-dir"],head:["rev-parse","--verify","--quiet","HEAD"],remotes:["remote"],"numstat-head":["diff","--numstat","HEAD"],"numstat-cached":["diff","--numstat","--cached"],status:["status","--porcelain=v1","-z","--branch","--ignored=traditional"],"index-identity":["ls-files","--stage","-z","--"],"refs-identity":["for-each-ref","--format=%(refname) %(objectname) %(symref)"],"config-identity":["config","--null","--list","--includes","--show-origin"]},Xu=tt({directory:ce().min(1).max(4096),gitDirectory:ce().min(1).max(4096),commonDirectory:ce().min(1).max(4096)}).strict(),Zs=tt({type:qt("git-status-run-v1"),id:et().int().positive().max(Number.MAX_SAFE_INTEGER),operation:Wu,directory:ce().min(1).max(4096),executable:ce().min(1).max(4096),repository:Xu.optional()}).strict(),Ps=tt({type:qt("git-status-abort-v1"),id:et().int().positive().max(Number.MAX_SAFE_INTEGER)}).strict(),Sp=tt({type:qt("git-status-result-v1"),id:et().int().positive(),code:et().int(),stdout:ce().max(3145728),truncated:be(),cancelled:be(),timedOut:be(),notRepository:be(),stderrPresent:be()}).strict(),Ss=(e)=>e==="version"||e==="top"||e==="git-directory"||e==="common-directory";var Os=["--no-pager","-c","core.fsmonitor=false","-c","gc.auto=0","-c","maintenance.auto=false"],Is=(e)=>e?[`--git-dir=${e.gitDirectory}`,`--work-tree=${e.directory}`]:[];function As(e){let t=/^git version (\d+)\.(\d+)/.exec(e);return!!t&&(+t[1]>2||+t[1]===2&&+t[2]>=36)}var Hu=(e="1")=>({GIT_OPTIONAL_LOCKS:"0",GIT_LITERAL_PATHSPECS:e,GIT_TERMINAL_PROMPT:"0",GIT_PAGER:"cat",LC_ALL:"C"});function Es(e,t){let r={...process.env,...Hu()};for(let n of e)delete r[n];if(t)r.GIT_COMMON_DIR=t.commonDirectory;return r}function Ts(e){let t;return{terminate(){if(e.exitCode!==null||e.signalCode!==null)return;if(e.kill("SIGTERM"),t===void 0)t=setTimeout(()=>e.kill("SIGKILL"),500),t.unref()},clear(){if(t!==void 0)clearTimeout(t)}}}function Ns(e,t,r){let n=Buffer.alloc(0);return(o)=>{if(n=Buffer.concat([n,o]),n.length>e){t();return}for(;;){let i=n.indexOf(10);if(i<0)return;let s=n.subarray(0,i);n=n.subarray(i+1);let c;try{c=JSON.parse(s.toString("utf8"))}catch{t();return}if(r(c)===!1)return}}}var er=!1,Qt,Cs=!1,re,Ls=()=>process.stdout.write("",()=>process.exit(0)),q=()=>{if(er=!0,re?.cancel(),!re)Ls()};process.on("SIGTERM",q);process.on("SIGINT",q);process.stdin.on("error",q);process.stdout.on("error",q);process.stdin.on("end",q);var Yu=Ns(65536,q,(e)=>{let t=Ps.safeParse(e);if(t.success){if(re?.id===t.data.id)re.cancel();return}let r=Zs.safeParse(e);if(!r.success||re)return q(),!1;let n=r.data,o=Ss(n.operation),i=n.repository;if(![n.directory,n.executable,...Object.values(i??{})].every(Ds.isAbsolute)||o===Boolean(i)||Qt!==void 0&&Qt!==n.executable||n.operation!=="version"&&!Cs)return q(),!1;Qt=n.executable;let s=Es(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR"],i),c=[...Os,...Is(i),...ks[n.operation]],u=n.operation.endsWith("-identity"),a=Rs.spawn(n.executable,c,{cwd:u?i.directory:n.directory,env:{...s,HOME:process.env.HOME,USERPROFILE:process.env.USERPROFILE},stdio:["pipe","pipe","pipe"],windowsHide:!0});a.stdin.on("error",()=>{return}),a.stdin.end();let l=Buffer.alloc(0),f=Buffer.alloc(0),d=!1,m=!1,h=!1,x=!1,_=u?js.createHash("sha256"):void 0,b=0,A=Ts(a),R=A.terminate,V=setTimeout(()=>{h=!0,R()},1e4);V.unref(),re={id:n.id,child:a,cancel(){m=!0,R()}},a.stdout.on("data",(y)=>{if(_){if(b+=y.length,b>67108864)d=!0,R();else _.update(y);return}let E=2097152-l.length;if(l=Buffer.concat([l,y.subarray(0,E)]),y.length>E)d=!0,R()}),a.stderr.on("data",(y)=>{if(f.length<65536)f=Buffer.concat([f,y.subarray(0,65536-f.length)])});let Z=()=>{x=!0,R()};a.stdout.on("error",Z),a.stderr.on("error",Z),a.on("error",()=>{return}),a.on("close",(y)=>{if(clearTimeout(V),A.clear(),_)l=Buffer.from(_.digest("hex"));if(n.operation==="version"&&y===0&&!d&&!m&&!h)Cs=As(l.toString("utf8"));if(process.stdout.write(JSON.stringify({type:"git-status-result-v1",id:n.id,code:x?127:y??127,stdout:l.toString("base64"),truncated:d,cancelled:m,timedOut:h,notRepository:/not a git repository/i.test(f.toString("utf8")),stderrPresent:f.length>0})+`
|
|
59
|
+
`),re=void 0,er)Ls()})});process.stdin.on("data",(e)=>{if(!er)Yu(e)});
|