buildkeel 0.3.0 → 0.4.0
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/antigravity/dist/hooks/main.js +151 -15
- package/antigravity/dist/server/main.js +327 -314
- package/antigravity/package.json +1 -1
- package/antigravity/plugin.json +1 -1
- package/antigravity/rules/buildkeel.md +7 -5
- package/antigravity/skills/bk-approve/SKILL.md +11 -8
- package/antigravity/skills/bk-build/SKILL.md +93 -27
- package/antigravity/skills/bk-capture/SKILL.md +32 -14
- package/antigravity/skills/bk-done/SKILL.md +16 -6
- package/antigravity/skills/bk-impact/SKILL.md +5 -5
- package/antigravity/skills/bk-init/SKILL.md +4 -4
- package/antigravity/skills/bk-migrate/SKILL.md +32 -8
- package/antigravity/skills/bk-new/SKILL.md +4 -4
- package/antigravity/skills/bk-onboard/SKILL.md +11 -18
- package/antigravity/skills/bk-stats/SKILL.md +1 -1
- package/antigravity/skills/bk-status/SKILL.md +1 -1
- package/cli.mjs +1 -1
- package/package.json +1 -1
- package/antigravity/skills/bk-adhoc/SKILL.md +0 -49
- package/antigravity/skills/bk-start/SKILL.md +0 -44
package/cli.mjs
CHANGED
|
@@ -197,7 +197,7 @@ ${c}`:c:"",l=Function,d=`return (input) => {
|
|
|
197
197
|
${c}
|
|
198
198
|
}`,f;try{f=new l(...a,d)(...s)}catch(m){throw new L(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(f.code=u),f.definite=o.definite,f}function j(e,t){for(let[o,n]of e.constants)if(n===t)return o;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function xt(e,t){return e.definite=!1,j(e,t)}function D(e){return`v${e.varCounter++}`}function aO(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return se;let o=r;return o.issues.length===0?o.value:se}function ie(e,t,r,o,n=!0){let i=e.content.length,a=t.constants.size,s=t.constantCounter,c=t.varCounter;try{return K(e,t,r,o,n)}catch(u){if(!(u instanceof L)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>a){let l=Array.from(t.constants.keys()).slice(a);for(let d of l)t.constants.delete(d)}return t.constantCounter=s,t.varCounter=c,sO(e,t,r,o)}}function sO(e,t,r,o){t.definite=!1;let n=j(t,r),i=j(t,aO),a=D(t);return e.write(`const ${a} = ${i}(${n}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}var cO=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function uO(e,t,r,o){let n=r._zod.def.checks;if(!n||n.length===0)return o;let i=o;for(let a of n){let s=a._zod.def;if(s.when&&!cO.has(s.check))throw new L('check with a custom "when" condition');switch(s.check){case"greater_than":lO(e,t,s,i);break;case"less_than":dO(e,t,s,i);break;case"multiple_of":fO(e,t,s,i);break;case"number_format":x$(e,s,i);break;case"min_length":{let c=St(s.minimum,"min_length"),u=Md(e,t,i,`${i}.length >= ${c} && ${i}.length < ${s.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=St(s.maximum,"max_length"),u=Md(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=St(s.length,"length_equals"),u=Md(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${s.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${St(s.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${St(s.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${St(s.size,"size_equals")}) return INVALID;`);break;case"string_format":i=z$(e,t,s,i);break;case"custom":i=yO(e,t,a,i);break;case"bigint_format":mO(e,s,i);break;case"mime_type":pO(e,t,s,i);break;case"property":hO(e,t,s,i);break;case"properties":gO(e,t,s,i);break;case"overwrite":{let c=D(t);vO(e,t,a,i,c),i=c;break}default:throw new L(`check type ${s.check}`)}}return i}function Md(e,t,r,o){let n=j(t,bt),i=D(t);return e.write(`const ${i} = typeof ${r} === "string" && ${o} ? ${n}(${r}) : ${r}.length;`),i}function St(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new L(`${t} bound of type ${typeof e}`);return`${e}`}function I$(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new L("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new L("comparison check with Invalid Date bound");return j(e,t)}throw new L(`comparison check bound of type ${typeof t}`)}function lO(e,t,r,o){let n=r.inclusive?"<":"<=";e.write(`if (${o} ${n} ${I$(t,r.value)}) return INVALID;`)}function dO(e,t,r,o){let n=r.inclusive?">":">=";e.write(`if (${o} ${n} ${I$(t,r.value)}) return INVALID;`)}function fO(e,t,r,o){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new L("multiple_of check with a zero divisor");e.write(`if (${o} % ${r.value}n !== 0n) return INVALID;`)}else{let n=j(t,mr);e.write(`if (${n}(${o}, ${St(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function x$(e,t,r){let o=t.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new L(`number format ${o}`)}}function mO(e,t,r){let o=t.format;if(o)switch(o){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new L(`bigint format ${o}`)}}function pO(e,t,r,o){let n=r.mime;if(n&&n.length>0){let i=j(t,new Set(n));e.write(`if (!${i}.has(${o}.type)) return INVALID;`)}}function gO(e,t,r,o){if(r.when)throw new L('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let n=r.shape;for(let i of Reflect.ownKeys(n)){let a=typeof i=="symbol"?j(t,i):oe(i),s=D(t);e.write(`const ${s} = ${o}[${a}];`),ie(e,t,n[i],s,!1)}}function hO(e,t,r,o){let n=`${o}[${JSON.stringify(r.property)}]`;K(e,t,r.schema,n)}function vO(e,t,r,o,n){let i=r._zod.def.tx;if(!i)throw new L("overwrite check without a transform function");if(zt(i))throw new ze("z.compile: async overwrite transforms are not supported");let a=j(t,i);e.write(`const ${n} = ${a}(${o});`)}function Rd(){throw new pe}function Fd(e){this.issues.push(e)}function yO(e,t,r,o){let n=r._zod.def;if(n.fn){if(zt(n.fn))throw new ze("z.compile: async .refine() predicates are not supported");let i=xt(t,n.fn),a=j(t,Rd),s=D(t);return e.write(`const ${s} = ${i}(${o});`),e.write(`if (${s} instanceof Promise) ${a}();`),e.write(`if (!${s}) return INVALID;`),o}if(r._zod.check){if(zt(r._zod.check))throw new ze("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,s=xt(t,u=>{let l={value:u,issues:[],addIssue:Fd};return i(l)instanceof Promise&&Rd(),l.issues.length===0?l.value:se}),c=D(t);return e.write(`const ${c} = ${s}(${o});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new L("custom check without a predicate or check function")}var $O=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function z$(e,t,r,o,n=!0){let i=r.format;if(i==="base64"){let u=j(t,Dr);return e.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="base64url"){let u=j(t,Fo);return e.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="jwt"){let u=j(t,Jo),l=j(t,r.alg??null);return e.write(`if (!${u}(${o}, ${l})) return INVALID;`),o}if(i==="ipv6"){let u=j(t,Ar);return e.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="cidrv6"){let u=j(t,Vo);return e.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="credit_card"){let u=j(t,Bo);return e.write(`if (!${u}(${o})) return INVALID;`),o}if(i==="iban"){let u=j(t,Ko);return e.write(`if (!${u}(${o})) return INVALID;`),o}let a=r;if(i==="url"||i==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let u=j(t,Zo),l=j(t,r),d=D(t),f=D(t);if(e.write(`const ${d} = ${o}.trim();`),e.write(`const ${f} = ${u}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),a.hostname!==void 0){let p=j(t,Mo);e.write(`if (!${p}(${f}, ${l}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let p=j(t,Ro);e.write(`if (!${p}(${f}, ${l}.protocol)) return INVALID;`)}if(!n)return null;let m=D(t),g=a.normalize?`${f}.href`:`${j(t,Pr)}(${d})`;return e.write(`const ${m} = ${g};`),m}let s=r.fn;if(s){if(zt(s))throw new L(`async string format ${i}`);let u=j(t,s);return e.write(`if (!${u}(${o})) return INVALID;`),o}if($O.has(i)&&r.pattern){let u=j(t,r.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${o})) return INVALID;`),o}let c=r.format;switch(c){case"regex":throw new L("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${oe(r.includes)})) return INVALID;`);break;case"starts_with":{let u=r.prefix;e.write(`if (${o}.slice(0, ${u.length}) !== ${oe(u)}) return INVALID;`);break}case"ends_with":{let u=r.suffix;e.write(`if (${o}.slice(-${u.length}) !== ${oe(u)}) return INVALID;`);break}default:throw new L(`string format ${c}`)}return o}function K(e,t,r,o,n=!0){let i=r._zod.def,a=i.type;if(i.coerce)throw new L(`coercion (z.coerce.${a}())`);let s=n||!!i.checks?.length,c;switch(a){case"string":c=bO(e,t,r,o,s);break;case"number":c=_O(e,r,o);break;case"boolean":c=kO(e,o);break;case"bigint":c=wO(e,r,o);break;case"symbol":c=SO(e,o);break;case"undefined":c=IO(e,o);break;case"null":c=xO(e,o);break;case"any":case"unknown":c=o;break;case"never":e.write("return INVALID;"),c=o;break;case"void":c=zO(e,o);break;case"nan":c=NO(e,o);break;case"date":c=OO(e,o);break;case"object":c=PO(e,t,r,o,s);break;case"optional":c=AO(e,t,r,o,s);break;case"nullable":c=TO(e,t,r,o,s);break;case"array":c=UO(e,t,r,o,s);break;case"literal":c=EO(e,t,r,o);break;case"enum":c=CO(e,t,r,o);break;case"readonly":{let u=k$(e,t,r,o),l=D(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":k$(e,t,r,o),c="true";break;case"default":case"prefault":c=LO(e,t,r,o);break;case"nonoptional":c=ZO(e,t,r,o);break;case"tuple":c=MO(e,t,r,o);break;case"union":c=RO(e,t,r,o);break;case"intersection":c=FO(e,t,r,o);break;case"record":c=BO(e,t,r,o);break;case"map":c=JO(e,t,r,o);break;case"set":c=GO(e,t,r,o);break;case"file":c=WO(e,o);break;case"template_literal":c=YO(e,t,r,o);break;case"lazy":c=XO(e,t,r,o);break;case"pipe":c=HO(e,t,r,o);break;case"custom":c=QO(e,t,r,o);break;case"transform":c=nP(e,t,r,o);break;case"catch":c=tP(e,t,r,o);break;default:throw new L(`schema type ${a}`)}return c===null?null:uO(e,t,r,c)}function bO(e,t,r,o,n=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?o:z$(e,t,i,o,n)}function _O(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let o=t._zod.def;return o.check==="number_format"&&o.format&&x$(e,{format:o.format},r),r}function kO(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function wO(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let o=t._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function SO(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function IO(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function xO(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function zO(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function NO(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function OO(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function PO(e,t,r,o,n=!0){let i=r._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=i.shape,s=Object.keys(a),c=Object.getOwnPropertySymbols(a),u=c.length?[...s,...c]:s,l=k=>typeof k=="symbol"?j(t,k):oe(k),d=k=>typeof k=="symbol"?`[${l(k)}]`:oe(k),f=a;if(s.includes("__proto__"))throw new L('object shape key "__proto__"');let m=new Map;for(let k of u){let S=f[k],x=l(k),P=D(t);if(e.write(`const ${P} = ${o}[${x}];`),S._zod.optin!==void 0){let z=D(t);e.write(`let ${z} = (() => {`),e.indented(U=>{let A=ie(U,t,S,P);U.write(`return ${A};`)}),e.write("})();"),S._zod.optout==="optional"?(e.write(`if (${z} === INVALID) {`),e.indented(U=>{U.write(`if (${x} in ${o}) return INVALID;`),U.write(`${z} = undefined;`)}),e.write("}")):e.write(`if (${z} === INVALID) return INVALID;`),m.set(k,z)}else{jO(S)&&e.write(`if (!(${x} in ${o})) return INVALID;`);let z=ie(e,t,S,P,n);z!==null&&m.set(k,z)}}let g=i.catchall,p="none";if(g){let k=g._zod.def.type;if(k==="never"){let S=s.map(x=>`k !== ${oe(x)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(x=>{x.write(`if (${S}) return INVALID;`)}),e.write("}")}else(k==="unknown"||k==="any")&&!g._zod.def.checks?.length?p="passthrough":p="schema"}let y=D(t),w=u.some(k=>_$(f[k])||Vd(f[k]));if(!n){if(p==="schema"){let k=s.length>0?j(t,new Set(s)):null;e.write(`for (const k in ${o}) {`),e.indented(S=>{S.write('if (k === "__proto__") continue;'),k&&S.write(`if (${k}.has(k)) continue;`);let x=D(t);S.write(`const ${x} = ${o}[k];`),ie(S,t,g,x,!1)}),e.write("}")}return null}if(w){e.write(`const ${y} = {};`);for(let k of u){let S=l(k),x=m.get(k);Vd(f[k])?e.write(`if (${S} in ${o}) ${y}[${S}] = ${x};`):_$(f[k])?e.write(`if (${x} !== undefined || ${S} in ${o}) ${y}[${S}] = ${x};`):e.write(`${y}[${S}] = ${x};`)}}else{let k=u.map(S=>`${d(S)}: ${m.get(S)}`).join(", ");e.write(`const ${y} = { ${k} };`)}if(p!=="none"){let k=s.length>0?j(t,new Set(s)):null;e.write(`for (const k in ${o}) {`),e.indented(S=>{if(S.write('if (k === "__proto__") continue;'),k&&S.write(`if (${k}.has(k)) continue;`),p==="passthrough")S.write(`${y}[k] = ${o}[k];`);else{let x=D(t);S.write(`const ${x} = ${o}[k];`);let P=ie(S,t,g,x);S.write(`${y}[k] = ${P};`)}}),e.write("}")}return y}function AO(e,t,r,o,n=!0){let i=r._zod.def;if(DO(r))return K(e,t,i.innerType,o,n);if(i.innerType._zod.optin==="defaulted"){let s=D(t),c=D(t);return e.write(`let ${s};`),e.write(`if (${o} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let d=K(l,t,i.innerType,o);l.write(`return ${d};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${s} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=K(u,t,i.innerType,o);u.write(`${s} = ${l};`)}),e.write("}"),s}let a=n?D(t):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let c=K(s,t,i.innerType,o,n);a&&c!==null&&s.write(`${a} = ${c};`)}),e.write("}"),a}function DO(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function jO(e){return e._zod.optin===void 0&&It(e)}function It(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?It(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?It(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(It):!0;case"intersection":return!t.left||!t.right?!0:It(t.left)&&It(t.right);case"pipe":return t.in?It(t.in):!0;default:return!0}}function Vd(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function _$(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&dn(e)}function dn(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?dn(t.innerType):!0;case"union":return t.options?t.options.some(dn):!0;case"intersection":return!t.left||!t.right||dn(t.left)||dn(t.right);case"pipe":return t.out?dn(t.out):!0;default:return!0}}function TO(e,t,r,o,n=!0){let i=r._zod.def,a=n?D(t):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(s=>{let c=K(s,t,i.innerType,o,n);a&&c!==null&&s.write(`${a} = ${c};`)}),e.write("}"),a}function UO(e,t,r,o,n=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`);let a=n?D(t):null,s=D(t),c=D(t);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${s} = 0; ${s} < ${o}.length; ${s}++) {`),e.indented(u=>{u.write(`const ${c} = ${o}[${s}];`);let l=ie(u,t,i.element,c,n);a&&l!==null&&u.write(`${a}[${s}] = ${l};`)}),e.write("}"),a}function EO(e,t,r,o){let i=r._zod.def.values;if(i.length!==1){let s=j(t,new Set(i));return e.write(`if (!${s}.has(${o})) return INVALID;`),o}let a=i[0];if(typeof a=="number"&&Number.isNaN(a)){let s=j(t,new Set(i));return e.write(`if (!${s}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${oe(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new L(`literal type ${typeof a}`);return o}function CO(e,t,r,o){let n=r._zod.values;if(!n)throw new L("enum schema without enumerated values");let i=j(t,n);return e.write(`if (!${i}.has(${o})) return INVALID;`),o}function k$(e,t,r,o){let n=r._zod.def;return K(e,t,n.innerType,o)}function LO(e,t,r,o){let n=r._zod.def,a=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!a)return K(e,t,n.innerType,o);let c=j(t,a),u=D(t);return e.write(`let ${u} = ${o};`),e.write(`if (${o} === undefined) ${u} = ${c}();`),K(e,t,n.innerType,u)}let s=D(t);if(a){let c=j(t,a),u=j(t,pr);e.write(`let ${s};`),e.write(`if (${o} === undefined) {`),e.indented(l=>{l.write(`${s} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let d=K(l,t,n.innerType,o);l.write(`${s} = ${d} === undefined ? ${u}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${s};`),e.write(`if (${o} !== undefined) {`),e.indented(c=>{let u=K(c,t,n.innerType,o);c.write(`${s} = ${u};`)}),e.write("}");return s}function ZO(e,t,r,o){let n=r._zod.def,i=K(e,t,n.innerType,o),a=D(t);return e.write(`const ${a} = ${i};`),e.write(`if (${a} === undefined) return INVALID;`),a}function MO(e,t,r,o){let n=r._zod.def,i=n.items,a=n.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let s=w$(i,"optin"),c=w$(i,"optout");a?e.write(`if (${o}.length < ${s}) return INVALID;`):e.write(`if (${o}.length < ${s} || ${o}.length > ${i.length}) return INVALID;`);let u=D(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let d=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${o}.length) {`),f.indented(m=>{let g=D(t);m.write(`const ${g} = ${o}[${l}];`);let p=ie(m,t,d,g);m.write(`${u}[${l}] = ${p};`)}),f.write("} else {"),f.indented(m=>{if(Vd(d)){m.write(`${u}.length = ${l};`);return}let g=D(t),p=D(t);m.write(`const ${g} = undefined;`),m.write(`const ${p} = (() => {`),m.indented(y=>{let w=ie(y,t,d,g);y.write(`return ${w};`)}),m.write("})();"),m.write(`if (${p} === INVALID || ${p} === undefined) ${u}.length = ${l};`),m.write(`else ${u}[${l}] = ${p};`)}),f.write("}")}),e.write("}");else{let f=D(t);e.write(`const ${f} = ${o}[${l}];`);let m=ie(e,t,d,f);e.write(`${u}[${l}] = ${m};`)}}if(a){let l=D(t),d=D(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${o}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${o}[${l}];`);let m=ie(f,t,a,d);f.write(`${u}[${l}] = ${m};`)}),e.write("}")}return u}function w$(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function RO(e,t,r,o){let n=r._zod.def,i=n.options;if(n.discriminator)return VO(e,t,n,o);if(n.inclusive===!1)throw new L("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),o;if(i.length===1)return K(e,t,i[0],o);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=j(t,c);return e.write(`if (!${u}.has(${o})) return INVALID;`),o}let s=D(t);e.write(`let ${s};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${s} = (() => {`):e.write(`if (${s} === INVALID) ${s} = (() => {`),e.indented(l=>{let d=K(l,t,u,o);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${s} === INVALID) return INVALID;`),s}function VO(e,t,r,o){if(r.unionFallback)throw new L("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),o;let n=D(t),i=D(t);e.write(`const ${n} = ${o}?.[${oe(r.discriminator)}];`),e.write(`let ${i};`);let a=!0,s=new Set;for(let c of r.options){let u=c._zod.propValues?.[r.discriminator];if(!u||u.size===0)throw new L("discriminated union option without static discriminator values");for(let f of u){if(s.has(f))throw new L(`duplicate discriminator value ${String(f)}`);s.add(f)}let l=Array.from(u,f=>qO(t,n,f)),d=a?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let m=K(f,t,c,o);f.write(`${i} = ${m};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),i}function qO(e,t,r){if(typeof r=="string")return`${t} === ${oe(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let o=j(e,r);return`${t} === ${o}`}throw new L(`literal discriminator value ${String(r)}`)}function FO(e,t,r,o){let n=r._zod.def;t.definite=!1;let i=ie(e,t,n.left,o),a=ie(e,t,n.right,o),s=j(t,cn),c=D(t);return e.write(`const ${c} = ${s}(${i}, ${a});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function BO(e,t,r,o){let n=r._zod.def,i=j(t,_e);e.write(`if (!${i}(${o})) return INVALID;`);let a=D(t),s=D(t),c=D(t);e.write(`const ${a} = {};`);let u=n,l=u.partial?void 0:n.keyType._zod.values;if(l){let m=[];for(let p of l){if(!(typeof p=="string"||typeof p=="number"||typeof p=="symbol"))throw new L(`record key value ${String(p)}`);let y=typeof p=="number"?p.toString():p;if(y==="__proto__")throw new L('record key "__proto__"');m.push(y);let w=j(t,p),k=K(e,t,n.keyType,w),S=D(t);e.write(`const ${S} = ${o}[${KO(t,y)}];`);let x=ie(e,t,n.valueType,S);e.write(`${a}[${k}] = ${x};`)}let g=j(t,new Set(m));return e.write(`for (const ${s} in ${o}) {`),e.indented(p=>{p.write(`if (${g}.has(${s})) continue;`),u.mode==="loose"?p.write(`if (${s} !== "__proto__") ${a}[${s}] = ${o}[${s}];`):p.write("return INVALID;")}),e.write("}"),a}let d=n.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let m=n.mode==="loose",g=da(n.keyType);g.definite===!1&&(t.definite=!1);let p=j(t,g),y=j(t,Re),w=D(t);return S$(e,t,o,s,k=>{k.write(`let ${w} = ${p}(${s});`),k.write(`if (${w} === INVALID && typeof ${s} === "string" && ${y}.test(${s})) ${w} = ${p}(Number(${s}));`),m?k.write(`if (${w} === INVALID) { ${a}[${s}] = ${o}[${s}]; continue; }`):k.write(`if (${w} === INVALID) return INVALID;`),k.write(`if (${w} === "__proto__") continue;`);let S=D(t);k.write(`const ${S} = ${o}[${s}];`);let x=ie(k,t,n.valueType,S);k.write(`${a}[${w}] = ${x};`)}),a}return S$(e,t,o,s,m=>{m.write(`const ${c} = ${o}[${s}];`);let g=ie(m,t,n.valueType,c);m.write(`${a}[${s}] = ${g};`)},"return INVALID;"),a}function S$(e,t,r,o,n,i){let a=j(t,Object.prototype.propertyIsEnumerable),s=D(t),c=D(t),u=D(t);e.write(`const ${s} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${c} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${o} = ${c}[${u}];`),l.write(`if (${o} === "__proto__" || !${a}.call(${r}, ${o})) continue;`),n(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${s}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${o} = ${s}[${u}];`),l.write(`if (!${a}.call(${r}, ${o})) continue;`),i?l.write(i):n(l)}),e.write("}")}function KO(e,t){return typeof t=="string"?oe(t):j(e,t)}function JO(e,t,r,o){let n=r._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`);let i=D(t),a=D(t),s=D(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${a}, ${s}] of ${o}) {`),e.indented(c=>{let u=K(c,t,n.keyType,a),l=K(c,t,n.valueType,s);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function GO(e,t,r,o){let n=r._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`);let i=D(t),a=D(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(s=>{let c=K(s,t,n.valueType,a);s.write(`${i}.add(${c});`)}),e.write("}"),i}function WO(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function YO(e,t,r,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let i=j(t,n);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${o})) return INVALID;`)}return o}function XO(e,t,r,o){let n=r._zod.def,i=xt(t,n.getter),a=j(t,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${a}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let s=D(t);return e.write(`const ${s} = ${a}.parser(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function HO(e,t,r,o){let n=r._zod.def,i=K(e,t,n.in,o);if(n.transform){if(zt(n.transform))throw new ze("z.compile: async transforms in pipes are not supported");let a=n.transform,c=xt(t,l=>{let d={value:l,issues:[],addIssue:Fd},f=a(l,d);return f instanceof Promise?se:d.issues.length===0?f:se}),u=D(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),K(e,t,n.out,u)}else return K(e,t,n.out,i)}function zt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function QO(e,t,r,o){let n=r._zod.def;if(n.fn){if(zt(n.fn))throw new ze("z.compile: async custom predicates are not supported");let i=xt(t,n.fn),a=j(t,Rd),s=D(t);e.write(`const ${s} = ${i}(${o});`),e.write(`if (${s} instanceof Promise) ${a}();`),e.write(`if (!${s}) return INVALID;`)}else throw new L("custom schema without a predicate function");return o}function eP(e,t,r){let o=e._zod.run({value:r,issues:[]},{});if(o&&typeof o.then=="function")return se;let n=o;return n.issues.length===0?n.value:t()}function tP(e,t,r,o){let n=r._zod.def;if(!n.catchValue[ho])throw new L("catch with a callback (only a constant catch value compiles)",!1);let i=D(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=ie(u,t,n.innerType,o);u.write(`return ${l};`)}),e.write("})();");let a=j(t,n.innerType),s=xt(t,n.catchValue),c=j(t,eP);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${a}, ${s}, ${o});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function nP(e,t,r,o){let n=r._zod.def;if(n.transform){if(zt(n.transform))throw new ze("z.compile: async transforms are not supported");let i=n.transform,s=xt(t,u=>{let l={value:u,issues:[],addIssue:Fd},d=i(u,l);return d instanceof Promise?se:l.issues.length===0?d:se}),c=D(t);return e.write(`const ${c} = ${s}(${o});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return o}function fa(e){return e.checks&&(e.checks=[...e.checks]),e}function Bd(e,t){return new e(fa({type:"string",...I(t)}))}function Kd(e,t){return new e(fa({type:"string",coerce:!0,...I(t)}))}function ma(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function pa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function ga(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function ha(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function va(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function ya(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function qr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function $a(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function ba(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function _a(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function ka(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function wa(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Sa(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function Ia(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function xa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function za(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function Jd(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(t)})}function Na(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function Oa(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function Pa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function Aa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function Da(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function Gd(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...I(t)})}function Wd(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...I(t)})}function ja(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}var Yd={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Fr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Br(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Kr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Jr(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Xd(e,t){return new e(fa({type:"number",checks:[],...I(t)}))}function Hd(e,t){return new e(fa({type:"number",coerce:!0,checks:[],...I(t)}))}function Qd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function ef(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(t)})}function tf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(t)})}function nf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(t)})}function rf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(t)})}function of(e,t){return new e({type:"boolean",...I(t)})}function af(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function sf(e,t){return new e({type:"bigint",...I(t)})}function cf(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function uf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(t)})}function lf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(t)})}function df(e,t){return new e({type:"symbol",...I(t)})}function ff(e,t){return new e({type:"undefined",...I(t)})}function mf(e,t){return new e({type:"null",...I(t)})}function pf(e){return new e({type:"any"})}function gf(e){return new e({type:"unknown"})}function hf(e,t){return new e({type:"never",...I(t)})}function vf(e,t){return new e({type:"void",...I(t)})}function yf(e,t){return new e({type:"date",...I(t)})}function $f(e,t){return new e({type:"date",coerce:!0,...I(t)})}function bf(e,t){return new e({type:"nan",...I(t)})}function Ae(e,t){return new Do({check:"less_than",...I(t),value:e,inclusive:!1})}function ve(e,t){return new Do({check:"less_than",...I(t),value:e,inclusive:!0})}function De(e,t){return new jo({check:"greater_than",...I(t),value:e,inclusive:!1})}function ye(e,t){return new jo({check:"greater_than",...I(t),value:e,inclusive:!0})}function Ta(e){return De(0,e)}function Ua(e){return Ae(0,e)}function Ea(e){return ve(0,e)}function Ca(e){return ye(0,e)}function rt(e,t){return new rl({check:"multiple_of",...I(t),value:e})}function it(e,t){return new al({check:"max_size",...I(t),maximum:e})}function je(e,t){return new sl({check:"min_size",...I(t),minimum:e})}function Nt(e,t){return new cl({check:"size_equals",...I(t),size:e})}function Ot(e,t){return new ul({check:"max_length",...I(t),maximum:e})}function Ve(e,t){return new ll({check:"min_length",...I(t),minimum:e})}function Pt(e,t){return new dl({check:"length_equals",...I(t),length:e})}function fn(e,t){return new fl({check:"string_format",format:"regex",...I(t),pattern:e})}function mn(e){return new ml({check:"string_format",format:"lowercase",...I(e)})}function pn(e){return new pl({check:"string_format",format:"uppercase",...I(e)})}function gn(e,t){return new gl({check:"string_format",format:"includes",...I(t),includes:e})}function hn(e,t){return new hl({check:"string_format",format:"starts_with",...I(t),prefix:e})}function vn(e,t){return new vl({check:"string_format",format:"ends_with",...I(t),suffix:e})}function La(e,t,r){return new yl({check:"property",property:e,schema:t,...I(r)})}function yn(e,t){return new $l({check:"properties",shape:e,...I(t)})}function $n(e,t){return new bl({check:"mime_type",mime:e,...I(t)})}function Ne(e){return new _l({check:"overwrite",tx:e})}function bn(e){return Ne(t=>t.normalize(e))}function _n(){return Ne(e=>e.trim())}function kn(){return Ne(e=>e.toLowerCase())}function wn(){return Ne(e=>e.toUpperCase())}function Sn(){return Ne(e=>ou(e))}function _f(e,t,r){return new e({type:"array",element:t,...I(r)})}function rP(e,t,r){return new e({type:"union",options:t,...I(r)})}function iP(e,t,r){return new e({type:"union",options:t,inclusive:!1,...I(r)})}function oP(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...I(o)})}function aP(e,t,r){return new e({type:"intersection",left:t,right:r})}function sP(e,t,r,o){let n=r instanceof T,i=n?o:r,a=n?r:null;return new e({type:"tuple",items:t,rest:a,...I(i)})}function cP(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...I(o)})}function uP(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...I(o)})}function lP(e,t,r){return new e({type:"set",valueType:t,...I(r)})}function dP(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...I(r)})}function fP(e,t,r){return new e({type:"enum",entries:t,...I(r)})}function mP(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...I(r)})}function kf(e,t){return new e({type:"file",...I(t)})}function pP(e,t){return new e({type:"transform",transform:t})}function gP(e,t){return new e({type:"optional",innerType:t})}function hP(e,t){return new e({type:"nullable",innerType:t})}function vP(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():pr(r)}})}function yP(e,t,r){return new e({type:"nonoptional",innerType:t,...I(r)})}function $P(e,t){return new e({type:"success",innerType:t})}function bP(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:du(r)})}function _P(e,t,r){return new e({type:"pipe",in:t,out:r})}function kP(e,t){return new e({type:"readonly",innerType:t})}function wP(e,t,r){return new e({type:"template_literal",parts:t,...I(r)})}function SP(e,t){return new e({type:"lazy",getter:t})}function IP(e,t){return new e({type:"promise",innerType:t})}function wf(e,t,r){let o=I(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Sf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function If(e,t){let r=N$(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(tn(n,o.value,r._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(tn(i))}},e(o.value,o)),t);return r}function N$(e,t){let r=new B({check:"custom",...I(t)});return r._zod.check=e,r}function xf(e){let t=new B({check:"describe"});return t._zod.onattach=[r=>{let o=re.get(r)??{};re.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function zf(e){let t=new B({check:"meta"});return t._zod.onattach=[r=>{let o=re.get(r)??{};re.add(r,{...o,...e})}],t._zod.check=()=>{},t}function Nf(e,t){let r=I(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(m=>typeof m=="string"?m.toLowerCase():m),n=n.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(o),a=new Set(n),s=e.Codec??Er,c=e.Boolean??Tr,u=e.String??wt,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((m,g)=>{let p=m;return r.case!=="sensitive"&&(p=p.toLowerCase()),i.has(p)?!0:a.has(p)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:f,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?o[0]||"true":n[0]||"false"),error:r.error});return f._zod.bag.truthy=o,f._zod.bag.falsy=n,f._zod.bag.case=r.case??"insensitive",f}function At(e,t,r,o={}){let n=I(o),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Gr(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&ne(e,o,r[o]);return e}function ot(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??re,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 H(e,t,r,o,n){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(n);return Object.assign(r,i),!0}function q(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let f=a.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),q(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Gr(a.schema,c),t.io==="input"&&ce(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function O$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function at(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=o.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(s,a[0])}}let n=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(g=>g);if(d)return{ref:f(d)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${f("__shared")}#/${s}/${O$(m)}`}}let c="#",u=`${c}/${s}/`;if(a[1]===r&&!a[1].schema.id)return{ref:c};let l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+O$(l)}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=n(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
199
199
|
|
|
200
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}s.count>1&&e.reused==="ref"&&i(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function D$(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;D$(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let a of Array.isArray(i)?i:[i]){if(typeof a!="string")return;r.includes(a)||r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var j$=new Set(["type","properties","required","additionalProperties"]),P$=["oneOf","anyOf"];function A$(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Of(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!j$.has(a))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let s=[];for(let u of t){let l=u.properties?.[a]??A$(u);l!=null&&(s.some(d=>JSON.stringify(d)===JSON.stringify(l))||s.push(l))}let c=s.length===1?s[0]:Of(s)??{allOf:s};ne(r,a,c)}for(let a of i.required??[])o.add(a)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let a of t){let s=A$(a);s&&!i.some(c=>JSON.stringify(c)===JSON.stringify(s))&&i.push(s)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function xP(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of j$)if(n in e)return;let r=t.filter(n=>P$.some(i=>Array.isArray(n[i]))),o=null;if(!r.length)o=Of(t);else{let n=r[0],i=P$.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let a=t.filter(c=>c!==n),s=n[i].map(c=>Of([...a,c]));if(s.some(c=>!c))return;o={[i]:s}}o&&(delete e.allOf,Gr(e,o))}function st(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=s=>{let c=e.seen.get(s);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let m=e.seen.get(d),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Gr(u,g),Gr(u,l),s._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(g.$ref&&m.def)for(let y in u)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y])&&delete u[y]}let f=s._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())o(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())D$(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=s.get(l);d?d.push(u):s.set(l,[u])}for(let c of e.intersections)for(let u of s.get(c)??[])xP(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Gr(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ne(a,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:In(t,"input",e.processors),output:In(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ce(o.element,r);if(o.type==="set")return ce(o.valueType,r);if(o.type==="lazy")return ce(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ce(o.innerType,r);if(o.type==="intersection")return ce(o.left,r)||ce(o.right,r);if(o.type==="record"||o.type==="map")return ce(o.keyType,r)||ce(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ce(o.in,r)||ce(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ce(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ce(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ce(n,r))return!0;return!!(o.rest&&ce(o.rest,r))}return!1}var Pf=(e,t={})=>r=>{let o=ot({...r,processors:t});return q(e,o),at(o,e),st(o,e)},In=(e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},a=ot({...n??{},target:i,io:t,processors:r});return q(e,a),at(a,e),st(a,e)};var xn=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},zn=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},T$=(e,t)=>{xn(e,"minimum",t),zn(e,"maximum",t)},L$=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Z$=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},M$=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},R$=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},U$=(e,t)=>xn(e,"minimum",t.minimum),E$=(e,t)=>zn(e,"maximum",t.maximum),C$=e=>(t,r)=>{R$(t,r.format);let[o,n]=e[r.format];xn(t,"minimum",o),zn(t,"maximum",n)},zP={greater_than:(e,t)=>xn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>zn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>L$(e,t.value),number_format:C$(hr),bigint_format:C$(vr),min_length:U$,max_length:E$,length_equals:(e,t)=>T$(e,t.length),min_size:U$,max_size:E$,size_equals:(e,t)=>T$(e,t.size),string_format:(e,t)=>{R$(e,t.format),t.pattern&&Z$(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>M$(e,t.mime)};function Q(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)zP[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;n.minimum!==void 0&&xn(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&xn(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&zn(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&zn(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&L$(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&M$(t,n.mime);for(let i of n.patterns??[])Z$(t,i);return t}var NP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},OP=new Map([[qo,Cu],[jr,Lu]]),V$=e=>OP.get(e)??e,jf=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u,laxFormat:l}=Q(e);if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=NP[s]??s,n.format===""&&delete n.format,(s==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(V$);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Tf=(e,t,r,o)=>{let n=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Q(e);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d?m?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof i=="number"&&(n.minimum=i),f?m?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof a=="number"&&(n.maximum=a),s){let g=new Set;for(let w of s)Number.isFinite(w)&&w!==0?g.add(Math.abs(w)):H(e,t,n,o,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[p,...y]=g;p!==void 0&&(n.multipleOf=p),y.length&&(n.allOf=[...n.allOf??[],...y.map(w=>({multipleOf:w}))])}},Uf=(e,t,r,o)=>{r.type="boolean"},Ef=(e,t,r,o)=>{H(e,t,r,o,"BigInt cannot be represented in JSON Schema")},Cf=(e,t,r,o)=>{H(e,t,r,o,"Symbols cannot be represented in JSON Schema")},Lf=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Zf=(e,t,r,o)=>{H(e,t,r,o,"Undefined cannot be represented in JSON Schema")},Mf=(e,t,r,o)=>{H(e,t,r,o,"Void cannot be represented in JSON Schema")},Rf=(e,t,r,o)=>{r.not={}},Vf=(e,t,r,o)=>{},qf=(e,t,r,o)=>{},Ff=(e,t,r,o)=>{H(e,t,r,o,"Date cannot be represented in JSON Schema")},Bf=(e,t,r,o)=>{let n=e._zod.def,i=Xt(n.entries);if(i.length===0){r.not={};return}i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Kf=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let a of n.values)if(a===void 0){if(H(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(H(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Jf=(e,t,r,o)=>{H(e,t,r,o,"NaN cannot be represented in JSON Schema")},Gf=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Wf=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=Q(e);i!==void 0&&(n.minLength=i),a!==void 0&&(n.maxLength=a),s&&(s.length===0?n.not={}:s.length===1?n.contentMediaType=s[0]:n.anyOf=s.map(c=>({contentMediaType:c})))},Yf=(e,t,r,o)=>{r.type="boolean"},Xf=(e,t,r,o)=>{H(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Hf=(e,t,r,o)=>{H(e,t,r,o,"Function types cannot be represented in JSON Schema")},Qf=(e,t,r,o)=>{H(e,t,r,o,"Transforms cannot be represented in JSON Schema")},em=(e,t,r,o)=>{H(e,t,r,o,"Map cannot be represented in JSON Schema")},tm=(e,t,r,o)=>{H(e,t,r,o,"Set cannot be represented in JSON Schema")},nm=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:s}=Q(e);typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=q(i.element,t,{...o,path:[...o.path,"items"]})};function Wr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Wr(t.out):t.type==="catch"?Wr(t.innerType):e._zod.optin}var rm=(e,t,r,o)=>{let n=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&H(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in a)ne(n.properties,u,q(a[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(a)){let l=i.shape[u];(t.io==="input"?Wr(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=q(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Ma=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,c)=>q(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},im=(e,t,r,o)=>{let n=e._zod.def,i=q(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=q(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c,t.intersections.push(c)},om=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,y)=>q(p,t,{...o,path:[...o.path,a,y]})),u=i.rest?q(i.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let p=i.items[l-1];if(!(t.io==="input"?Wr(p)!==void 0:p._zod.optout==="optional"))break;l--}let d=i.items.length,f=!i.rest;t.target==="draft-2020-12"?(n.prefixItems=c,f?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):(n.items=c,f?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),f&&(n.maxItems=d));let{minimum:m,maximum:g}=Q(e);typeof m=="number"&&(n.minItems=m),typeof g=="number"&&(n.maxItems=g)};function Af(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let p=Af(e,g,r);return p===g?t:p}for(let g of["anyOf","oneOf"]){let p=t[g];if(!Array.isArray(p))continue;let y=p.map(w=>Af(e,w,r));y.some((w,k)=>w!==p[k])&&(t={...t,[g]:y})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some(g=>typeof g=="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),n&&(m.type="string",i||(m.pattern=(o.includes("number")?Re:xr).source)),m}var Df=new WeakMap;function PP(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Df.get(e)??[]){let n=e.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=Af(t,i,new Set);a!==i&&r.set(i,a)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var am=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,s=Q(a).patterns;if(i.mode==="loose"&&s&&s.size>0){let l=q(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of s)ne(n.patternProperties,V$(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=q(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=Df.get(t);l||(l=[],Df.set(t,l),t.deferred.push(()=>PP(t))),l.push(e)}n.additionalProperties=q(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=a._zod.values,u=t.io==="input"&&Wr(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},sm=(e,t,r,o)=>{let n=e._zod.def,i=q(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},cm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},um=Symbol();function q$(e,t,r,o,n){let i=!1,a=JSON.stringify(e,(s,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(H(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),um):JSON.parse(a)}var lm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a=q$(n.defaultValue,e,t,r,o);a!==um&&(r.default=a)},dm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let a=q$(n.defaultValue,e,t,r,o);a!==um&&(r._prefault=a)},fm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{H(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},mm=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;q(a,t,o);let s=t.seen.get(e);s.ref=a},pm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},gm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Ra=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},hm=(e,t,r,o)=>{let n=e._zod.innerType;q(n,t,o);let i=t.seen.get(e);i.ref=n},Za={string:jf,number:Tf,boolean:Uf,bigint:Ef,symbol:Cf,null:Lf,undefined:Zf,void:Mf,never:Rf,any:Vf,unknown:qf,date:Ff,enum:Bf,literal:Kf,nan:Jf,template_literal:Gf,file:Wf,success:Yf,custom:Xf,function:Hf,transform:Qf,map:em,set:tm,array:nm,object:rm,union:Ma,intersection:im,tuple:om,record:am,nullable:sm,nonoptional:cm,default:lm,prefault:dm,catch:fm,pipe:mm,readonly:pm,promise:gm,optional:Ra,lazy:hm};function Va(e,t){if("_idmap"in e){let o=e,n=ot({...t,processors:Za}),i={};for(let c of o._idmap.entries()){let[u,l]=c;q(l,n)}let a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(let c of o._idmap.entries()){let[u,l]=c;at(n,l),ne(a,u,st(n,l))}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i}}return{schemas:a}}let r=ot({...t,processors:Za});return q(e,r),at(r,e),st(r,e)}var qa=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ot({processors:Za,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return q(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,at(this.ctx,t);let o=st(this.ctx,t),{"~standard":n,...i}=o;return i}};var F$={};var Un={};Ee(Un,{ZodAny:()=>Lm,ZodArray:()=>Vm,ZodBase64:()=>cs,ZodBase64URL:()=>us,ZodBigInt:()=>jn,ZodBigIntFormat:()=>fs,ZodBoolean:()=>Dn,ZodCIDRv4:()=>as,ZodCIDRv6:()=>ss,ZodCUID:()=>Qa,ZodCUID2:()=>es,ZodCatch:()=>up,ZodCodec:()=>oi,ZodCreditCard:()=>Pm,ZodCustom:()=>ai,ZodCustomStringFormat:()=>Ut,ZodDate:()=>Qr,ZodDefault:()=>rp,ZodDiscriminatedUnion:()=>Fm,ZodE164:()=>ls,ZodEmail:()=>Wa,ZodEmoji:()=>Xa,ZodEnum:()=>On,ZodExactOptional:()=>hs,ZodFile:()=>Qm,ZodFunction:()=>$p,ZodGUID:()=>Ya,ZodIBAN:()=>Am,ZodIPv4:()=>is,ZodIPv6:()=>os,ZodISODate:()=>ut,ZodISODateTime:()=>ct,ZodISODuration:()=>dt,ZodISOTime:()=>lt,ZodInstanceOf:()=>kp,ZodIntersection:()=>Bm,ZodJWT:()=>ds,ZodKSUID:()=>rs,ZodLazy:()=>hp,ZodLiteral:()=>Hm,ZodMAC:()=>Om,ZodMap:()=>Ym,ZodNaN:()=>dp,ZodNanoID:()=>Ha,ZodNever:()=>Mm,ZodNonOptional:()=>vs,ZodNull:()=>Em,ZodNullable:()=>np,ZodNumber:()=>An,ZodNumberFormat:()=>Et,ZodObject:()=>ti,ZodOptional:()=>ri,ZodPipe:()=>ii,ZodPrefault:()=>op,ZodPreprocess:()=>fp,ZodPromise:()=>yp,ZodReadonly:()=>mp,ZodRecord:()=>Nn,ZodSet:()=>Xm,ZodString:()=>Pn,ZodStringFormat:()=>F,ZodSuccess:()=>cp,ZodSymbol:()=>Tm,ZodTemplateLiteral:()=>gp,ZodTransform:()=>ep,ZodTuple:()=>Jm,ZodType:()=>E,ZodULID:()=>ts,ZodURL:()=>Hr,ZodUUID:()=>Te,ZodUndefined:()=>Um,ZodUnion:()=>ni,ZodUnknown:()=>Zm,ZodVoid:()=>Rm,ZodXID:()=>ns,ZodXor:()=>qm,_ZodString:()=>Ga,_default:()=>ip,_function:()=>n_,any:()=>jb,array:()=>ei,base64:()=>mb,base64url:()=>pb,bigint:()=>Nb,boolean:()=>jm,catch:()=>lp,check:()=>r_,cidrv4:()=>db,cidrv6:()=>fb,codec:()=>Hb,creditCard:()=>hb,cuid:()=>rb,cuid2:()=>ib,currencyCode:()=>kb,custom:()=>i_,date:()=>Ub,describe:()=>o_,discriminatedUnion:()=>Rb,e164:()=>gb,email:()=>J$,emoji:()=>tb,enum:()=>ps,exactOptional:()=>tp,file:()=>Gb,float32:()=>Sb,float64:()=>Ib,function:()=>n_,guid:()=>G$,hash:()=>wb,hex:()=>_b,hostname:()=>bb,httpUrl:()=>eb,iban:()=>vb,instanceof:()=>s_,int:()=>Ka,int32:()=>xb,int64:()=>Ob,intersection:()=>Km,invertCodec:()=>Qb,ipv4:()=>cb,ipv6:()=>lb,json:()=>u_,jwt:()=>yb,keyof:()=>Eb,ksuid:()=>sb,lazy:()=>vp,literal:()=>Jb,looseObject:()=>Zb,looseRecord:()=>qb,mac:()=>ub,map:()=>Fb,meta:()=>a_,nan:()=>Xb,nanoid:()=>nb,nativeEnum:()=>Kb,never:()=>ms,nonoptional:()=>sp,null:()=>Cm,nullable:()=>Xr,nullish:()=>Wb,number:()=>Dm,object:()=>Cb,optional:()=>jt,partialRecord:()=>Vb,pipe:()=>Ja,prefault:()=>ap,preprocess:()=>l_,promise:()=>t_,readonly:()=>pp,record:()=>Wm,refine:()=>bp,set:()=>Bb,strictObject:()=>Lb,string:()=>Yr,stringFormat:()=>$b,stringbool:()=>c_,success:()=>Yb,superRefine:()=>_p,symbol:()=>Ab,templateLiteral:()=>e_,transform:()=>gs,tuple:()=>Gm,uint32:()=>zb,uint64:()=>Pb,ulid:()=>ob,undefined:()=>Db,union:()=>Tn,unknown:()=>Dt,url:()=>Q$,uuid:()=>W$,uuidv4:()=>Y$,uuidv6:()=>X$,uuidv7:()=>H$,void:()=>Tb,xid:()=>ab,xor:()=>Mb});var Fa={};Ee(Fa,{endsWith:()=>vn,gt:()=>De,gte:()=>ye,includes:()=>gn,length:()=>Pt,lowercase:()=>mn,lt:()=>Ae,lte:()=>ve,maxLength:()=>Ot,maxSize:()=>it,mime:()=>$n,minLength:()=>Ve,minSize:()=>je,multipleOf:()=>rt,negative:()=>Ua,nonnegative:()=>Ca,nonpositive:()=>Ea,normalize:()=>bn,overwrite:()=>Ne,positive:()=>Ta,properties:()=>yn,property:()=>La,regex:()=>fn,size:()=>Nt,slugify:()=>Sn,startsWith:()=>hn,toLowerCase:()=>kn,toUpperCase:()=>wn,trim:()=>_n,uppercase:()=>pn});var B$=new WeakSet([Object.prototype,Error.prototype]);function Ba(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var K$=(e,t)=>{vu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);B$.has(r)||(B$.add(r),Ba(r,"format",o=>n=>kr(o,n)),Ba(r,"flatten",o=>n=>_r(o,n)),Ba(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,Ht,2)}),Ba(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,Ht,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},DP=h("ZodError",K$),he=h("ZodError",K$,void 0,{Parent:Error});var vm=nn(he),ym=rn(he),$m=on(he),bm=an(he),_m=bo(he),km=_o(he),wm=ko(he),Sm=wo(he),Im=So(he),xm=Io(he),zm=xo(he),Nm=zo(he);function TP(){ee.localeError||G(oa())}function Tt(){ee.memoizer||G({memoizer:Mr()})}var E=h("ZodType",(e,t)=>(TP(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone($.mergeDefs(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 R(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bp(e,t))},superRefine(e,t){return this.check(_p(e,t))},overwrite(e){return this.check(Ne(e))},optional(){return jt(this)},exactOptional(){return tp(this)},nullable(){return Xr(this)},nullish(){return jt(Xr(this))},nonoptional(e){return sp(this,e)},array(){return ei(this)},or(e){return Tn([this,e])},and(e){return Km(this,e)},transform(e){return Ja(this,gs(e))},default(e){return ip(this,e)},prefault(e){return ap(this,e)},catch(e){return lp(this,e)},pipe(e){return Ja(this,e)},readonly(){return pp(this)},describe(e){let t=this.clone();return re.add(t,{description:e}),t},meta(...e){if(e.length===0)return re.get(this);let t=this.clone();return re.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 $.hide(this,"~standard",{...Lo(this),jsonSchema:{input:In(this,"input"),output:In(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(t,r){return vm(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await ym(this,t,r,{callee:e})},safeParse(e,t){return $m(this,e,t)},async safeParseAsync(e,t){return bm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,t){return wr(this,e,t)},validateAsync(e,t){return Sr(this,e,t)},encode:function e(t,r){return _m(this,t,r,{callee:e})},decode:function e(t,r){return km(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await wm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Sm(this,t,r,{callee:e})},safeEncode(e,t){return Im(this,e,t)},safeDecode(e,t){return xm(this,e,t)},async safeEncodeAsync(e,t){return zm(this,e,t)},async safeDecodeAsync(e,t){return Nm(this,e,t)},toJSONSchema(e){return Pf(this,{})(e)},get description(){return re.get(this)?.description},get _def(){return this._zod.def}}),Ga=h("_ZodString",(e,t)=>{wt.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jf(e,r,o,n)},$.derived({format:e=>Q(e).format??null,minLength:e=>Q(e).minimum??null,maxLength:e=>Q(e).maximum??null},{regex(...e){return this.check(fn(...e))},includes(...e){return this.check(gn(...e))},startsWith(...e){return this.check(hn(...e))},endsWith(...e){return this.check(vn(...e))},min(...e){return this.check(Ve(...e))},max(...e){return this.check(Ot(...e))},length(...e){return this.check(Pt(...e))},nonempty(...e){return this.check(Ve(1,...e))},lowercase(e){return this.check(mn(e))},uppercase(e){return this.check(pn(e))},trim(){return this.check(_n())},normalize(...e){return this.check(bn(...e))},toLowerCase(){return this.check(kn())},toUpperCase(){return this.check(wn())},slugify(){return this.check(Sn())}})),Pn=h("ZodString",(e,t)=>{wt.init(e,t),Ga.init(e,t)},{email(e){return this.check(ma(Wa,e))},url(e){return this.check(qr(Hr,e))},jwt(e){return this.check(ja(ds,e))},emoji(e){return this.check($a(Xa,e))},guid(e){return this.check(pa(Ya,e))},uuid(e){return this.check(ga(Te,e))},uuidv4(e){return this.check(ha(Te,e))},uuidv6(e){return this.check(va(Te,e))},uuidv7(e){return this.check(ya(Te,e))},nanoid(e){return this.check(ba(Ha,e))},cuid(e){return this.check(_a(Qa,e))},cuid2(e){return this.check(ka(es,e))},ulid(e){return this.check(wa(ts,e))},base64(e){return this.check(Pa(cs,e))},base64url(e){return this.check(Aa(us,e))},xid(e){return this.check(Sa(ns,e))},ksuid(e){return this.check(Ia(rs,e))},ipv4(e){return this.check(xa(is,e))},ipv6(e){return this.check(za(os,e))},cidrv4(e){return this.check(Na(as,e))},cidrv6(e){return this.check(Oa(ss,e))},e164(e){return this.check(Da(ls,e))},datetime(e){return this.check(Fr(ct,e))},date(e){return this.check(Br(ut,e))},time(e){return this.check(Kr(lt,e))},duration(e){return this.check(Jr(dt,e))}});function Yr(e){return Bd(Pn,e)}var F=h("ZodStringFormat",(e,t)=>{V.init(e,t),Ga.init(e,t)}),ct=h("ZodISODateTime",(e,t)=>{Cl.init(e,t),F.init(e,t)}),ut=h("ZodISODate",(e,t)=>{Ll.init(e,t),F.init(e,t)}),lt=h("ZodISOTime",(e,t)=>{Zl.init(e,t),F.init(e,t)}),dt=h("ZodISODuration",(e,t)=>{Ml.init(e,t),F.init(e,t)}),Wa=h("ZodEmail",(e,t)=>{xl.init(e,t),F.init(e,t)});function J$(e){return ma(Wa,e)}var Ya=h("ZodGUID",(e,t)=>{Sl.init(e,t),F.init(e,t)});function G$(e){return pa(Ya,e)}var Te=h("ZodUUID",(e,t)=>{Il.init(e,t),F.init(e,t)});function W$(e){return ga(Te,e)}function Y$(e){return ha(Te,e)}function X$(e){return va(Te,e)}function H$(e){return ya(Te,e)}var Hr=h("ZodURL",(e,t)=>{Ol.init(e,t),F.init(e,t)});function Q$(e){return qr(Hr,e)}function eb(e){return qr(Hr,{protocol:Ir,hostname:Mu,...$.normalizeParams(e)})}var Xa=h("ZodEmoji",(e,t)=>{Pl.init(e,t),F.init(e,t)});function tb(e){return $a(Xa,e)}var Ha=h("ZodNanoID",(e,t)=>{Al.init(e,t),F.init(e,t)});function nb(e){return ba(Ha,e)}var Qa=h("ZodCUID",(e,t)=>{Dl.init(e,t),F.init(e,t)});function rb(e){return _a(Qa,e)}var es=h("ZodCUID2",(e,t)=>{jl.init(e,t),F.init(e,t)});function ib(e){return ka(es,e)}var ts=h("ZodULID",(e,t)=>{Tl.init(e,t),F.init(e,t)});function ob(e){return wa(ts,e)}var ns=h("ZodXID",(e,t)=>{Ul.init(e,t),F.init(e,t)});function ab(e){return Sa(ns,e)}var rs=h("ZodKSUID",(e,t)=>{El.init(e,t),F.init(e,t)});function sb(e){return Ia(rs,e)}var is=h("ZodIPv4",(e,t)=>{Rl.init(e,t),F.init(e,t)});function cb(e){return xa(is,e)}var Om=h("ZodMAC",(e,t)=>{ql.init(e,t),F.init(e,t)});function ub(e){return Jd(Om,e)}var os=h("ZodIPv6",(e,t)=>{Vl.init(e,t),F.init(e,t)});function lb(e){return za(os,e)}var as=h("ZodCIDRv4",(e,t)=>{Fl.init(e,t),F.init(e,t)});function db(e){return Na(as,e)}var ss=h("ZodCIDRv6",(e,t)=>{Bl.init(e,t),F.init(e,t)});function fb(e){return Oa(ss,e)}var cs=h("ZodBase64",(e,t)=>{Kl.init(e,t),F.init(e,t)});function mb(e){return Pa(cs,e)}var us=h("ZodBase64URL",(e,t)=>{Jl.init(e,t),F.init(e,t)});function pb(e){return Aa(us,e)}var ls=h("ZodE164",(e,t)=>{Gl.init(e,t),F.init(e,t)});function gb(e){return Da(ls,e)}var Pm=h("ZodCreditCard",(e,t)=>{Wl.init(e,t),F.init(e,t)});function hb(e){return Gd(Pm,e)}var Am=h("ZodIBAN",(e,t)=>{Yl.init(e,t),F.init(e,t)});function vb(e){return Wd(Am,e)}var ds=h("ZodJWT",(e,t)=>{Xl.init(e,t),F.init(e,t)});function yb(e){return ja(ds,e)}var Ut=h("ZodCustomStringFormat",(e,t)=>{Hl.init(e,t),F.init(e,t)});function $b(e,t,r={}){return At(Ut,e,t,r)}function bb(e){return At(Ut,"hostname",Zu,e)}function _b(e){return At(Ut,"hex",el,e)}function kb(e){return At(Ut,"currency_code",Vu,e)}function wb(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=we[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return At(Ut,o,n,t)}var An=h("ZodNumber",(e,t)=>{Go.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tf(e,r,o,n),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Q(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Q(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Q(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Q(e).format??null},{gt(e,t){return this.check(De(e,t))},gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},lt(e,t){return this.check(Ae(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},int(e){return this.check(Ka(e))},safe(e){return this.check(Ka(e))},positive(e){return this.check(De(0,e))},nonnegative(e){return this.check(ye(0,e))},negative(e){return this.check(Ae(0,e))},nonpositive(e){return this.check(ve(0,e))},multipleOf(e,t){return this.check(rt(e,t))},step(e,t){return this.check(rt(e,t))},finite(){return this}}));function Dm(e){return Xd(An,e)}var Et=h("ZodNumberFormat",(e,t)=>{Ql.init(e,t),An.init(e,t)});function Ka(e){return Qd(Et,e)}function Sb(e){return ef(Et,e)}function Ib(e){return tf(Et,e)}function xb(e){return nf(Et,e)}function zb(e){return rf(Et,e)}var Dn=h("ZodBoolean",(e,t)=>{Tr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Uf(e,r,o,n)});function jm(e){return of(Dn,e)}var jn=h("ZodBigInt",(e,t)=>{Wo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ef(e,r,o,n)},$.derived({minValue:e=>Q(e).minimum??null,maxValue:e=>Q(e).maximum??null,format:e=>Q(e).format??null},{gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},gt(e,t){return this.check(De(e,t))},lt(e,t){return this.check(Ae(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},positive(e){return this.check(De(BigInt(0),e))},negative(e){return this.check(Ae(BigInt(0),e))},nonpositive(e){return this.check(ve(BigInt(0),e))},nonnegative(e){return this.check(ye(BigInt(0),e))},multipleOf(e,t){return this.check(rt(e,t))}}));function Nb(e){return sf(jn,e)}var fs=h("ZodBigIntFormat",(e,t)=>{ed.init(e,t),jn.init(e,t)});function Ob(e){return uf(fs,e)}function Pb(e){return lf(fs,e)}var Tm=h("ZodSymbol",(e,t)=>{td.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cf(e,r,o,n)});function Ab(e){return df(Tm,e)}var Um=h("ZodUndefined",(e,t)=>{nd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zf(e,r,o,n)});function Db(e){return ff(Um,e)}var Em=h("ZodNull",(e,t)=>{rd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lf(e,r,o,n)});function Cm(e){return mf(Em,e)}var Lm=h("ZodAny",(e,t)=>{id.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vf(e,r,o,n)});function jb(){return pf(Lm)}var Zm=h("ZodUnknown",(e,t)=>{od.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qf(e,r,o,n)});function Dt(){return gf(Zm)}var Mm=h("ZodNever",(e,t)=>{ad.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rf(e,r,o,n)});function ms(e){return hf(Mm,e)}var Rm=h("ZodVoid",(e,t)=>{sd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mf(e,r,o,n)});function Tb(e){return vf(Rm,e)}var Qr=h("ZodDate",(e,t)=>{cd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ff(e,r,o,n),e.min=(r,o)=>e.check(ye(r,o)),e.max=(r,o)=>e.check(ve(r,o))},$.derived({minDate:e=>{let{minimum:t}=Q(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Q(e);return t?new Date(t):null}},{}));function Ub(e){return yf(Qr,e)}var Vm=h("ZodArray",(e,t)=>{Tt(),ud.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nm(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Ve(e,t))},nonempty(e){return this.check(Ve(1,e))},max(e,t){return this.check(Ot(e,t))},length(e,t){return this.check(Pt(e,t))},unwrap(){return this.element}});function ei(e,t){return _f(Vm,e,t)}function Eb(e){let t=e._zod.def.shape;return ps(Object.keys(t))}var ti=h("ZodObject",(e,t)=>{Tt(),ld.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rm(e,r,o,n),$.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ps(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:Dt()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:Dt()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:ms()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(ri,this,e[0])},exactPartial(...e){return $.partial(hs,this,e[0],"exactPartial")},required(...e){return $.required(vs,this,e[0])}});function Cb(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new ti(r)}function Lb(e,t){return new ti({type:"object",shape:e,catchall:ms(),...$.normalizeParams(t)})}function Zb(e,t){return new ti({type:"object",shape:e,catchall:Dt(),...$.normalizeParams(t)})}var ni=h("ZodUnion",(e,t)=>{Ur.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ma(e,r,o,n),e.options=t.options});function Tn(e,t){return new ni({type:"union",options:e,...$.normalizeParams(t)})}var qm=h("ZodXor",(e,t)=>{ni.init(e,t),dd.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ma(e,r,o,n),e.options=t.options});function Mb(e,t){return new qm({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var Fm=h("ZodDiscriminatedUnion",(e,t)=>{ni.init(e,t),md.init(e,t)});function Rb(e,t,r){return new Fm({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var Bm=h("ZodIntersection",(e,t)=>{pd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>im(e,r,o,n)});function Km(e,t){return new Bm({type:"intersection",left:e,right:t})}var Jm=h("ZodTuple",(e,t)=>{Tt(),Yo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>om(e,r,o,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ri({type:"optional",innerType:t}))})}});function Gm(e,t,r){let o=t instanceof T,n=o?r:t,i=o?t:null;return new Jm({type:"tuple",items:e,rest:i,...$.normalizeParams(n)})}var Nn=h("ZodRecord",(e,t)=>{Tt(),gd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>am(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Wm(e,t,r){return!t||!t._zod?new Nn({type:"record",keyType:Yr(),valueType:e,...$.normalizeParams(t)}):new Nn({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function Vb(e,t,r){return new Nn({type:"record",keyType:e,valueType:t,...$.normalizeParams(r),partial:!0})}function qb(e,t,r){return new Nn({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var Ym=h("ZodMap",(e,t)=>{Tt(),hd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>em(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(it(...r)),e.size=(...r)=>e.check(Nt(...r))});function Fb(e,t,r){return new Ym({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var Xm=h("ZodSet",(e,t)=>{Tt(),vd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tm(e,r,o,n),e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(it(...r)),e.size=(...r)=>e.check(Nt(...r))});function Bb(e,t){return new Xm({type:"set",valueType:e,...$.normalizeParams(t)})}var On=h("ZodEnum",(e,t)=>{yd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Bf(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new On({...t,checks:[],...$.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new On({...t,checks:[],...$.normalizeParams(n),entries:i})}});function ps(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new On({type:"enum",entries:r,...$.normalizeParams(t)})}function Kb(e,t){return new On({type:"enum",entries:e,...$.normalizeParams(t)})}var Hm=h("ZodLiteral",(e,t)=>{$d.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kf(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Jb(e,t){return new Hm({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var Qm=h("ZodFile",(e,t)=>{bd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wf(e,r,o,n),e.min=(r,o)=>e.check(je(r,o)),e.max=(r,o)=>e.check(it(r,o)),e.mime=(r,o)=>e.check($n(Array.isArray(r)?r:[r],o))});function Gb(e){return kf(Qm,e)}var ep=h("ZodTransform",(e,t)=>{Tt(),_d.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qf(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new nt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function gs(e){return new ep({type:"transform",transform:e})}var ri=h("ZodOptional",(e,t)=>{Xo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ra(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jt(e){return new ri({type:"optional",innerType:e})}var hs=h("ZodExactOptional",(e,t)=>{kd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ra(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function tp(e){return new hs({type:"optional",innerType:e})}var np=h("ZodNullable",(e,t)=>{wd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Xr(e){return new np({type:"nullable",innerType:e})}function Wb(e){return jt(Xr(e))}var rp=h("ZodDefault",(e,t)=>{Sd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ip(e,t){return new rp({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var op=h("ZodPrefault",(e,t)=>{Id.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new op({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var vs=h("ZodNonOptional",(e,t)=>{xd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sp(e,t){return new vs({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var cp=h("ZodSuccess",(e,t)=>{zd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Yb(e){return new cp({type:"success",innerType:e})}var up=h("ZodCatch",(e,t)=>{Nd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lp(e,t){return new up({type:"catch",innerType:e,catchValue:typeof t=="function"?t:$.constantCatch(t)})}var dp=h("ZodNaN",(e,t)=>{Od.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jf(e,r,o,n)});function Xb(e){return bf(dp,e)}var ii=h("ZodPipe",(e,t)=>{Ho.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mm(e,r,o,n),e.in=t.in,e.out=t.out});function Ja(e,t){return new ii({type:"pipe",in:e,out:t})}var oi=h("ZodCodec",(e,t)=>{ii.init(e,t),Er.init(e,t)});function Hb(e,t,r){return new oi({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Qb(e){let t=e._zod.def;return new oi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var fp=h("ZodPreprocess",(e,t)=>{ii.init(e,t),Pd.init(e,t)}),mp=h("ZodReadonly",(e,t)=>{Ad.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pp(e){return new mp({type:"readonly",innerType:e})}var gp=h("ZodTemplateLiteral",(e,t)=>{Dd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gf(e,r,o,n)});function e_(e,t){return new gp({type:"template_literal",parts:e,...$.normalizeParams(t)})}var hp=h("ZodLazy",(e,t)=>{Cr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hm(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function vp(e){return new hp({type:"lazy",getter:e})}var yp=h("ZodPromise",(e,t)=>{Td.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function t_(e){return new yp({type:"promise",innerType:e})}var $p=h("ZodFunction",(e,t)=>{jd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hf(e,r,o,n)});function n_(e){return new $p({type:"function",input:Array.isArray(e?.input)?Gm(e?.input):e?.input??ei(Dt()),output:e?.output??Dt()})}var ai=h("ZodCustom",(e,t)=>{Ud.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xf(e,r,o,n)});function r_(e){let t=new B({check:"custom"});return t._zod.check=e,t}function i_(e,t){return wf(ai,e??(()=>!0),t)}function bp(e,t={}){return Sf(ai,e,t)}function _p(e,t){return If(e,t)}var o_=xf,a_=zf,kp=h("ZodInstanceOf",(e,t)=>{ai.init(e,t)},{properties(e,t){return this.check(yn(e,t))}});function s_(e,t={}){let r=new kp({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var c_=(...e)=>Nf({Codec:oi,Boolean:Dn,String:Pn},...e);function u_(e){let t=vp(()=>Tn([Yr(e),Dm(),jm(),Cm(),ei(t),Wm(Yr(),t)]));return t}function l_(e,t){return new fp({type:"pipe",in:gs(e),out:t})}var UP={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function EP(e){G({customError:e})}function CP(){return G().customError}var wp;wp||(wp={});var si={};Ee(si,{ZodISODate:()=>ut,ZodISODateTime:()=>ct,ZodISODuration:()=>dt,ZodISOTime:()=>lt,date:()=>ZP,datetime:()=>LP,duration:()=>RP,time:()=>MP});function LP(e){return Fr(ct,e)}function ZP(e){return Br(ut,e)}function MP(e){return Kr(lt,e)}function RP(e){return Jr(dt,e)}var N={...Un,...Fa,iso:si},VP=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function qP(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function d_(e,t){return e.map((r,o)=>o<t?r:r.optional())}function FP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function BP(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1]===void 0?void 0:FP(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function KP(e,t){return N.transform(o=>o).check(o=>{let n=o.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&i.length<t.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let a of i){let s=t.keySchema.safeParse(a);s.success||o.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function Sp(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let o=String(e);return`${r[0]}${o.length}:${o}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let a of e){let s=Sp(a,t);if(s===null)return null;i.push(s)}return`a${i.length}:[${i.join(",")}]`}let o=Object.keys(e).sort(),n=[];for(let i of o){let a=Sp(e[i],t);if(a===null)return null;n.push(`${i.length}:${i}=${a}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var JP=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),GP=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function ci(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(ci):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>JP.has(t)?ci(r):!GP.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(ci))}function f_(e){return e===1?"element":"elements"}function WP(e,t){return N.transform(o=>o).check(o=>{let n=o.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let i=new Map;for(let a=0;a<n.length;a++){let s=Sp(n[a],new Set);if(s===null)continue;let c=i.get(s);if(c===void 0){i.set(s,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${c}`,input:n,path:[a],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,a=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,s=0;for(let c of n)if(t.containsSchema.safeParse(c).success&&++s>=a)break;s<i&&o.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${f_(i)}; found ${s}`,input:n,continue:!0}),t.maxContains!==void 0&&s>t.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${f_(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function m_(e,t){if(e!==!1)return e===void 0||e===!0?N.any():ue(e,t)}var YP=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function p_(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return N.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return N.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=BP(n,t),a=ue(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return N.null();if(n.length===0)return N.never();if(n.length===1)return N.literal(n[0]);if(n.every(a=>typeof a=="string"))return N.enum(n);let i=n.map(a=>N.literal(a));return i.length<2?i[0]:N.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return N.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let a={...e,type:i};return p_(a,t)});return n.length===0?N.never():n.length===1?n[0]:N.union(n)}if(!r)return N.any();let o;switch(r){case"string":{let n=N.string();if(e.format){let i=e.format;i==="email"?n=n.check(N.email()):i==="uri"||i==="uri-reference"?n=n.check(N.url()):i==="uuid"||i==="guid"?n=n.check(N.uuid()):i==="date-time"?n=n.check(N.iso.datetime({offset:!0})):i==="date"?n=n.check(N.iso.date()):i==="time"?n=n.check(N.regex(YP)):i==="duration"?n=n.check(N.iso.duration()):i==="hostname"?n=n.check(N.hostname()):i==="ipv4"?n=n.check(N.ipv4()):i==="ipv6"?n=n.check(N.ipv6()):i==="mac"?n=n.check(N.mac()):i==="cidr"?n=n.check(N.cidrv4()):i==="cidr-v6"?n=n.check(N.cidrv6()):i==="base64"?n=n.check(N.base64()):i==="base64url"?n=n.check(N.base64url()):i==="e164"?n=n.check(N.e164()):i==="credit_card"?n=n.check(N.creditCard()):i==="iban"?n=n.check(N.iban()):i==="jwt"?n=n.check(N.jwt()):i==="emoji"?n=n.check(N.emoji()):i==="nanoid"?n=n.check(N.nanoid()):i==="cuid"?n=n.check(N.cuid()):i==="cuid2"?n=n.check(N.cuid2()):i==="ulid"?n=n.check(N.ulid()):i==="xid"?n=n.check(N.xid()):i==="ksuid"&&(n=n.check(N.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?N.number().int():N.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=N.boolean();break}case"null":{o=N.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?ue(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(i)){let m=ue(f,t);ne(n,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let p of f){let y=ue(d[p],t),w=N.string().regex(new RegExp(p));m.push(N.looseRecord(w,y))}let g=[];if(Object.keys(n).length>0&&g.push(N.object(n).passthrough()),g.push(...m),g.length===0)o=N.object({}).passthrough();else if(g.length===1)o=g[0];else{let p=N.intersection(g[0],g[1]);for(let y=2;y<g.length;y++)p=N.intersection(p,g[y]);o=p}if(e.additionalProperties===!1){let p=Object.keys(n),y=f.map(k=>new RegExp(k)),w=o;o=o.check(k=>{if(!_e(k.value))return;let S=[];for(let x of Object.keys(k.value))p.includes(x)||y.some(P=>P.test(x))||S.push(x);S.length&&k.issues.push({code:"unrecognized_keys",keys:S,input:k.value,inst:w})})}}else{let d=N.object(n);e.additionalProperties===!1?o=d.strict():s?o=d.catchall(s):o=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ue(f,t)}o=KP(o,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,s=n.map(d=>ue(d,t)),c=d_(s,a),u=Array.isArray(i)?void 0:m_(i,t),l=N.tuple(c);o=u?l.rest(u):l,typeof e.minItems=="number"&&(o=o.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(N.maxLength(e.maxItems)))}else if(Array.isArray(i)){let a=typeof e.minItems=="number"?e.minItems:0,s=i.map(d=>ue(d,t)),c=d_(s,a),u=m_(e.additionalItems,t),l=N.tuple(c);o=u?l.rest(u):l,typeof e.minItems=="number"&&(o=o.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(N.maxLength(e.maxItems)))}else if(i!==void 0){let a=ue(i,t),s=N.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=N.array(N.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=WP(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ue(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return o}function ue(e,t){if(typeof e=="boolean")return e?N.any():N.never();let r=p_(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(u=>ue(u,t)),c=N.union(s);r=o?N.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(u=>ue(u,t)),c=N.xor(s);r=o?N.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:N.any();else{let s=o?r:ue(e.allOf[0],t),c=o?0:1;for(let u=c;u<e.allOf.length;u++)s=N.intersection(s,ue(e.allOf[u],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=N.nullable(r)),e.readOnly===!0&&(r=N.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in e&&(n[s]=e[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in e&&(n[s]=e[s]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!ci(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let s of["minProperties","maxProperties"])e[s]!==void 0&&(n[s]=e[s])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!ci(e.contains)&&(n.contains=e.contains);for(let s of["uniqueItems","minContains","maxContains"])e[s]!==void 0&&(n[s]=e[s])}for(let s of Object.keys(e))VP.has(s)||ne(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function g_(e,t){if(typeof e=="boolean")return e?N.any():N.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=qP(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??re};return ue(r,i)}var h_=Symbol("z.visit/resolving");function ui(e,t){let r=typeof t=="function"?t:(a,s)=>{let c=t[a._zod.def.type];return c?c(a,s):a},o=new Map;function n(a){let s=o.get(a);if(s===h_)return new Cr({type:"lazy",getter:()=>o.get(a)});if(s!==void 0)return s;o.set(a,h_);let c=i(a),u=r(c,c!==a);return o.set(a,u),u}function i(a){let s=a._zod.def,c=s.type;switch(c){case"object":{let u=s.shape,l=Object.keys(u),d=!1,f={};for(let g of l){let p=n(u[g]);p!==u[g]&&(d=!0),f[g]=p}let m=s.catchall;return s.catchall&&(m=n(s.catchall),m!==s.catchall&&(d=!0)),d?R(a,{...s,shape:f,catchall:m}):a}case"array":{let u=n(s.element);return u===s.element?a:R(a,{...s,element:u})}case"tuple":{let u=s.items,l=!1,d=[];for(let m of u){let g=n(m);g!==m&&(l=!0),d.push(g)}let f=s.rest;return s.rest&&(f=n(s.rest),f!==s.rest&&(l=!0)),l?R(a,{...s,items:d,rest:f}):a}case"record":case"map":{let u=n(s.keyType),l=n(s.valueType);return u===s.keyType&&l===s.valueType?a:R(a,{...s,keyType:u,valueType:l})}case"set":{let u=n(s.valueType);return u===s.valueType?a:R(a,{...s,valueType:u})}case"union":{let u=s.options,l=!1,d=[];for(let f of u){let m=n(f);m!==f&&(l=!0),d.push(m)}return l?R(a,{...s,options:d}):a}case"intersection":{let u=n(s.left),l=n(s.right);return u===s.left&&l===s.right?a:R(a,{...s,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=n(s.innerType);return u===s.innerType?a:R(a,{...s,innerType:u})}case"pipe":{let u=n(s.in),l=n(s.out);return u===s.in&&l===s.out?a:R(a,{...s,in:u,out:l})}case"function":{let u=n(s.input),l=n(s.output);return u===s.input&&l===s.output?a:R(a,{...s,input:u,output:l})}case"lazy":{let u=s.getter,{_cachedInner:l,...d}=s;return R(a,{...d,getter:()=>n(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return n(e)}function v_(e){return ui(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Tn(r.options)}})}function XP(e,t){if(!t?.length)return e;let r=e._zod.def;return R(e,xe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function y_(e){return XP(e.out,e.checks)}function HP(e){return e.in._zod.traits.has("$ZodTransform")?y_(e):e.in}function $_(e){return ui(e,{pipe:t=>HP(t._zod.def),default:(t,r)=>r?jt(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function b_(e){return ui(e,{pipe:t=>y_(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Ip={};Ee(Ip,{bigint:()=>nA,boolean:()=>tA,date:()=>rA,number:()=>eA,string:()=>QP});function QP(e){return Kd(Pn,e)}function eA(e){return Hd(An,e)}function tA(e){return af(Dn,e)}function nA(e){return cf(jn,e)}function rA(e){return $f(Qr,e)}var xp=Tp(eu(),1);function zp(e,t){return e==="antigravity"?`/bk-${t}`:`/bk:${t}`}var Z4=Ct.object({name:Ct.string().regex(/^[a-z][a-z-]*$/),description:Ct.string().min(1),"argument-hint":Ct.string().default("")});var oA=["write_to_file","replace_file_content","multi_replace_file_content"],Np=oA.join("|"),__=["PreInvocation","PreToolUse","PostToolUse"];var li="buildkeel";var x_="When you ask a question with choices, the user may see nothing you wrote before it: whenever a step says to show something and then ask, put it in the question itself, as it is, and never say it was shown above.",e6=`BuildKeel's tools are on the MCP server \`buildkeel\`: call each one with \`call_mcp_tool\` (\`ServerName\` \`buildkeel\`, \`ToolName\` the tool's name), passing \`workspace\`, the absolute path of this project's folder. Never read or write the spec tree's files instead. If you have no \`call_mcp_tool\` tool, tell the user to start a new conversation and stop: never run BuildKeel's server or programs yourself.
|
|
200
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}s.count>1&&e.reused==="ref"&&i(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function D$(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;D$(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let a of Array.isArray(i)?i:[i]){if(typeof a!="string")return;r.includes(a)||r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var j$=new Set(["type","properties","required","additionalProperties"]),P$=["oneOf","anyOf"];function A$(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Of(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!j$.has(a))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let s=[];for(let u of t){let l=u.properties?.[a]??A$(u);l!=null&&(s.some(d=>JSON.stringify(d)===JSON.stringify(l))||s.push(l))}let c=s.length===1?s[0]:Of(s)??{allOf:s};ne(r,a,c)}for(let a of i.required??[])o.add(a)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let a of t){let s=A$(a);s&&!i.some(c=>JSON.stringify(c)===JSON.stringify(s))&&i.push(s)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function xP(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of j$)if(n in e)return;let r=t.filter(n=>P$.some(i=>Array.isArray(n[i]))),o=null;if(!r.length)o=Of(t);else{let n=r[0],i=P$.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let a=t.filter(c=>c!==n),s=n[i].map(c=>Of([...a,c]));if(s.some(c=>!c))return;o={[i]:s}}o&&(delete e.allOf,Gr(e,o))}function st(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=s=>{let c=e.seen.get(s);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let m=e.seen.get(d),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Gr(u,g),Gr(u,l),s._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(g.$ref&&m.def)for(let y in u)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y])&&delete u[y]}let f=s._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())o(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())D$(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=s.get(l);d?d.push(u):s.set(l,[u])}for(let c of e.intersections)for(let u of s.get(c)??[])xP(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Gr(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ne(a,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:In(t,"input",e.processors),output:In(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ce(o.element,r);if(o.type==="set")return ce(o.valueType,r);if(o.type==="lazy")return ce(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ce(o.innerType,r);if(o.type==="intersection")return ce(o.left,r)||ce(o.right,r);if(o.type==="record"||o.type==="map")return ce(o.keyType,r)||ce(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ce(o.in,r)||ce(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ce(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ce(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ce(n,r))return!0;return!!(o.rest&&ce(o.rest,r))}return!1}var Pf=(e,t={})=>r=>{let o=ot({...r,processors:t});return q(e,o),at(o,e),st(o,e)},In=(e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},a=ot({...n??{},target:i,io:t,processors:r});return q(e,a),at(a,e),st(a,e)};var xn=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},zn=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},T$=(e,t)=>{xn(e,"minimum",t),zn(e,"maximum",t)},L$=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Z$=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},M$=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},R$=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},U$=(e,t)=>xn(e,"minimum",t.minimum),E$=(e,t)=>zn(e,"maximum",t.maximum),C$=e=>(t,r)=>{R$(t,r.format);let[o,n]=e[r.format];xn(t,"minimum",o),zn(t,"maximum",n)},zP={greater_than:(e,t)=>xn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>zn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>L$(e,t.value),number_format:C$(hr),bigint_format:C$(vr),min_length:U$,max_length:E$,length_equals:(e,t)=>T$(e,t.length),min_size:U$,max_size:E$,size_equals:(e,t)=>T$(e,t.size),string_format:(e,t)=>{R$(e,t.format),t.pattern&&Z$(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>M$(e,t.mime)};function Q(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)zP[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;n.minimum!==void 0&&xn(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&xn(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&zn(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&zn(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&L$(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&M$(t,n.mime);for(let i of n.patterns??[])Z$(t,i);return t}var NP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},OP=new Map([[qo,Cu],[jr,Lu]]),V$=e=>OP.get(e)??e,jf=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u,laxFormat:l}=Q(e);if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=NP[s]??s,n.format===""&&delete n.format,(s==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(V$);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Tf=(e,t,r,o)=>{let n=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Q(e);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d?m?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof i=="number"&&(n.minimum=i),f?m?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof a=="number"&&(n.maximum=a),s){let g=new Set;for(let w of s)Number.isFinite(w)&&w!==0?g.add(Math.abs(w)):H(e,t,n,o,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[p,...y]=g;p!==void 0&&(n.multipleOf=p),y.length&&(n.allOf=[...n.allOf??[],...y.map(w=>({multipleOf:w}))])}},Uf=(e,t,r,o)=>{r.type="boolean"},Ef=(e,t,r,o)=>{H(e,t,r,o,"BigInt cannot be represented in JSON Schema")},Cf=(e,t,r,o)=>{H(e,t,r,o,"Symbols cannot be represented in JSON Schema")},Lf=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Zf=(e,t,r,o)=>{H(e,t,r,o,"Undefined cannot be represented in JSON Schema")},Mf=(e,t,r,o)=>{H(e,t,r,o,"Void cannot be represented in JSON Schema")},Rf=(e,t,r,o)=>{r.not={}},Vf=(e,t,r,o)=>{},qf=(e,t,r,o)=>{},Ff=(e,t,r,o)=>{H(e,t,r,o,"Date cannot be represented in JSON Schema")},Bf=(e,t,r,o)=>{let n=e._zod.def,i=Xt(n.entries);if(i.length===0){r.not={};return}i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Kf=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let a of n.values)if(a===void 0){if(H(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(H(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Jf=(e,t,r,o)=>{H(e,t,r,o,"NaN cannot be represented in JSON Schema")},Gf=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Wf=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=Q(e);i!==void 0&&(n.minLength=i),a!==void 0&&(n.maxLength=a),s&&(s.length===0?n.not={}:s.length===1?n.contentMediaType=s[0]:n.anyOf=s.map(c=>({contentMediaType:c})))},Yf=(e,t,r,o)=>{r.type="boolean"},Xf=(e,t,r,o)=>{H(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Hf=(e,t,r,o)=>{H(e,t,r,o,"Function types cannot be represented in JSON Schema")},Qf=(e,t,r,o)=>{H(e,t,r,o,"Transforms cannot be represented in JSON Schema")},em=(e,t,r,o)=>{H(e,t,r,o,"Map cannot be represented in JSON Schema")},tm=(e,t,r,o)=>{H(e,t,r,o,"Set cannot be represented in JSON Schema")},nm=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:s}=Q(e);typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=q(i.element,t,{...o,path:[...o.path,"items"]})};function Wr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Wr(t.out):t.type==="catch"?Wr(t.innerType):e._zod.optin}var rm=(e,t,r,o)=>{let n=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&H(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in a)ne(n.properties,u,q(a[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(a)){let l=i.shape[u];(t.io==="input"?Wr(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=q(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Ma=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,c)=>q(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},im=(e,t,r,o)=>{let n=e._zod.def,i=q(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=q(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c,t.intersections.push(c)},om=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,y)=>q(p,t,{...o,path:[...o.path,a,y]})),u=i.rest?q(i.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let p=i.items[l-1];if(!(t.io==="input"?Wr(p)!==void 0:p._zod.optout==="optional"))break;l--}let d=i.items.length,f=!i.rest;t.target==="draft-2020-12"?(n.prefixItems=c,f?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):(n.items=c,f?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),f&&(n.maxItems=d));let{minimum:m,maximum:g}=Q(e);typeof m=="number"&&(n.minItems=m),typeof g=="number"&&(n.maxItems=g)};function Af(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let p=Af(e,g,r);return p===g?t:p}for(let g of["anyOf","oneOf"]){let p=t[g];if(!Array.isArray(p))continue;let y=p.map(w=>Af(e,w,r));y.some((w,k)=>w!==p[k])&&(t={...t,[g]:y})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some(g=>typeof g=="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),n&&(m.type="string",i||(m.pattern=(o.includes("number")?Re:xr).source)),m}var Df=new WeakMap;function PP(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Df.get(e)??[]){let n=e.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=Af(t,i,new Set);a!==i&&r.set(i,a)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var am=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,s=Q(a).patterns;if(i.mode==="loose"&&s&&s.size>0){let l=q(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of s)ne(n.patternProperties,V$(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=q(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=Df.get(t);l||(l=[],Df.set(t,l),t.deferred.push(()=>PP(t))),l.push(e)}n.additionalProperties=q(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=a._zod.values,u=t.io==="input"&&Wr(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},sm=(e,t,r,o)=>{let n=e._zod.def,i=q(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},cm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},um=Symbol();function q$(e,t,r,o,n){let i=!1,a=JSON.stringify(e,(s,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(H(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),um):JSON.parse(a)}var lm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a=q$(n.defaultValue,e,t,r,o);a!==um&&(r.default=a)},dm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let a=q$(n.defaultValue,e,t,r,o);a!==um&&(r._prefault=a)},fm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{H(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},mm=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;q(a,t,o);let s=t.seen.get(e);s.ref=a},pm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},gm=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Ra=(e,t,r,o)=>{let n=e._zod.def;q(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},hm=(e,t,r,o)=>{let n=e._zod.innerType;q(n,t,o);let i=t.seen.get(e);i.ref=n},Za={string:jf,number:Tf,boolean:Uf,bigint:Ef,symbol:Cf,null:Lf,undefined:Zf,void:Mf,never:Rf,any:Vf,unknown:qf,date:Ff,enum:Bf,literal:Kf,nan:Jf,template_literal:Gf,file:Wf,success:Yf,custom:Xf,function:Hf,transform:Qf,map:em,set:tm,array:nm,object:rm,union:Ma,intersection:im,tuple:om,record:am,nullable:sm,nonoptional:cm,default:lm,prefault:dm,catch:fm,pipe:mm,readonly:pm,promise:gm,optional:Ra,lazy:hm};function Va(e,t){if("_idmap"in e){let o=e,n=ot({...t,processors:Za}),i={};for(let c of o._idmap.entries()){let[u,l]=c;q(l,n)}let a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(let c of o._idmap.entries()){let[u,l]=c;at(n,l),ne(a,u,st(n,l))}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i}}return{schemas:a}}let r=ot({...t,processors:Za});return q(e,r),at(r,e),st(r,e)}var qa=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ot({processors:Za,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return q(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,at(this.ctx,t);let o=st(this.ctx,t),{"~standard":n,...i}=o;return i}};var F$={};var Un={};Ee(Un,{ZodAny:()=>Lm,ZodArray:()=>Vm,ZodBase64:()=>cs,ZodBase64URL:()=>us,ZodBigInt:()=>jn,ZodBigIntFormat:()=>fs,ZodBoolean:()=>Dn,ZodCIDRv4:()=>as,ZodCIDRv6:()=>ss,ZodCUID:()=>Qa,ZodCUID2:()=>es,ZodCatch:()=>up,ZodCodec:()=>oi,ZodCreditCard:()=>Pm,ZodCustom:()=>ai,ZodCustomStringFormat:()=>Ut,ZodDate:()=>Qr,ZodDefault:()=>rp,ZodDiscriminatedUnion:()=>Fm,ZodE164:()=>ls,ZodEmail:()=>Wa,ZodEmoji:()=>Xa,ZodEnum:()=>On,ZodExactOptional:()=>hs,ZodFile:()=>Qm,ZodFunction:()=>$p,ZodGUID:()=>Ya,ZodIBAN:()=>Am,ZodIPv4:()=>is,ZodIPv6:()=>os,ZodISODate:()=>ut,ZodISODateTime:()=>ct,ZodISODuration:()=>dt,ZodISOTime:()=>lt,ZodInstanceOf:()=>kp,ZodIntersection:()=>Bm,ZodJWT:()=>ds,ZodKSUID:()=>rs,ZodLazy:()=>hp,ZodLiteral:()=>Hm,ZodMAC:()=>Om,ZodMap:()=>Ym,ZodNaN:()=>dp,ZodNanoID:()=>Ha,ZodNever:()=>Mm,ZodNonOptional:()=>vs,ZodNull:()=>Em,ZodNullable:()=>np,ZodNumber:()=>An,ZodNumberFormat:()=>Et,ZodObject:()=>ti,ZodOptional:()=>ri,ZodPipe:()=>ii,ZodPrefault:()=>op,ZodPreprocess:()=>fp,ZodPromise:()=>yp,ZodReadonly:()=>mp,ZodRecord:()=>Nn,ZodSet:()=>Xm,ZodString:()=>Pn,ZodStringFormat:()=>F,ZodSuccess:()=>cp,ZodSymbol:()=>Tm,ZodTemplateLiteral:()=>gp,ZodTransform:()=>ep,ZodTuple:()=>Jm,ZodType:()=>E,ZodULID:()=>ts,ZodURL:()=>Hr,ZodUUID:()=>Te,ZodUndefined:()=>Um,ZodUnion:()=>ni,ZodUnknown:()=>Zm,ZodVoid:()=>Rm,ZodXID:()=>ns,ZodXor:()=>qm,_ZodString:()=>Ga,_default:()=>ip,_function:()=>n_,any:()=>jb,array:()=>ei,base64:()=>mb,base64url:()=>pb,bigint:()=>Nb,boolean:()=>jm,catch:()=>lp,check:()=>r_,cidrv4:()=>db,cidrv6:()=>fb,codec:()=>Hb,creditCard:()=>hb,cuid:()=>rb,cuid2:()=>ib,currencyCode:()=>kb,custom:()=>i_,date:()=>Ub,describe:()=>o_,discriminatedUnion:()=>Rb,e164:()=>gb,email:()=>J$,emoji:()=>tb,enum:()=>ps,exactOptional:()=>tp,file:()=>Gb,float32:()=>Sb,float64:()=>Ib,function:()=>n_,guid:()=>G$,hash:()=>wb,hex:()=>_b,hostname:()=>bb,httpUrl:()=>eb,iban:()=>vb,instanceof:()=>s_,int:()=>Ka,int32:()=>xb,int64:()=>Ob,intersection:()=>Km,invertCodec:()=>Qb,ipv4:()=>cb,ipv6:()=>lb,json:()=>u_,jwt:()=>yb,keyof:()=>Eb,ksuid:()=>sb,lazy:()=>vp,literal:()=>Jb,looseObject:()=>Zb,looseRecord:()=>qb,mac:()=>ub,map:()=>Fb,meta:()=>a_,nan:()=>Xb,nanoid:()=>nb,nativeEnum:()=>Kb,never:()=>ms,nonoptional:()=>sp,null:()=>Cm,nullable:()=>Xr,nullish:()=>Wb,number:()=>Dm,object:()=>Cb,optional:()=>jt,partialRecord:()=>Vb,pipe:()=>Ja,prefault:()=>ap,preprocess:()=>l_,promise:()=>t_,readonly:()=>pp,record:()=>Wm,refine:()=>bp,set:()=>Bb,strictObject:()=>Lb,string:()=>Yr,stringFormat:()=>$b,stringbool:()=>c_,success:()=>Yb,superRefine:()=>_p,symbol:()=>Ab,templateLiteral:()=>e_,transform:()=>gs,tuple:()=>Gm,uint32:()=>zb,uint64:()=>Pb,ulid:()=>ob,undefined:()=>Db,union:()=>Tn,unknown:()=>Dt,url:()=>Q$,uuid:()=>W$,uuidv4:()=>Y$,uuidv6:()=>X$,uuidv7:()=>H$,void:()=>Tb,xid:()=>ab,xor:()=>Mb});var Fa={};Ee(Fa,{endsWith:()=>vn,gt:()=>De,gte:()=>ye,includes:()=>gn,length:()=>Pt,lowercase:()=>mn,lt:()=>Ae,lte:()=>ve,maxLength:()=>Ot,maxSize:()=>it,mime:()=>$n,minLength:()=>Ve,minSize:()=>je,multipleOf:()=>rt,negative:()=>Ua,nonnegative:()=>Ca,nonpositive:()=>Ea,normalize:()=>bn,overwrite:()=>Ne,positive:()=>Ta,properties:()=>yn,property:()=>La,regex:()=>fn,size:()=>Nt,slugify:()=>Sn,startsWith:()=>hn,toLowerCase:()=>kn,toUpperCase:()=>wn,trim:()=>_n,uppercase:()=>pn});var B$=new WeakSet([Object.prototype,Error.prototype]);function Ba(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var K$=(e,t)=>{vu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);B$.has(r)||(B$.add(r),Ba(r,"format",o=>n=>kr(o,n)),Ba(r,"flatten",o=>n=>_r(o,n)),Ba(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,Ht,2)}),Ba(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,Ht,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},DP=h("ZodError",K$),he=h("ZodError",K$,void 0,{Parent:Error});var vm=nn(he),ym=rn(he),$m=on(he),bm=an(he),_m=bo(he),km=_o(he),wm=ko(he),Sm=wo(he),Im=So(he),xm=Io(he),zm=xo(he),Nm=zo(he);function TP(){ee.localeError||G(oa())}function Tt(){ee.memoizer||G({memoizer:Mr()})}var E=h("ZodType",(e,t)=>(TP(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone($.mergeDefs(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 R(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bp(e,t))},superRefine(e,t){return this.check(_p(e,t))},overwrite(e){return this.check(Ne(e))},optional(){return jt(this)},exactOptional(){return tp(this)},nullable(){return Xr(this)},nullish(){return jt(Xr(this))},nonoptional(e){return sp(this,e)},array(){return ei(this)},or(e){return Tn([this,e])},and(e){return Km(this,e)},transform(e){return Ja(this,gs(e))},default(e){return ip(this,e)},prefault(e){return ap(this,e)},catch(e){return lp(this,e)},pipe(e){return Ja(this,e)},readonly(){return pp(this)},describe(e){let t=this.clone();return re.add(t,{description:e}),t},meta(...e){if(e.length===0)return re.get(this);let t=this.clone();return re.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 $.hide(this,"~standard",{...Lo(this),jsonSchema:{input:In(this,"input"),output:In(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(t,r){return vm(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await ym(this,t,r,{callee:e})},safeParse(e,t){return $m(this,e,t)},async safeParseAsync(e,t){return bm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,t){return wr(this,e,t)},validateAsync(e,t){return Sr(this,e,t)},encode:function e(t,r){return _m(this,t,r,{callee:e})},decode:function e(t,r){return km(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await wm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Sm(this,t,r,{callee:e})},safeEncode(e,t){return Im(this,e,t)},safeDecode(e,t){return xm(this,e,t)},async safeEncodeAsync(e,t){return zm(this,e,t)},async safeDecodeAsync(e,t){return Nm(this,e,t)},toJSONSchema(e){return Pf(this,{})(e)},get description(){return re.get(this)?.description},get _def(){return this._zod.def}}),Ga=h("_ZodString",(e,t)=>{wt.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jf(e,r,o,n)},$.derived({format:e=>Q(e).format??null,minLength:e=>Q(e).minimum??null,maxLength:e=>Q(e).maximum??null},{regex(...e){return this.check(fn(...e))},includes(...e){return this.check(gn(...e))},startsWith(...e){return this.check(hn(...e))},endsWith(...e){return this.check(vn(...e))},min(...e){return this.check(Ve(...e))},max(...e){return this.check(Ot(...e))},length(...e){return this.check(Pt(...e))},nonempty(...e){return this.check(Ve(1,...e))},lowercase(e){return this.check(mn(e))},uppercase(e){return this.check(pn(e))},trim(){return this.check(_n())},normalize(...e){return this.check(bn(...e))},toLowerCase(){return this.check(kn())},toUpperCase(){return this.check(wn())},slugify(){return this.check(Sn())}})),Pn=h("ZodString",(e,t)=>{wt.init(e,t),Ga.init(e,t)},{email(e){return this.check(ma(Wa,e))},url(e){return this.check(qr(Hr,e))},jwt(e){return this.check(ja(ds,e))},emoji(e){return this.check($a(Xa,e))},guid(e){return this.check(pa(Ya,e))},uuid(e){return this.check(ga(Te,e))},uuidv4(e){return this.check(ha(Te,e))},uuidv6(e){return this.check(va(Te,e))},uuidv7(e){return this.check(ya(Te,e))},nanoid(e){return this.check(ba(Ha,e))},cuid(e){return this.check(_a(Qa,e))},cuid2(e){return this.check(ka(es,e))},ulid(e){return this.check(wa(ts,e))},base64(e){return this.check(Pa(cs,e))},base64url(e){return this.check(Aa(us,e))},xid(e){return this.check(Sa(ns,e))},ksuid(e){return this.check(Ia(rs,e))},ipv4(e){return this.check(xa(is,e))},ipv6(e){return this.check(za(os,e))},cidrv4(e){return this.check(Na(as,e))},cidrv6(e){return this.check(Oa(ss,e))},e164(e){return this.check(Da(ls,e))},datetime(e){return this.check(Fr(ct,e))},date(e){return this.check(Br(ut,e))},time(e){return this.check(Kr(lt,e))},duration(e){return this.check(Jr(dt,e))}});function Yr(e){return Bd(Pn,e)}var F=h("ZodStringFormat",(e,t)=>{V.init(e,t),Ga.init(e,t)}),ct=h("ZodISODateTime",(e,t)=>{Cl.init(e,t),F.init(e,t)}),ut=h("ZodISODate",(e,t)=>{Ll.init(e,t),F.init(e,t)}),lt=h("ZodISOTime",(e,t)=>{Zl.init(e,t),F.init(e,t)}),dt=h("ZodISODuration",(e,t)=>{Ml.init(e,t),F.init(e,t)}),Wa=h("ZodEmail",(e,t)=>{xl.init(e,t),F.init(e,t)});function J$(e){return ma(Wa,e)}var Ya=h("ZodGUID",(e,t)=>{Sl.init(e,t),F.init(e,t)});function G$(e){return pa(Ya,e)}var Te=h("ZodUUID",(e,t)=>{Il.init(e,t),F.init(e,t)});function W$(e){return ga(Te,e)}function Y$(e){return ha(Te,e)}function X$(e){return va(Te,e)}function H$(e){return ya(Te,e)}var Hr=h("ZodURL",(e,t)=>{Ol.init(e,t),F.init(e,t)});function Q$(e){return qr(Hr,e)}function eb(e){return qr(Hr,{protocol:Ir,hostname:Mu,...$.normalizeParams(e)})}var Xa=h("ZodEmoji",(e,t)=>{Pl.init(e,t),F.init(e,t)});function tb(e){return $a(Xa,e)}var Ha=h("ZodNanoID",(e,t)=>{Al.init(e,t),F.init(e,t)});function nb(e){return ba(Ha,e)}var Qa=h("ZodCUID",(e,t)=>{Dl.init(e,t),F.init(e,t)});function rb(e){return _a(Qa,e)}var es=h("ZodCUID2",(e,t)=>{jl.init(e,t),F.init(e,t)});function ib(e){return ka(es,e)}var ts=h("ZodULID",(e,t)=>{Tl.init(e,t),F.init(e,t)});function ob(e){return wa(ts,e)}var ns=h("ZodXID",(e,t)=>{Ul.init(e,t),F.init(e,t)});function ab(e){return Sa(ns,e)}var rs=h("ZodKSUID",(e,t)=>{El.init(e,t),F.init(e,t)});function sb(e){return Ia(rs,e)}var is=h("ZodIPv4",(e,t)=>{Rl.init(e,t),F.init(e,t)});function cb(e){return xa(is,e)}var Om=h("ZodMAC",(e,t)=>{ql.init(e,t),F.init(e,t)});function ub(e){return Jd(Om,e)}var os=h("ZodIPv6",(e,t)=>{Vl.init(e,t),F.init(e,t)});function lb(e){return za(os,e)}var as=h("ZodCIDRv4",(e,t)=>{Fl.init(e,t),F.init(e,t)});function db(e){return Na(as,e)}var ss=h("ZodCIDRv6",(e,t)=>{Bl.init(e,t),F.init(e,t)});function fb(e){return Oa(ss,e)}var cs=h("ZodBase64",(e,t)=>{Kl.init(e,t),F.init(e,t)});function mb(e){return Pa(cs,e)}var us=h("ZodBase64URL",(e,t)=>{Jl.init(e,t),F.init(e,t)});function pb(e){return Aa(us,e)}var ls=h("ZodE164",(e,t)=>{Gl.init(e,t),F.init(e,t)});function gb(e){return Da(ls,e)}var Pm=h("ZodCreditCard",(e,t)=>{Wl.init(e,t),F.init(e,t)});function hb(e){return Gd(Pm,e)}var Am=h("ZodIBAN",(e,t)=>{Yl.init(e,t),F.init(e,t)});function vb(e){return Wd(Am,e)}var ds=h("ZodJWT",(e,t)=>{Xl.init(e,t),F.init(e,t)});function yb(e){return ja(ds,e)}var Ut=h("ZodCustomStringFormat",(e,t)=>{Hl.init(e,t),F.init(e,t)});function $b(e,t,r={}){return At(Ut,e,t,r)}function bb(e){return At(Ut,"hostname",Zu,e)}function _b(e){return At(Ut,"hex",el,e)}function kb(e){return At(Ut,"currency_code",Vu,e)}function wb(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=we[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return At(Ut,o,n,t)}var An=h("ZodNumber",(e,t)=>{Go.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tf(e,r,o,n),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Q(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Q(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Q(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Q(e).format??null},{gt(e,t){return this.check(De(e,t))},gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},lt(e,t){return this.check(Ae(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},int(e){return this.check(Ka(e))},safe(e){return this.check(Ka(e))},positive(e){return this.check(De(0,e))},nonnegative(e){return this.check(ye(0,e))},negative(e){return this.check(Ae(0,e))},nonpositive(e){return this.check(ve(0,e))},multipleOf(e,t){return this.check(rt(e,t))},step(e,t){return this.check(rt(e,t))},finite(){return this}}));function Dm(e){return Xd(An,e)}var Et=h("ZodNumberFormat",(e,t)=>{Ql.init(e,t),An.init(e,t)});function Ka(e){return Qd(Et,e)}function Sb(e){return ef(Et,e)}function Ib(e){return tf(Et,e)}function xb(e){return nf(Et,e)}function zb(e){return rf(Et,e)}var Dn=h("ZodBoolean",(e,t)=>{Tr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Uf(e,r,o,n)});function jm(e){return of(Dn,e)}var jn=h("ZodBigInt",(e,t)=>{Wo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ef(e,r,o,n)},$.derived({minValue:e=>Q(e).minimum??null,maxValue:e=>Q(e).maximum??null,format:e=>Q(e).format??null},{gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},gt(e,t){return this.check(De(e,t))},lt(e,t){return this.check(Ae(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},positive(e){return this.check(De(BigInt(0),e))},negative(e){return this.check(Ae(BigInt(0),e))},nonpositive(e){return this.check(ve(BigInt(0),e))},nonnegative(e){return this.check(ye(BigInt(0),e))},multipleOf(e,t){return this.check(rt(e,t))}}));function Nb(e){return sf(jn,e)}var fs=h("ZodBigIntFormat",(e,t)=>{ed.init(e,t),jn.init(e,t)});function Ob(e){return uf(fs,e)}function Pb(e){return lf(fs,e)}var Tm=h("ZodSymbol",(e,t)=>{td.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cf(e,r,o,n)});function Ab(e){return df(Tm,e)}var Um=h("ZodUndefined",(e,t)=>{nd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zf(e,r,o,n)});function Db(e){return ff(Um,e)}var Em=h("ZodNull",(e,t)=>{rd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lf(e,r,o,n)});function Cm(e){return mf(Em,e)}var Lm=h("ZodAny",(e,t)=>{id.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vf(e,r,o,n)});function jb(){return pf(Lm)}var Zm=h("ZodUnknown",(e,t)=>{od.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qf(e,r,o,n)});function Dt(){return gf(Zm)}var Mm=h("ZodNever",(e,t)=>{ad.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rf(e,r,o,n)});function ms(e){return hf(Mm,e)}var Rm=h("ZodVoid",(e,t)=>{sd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mf(e,r,o,n)});function Tb(e){return vf(Rm,e)}var Qr=h("ZodDate",(e,t)=>{cd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ff(e,r,o,n),e.min=(r,o)=>e.check(ye(r,o)),e.max=(r,o)=>e.check(ve(r,o))},$.derived({minDate:e=>{let{minimum:t}=Q(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Q(e);return t?new Date(t):null}},{}));function Ub(e){return yf(Qr,e)}var Vm=h("ZodArray",(e,t)=>{Tt(),ud.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nm(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Ve(e,t))},nonempty(e){return this.check(Ve(1,e))},max(e,t){return this.check(Ot(e,t))},length(e,t){return this.check(Pt(e,t))},unwrap(){return this.element}});function ei(e,t){return _f(Vm,e,t)}function Eb(e){let t=e._zod.def.shape;return ps(Object.keys(t))}var ti=h("ZodObject",(e,t)=>{Tt(),ld.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rm(e,r,o,n),$.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ps(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:Dt()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:Dt()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:ms()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(ri,this,e[0])},exactPartial(...e){return $.partial(hs,this,e[0],"exactPartial")},required(...e){return $.required(vs,this,e[0])}});function Cb(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new ti(r)}function Lb(e,t){return new ti({type:"object",shape:e,catchall:ms(),...$.normalizeParams(t)})}function Zb(e,t){return new ti({type:"object",shape:e,catchall:Dt(),...$.normalizeParams(t)})}var ni=h("ZodUnion",(e,t)=>{Ur.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ma(e,r,o,n),e.options=t.options});function Tn(e,t){return new ni({type:"union",options:e,...$.normalizeParams(t)})}var qm=h("ZodXor",(e,t)=>{ni.init(e,t),dd.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ma(e,r,o,n),e.options=t.options});function Mb(e,t){return new qm({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var Fm=h("ZodDiscriminatedUnion",(e,t)=>{ni.init(e,t),md.init(e,t)});function Rb(e,t,r){return new Fm({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var Bm=h("ZodIntersection",(e,t)=>{pd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>im(e,r,o,n)});function Km(e,t){return new Bm({type:"intersection",left:e,right:t})}var Jm=h("ZodTuple",(e,t)=>{Tt(),Yo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>om(e,r,o,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ri({type:"optional",innerType:t}))})}});function Gm(e,t,r){let o=t instanceof T,n=o?r:t,i=o?t:null;return new Jm({type:"tuple",items:e,rest:i,...$.normalizeParams(n)})}var Nn=h("ZodRecord",(e,t)=>{Tt(),gd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>am(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Wm(e,t,r){return!t||!t._zod?new Nn({type:"record",keyType:Yr(),valueType:e,...$.normalizeParams(t)}):new Nn({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function Vb(e,t,r){return new Nn({type:"record",keyType:e,valueType:t,...$.normalizeParams(r),partial:!0})}function qb(e,t,r){return new Nn({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var Ym=h("ZodMap",(e,t)=>{Tt(),hd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>em(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(it(...r)),e.size=(...r)=>e.check(Nt(...r))});function Fb(e,t,r){return new Ym({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var Xm=h("ZodSet",(e,t)=>{Tt(),vd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tm(e,r,o,n),e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(it(...r)),e.size=(...r)=>e.check(Nt(...r))});function Bb(e,t){return new Xm({type:"set",valueType:e,...$.normalizeParams(t)})}var On=h("ZodEnum",(e,t)=>{yd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Bf(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new On({...t,checks:[],...$.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new On({...t,checks:[],...$.normalizeParams(n),entries:i})}});function ps(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new On({type:"enum",entries:r,...$.normalizeParams(t)})}function Kb(e,t){return new On({type:"enum",entries:e,...$.normalizeParams(t)})}var Hm=h("ZodLiteral",(e,t)=>{$d.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kf(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Jb(e,t){return new Hm({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var Qm=h("ZodFile",(e,t)=>{bd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wf(e,r,o,n),e.min=(r,o)=>e.check(je(r,o)),e.max=(r,o)=>e.check(it(r,o)),e.mime=(r,o)=>e.check($n(Array.isArray(r)?r:[r],o))});function Gb(e){return kf(Qm,e)}var ep=h("ZodTransform",(e,t)=>{Tt(),_d.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qf(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new nt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function gs(e){return new ep({type:"transform",transform:e})}var ri=h("ZodOptional",(e,t)=>{Xo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ra(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jt(e){return new ri({type:"optional",innerType:e})}var hs=h("ZodExactOptional",(e,t)=>{kd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ra(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function tp(e){return new hs({type:"optional",innerType:e})}var np=h("ZodNullable",(e,t)=>{wd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Xr(e){return new np({type:"nullable",innerType:e})}function Wb(e){return jt(Xr(e))}var rp=h("ZodDefault",(e,t)=>{Sd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ip(e,t){return new rp({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var op=h("ZodPrefault",(e,t)=>{Id.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new op({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var vs=h("ZodNonOptional",(e,t)=>{xd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sp(e,t){return new vs({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var cp=h("ZodSuccess",(e,t)=>{zd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Yb(e){return new cp({type:"success",innerType:e})}var up=h("ZodCatch",(e,t)=>{Nd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lp(e,t){return new up({type:"catch",innerType:e,catchValue:typeof t=="function"?t:$.constantCatch(t)})}var dp=h("ZodNaN",(e,t)=>{Od.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jf(e,r,o,n)});function Xb(e){return bf(dp,e)}var ii=h("ZodPipe",(e,t)=>{Ho.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mm(e,r,o,n),e.in=t.in,e.out=t.out});function Ja(e,t){return new ii({type:"pipe",in:e,out:t})}var oi=h("ZodCodec",(e,t)=>{ii.init(e,t),Er.init(e,t)});function Hb(e,t,r){return new oi({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Qb(e){let t=e._zod.def;return new oi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var fp=h("ZodPreprocess",(e,t)=>{ii.init(e,t),Pd.init(e,t)}),mp=h("ZodReadonly",(e,t)=>{Ad.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pp(e){return new mp({type:"readonly",innerType:e})}var gp=h("ZodTemplateLiteral",(e,t)=>{Dd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gf(e,r,o,n)});function e_(e,t){return new gp({type:"template_literal",parts:e,...$.normalizeParams(t)})}var hp=h("ZodLazy",(e,t)=>{Cr.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hm(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function vp(e){return new hp({type:"lazy",getter:e})}var yp=h("ZodPromise",(e,t)=>{Td.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function t_(e){return new yp({type:"promise",innerType:e})}var $p=h("ZodFunction",(e,t)=>{jd.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hf(e,r,o,n)});function n_(e){return new $p({type:"function",input:Array.isArray(e?.input)?Gm(e?.input):e?.input??ei(Dt()),output:e?.output??Dt()})}var ai=h("ZodCustom",(e,t)=>{Ud.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xf(e,r,o,n)});function r_(e){let t=new B({check:"custom"});return t._zod.check=e,t}function i_(e,t){return wf(ai,e??(()=>!0),t)}function bp(e,t={}){return Sf(ai,e,t)}function _p(e,t){return If(e,t)}var o_=xf,a_=zf,kp=h("ZodInstanceOf",(e,t)=>{ai.init(e,t)},{properties(e,t){return this.check(yn(e,t))}});function s_(e,t={}){let r=new kp({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var c_=(...e)=>Nf({Codec:oi,Boolean:Dn,String:Pn},...e);function u_(e){let t=vp(()=>Tn([Yr(e),Dm(),jm(),Cm(),ei(t),Wm(Yr(),t)]));return t}function l_(e,t){return new fp({type:"pipe",in:gs(e),out:t})}var UP={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function EP(e){G({customError:e})}function CP(){return G().customError}var wp;wp||(wp={});var si={};Ee(si,{ZodISODate:()=>ut,ZodISODateTime:()=>ct,ZodISODuration:()=>dt,ZodISOTime:()=>lt,date:()=>ZP,datetime:()=>LP,duration:()=>RP,time:()=>MP});function LP(e){return Fr(ct,e)}function ZP(e){return Br(ut,e)}function MP(e){return Kr(lt,e)}function RP(e){return Jr(dt,e)}var N={...Un,...Fa,iso:si},VP=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function qP(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function d_(e,t){return e.map((r,o)=>o<t?r:r.optional())}function FP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function BP(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1]===void 0?void 0:FP(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function KP(e,t){return N.transform(o=>o).check(o=>{let n=o.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&i.length<t.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let a of i){let s=t.keySchema.safeParse(a);s.success||o.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function Sp(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let o=String(e);return`${r[0]}${o.length}:${o}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let a of e){let s=Sp(a,t);if(s===null)return null;i.push(s)}return`a${i.length}:[${i.join(",")}]`}let o=Object.keys(e).sort(),n=[];for(let i of o){let a=Sp(e[i],t);if(a===null)return null;n.push(`${i.length}:${i}=${a}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var JP=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),GP=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function ci(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(ci):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>JP.has(t)?ci(r):!GP.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(ci))}function f_(e){return e===1?"element":"elements"}function WP(e,t){return N.transform(o=>o).check(o=>{let n=o.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let i=new Map;for(let a=0;a<n.length;a++){let s=Sp(n[a],new Set);if(s===null)continue;let c=i.get(s);if(c===void 0){i.set(s,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${c}`,input:n,path:[a],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,a=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,s=0;for(let c of n)if(t.containsSchema.safeParse(c).success&&++s>=a)break;s<i&&o.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${f_(i)}; found ${s}`,input:n,continue:!0}),t.maxContains!==void 0&&s>t.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${f_(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function m_(e,t){if(e!==!1)return e===void 0||e===!0?N.any():ue(e,t)}var YP=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function p_(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return N.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return N.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=BP(n,t),a=ue(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return N.null();if(n.length===0)return N.never();if(n.length===1)return N.literal(n[0]);if(n.every(a=>typeof a=="string"))return N.enum(n);let i=n.map(a=>N.literal(a));return i.length<2?i[0]:N.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return N.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let a={...e,type:i};return p_(a,t)});return n.length===0?N.never():n.length===1?n[0]:N.union(n)}if(!r)return N.any();let o;switch(r){case"string":{let n=N.string();if(e.format){let i=e.format;i==="email"?n=n.check(N.email()):i==="uri"||i==="uri-reference"?n=n.check(N.url()):i==="uuid"||i==="guid"?n=n.check(N.uuid()):i==="date-time"?n=n.check(N.iso.datetime({offset:!0})):i==="date"?n=n.check(N.iso.date()):i==="time"?n=n.check(N.regex(YP)):i==="duration"?n=n.check(N.iso.duration()):i==="hostname"?n=n.check(N.hostname()):i==="ipv4"?n=n.check(N.ipv4()):i==="ipv6"?n=n.check(N.ipv6()):i==="mac"?n=n.check(N.mac()):i==="cidr"?n=n.check(N.cidrv4()):i==="cidr-v6"?n=n.check(N.cidrv6()):i==="base64"?n=n.check(N.base64()):i==="base64url"?n=n.check(N.base64url()):i==="e164"?n=n.check(N.e164()):i==="credit_card"?n=n.check(N.creditCard()):i==="iban"?n=n.check(N.iban()):i==="jwt"?n=n.check(N.jwt()):i==="emoji"?n=n.check(N.emoji()):i==="nanoid"?n=n.check(N.nanoid()):i==="cuid"?n=n.check(N.cuid()):i==="cuid2"?n=n.check(N.cuid2()):i==="ulid"?n=n.check(N.ulid()):i==="xid"?n=n.check(N.xid()):i==="ksuid"&&(n=n.check(N.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?N.number().int():N.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=N.boolean();break}case"null":{o=N.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?ue(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(i)){let m=ue(f,t);ne(n,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let p of f){let y=ue(d[p],t),w=N.string().regex(new RegExp(p));m.push(N.looseRecord(w,y))}let g=[];if(Object.keys(n).length>0&&g.push(N.object(n).passthrough()),g.push(...m),g.length===0)o=N.object({}).passthrough();else if(g.length===1)o=g[0];else{let p=N.intersection(g[0],g[1]);for(let y=2;y<g.length;y++)p=N.intersection(p,g[y]);o=p}if(e.additionalProperties===!1){let p=Object.keys(n),y=f.map(k=>new RegExp(k)),w=o;o=o.check(k=>{if(!_e(k.value))return;let S=[];for(let x of Object.keys(k.value))p.includes(x)||y.some(P=>P.test(x))||S.push(x);S.length&&k.issues.push({code:"unrecognized_keys",keys:S,input:k.value,inst:w})})}}else{let d=N.object(n);e.additionalProperties===!1?o=d.strict():s?o=d.catchall(s):o=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ue(f,t)}o=KP(o,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,s=n.map(d=>ue(d,t)),c=d_(s,a),u=Array.isArray(i)?void 0:m_(i,t),l=N.tuple(c);o=u?l.rest(u):l,typeof e.minItems=="number"&&(o=o.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(N.maxLength(e.maxItems)))}else if(Array.isArray(i)){let a=typeof e.minItems=="number"?e.minItems:0,s=i.map(d=>ue(d,t)),c=d_(s,a),u=m_(e.additionalItems,t),l=N.tuple(c);o=u?l.rest(u):l,typeof e.minItems=="number"&&(o=o.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(N.maxLength(e.maxItems)))}else if(i!==void 0){let a=ue(i,t),s=N.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=N.array(N.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=WP(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ue(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return o}function ue(e,t){if(typeof e=="boolean")return e?N.any():N.never();let r=p_(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(u=>ue(u,t)),c=N.union(s);r=o?N.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(u=>ue(u,t)),c=N.xor(s);r=o?N.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:N.any();else{let s=o?r:ue(e.allOf[0],t),c=o?0:1;for(let u=c;u<e.allOf.length;u++)s=N.intersection(s,ue(e.allOf[u],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=N.nullable(r)),e.readOnly===!0&&(r=N.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in e&&(n[s]=e[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in e&&(n[s]=e[s]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!ci(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let s of["minProperties","maxProperties"])e[s]!==void 0&&(n[s]=e[s])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!ci(e.contains)&&(n.contains=e.contains);for(let s of["uniqueItems","minContains","maxContains"])e[s]!==void 0&&(n[s]=e[s])}for(let s of Object.keys(e))VP.has(s)||ne(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function g_(e,t){if(typeof e=="boolean")return e?N.any():N.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=qP(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??re};return ue(r,i)}var h_=Symbol("z.visit/resolving");function ui(e,t){let r=typeof t=="function"?t:(a,s)=>{let c=t[a._zod.def.type];return c?c(a,s):a},o=new Map;function n(a){let s=o.get(a);if(s===h_)return new Cr({type:"lazy",getter:()=>o.get(a)});if(s!==void 0)return s;o.set(a,h_);let c=i(a),u=r(c,c!==a);return o.set(a,u),u}function i(a){let s=a._zod.def,c=s.type;switch(c){case"object":{let u=s.shape,l=Object.keys(u),d=!1,f={};for(let g of l){let p=n(u[g]);p!==u[g]&&(d=!0),f[g]=p}let m=s.catchall;return s.catchall&&(m=n(s.catchall),m!==s.catchall&&(d=!0)),d?R(a,{...s,shape:f,catchall:m}):a}case"array":{let u=n(s.element);return u===s.element?a:R(a,{...s,element:u})}case"tuple":{let u=s.items,l=!1,d=[];for(let m of u){let g=n(m);g!==m&&(l=!0),d.push(g)}let f=s.rest;return s.rest&&(f=n(s.rest),f!==s.rest&&(l=!0)),l?R(a,{...s,items:d,rest:f}):a}case"record":case"map":{let u=n(s.keyType),l=n(s.valueType);return u===s.keyType&&l===s.valueType?a:R(a,{...s,keyType:u,valueType:l})}case"set":{let u=n(s.valueType);return u===s.valueType?a:R(a,{...s,valueType:u})}case"union":{let u=s.options,l=!1,d=[];for(let f of u){let m=n(f);m!==f&&(l=!0),d.push(m)}return l?R(a,{...s,options:d}):a}case"intersection":{let u=n(s.left),l=n(s.right);return u===s.left&&l===s.right?a:R(a,{...s,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=n(s.innerType);return u===s.innerType?a:R(a,{...s,innerType:u})}case"pipe":{let u=n(s.in),l=n(s.out);return u===s.in&&l===s.out?a:R(a,{...s,in:u,out:l})}case"function":{let u=n(s.input),l=n(s.output);return u===s.input&&l===s.output?a:R(a,{...s,input:u,output:l})}case"lazy":{let u=s.getter,{_cachedInner:l,...d}=s;return R(a,{...d,getter:()=>n(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return n(e)}function v_(e){return ui(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Tn(r.options)}})}function XP(e,t){if(!t?.length)return e;let r=e._zod.def;return R(e,xe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function y_(e){return XP(e.out,e.checks)}function HP(e){return e.in._zod.traits.has("$ZodTransform")?y_(e):e.in}function $_(e){return ui(e,{pipe:t=>HP(t._zod.def),default:(t,r)=>r?jt(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function b_(e){return ui(e,{pipe:t=>y_(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Ip={};Ee(Ip,{bigint:()=>nA,boolean:()=>tA,date:()=>rA,number:()=>eA,string:()=>QP});function QP(e){return Kd(Pn,e)}function eA(e){return Hd(An,e)}function tA(e){return af(Dn,e)}function nA(e){return cf(jn,e)}function rA(e){return $f(Qr,e)}var xp=Tp(eu(),1);function zp(e,t){return e==="antigravity"?`/bk-${t}`:`/bk:${t}`}var Z4=Ct.object({name:Ct.string().regex(/^[a-z][a-z-]*$/),description:Ct.string().min(1),"argument-hint":Ct.string().default("")});var oA=["write_to_file","replace_file_content","multi_replace_file_content"],Np=oA.join("|"),__=["PreInvocation","PreToolUse","PostToolUse"];var li="buildkeel";var x_="Whenever a step says to show something and ask about it, write it out in your reply as normal text and end that reply with the question in plain text, calling no tool after it: the user may see nothing you wrote before a tool call. Use your tool for asking a question with choices only for a quick choice with nothing to read, and put in the question itself anything the user needs to choose.",e6=`BuildKeel's tools are on the MCP server \`buildkeel\`: call each one with \`call_mcp_tool\` (\`ServerName\` \`buildkeel\`, \`ToolName\` the tool's name), passing \`workspace\`, the absolute path of this project's folder. Never read or write the spec tree's files instead. If you have no \`call_mcp_tool\` tool, tell the user to start a new conversation and stop: never run BuildKeel's server or programs yourself.
|
|
201
201
|
|
|
202
202
|
${x_}
|
|
203
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buildkeel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Keeps requirements, tests and code connected, and gives the coding agent the full picture before it writes anything.",
|
|
5
5
|
"homepage": "https://buildkeel.ai",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: bk-adhoc
|
|
3
|
-
description: 'BuildKeel: Record a small change as an ad-hoc unit and start it, so its commits trace to something. Run as /bk-adhoc "<the change>", e.g. "Fix typo in the reset email", only when the user types it.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
BuildKeel's tools are on the MCP server `buildkeel`: call each one with `call_mcp_tool` (`ServerName` `buildkeel`, `ToolName` the tool's name), passing `workspace`, the absolute path of this project's folder. Never read or write the spec tree's files instead. If you have no `call_mcp_tool` tool, tell the user to start a new conversation and stop: never run BuildKeel's server or programs yourself.
|
|
7
|
-
|
|
8
|
-
When you ask a question with choices, the user may see nothing you wrote before it: whenever a step says to show something and then ask, put it in the question itself, as it is, and never say it was shown above.
|
|
9
|
-
|
|
10
|
-
Record a small change as a BuildKeel ad-hoc unit and start it. An ad-hoc unit needs no approval: it gets its permanent ID straight away, its commits carry that ID, and it is finished with /bk-done like any other unit.
|
|
11
|
-
|
|
12
|
-
The user typed: whatever follows /bk-adhoc in the user's message (nothing, if they typed only /bk-adhoc)
|
|
13
|
-
|
|
14
|
-
## Name the change
|
|
15
|
-
|
|
16
|
-
If the user described the change above, use it.
|
|
17
|
-
|
|
18
|
-
If the user typed nothing, ask straight away, before calling any tool: "What is the change?" Offer the choices with your tool for asking a question with choices, if you have one:
|
|
19
|
-
|
|
20
|
-
1. **The change we were just discussing** (the default, listed first), with the title you propose for it. Offer this only when the conversation names a change.
|
|
21
|
-
2. **Type a short description.** If they pick this, ask for it.
|
|
22
|
-
|
|
23
|
-
The title says what changes in a few words, such as "Fix typo in the reset email". If the change is a defect in work that was planned and tested, suggest recording it as a bug with /bk-new bug instead, and go on as the user prefers.
|
|
24
|
-
|
|
25
|
-
## Create and start it
|
|
26
|
-
|
|
27
|
-
1. Call the BuildKeel `save_draft` tool with `type: "adhoc"` and this content, with the title and a sentence or two saying what changes and why:
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
---
|
|
31
|
-
id: {{id}}
|
|
32
|
-
title: <title>
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Description
|
|
36
|
-
|
|
37
|
-
<what changes and why>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
It gives the unit its ID and commits it in the spec repo. If the number counter cannot be reached, the ID ends in letters and digits instead of a number; it is still permanent.
|
|
41
|
-
2. Call the BuildKeel `start_work` tool with the new ID.
|
|
42
|
-
- **Uncommitted changes:** show the files it lists. Files it says set BuildKeel up are committed on their own, as setting BuildKeel up, with no `BuildKeel-Unit` line, once the user agrees. For the rest, ask what to do, offering these choices: **commit them to the active unit** (the default, when there is one), with the message ending in `BuildKeel-Unit: <active unit ID>`; **set them aside**, after an explicit yes, with `git stash push --include-untracked -m "BuildKeel: set aside before starting <ID>"` (they come back with `git stash pop`); or **leave them, and do not start**. Then call `start_work` again. Never discard changes any other way.
|
|
43
|
-
- **Started:** tell the user the ID and the branch.
|
|
44
|
-
|
|
45
|
-
## Make the change
|
|
46
|
-
|
|
47
|
-
Make the change, and commit it with a message ending in `BuildKeel-Unit: <ID>`. If tests cover it, run them with a JUnit XML report and record it with the BuildKeel `test_results` tool. Then offer to finish it with /bk-done.
|
|
48
|
-
|
|
49
|
-
Do not create or edit spec tree files yourself; `save_draft` writes the unit.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: bk-start
|
|
3
|
-
description: "BuildKeel: Start work on a task, story, bug or ad-hoc unit: check it is ready, switch to its branch and load its context. Run as /bk-start [unit ID], e.g. TK-001, only when the user types it."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
BuildKeel's tools are on the MCP server `buildkeel`: call each one with `call_mcp_tool` (`ServerName` `buildkeel`, `ToolName` the tool's name), passing `workspace`, the absolute path of this project's folder. Never read or write the spec tree's files instead. If you have no `call_mcp_tool` tool, tell the user to start a new conversation and stop: never run BuildKeel's server or programs yourself.
|
|
7
|
-
|
|
8
|
-
When you ask a question with choices, the user may see nothing you wrote before it: whenever a step says to show something and then ask, put it in the question itself, as it is, and never say it was shown above.
|
|
9
|
-
|
|
10
|
-
Start work on a BuildKeel unit with the user. Every code change belongs to exactly one unit, and the unit's context tells you what to build.
|
|
11
|
-
|
|
12
|
-
The user typed: whatever follows /bk-start in the user's message (nothing, if they typed only /bk-start)
|
|
13
|
-
|
|
14
|
-
If BuildKeel's session report, or `query` with `view: "process"`, says this spec tree is Spec-driven, follow "In a Spec-driven tree" at the end as well.
|
|
15
|
-
|
|
16
|
-
## Choose the unit
|
|
17
|
-
|
|
18
|
-
If the user named a unit above, use it.
|
|
19
|
-
|
|
20
|
-
If the user typed nothing, ask straight away, before calling any tool: "What do you want to start?" Offer the choices with your tool for asking a question with choices, if you have one:
|
|
21
|
-
|
|
22
|
-
1. **Show what can be started** (the default, listed first).
|
|
23
|
-
2. **Type a unit ID.** If they pick this, ask for the ID.
|
|
24
|
-
|
|
25
|
-
If they pick the first choice, call the BuildKeel `query` tool with `view: "startable"` and show its result as it is. Then ask which unit to start, offering the ready ones as choices with the one you recommend first. If nothing is ready, say what is in the way and suggest the next step, such as approving with /bk-approve.
|
|
26
|
-
|
|
27
|
-
## Start it
|
|
28
|
-
|
|
29
|
-
Call the BuildKeel `start_work` tool with the unit's `id`.
|
|
30
|
-
|
|
31
|
-
- **Refused by the start gate:** show every failing check with its fix, as it is. Offer the fix that comes first, such as approving the story or its test plan. Do not start anything else in its place without asking.
|
|
32
|
-
- **Uncommitted changes:** show the files it lists. If it says some of them set BuildKeel up (such as `.buildkeel.yaml` or the spec tree's `buildkeel.yaml`), offer first **Commit them as setting BuildKeel up** (the default): commit only those files, with a message such as "Set up BuildKeel" and no `BuildKeel-Unit` line, then deal with any other files as below, and call `start_work` again. Every other change must belong to one unit, so ask the user what to do with them, offering these choices:
|
|
33
|
-
1. **Commit them to the active unit** (the default, when there is one). Show what will be committed, commit it with the message ending in `BuildKeel-Unit: <active unit ID>`, then call `start_work` again. When there is no active unit, ask which unit the changes belong to instead.
|
|
34
|
-
2. **Set them aside.** List the files again and ask for an explicit yes. Then run `git stash push --include-untracked -m "BuildKeel: set aside before starting <ID>"`, tell the user they can bring the changes back with `git stash pop`, and call `start_work` again.
|
|
35
|
-
3. **Leave them, and do not start.**
|
|
36
|
-
|
|
37
|
-
Never discard changes any other way.
|
|
38
|
-
- **Started:** tell the user the branch and anything it warned about, such as a spec tree that is behind its remote. Then give a short summary of the context it returned: what to build, the acceptance criteria, and the test cases, by ID. Propose how to begin, and ask before writing code.
|
|
39
|
-
|
|
40
|
-
Keep the context in mind for the rest of the work, and call `get_context` again if you lose track of it. Do not create or edit spec tree files yourself.
|
|
41
|
-
|
|
42
|
-
## In a Spec-driven tree
|
|
43
|
-
|
|
44
|
-
The units are open changes, bugs and ad-hoc units, and no gate runs: `start_work` starts the unit, or says which working tree on this machine already holds it. If nothing can be started, suggest drafting a change with /bk-capture. When a change starts, sum up its context in a few lines: what the proposal changes, the requirements it adds, modifies or removes by ID, how many of its tasks are done, and the next unticked task. Propose starting with that task, or running /bk-build for all of them, and ask before writing code.
|