@task-handoff/node-agent 0.0.66 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/node-update-worker.js +1 -1
- package/docker/git-provisioning-helper.js +1 -1
- package/package.json +1 -1
- package/runtime-artifacts/{controlled-instance-runtime-0.0.66-linux-universal.manifest.json → controlled-instance-runtime-0.0.68-linux-universal.manifest.json} +2 -2
- package/runtime-artifacts/controlled-instance-runtime-0.0.68-linux-universal.tar.gz +0 -0
- package/runtime-artifacts/controlled-instance-runtime-0.0.68-linux-universal.tar.gz.sha256 +1 -0
- package/runtime-artifacts/controlled-instance-runtime-0.0.66-linux-universal.tar.gz +0 -0
- package/runtime-artifacts/controlled-instance-runtime-0.0.66-linux-universal.tar.gz.sha256 +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("node:fs"),t=require("node:path"),n=require("node:child_process");function r(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function i(e,t="|"){return e.map(e=>x(e)).join(t)}function o(e,t){return"bigint"==typeof t?t.toString():t}class s{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function a(e){return new s(e)}function c(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function u(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function d(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function l(e){return d(e._zod.def)??e._zod.def.shape}function f(e,t,n){Object.defineProperty(e,t,{get(){const e=n();return u(this,t,e),e},enumerable:!0,configurable:!0})}function p(e,t,n){t in e?u(e,t,n):e[t]=n}function h(e,t,n,r){const i=l(t);for(const o of n){const n=Object.getOwnPropertyDescriptor(i,o);n.enumerable&&(n.get?f(e,o,()=>{const e=t._zod.def.shape[o];return r?r(e,o):e}):p(e,o,r?r(n.value,o):n.value))}}function m(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function g(e){return JSON.stringify(e)}const y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const _=a(()=>{if(ie.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function b(e){if(!1===v(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==v(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function w(e){return b(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const z=new Set(["string","number","symbol"]);function k(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function O(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function x(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}const S=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),I={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function j(e,t){const n=l(e),r=[];for(const e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw new Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function E(e,t){const n={};return h(n,e,Reflect.ownKeys(l(e))),function(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?f(e,n,()=>t[n]):p(e,n,r.value))}}(n,t),n}function P(e,t,n,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const o=n?new Set(j(t,n)):void 0,s={};return h(s,t,Reflect.ownKeys(l(t)),e&&((t,n)=>o&&!o.has(n)?t:new e({type:"optional",innerType:t}))),$(t,m(t._zod.def,{shape:s,checks:[]}))}function A(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function T(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function Z(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function N(e){return"string"==typeof e?e:e?.message}function F(e){const t=[];for(const n of e??[]){const e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;const r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function R(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function C(e,t,n){var r;const i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(o?.(e))??N(t?.error?.(e))??N(n.customError?.(e))??N(n.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}const D=/[\uD800-\uDBFF]/;function U(e){const t=e.length;if(!D.test(e))return t;let n=t;for(let r=0;r<t-1;r++)55296==(64512&e.charCodeAt(r))&&56320==(64512&e.charCodeAt(r+1))&&(n--,r++);return n}function J(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function M(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}function L(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function K(e,t,n){return L(e,t,n,!1)}function V(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return L(this,n,r(this))},set(e){L(this,n,e)}})}return t}function W(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?n:L(this,t,n.bind(this))},set(e){L(this,t,e)}})}let G,H=!1;const B={configurable:!0,get(){H=!0}};function q(e,t,n){const r=Object.getPrototypeOf(e._zod);t in r&&G!==e._zod?G=void 0:(G=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,B);const e=H;H=!1;try{const r=n(this);return H?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),H=H||e,r}catch(n){throw delete this[t],H=H||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function X(e){const t=()=>e;return t["~constantCatch"]=!0,t}var Y;const Q={value:void 0,enumerable:!1};let ee="captureStackTrace"in Error?Error:null;function te(e,t,n,r){function i(e){this.def=e,this.constr=d,this.traits=new Set}i.prototype={};const o=n,s=o&&new WeakSet;function a(n,r){if(n._zod){if(n._zod.traits.has(e))return}else{Q.value=new i(r);try{Object.defineProperty(n,"_zod",Q)}finally{Q.value=void 0}}if(n._zod.traits.add(e),t(n,r),s){const e=Object.getPrototypeOf(n),t=n._zod.constr.prototype;let r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);const i=r??e;s.has(i)||(s.add(i),function(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):W(e,n,r.value)}}(i,o))}const a=d.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in n||(n[e]=a[e].bind(n)))}const c=r?.Parent??Object;class u extends c{}function d(e){const t=r?.Parent?function(e){const t=ee;if(t){const n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return ee=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(u):this;a(t,e);const n=t._zod.deferred;if(n){for(const e of n)e();t._zod.deferred=void 0}const i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(u,"name",{value:e}),Object.defineProperty(d,"init",{value:a}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}class ne extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class re extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Y=globalThis).__zod_globalConfig??(Y.__zod_globalConfig={});const ie=globalThis.__zod_globalConfig;function oe(e){return e&&Object.assign(ie,e),ie}const se={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,o,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},ae={value:void 0,enumerable:!1},ce=new WeakSet([Object.prototype,Error.prototype]),ue=te("$ZodError",(e,t)=>{e.name="$ZodError",ae.value=t,Object.defineProperty(e,"issues",ae),ae.value=void 0,Object.defineProperty(e,"message",se);const n=Object.getPrototypeOf(e);ce.has(n)||(ce.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function de(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||("__proto__"===t?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function le(e,t){return{callee:t?.callee??e,Err:t?.Err}}const fe=e=>{const t=(n,r,i,o)=>{const s=i?{...i,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ne;if(a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>C(e,s,oe())));throw y(n,o?.callee??t),n}return a.value};return t},pe=e=>{const t=async(n,r,i,o)=>{const s=i?{...i,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>C(e,s,oe())));throw y(n,o?.callee??t),n}return a.value};return t},he=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ne;return o.issues.length?me(e,o.issues,i):{success:!0,data:o.value}};function me(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>C(e,n,oe()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const ge=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?me(e,o.issues,i):{success:!0,data:o.value}},ye=Symbol.for("zod.compile.invalid"),ve=Symbol.for("zod.compile.fallback"),_e=e=>{const t=fe(e),n=(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return t(e,r,s,le(n,o))};return n},be=e=>{const t=fe(e),n=(e,r,i,o)=>t(e,r,i,le(n,o));return n},we=e=>{const t=pe(e),n=async(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(e,r,s,le(n,o))};return n},ze=e=>{const t=pe(e),n=async(e,r,i,o)=>await t(e,r,i,le(n,o));return n},ke=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return he(e)(t,n,i)},$e=e=>(t,n,r)=>he(e)(t,n,r),Oe=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ge(e)(t,n,i)},xe=e=>async(t,n,r)=>ge(e)(t,n,r),Se=/^[cC][0-9a-z]{6,}$/,Ie=/^[0-9a-z]+$/,je=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ee=/^[0-9a-vA-V]{20}$/,Pe=/^[A-Za-z0-9]{27}$/,Ae=/^[a-zA-Z0-9_-]{21}$/,Te=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ze=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ne=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Fe=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,De=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ue=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Je=/^https?$/,Me=/^\+[1-9]\d{6,14}$/,Le="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Ke(e){return new RegExp(`^${e}$`)}const Ve=Ke(Le);function We(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Ge=/^[\s\S]{0,}$/,He=/^-?\d+(?:\.\d+)?$/,Be=/^(?:true|false)$/i,qe=/^[^A-Z]*$/,Xe=/^[^a-z]*$/,Ye=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Qe=e=>{const t=e.value;return!(null==t||void 0===t.length)},et={number:"number",bigint:"bigint",object:"date"},tt=te("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);const n=et[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:et[typeof r.value]??n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nt=te("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);const n=et[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:et[typeof r.value]??n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rt=te("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),it=te("$ZodCheckNumberFormat",(e,t)=>{Ye.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=S[t.format];e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),ot=te("$ZodCheckMaxLength",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=Qe),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>t.maximum?U(r):i)<=t.maximum)return;const o=J(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),st=te("$ZodCheckMinLength",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=Qe),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>=t.minimum&&i<2*t.minimum?U(r):i)>=t.minimum)return;const o=J(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),at=te("$ZodCheckLengthEquals",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=Qe),e._zod.check=n=>{const r=n.value,i=r.length,o="string"==typeof r&&i>=t.length&&i<=2*t.length?U(r):i;if(o===t.length)return;const s=J(r),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ct=te("$ZodCheckStringFormat",(e,t)=>{var n,r;Ye.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ut=te("$ZodCheckRegex",(e,t)=>{ct.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dt=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qe),ct.init(e,t)}),lt=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xe),ct.init(e,t)}),ft=te("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);const n=k(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),pt=te("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);const n=new RegExp(`^${k(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ht=te("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);const n=new RegExp(`.*${k(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),mt=te("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class gt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join("\n")}\n};`)(...Object.values(this.closed))}}const yt={major:4,minor:6,patch:7},vt=te("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yt;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,n,r)=>{if(t.memo)return t;let i,o=A(t);for(const s of n){if(s._zod.def.when){if(T(t))continue;if(!s._zod.def.when(t))continue}else if(o)continue;const n=t.issues.length,a=s._zod.check(t);if(a instanceof Promise&&!1===r?.async)throw new ne;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,t.issues.length!==n&&(R(t.issues,n,e),o||(o=A(t,n)))});else{if(t.issues.length===n)continue;R(t.issues,n,e),o||(o=A(t,n))}}return i?i.then(()=>t):t},n=(n,r,o)=>{if(A(n))return n.aborted=!0,n;const s=t(r,i,o);if(s instanceof Promise){if(!1===o.async)throw new ne;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if("backward"===o.direction){const t=e._zod.parse({value:r.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}const s=e._zod.parse(r,o);if(s instanceof Promise){if(!1===o.async)throw new ne;return s.then(e=>t(e,i,o))}return t(s,i,o)}}},{get"~standard"(){return K(this,"~standard",bt(this))},set"~standard"(e){L(this,"~standard",e)}}),_t=(e,t)=>e.issues.length?{issues:e.issues.map(e=>C(e,t,oe()))}:{value:e.value};function bt(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return _t(r,n)}catch(e){}return async function(e,t){const n={async:!0};return _t(await e._zod.run({value:t,issues:[]},n),n)}(e,t)},vendor:"zod",version:1}}const wt=te("$ZodString",(e,t)=>{vt.init(e,t),e._zod.pattern=t.pattern??Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),zt=te("$ZodStringFormat",(e,t)=>{ct.init(e,t),wt.init(e,t)}),kt=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ze),zt.init(e,t)}),$t=te("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ne(e))}else t.pattern??(t.pattern=Ne());zt.init(e,t)}),Ot=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fe),zt.init(e,t)});function xt(e){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(e):(new URL(e),!0)}catch{return!1}}const St=/[\t\n\r]/g;function It(e){return e.replace(St,"")}const jt=te("$ZodURL",(e,t)=>{zt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=function(e,t){return"normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===Je.source&&!/^https?:\/\//i.test(e))return 1;try{if("undefined"!=typeof URL){const t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(e,t):xt(e)||2}(r,t);return 1===i?void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort}):2===i?void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort}):!0===i?void(n.value=It(r)):(t.hostname&&!function(e,t){return t.lastIndex=0,t.test(e.hostname)}(i,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!function(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),void(n.value=t.normalize?i.href:It(r)))}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Et=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),zt.init(e,t)}),Pt=te("$ZodNanoID",(e,t)=>{if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);var n;t.pattern??(t.pattern=void 0===t.length?Ae:(n=t.length,new RegExp(`^[a-zA-Z0-9_-]{${n}}$`))),zt.init(e,t)}),At=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Se),zt.init(e,t)}),Tt=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ie),zt.init(e,t)}),Zt=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=je),zt.init(e,t)}),Nt=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ee),zt.init(e,t)}),Ft=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pe),zt.init(e,t)}),Rt=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${We({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${We({precision:e.precision})}`:n;return new RegExp(`^${Le}T(?:${r})$`)}(t)),zt.init(e,t)}),Ct=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ve),zt.init(e,t)}),Dt=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${We(t)}$`)),zt.init(e,t)}),Ut=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Te),zt.init(e,t)}),Jt=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Re),zt.init(e,t)}),Mt=/^[0-9a-fA-F:.]+$/;function Lt(e){return!!Mt.test(e)&&xt(`http://[${e}]`)}const Kt=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ce),zt.init(e,t),e._zod.check=n=>{Lt(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Vt=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=De),zt.init(e,t)}),Wt=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ue),zt.init(e,t),e._zod.check=n=>{(function(e){const t=e.split("/");if(2!==t.length)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`===r&&!(i<0||i>128)&&Lt(n)})(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Gt(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Ht=/^[0-9a-zA-Z+/]*={0,2}$/,Bt=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ht),zt.init(e,t),e._zod.check=n=>{Gt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),qt=/^[A-Za-z0-9_-]*$/,Xt=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=qt),zt.init(e,t),e._zod.check=n=>{(function(e){if(!qt.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Gt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Yt=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Me),zt.init(e,t)}),Qt=te("$ZodJWT",(e,t)=>{zt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),en=te("$ZodNumber",(e,t)=>{vt.init(e,t),e._zod.pattern=He,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),tn=te("$ZodNumberFormat",(e,t)=>{it.init(e,t),en.init(e,t)}),nn=te("$ZodBoolean",(e,t)=>{vt.init(e,t),e._zod.pattern=Be,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),rn=te("$ZodUnknown",(e,t)=>{vt.init(e,t),e._zod.parse=e=>e}),on=te("$ZodNever",(e,t)=>{vt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),sn=e=>Array.isArray(e)?e.length:-1;function an(e,t,n){e.issues.length&&t.issues.push(...Z(n,e.issues)),t.value[n]=e.value}const cn=te("$ZodArray",(e,t)=>{vt.init(e,t);const n=ie.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);const s=[],a=i?.abortEarly;for(let e=0;e<o.length;e++){const n=o[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)s.push(c.then(t=>an(t,r,e)));else if(an(c,r,e),a&&0!==c.issues.length&&A(c))break}return s.length?Promise.all(s).then(()=>r):r},function(e,t){const n=F(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,o)=>{const s=t(n.value);if(s>r&&!o?.skipChecks&&"backward"!==o?.direction)for(const[t,r]of F(e._zod.def.checks))if(s>t&&r._zod.def.when(n)){const t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,R(n.issues,t,e),n}return i(n,o)}}(e,sn)});function un(e,t,n,r,i,o){const s=n in r,a="optional"===o;if(s||!a||"optional"!==i){if(e.issues.length){if(void 0!==i&&a&&!s)return;t.issues.push(...Z(n,e.issues))}s||void 0!==i?void 0===e.value?(s||"defaulted"===i&&!a)&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}}const dn=[];function ln(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:dn,i=r.length?[...t,...r]:t;for(const t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const o=(s=e.shape,Object.keys(s).filter(e=>void 0!==s[e]._zod.optin&&"optional"===s[e]._zod.optout));var s;return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function fn(e,t,n,r,i,o,s){const a=[],c=i.keySet,u=i.catchall._zod,d=u.def.type,l=u.optin,f=u.optout;let p=0;for(const i in t){if(s&&n.issues.length!==p){if(A(n,p))break;p=n.issues.length}if(c.has(i))continue;if("__proto__"===i){"never"===d&&a.push(i);continue}if("never"===d){a.push(i);continue}const o=u.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>un(e,n,i,t,l,f))):un(o,n,i,t,l,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const pn=te("$ZodObject",(e,t)=>{vt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const e=()=>{const n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}const i=a(()=>ln(t));q(e,"propValues",e=>{const t=e.def.shape,n={};for(const e in t){const r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||u(n,e,new Set);for(const t of r.values)n[e].add(t);void 0!==r.optin&&n[e].add(void 0)}}return n});const o=v,s=t.catchall;let c;const d=ie.memoizer;d?.attach(e),e._zod.parse=(t,n)=>{c??(c=i.value);const r=t.value;if(!o(r))return t.issues.push({expected:"object",code:"invalid_type",input:r,inst:e}),t;t.value=d?d.alloc(e,t,{},n):{};const a=[],u=c.shape,l=n?.abortEarly;let f=t.issues.length;for(const e of c.allKeys){if(l&&t.issues.length!==f){if(A(t,f))break;f=t.issues.length}if("__proto__"===e)continue;const i=u[e],o=i._zod.optin,s=i._zod.optout,c=i._zod.run({value:r[e],issues:[]},n);c instanceof Promise?a.push(c.then(n=>un(n,t,e,r,o,s))):un(c,t,e,r,o,s)}return s?fn(a,r,t,n,i.value,e,!0===l):a.length?Promise.all(a).then(()=>t):t}}),hn=te("$ZodObjectJIT",(e,t)=>{pn.init(e,t);const n=e._zod.parse,r=a(()=>ln(t)),i=ie.memoizer;let o;const s=v,c=!ie.jitless,u=c&&_.value,d=t.catchall;let l;e._zod.parse=(a,f)=>{l??(l=r.value);const p=a.value;return s(p)?c&&u&&!1===f?.async&&!0!==f.jitless?(o||(o=(t=>{const n=r.value,o=n.symbolKeys,s=new gt(["payload","ctx"],{shape:t,inst:e,memo:i,syms:o}),a=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;s.write("const input = payload.value;");const u=Object.create(null);let d=0;for(const e of n.allKeys)u[e]="key_"+d++;s.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const e of n.allKeys){if("__proto__"===e)continue;const n=u[e],r="symbol"==typeof e?`syms[${o.indexOf(e)}]`:g(e),i=`${r} in input`,d=t[e],l=d?._zod?.optin,f=void 0!==l,p="optional"===d?._zod?.optout;if(s.write(`const ${n} = ${a(r)};`),f&&p){const e="optional"===l?`${n}_present`:`${n}.value !== undefined || ${n}_present`;s.write(`\n const ${n}_present = ${i};\n if (!${n}.issues.length || ${n}_present) {\n if (${n}.issues.length) {${c(n,r)}\n }\n\n if (${e}) {\n newResult[${r}] = ${n}.value;\n }\n }\n\n `)}else f?(s.write(`\n if (${n}.issues.length) {${c(n,r)}\n }\n `),"defaulted"===l?s.write(`newResult[${r}] = ${n}.value;`):s.write(`\n if (${n}.value !== undefined || ${i}) {\n newResult[${r}] = ${n}.value;\n }\n `)):s.write(`\n const ${n}_present = ${i};\n if (${n}.issues.length) {${c(n,r)}\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${r}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${n}_present) {\n newResult[${r}] = ${n}.value;\n }\n\n `)}return s.write("payload.value = newResult;"),s.write("return payload;"),s.compile()})(t.shape)),a=o(a,f),d?fn([],p,a,f,l,e,!0===f?.abortEarly):a):n(a,f):(a.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),a)}});function mn(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!A(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>C(e,r,oe())))}),t)}const gn=te("$ZodUnion",(e,t)=>{vt.init(e,t),q(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),q(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),q(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),q(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){const t=e.def.options.map(e=>e._zod.pattern);return new RegExp(`^(${t.map(e=>c(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>mn(t,r,e,i)):mn(s,r,e,i)}}),yn=te("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gn.init(e,t);const n=e._zod.parse;q(e,"propValues",e=>{const t={};let n=0;for(const r of e.def.options){const i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw new Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(const[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||u(t,e,new Set);for(const r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{const r=d(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw new Error(`Invalid discriminated union option at index "${n}"`)});const r=a(()=>function(e){const t=new Map;for(const n of e.options){const r=n._zod.propValues?.[e.discriminator];if(!r||0===r.size)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const e of r)if(t.has(e)){if(void 0!==e)throw new Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}(t));e._zod.parse=(i,o)=>{const s=i.value;if(!v(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=s?.[t.discriminator],c=r.value.get(a);return!c||void 0===a&&"backward"===o.direction?t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>null!==r.value.get(e)),input:s,path:[t.discriminator],inst:e}),i):c._zod.run(i,o)}}),vn=te("$ZodIntersection",(e,t)=>{vt.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>bn(e,t,n)):bn(e,i,o)}});function _n(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(b(e)&&b(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const n of r){if("__proto__"===n)continue;const r=_n(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=_n(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function bn(e,t,n){const r=new Map;let i;const o=new Map,s=(e,t)=>{let n;if("unrecognized_keys"!==e.code||e.path?.length){if("invalid_key"!==e.code||"record"!==e.origin||1!==e.path?.length)return!1;{const t=String(e.path[0]);o.has(t)||o.set(t,e),n=[t]}}else i??(i=e),n=e.keys;for(const e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(const n of t.issues)s(n,"l")||e.issues.push(n);for(const t of n.issues)s(t,"r")||e.issues.push(t);const a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length){const t=i?a.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(const n of a)!t.includes(n)&&o.has(n)&&e.issues.push(o.get(n))}const c=_n(t.value,n.value);if(!c.valid){if(A(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const wn=te("$ZodEnum",(e,t)=>{vt.init(e,t);const n=r(t.entries),i=new Set(n);e._zod.values=i,q(e,"pattern",e=>{const t=r(e.def.entries).filter(e=>z.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>k(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,r)=>{const o=t.value;return i.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),zn=te("$ZodLiteral",(e,t)=>{vt.init(e,t);const n=new Set(t.values);e._zod.values=n,q(e,"pattern",e=>{const t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?k(e):e?k(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),kn=te("$ZodTransform",(e,t)=>{vt.init(e,t),e._zod.optin="optional",ie.memoizer?.guard(e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new re(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ne;return n.value=i,n}});function $n(e,t){return e.value=t.issues.length?void 0:t.value,e}const On=te("$ZodOptional",(e,t)=>{vt.init(e,t),q(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",q(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),q(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${c(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>$n(e,t)):$n(e,r)}return t.innerType._zod.run(e,n)}}),xn=te("$ZodExactOptional",(e,t)=>{On.init(e,t),q(e,"values",e=>e.def.innerType._zod.values),q(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sn=te("$ZodNullable",(e,t)=>{vt.init(e,t),q(e,"optin",e=>e.def.innerType._zod.optin),q(e,"optout",e=>e.def.innerType._zod.optout),q(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${c(t.source)}|null)$`):void 0}),q(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),In=te("$ZodDefault",(e,t)=>{vt.init(e,t),e._zod.optin="defaulted",q(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jn(e,t)):jn(r,t)}});function jn(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const En=te("$ZodPrefault",(e,t)=>{vt.init(e,t),e._zod.optin="defaulted",q(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Pn=te("$ZodNonOptional",(e,t)=>{vt.init(e,t),q(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>An(t,e)):An(i,e)}});function An(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Tn(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>C(e,r,oe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Zn=te("$ZodCatch",(e,t)=>{vt.init(e,t),q(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),q(e,"optout",e=>e.def.innerType._zod.optout),q(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Tn(e,r,t,n)):Tn(e,r,t,n)}}),Nn=te("$ZodPipe",(e,t)=>{vt.init(e,t),q(e,"values",e=>e.def.in._zod.values),q(e,"optin",e=>e.def.in._zod.optin),q(e,"optout",e=>e.def.out._zod.optout),q(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Fn(e,t.in,n)):Fn(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Fn(e,t.out,n)):Fn(r,t.out,n)}});function Fn(e,t,n){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Rn=te("$ZodReadonly",(e,t)=>{vt.init(e,t),q(e,"propValues",e=>e.def.innerType._zod.propValues),q(e,"values",e=>e.def.innerType._zod.values),q(e,"optin",e=>e.def.innerType?._zod?.optin),q(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Cn):Cn(r)}});function Cn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Dn=te("$ZodCustom",(e,t)=>{Ye.init(e,t),vt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Un(t,n,r,e));Un(i,n,r,e)}});function Un(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(M(e))}}class Jn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Mn="~memo",Ln=[];function Kn(e){return null!==e&&"object"==typeof e}function Vn(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Wn=new WeakMap;function Gn(e,t,n){const r=Wn.get(e);if(void 0!==r)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0;const o=e=>{if(2!==i&&e?._zod){const n=Gn(e,t);n>i&&(i=n)}},s=e=>{e>i&&(i=e)},a=e._zod.def;switch(a.type){case"object":{const e=d(a);s(e?(e=>{let n=0;for(const r of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,r);if(!i.enumerable)continue;const o=i.get?1:i.value?._zod?Gn(i.value,t):0;o>n&&(n=o)}return n})(e):1),o(a.catchall);break}case"array":o(a.element);break;case"tuple":for(const e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(const e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":{const e=a._cachedInner??void 0;s(e?Gn(e,t):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const e in a){const t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;const n=t.value;if(n&&"object"==typeof n)if(n._zod)o(n);else if(Array.isArray(n))for(const e of n)o(e)}}return t.delete(e),function(e,t){return 1!==t&&Wn.set(e,2===t),t}(e,i)}let Hn;const Bn=[],qn={alloc(e,t,n){const r=Hn;if(!r)return n;Hn=void 0;const i={value:n,issues:null};return r.set(t.value,i),Bn.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,n=(e,n)=>{if("backward"!==n.direction&&function(e,t){const n=e[Mn]?.backEdges;return void 0!==n&&Kn(t)&&n.has(t)}(n,e.value))throw new Jn;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,s=(a,c)=>{if(void 0===n){const r=Gn(e,new Set);if(0===r)return e._zod.parse=t,e._zod.run===s&&(e._zod.run=t),t(a,c);2===r||o?n=!0:o=!0}const u=a.value;if(!Kn(u))return t(a,c);let d,l=c[Mn];l||(l={buckets:new WeakMap,backEdges:void 0},c[Mn]=l),r===c?d=i:(d=function(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}(l,e),r=c,i=d);const f=d.get(u);if(f)return a.value=f.value,f.issues?f.issues.length&&a.issues.push(...Vn(f.issues)):(a.memo=!0,l.backEdges??(l.backEdges=new WeakSet),l.backEdges.add(f.value)),a;Hn=d;const p=Bn.length,h=t(a,c);Hn=void 0;const m=Bn.length>p?Bn.pop():void 0;return h instanceof Promise?h.then(e=>(m&&(m.issues=e.issues.length?Vn(e.issues):Ln),e)):(m&&(m.issues=h.issues.length?Vn(h.issues):Ln),h)};e._zod.parse=s,e._zod.run===t&&(e._zod.run=s)})}},Xn=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?r[e]??e:String(t)}return e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${o(e.expected)}, received ${o(function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input),e.input)}`;case"invalid_value":return 1===e.values.length?`Invalid input: expected ${x(e.values[0])}`:`Invalid option: expected one of ${i(e.values,"|")}`;case"too_big":{const n=e.exact?"exactly ":e.inclusive?"<=":"<",r=t(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.exact?"exactly ":e.inclusive?">=":">",r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${i(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(" | ")}`:!1===e.inclusive?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}}};var Yn;(Yn=globalThis).__zod_globalRegistry??(Yn.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const Qn=globalThis.__zod_globalRegistry;function er(e){return e.checks&&(e.checks=[...e.checks]),e}function tr(e,t){return new tt({check:"less_than",...O(t),value:e,inclusive:!1})}function nr(e,t){return new tt({check:"less_than",...O(t),value:e,inclusive:!0})}function rr(e,t){return new nt({check:"greater_than",...O(t),value:e,inclusive:!1})}function ir(e,t){return new nt({check:"greater_than",...O(t),value:e,inclusive:!0})}function or(e,t){return new rt({check:"multiple_of",...O(t),value:e})}function sr(e,t){return new ot({check:"max_length",...O(t),maximum:e})}function ar(e,t){return new st({check:"min_length",...O(t),minimum:e})}function cr(e,t){return new at({check:"length_equals",...O(t),length:e})}function ur(e){return new mt({check:"overwrite",tx:e})}function dr(e,...t){for(const n of t)for(const t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&u(e,t,n[t]);return e}function lr(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qn,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 fr(e,t,n,r,i){const o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw new Error(i);return Object.assign(n,o),!0}function pr(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),pr(o,t,r),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&dr(s.schema,c),"input"===t.io&&kr(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function hr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function mr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${hr(o)}`}}const i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:"#"};const o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+hr(o)}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;(o||r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function gr(e){const t=e.anyOf;if(!Array.isArray(t)||0===t.length||void 0!==e.type)return;const n=[];for(const e of t){if(!e||"object"!=typeof e)return;gr(e);const t=Object.keys(e);if(1!==t.length||"type"!==t[0])return;const r=e.type;for(const e of Array.isArray(r)?r:[r]){if("string"!=typeof e)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=1===n.length?n[0]:n}const yr=new Set(["type","properties","required","additionalProperties"]),vr=["oneOf","anyOf"];function _r(e){const t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function br(e){const t=[];for(const n of e){if("object"!=typeof n||"object"!==n.type)return null;for(const e in n)if(!yr.has(e))return null;t.push(n)}const n={},r=new Set;for(const e of t){for(const r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;const e=[];for(const n of t){const t=n.properties?.[r]??_r(n);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}u(n,r,1===e.length?e[0]:br(e)??{allOf:e})}for(const t of e.required??[])r.add(t)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{const e=[];for(const n of t){const t=_r(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function wr(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const t of yr)if(t in e)return;const n=t.filter(e=>vr.some(t=>Array.isArray(e[t])));let r=null;if(n.length){const e=n[0],i=vr.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;const o=t.filter(t=>t!==e),s=e[i].map(e=>br([...o,e]));if(s.some(e=>!e))return;r={[i]:s}}else r=br(t);r&&(delete e.allOf,dr(e,r))}function zr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?dr(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),dr(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const t of[...e.seen.entries()].reverse())r(t[0]);if("openapi-3.0"!==e.target)for(const t of e.seen.entries())gr(t[1].def??t[1].schema);for(const t of e.deferred)t();if(e.intersections.length){const t=new Map;for(const n of e.seen.values())for(const e of[n.schema,n.def]){const n=e?.allOf;if(!Array.isArray(n))continue;const r=t.get(n);r?r.push(e):t.set(n,[e])}for(const n of e.intersections)for(const e of t.get(n)??[])wr(e)}}const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}dr(i,n.defId?n.schema:n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,u(s,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:$r(t,"input",e.processors),output:$r(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function kr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return kr(r.element,n);if("set"===r.type)return kr(r.valueType,n);if("lazy"===r.type)return kr(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type||"catch"===r.type)return kr(r.innerType,n);if("intersection"===r.type)return kr(r.left,n)||kr(r.right,n);if("record"===r.type||"map"===r.type)return kr(r.keyType,n)||kr(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||kr(r.in,n)||kr(r.out,n);if("object"===r.type){for(const e in r.shape)if(kr(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(kr(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(kr(e,n))return!0;return!(!r.rest||!kr(r.rest,n))}return!1}const $r=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=lr({...i??{},target:o,io:t,processors:n});return pr(e,s),mr(s,e),zr(s,e)},Or=(e,t,n)=>{(void 0===e[t]||n>e[t])&&(e[t]=n)},xr=(e,t,n)=>{(void 0===e[t]||n<e[t])&&(e[t]=n)},Sr=(e,t)=>{Or(e,"minimum",t),xr(e,"maximum",t)},Ir=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},jr=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Er=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Pr=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Ar=(e,t)=>Or(e,"minimum",t.minimum),Tr=(e,t)=>xr(e,"maximum",t.maximum),Zr=e=>(t,n)=>{Pr(t,n.format);const[r,i]=e[n.format];Or(t,"minimum",r),xr(t,"maximum",i)},Nr={greater_than:(e,t)=>Or(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ir(e,t.value),number_format:Zr(S),bigint_format:Zr(I),min_length:Ar,max_length:Tr,length_equals:(e,t)=>Sr(e,t.length),min_size:Ar,max_size:Tr,size_equals:(e,t)=>Sr(e,t.size),string_format:(e,t)=>{Pr(e,t.format),t.pattern&&jr(e,t.pattern),"base64"!==t.format&&"base64url"!==t.format||(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>Er(e,t.mime)};function Fr(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const e of r)Nr[e._zod.def.check]?.(t,e._zod.def);const i=e._zod.bag;void 0!==i.minimum&&Or(t,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&Or(t,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&xr(t,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&xr(t,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&Ir(t,i.multipleOf),void 0!==i.format&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Er(t,i.mime);for(const e of i.patterns??[])jr(t,e);return t}const Rr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cr=new Map([[Ht,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[qt,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),Dr=e=>Cr.get(e)??e;function Ur(e){const t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?Ur(t.out):"catch"===t.type?Ur(t.innerType):e._zod.optin}const Jr=Symbol();function Mr(e,t,n,r,i){let o=!1;const s=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(fr(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),Jr):JSON.parse(s)}const Lr=(e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType},Kr=new WeakSet([Object.prototype,Error.prototype]);function Vr(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const Wr=(e,t)=>{ue.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);Kr.has(n)||(Kr.add(n),Vr(n,"format",e=>t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i],s=i===e.length-1;if("_errors"===n){s&&r._errors.push(t(o)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const a=r[n];s&&a._errors.push(t(o)),r=a,i++}}}};return r(e),n}(e,t)),Vr(n,"flatten",e=>t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?de(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)),Vr(n,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,o,2)}),Vr(n,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,o,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},Gr=te("ZodError",Wr,void 0,{Parent:Error}),Hr=fe(Gr),Br=pe(Gr),qr=he(Gr),Xr=ge(Gr),Yr=_e(Gr),Qr=be(Gr),ei=we(Gr),ti=ze(Gr),ni=ke(Gr),ri=$e(Gr),ii=Oe(Gr),oi=xe(Gr);function si(){ie.memoizer||oe({memoizer:qn})}const ai=te("ZodType",(e,t)=>(ie.localeError||oe({localeError:Xn()}),vt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(m(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new go({type:"custom",check:"custom",fn:t,...O(n)})}(0,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=function(e,t){const n=new Ye({check:"custom",...O(t)});return n._zod.check=e,n}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(M(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(M(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(ur(e))},optional(){return io(this)},exactOptional(){return new oo({type:"optional",innerType:this})},nullable(){return ao(this)},nullish(){return io(ao(this))},nonoptional(e){return function(e,t){return new lo({type:"nonoptional",innerType:e,...O(t)})}(this,e)},array(){return Vi(this)},or(e){return new Hi({type:"union",options:[this,e],...O(void 0)})},and(e){return new Xi({type:"intersection",left:this,right:e})},transform(e){return ho(this,new no({type:"transform",transform:e}))},default(e){return t=e,new co({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():w(t)}});var t},prefault(e){return t=e,new uo({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():w(t)}});var t},catch(e){return new fo({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:X(t)});var t},pipe(e){return ho(this,e)},readonly(){return new mo({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Qn.add(t,{description:e}),t},meta(...e){if(0===e.length)return Qn.get(this);const t=this.clone();return Qn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return K(this,"~standard",{...bt(this),jsonSchema:{input:$r(this,"input"),output:$r(this,"output")}})},set"~standard"(e){L(this,"~standard",e)},parse:function e(t,n){return Hr(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Br(this,t,n,{callee:e})},safeParse(e,t){return qr(this,e,t)},async safeParseAsync(e,t){return Xr(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){L(this,"spa",e)},validate(e,t){return((e,t,n)=>{const r=e._zod.bag.validator;if(void 0!==r){if(r(t)!==ye)return!0;if(!0===r.definite&&void 0===n)return!1}return function(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let o;if(i?(r[ve]=!0,o=i({value:t,issues:[]},r)):o=e._zod.run({value:t,issues:[]},r),o instanceof Promise)throw new ne;return 0===o.issues.length}(e,t,n)})(this,e,t)},validateAsync(e,t){return(async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),0===i.issues.length})(this,e,t)},encode:function e(t,n){return Yr(this,t,n,{callee:e})},decode:function e(t,n){return Qr(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ei(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ti(this,t,n,{callee:e})},safeEncode(e,t){return ni(this,e,t)},safeDecode(e,t){return ri(this,e,t)},async safeEncodeAsync(e,t){return ii(this,e,t)},async safeDecodeAsync(e,t){return oi(this,e,t)},toJSONSchema(e){return((e,t={})=>n=>{const r=lr({...n,processors:t});return pr(e,r),mr(r,e),zr(r,e)})(this,{})(e)},get description(){return Qn.get(this)?.description},get _def(){return this._zod.def}}),ci=te("_ZodString",(e,t)=>{wt.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:c,laxFormat:u}=Fr(e);if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=Rr[s]??s,""===r.format&&delete r.format,("time"===s||u)&&delete r.format),c&&(r.contentEncoding=c),a&&a.size>0){const e=[...a].map(Dr);1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n)},V({format:e=>Fr(e).format??null,minLength:e=>Fr(e).minimum??null,maxLength:e=>Fr(e).maximum??null},{regex(...e){return this.check(function(e,t){return new ut({check:"string_format",format:"regex",...O(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ft({check:"string_format",format:"includes",...O(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new pt({check:"string_format",format:"starts_with",...O(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ht({check:"string_format",format:"ends_with",...O(t),suffix:e})}(...e))},min(...e){return this.check(ar(...e))},max(...e){return this.check(sr(...e))},length(...e){return this.check(cr(...e))},nonempty(...e){return this.check(ar(1,...e))},lowercase(e){return this.check(function(e){return new dt({check:"string_format",format:"lowercase",...O(e)})}(e))},uppercase(e){return this.check(function(e){return new lt({check:"string_format",format:"uppercase",...O(e)})}(e))},trim(){return this.check(ur(e=>e.trim()))},normalize(...e){return this.check(function(e){return ur(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(ur(e=>e.toLowerCase()))},toUpperCase(){return this.check(ur(e=>e.toUpperCase()))},slugify(){return this.check(ur(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})),ui=te("ZodString",(e,t)=>{wt.init(e,t),ci.init(e,t)},{email(e){return this.check(function(e,t){return new gi({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}(0,e))},url(e){return this.check(function(e,t){return new _i({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}(0,e))},jwt(e){return this.check(function(e,t){return new Zi({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}(0,e))},emoji(e){return this.check(function(e,t){return new bi({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}(0,e))},guid(e){return this.check(function(e,t){return new yi({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}(0,e))},uuid(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}(0,e))},uuidv4(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}(0,e))},uuidv6(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}(0,e))},uuidv7(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}(0,e))},nanoid(e){return this.check(function(e,t){return new wi({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}(0,e))},cuid(e){return this.check(function(e,t){return new zi({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}(0,e))},cuid2(e){return this.check(function(e,t){return new ki({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}(0,e))},ulid(e){return this.check(function(e,t){return new $i({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}(0,e))},base64(e){return this.check(function(e,t){return new Pi({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}(0,e))},base64url(e){return this.check(function(e,t){return new Ai({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}(0,e))},xid(e){return this.check(function(e,t){return new Oi({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}(0,e))},ksuid(e){return this.check(function(e,t){return new xi({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}(0,e))},ipv4(e){return this.check(function(e,t){return new Si({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}(0,e))},ipv6(e){return this.check(function(e,t){return new Ii({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}(0,e))},cidrv4(e){return this.check(function(e,t){return new ji({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}(0,e))},cidrv6(e){return this.check(function(e,t){return new Ei({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}(0,e))},e164(e){return this.check(function(e,t){return new Ti({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}(0,e))},datetime(e){return this.check(function(e,t){return new fi({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}(0,e))},date(e){return this.check(function(e,t){return new pi({type:"string",format:"date",check:"string_format",...O(t)})}(0,e))},time(e){return this.check(function(e,t){return new hi({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}(0,e))},duration(e){return this.check(function(e,t){return new mi({type:"string",format:"duration",check:"string_format",...O(t)})}(0,e))}});function di(e){return function(e,t){return new ui(er({type:"string",...O(t)}))}(0,e)}const li=te("ZodStringFormat",(e,t)=>{zt.init(e,t),ci.init(e,t)}),fi=te("ZodISODateTime",(e,t)=>{Rt.init(e,t),li.init(e,t)}),pi=te("ZodISODate",(e,t)=>{Ct.init(e,t),li.init(e,t)}),hi=te("ZodISOTime",(e,t)=>{Dt.init(e,t),li.init(e,t)}),mi=te("ZodISODuration",(e,t)=>{Ut.init(e,t),li.init(e,t)}),gi=te("ZodEmail",(e,t)=>{Ot.init(e,t),li.init(e,t)}),yi=te("ZodGUID",(e,t)=>{kt.init(e,t),li.init(e,t)}),vi=te("ZodUUID",(e,t)=>{$t.init(e,t),li.init(e,t)}),_i=te("ZodURL",(e,t)=>{jt.init(e,t),li.init(e,t)}),bi=te("ZodEmoji",(e,t)=>{Et.init(e,t),li.init(e,t)}),wi=te("ZodNanoID",(e,t)=>{Pt.init(e,t),li.init(e,t)}),zi=te("ZodCUID",(e,t)=>{At.init(e,t),li.init(e,t)}),ki=te("ZodCUID2",(e,t)=>{Tt.init(e,t),li.init(e,t)}),$i=te("ZodULID",(e,t)=>{Zt.init(e,t),li.init(e,t)}),Oi=te("ZodXID",(e,t)=>{Nt.init(e,t),li.init(e,t)}),xi=te("ZodKSUID",(e,t)=>{Ft.init(e,t),li.init(e,t)}),Si=te("ZodIPv4",(e,t)=>{Jt.init(e,t),li.init(e,t)}),Ii=te("ZodIPv6",(e,t)=>{Kt.init(e,t),li.init(e,t)}),ji=te("ZodCIDRv4",(e,t)=>{Vt.init(e,t),li.init(e,t)}),Ei=te("ZodCIDRv6",(e,t)=>{Wt.init(e,t),li.init(e,t)}),Pi=te("ZodBase64",(e,t)=>{Bt.init(e,t),li.init(e,t)}),Ai=te("ZodBase64URL",(e,t)=>{Xt.init(e,t),li.init(e,t)}),Ti=te("ZodE164",(e,t)=>{Yt.init(e,t),li.init(e,t)}),Zi=te("ZodJWT",(e,t)=>{Qt.init(e,t),li.init(e,t)}),Ni=te("ZodNumber",(e,t)=>{en.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:d}=Fr(e);i.type=d?"integer":"number";const l="number"==typeof u&&u>=(o??Number.NEGATIVE_INFINITY),f="number"==typeof c&&c<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;if(l?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:"number"==typeof o&&(i.minimum=o),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:"number"==typeof s&&(i.maximum=s),a){const n=new Set;for(const o of a)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):fr(e,t,i,r,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);const[o,...s]=n;void 0!==o&&(i.multipleOf=o),s.length&&(i.allOf=[...i.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,n,r),e.isFinite=!0},V({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=Fr(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=Fr(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=Fr(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Fr(e).format??null},{gt(e,t){return this.check(rr(e,t))},gte(e,t){return this.check(ir(e,t))},min(e,t){return this.check(ir(e,t))},lt(e,t){return this.check(tr(e,t))},lte(e,t){return this.check(nr(e,t))},max(e,t){return this.check(nr(e,t))},int(e){return this.check(Ci(e))},safe(e){return this.check(Ci(e))},positive(e){return this.check(rr(0,e))},nonnegative(e){return this.check(ir(0,e))},negative(e){return this.check(tr(0,e))},nonpositive(e){return this.check(nr(0,e))},multipleOf(e,t){return this.check(or(e,t))},step(e,t){return this.check(or(e,t))},finite(){return this}}));function Fi(e){return function(e,t){return new Ni(er({type:"number",checks:[],...O(t)}))}(0,e)}const Ri=te("ZodNumberFormat",(e,t)=>{tn.init(e,t),Ni.init(e,t)});function Ci(e){return function(e,t){return new Ri({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}(0,e)}const Di=te("ZodBoolean",(e,t)=>{nn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function Ui(e){return function(e,t){return new Di({type:"boolean",...O(t)})}(0,e)}const Ji=te("ZodUnknown",(e,t)=>{rn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Mi(){return new Ji({type:"unknown"})}const Li=te("ZodNever",(e,t)=>{on.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const Ki=te("ZodArray",(e,t)=>{si(),cn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=Fr(e);"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=pr(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ar(e,t))},nonempty(e){return this.check(ar(1,e))},max(e,t){return this.check(sr(e,t))},length(e,t){return this.check(cr(e,t))},unwrap(){return this.element}});function Vi(e,t){return function(e,t,n){return new Ki({type:"array",element:t,...O(n)})}(0,e,t)}const Wi=te("ZodObject",(e,t)=>{si(),hn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&fr(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const e in s)u(i.properties,e,pr(s[e],t,{...r,path:[...r.path,"properties",e]}));const a=[];for(const e of Object.keys(s)){const n=o.shape[e];("input"===t.io?void 0===Ur(n):void 0===n._zod.optout)&&a.push(e)}a.length>0&&(i.required=a),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=pr(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),function(e,t,n,r){const i=function(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return Qi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(m(this._zod.def,{catchall:e}))},passthrough(){return this.clone(m(this._zod.def,{catchall:Mi()}))},loose(){return this.clone(m(this._zod.def,{catchall:Mi()}))},strict(){return this.clone(m(this._zod.def,{catchall:function(e,t){return new Li({type:"never",...O(t)})}(0,e)}));var e},strip(){return this.clone(m(this._zod.def,{catchall:void 0}))},extend(e){return function(e,t){if(!b(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=l(e);for(const e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $(e,m(e._zod.def,{shape:E(e,t)}))}(this,e)},safeExtend(e){return function(e,t){if(!b(t))throw new Error("Invalid input to safeExtend: expected a plain object");return $(e,m(e._zod.def,{shape:E(e,t)}))}(this,e)},merge(e){return function(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};return h(n,e,Reflect.ownKeys(l(e))),h(n,t,Reflect.ownKeys(l(t))),$(e,m(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return h(i,e,j(e,t)),$(e,m(n,{shape:i,checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(j(e,t)),o={};return h(o,e,Reflect.ownKeys(l(e)).filter(e=>!i.has(e))),$(e,m(n,{shape:o,checks:[]}))}(this,e)},partial(...e){return P(ro,this,e[0])},exactPartial(...e){return P(oo,this,e[0],"exactPartial")},required(...e){return function(e,t,n){const r=n?new Set(j(t,n)):void 0,i={};return h(i,t,Reflect.ownKeys(l(t)),(t,n)=>r&&!r.has(n)?t:new e({type:"nonoptional",innerType:t})),$(t,m(t._zod.def,{shape:i}))}(lo,this,e[0])}});function Gi(e,t){const n={type:"object",shape:e??{},...O(t)};return new Wi(n)}const Hi=te("ZodUnion",(e,t)=>{gn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>pr(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options}),Bi=te("ZodDiscriminatedUnion",(e,t)=>{Hi.init(e,t),yn.init(e,t)});function qi(e,t,n){return new Bi({type:"union",options:t,discriminator:e,...O(n)})}const Xi=te("ZodIntersection",(e,t)=>{vn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=pr(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=pr(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)})(e,t,n,r)}),Yi=te("ZodEnum",(e,t)=>{wn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n)=>{const i=r(e._zod.def.entries);0!==i.length?(i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=i):n.not={}})(e,0,n),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new Yi({...t,checks:[],...O(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Yi({...t,checks:[],...O(r),entries:i})}});function Qi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Yi({type:"enum",entries:n,...O(t)})}const eo=te("ZodLiteral",(e,t)=>{zn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(0===i.values.length)return void(n.not={});const o=[];for(const s of i.values)if(void 0===s){if(fr(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(fr(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function to(e,t){return new eo({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const no=te("ZodTransform",(e,t)=>{si(),kn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{fr(e,t,n,r,"Transforms cannot be represented in JSON Schema")})(e,t,n,r),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new re(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(M(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=n.value),t.inst??(t.inst=e),n.issues.push(M(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}}),ro=te("ZodOptional",(e,t)=>{On.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function io(e){return new ro({type:"optional",innerType:e})}const oo=te("ZodExactOptional",(e,t)=>{xn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),so=te("ZodNullable",(e,t)=>{Sn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=pr(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new so({type:"nullable",innerType:e})}const co=te("ZodDefault",(e,t)=>{In.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;const o=Mr(i.defaultValue,e,t,n,r);o!==Jr&&(n.default=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),uo=te("ZodPrefault",(e,t)=>{En.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;const o=Mr(i.defaultValue,e,t,n,r);o!==Jr&&(n._prefault=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),lo=te("ZodNonOptional",(e,t)=>{Pn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),fo=te("ZodCatch",(e,t)=>{Zn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{return void fr(e,t,n,r,"Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),po=te("ZodPipe",(e,t)=>{Nn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;pr(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function ho(e,t){return new po({type:"pipe",in:e,out:t})}const mo=te("ZodReadonly",(e,t)=>{Rn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),go=te("ZodCustom",(e,t)=>{Dn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{fr(e,t,n,r,"Custom types cannot be represented in JSON Schema")})(e,t,n,r)}),yo=di().trim().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/),vo=di().datetime(),_o=Fi().int().nonnegative(),bo=Qi(["https-token","ssh-key"]),wo=Qi(["operation-only","instance-retained"]),zo=Qi(["enabled","disabled"]),ko=Qi(["pending","synced","deferred","revoking","revoked"]),$o=Gi({scheme:Qi(["https","ssh"]),host:di().trim().min(1).max(253),port:Fi().int().min(1).max(65535).optional(),pathPrefix:di().min(1).max(2048).default("/")}).strict();function Oo(e){throw new Error(`Invalid Git credential scope: ${e}`)}function xo(e){const t=e.trim().replace(/^\[|\]$/g,"");(!t||t.includes("*")||/[/?#@\s]/.test(t))&&Oo("host is invalid");try{const e=new URL(t.includes(":")?`http://[${t}]/`:`http://${t}/`).hostname.replace(/^\[|\]$/g,"").toLowerCase();return(!e||e.length>253||e.includes("*"))&&Oo("host is invalid"),e}catch{Oo("host is invalid")}}function So(e){try{return decodeURIComponent(e)}catch{Oo("path contains invalid percent encoding")}}function Io(e){const t=e?.trim()||"/";(t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("\0"))&&Oo("path contains an unsupported delimiter");const n=(t.startsWith("/")?t:`/${t}`).split("/").filter(Boolean);for(const e of n){const t=So(e);("."===t||".."===t||t.includes("/")||t.includes("\\")||t.includes("\0"))&&Oo("path contains an unsafe segment")}return 0===n.length?"/":`/${n.join("/")}/`}function jo(e){const t=$o.parse(e),n="https"===t.scheme?443:22;return $o.parse({scheme:t.scheme,host:xo(t.host),...void 0===t.port||t.port===n?{}:{port:t.port},pathPrefix:Io(t.pathPrefix)})}function Eo(e){return Io(e.replace(/\.git\/?$/,""))}const Po=Gi({id:yo,name:di().trim().min(1).max(160),kind:bo,scope:$o,secretSet:to(!0),status:zo,revision:_o,createdAt:vo,updatedAt:vo}).strict(),Ao=qi("kind",[Gi({kind:to("https-token"),username:di().trim().min(1).max(240),token:di().min(1).max(8192)}).strict(),Gi({kind:to("ssh-key"),privateKey:di().min(1).max(131072),passphrase:di().max(8192).optional(),pinnedKnownHosts:di().min(1).max(131072)}).strict()]);Gi({name:di().trim().min(1).max(160),scope:$o,secret:Ao}).strict().superRefine((e,t)=>{"https"===e.scope.scheme!=("https-token"===e.secret.kind)&&t.addIssue({code:"custom",path:["scope","scheme"],message:"Credential kind must match the remote scheme."});try{jo(e.scope)}catch(e){t.addIssue({code:"custom",path:["scope"],message:e instanceof Error?e.message:"Invalid Git scope."})}}),Gi({name:di().trim().min(1).max(160).optional(),scope:$o.optional(),secret:Ao.optional(),status:zo.optional()}).strict().refine(e=>Object.keys(e).length>0,"At least one credential field must be updated."),Gi({items:Vi(Po).max(1e4)}).strict(),Gi({host:di().trim().min(1).max(253),port:Fi().int().min(1).max(65535).optional()}).strict();const To=Gi({keyType:di().trim().min(1).max(64),fingerprint:di().trim().min(1).max(256),publicKey:di().trim().min(1).max(8192),knownHosts:di().min(1).max(8192)}).strict();Gi({host:di().trim().min(1).max(253),port:Fi().int().min(1).max(65535),fetchedAt:vo,knownHosts:di().min(1).max(65536),entries:Vi(To).min(1).max(32)}).strict(),Gi({instanceId:yo,credentialId:yo,credentialRevision:_o,assignmentRevision:_o,status:ko,authorizedAt:vo,updatedAt:vo}).strict();const Zo=Gi({credential:Po,secret:Ao}).strict().superRefine((e,t)=>{e.credential.kind!==e.secret.kind&&t.addIssue({code:"custom",path:["secret","kind"],message:"Credential payload kind mismatch."})});Gi({instanceId:yo,generation:_o,credentialIds:Vi(yo).max(256).transform(e=>[...new Set(e)].sort()),updatedAt:vo}).strict(),Gi({remoteUrl:di().trim().min(1).max(4096)}).strict(),qi("status",[Gi({status:to("ok"),username:di().min(1).max(240),password:di().min(1).max(8192)}).strict(),Gi({status:Qi(["none","ambiguous","unsupported","missing-host-key","rejected"])}).strict()]),Gi({remoteUrl:di().trim().min(1).max(4096)}).strict(),qi("status",[Gi({status:to("ok"),invocationId:yo,publicIdentity:di().min(1).max(131072),pinnedKnownHosts:di().min(1).max(131072)}).strict(),Gi({status:Qi(["none","ambiguous","unsupported","missing-host-key","rejected"])}).strict()]),Gi({invocationId:yo,frame:di().min(1).max(1048576)}).strict(),Gi({frame:di().min(1).max(1048576)}).strict();const No=Gi({operationId:yo,retention:wo,payload:Zo}).strict();function Fo(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ro(e){const t=e.replace(/-/g,"_").toUpperCase();return Object.assign(new Error(`TASK_HANDOFF_GIT_PROVISIONING_ERROR=${t}`),{code:t})}function Co(n,r=process.env.TASK_HANDOFF_GIT_RUNTIME_DIR||"/run/task-handoff/git-runtime"){const i=function(n){return e.readdirSync(n,{withFileTypes:!0}).filter(e=>e.isDirectory()&&e.name.startsWith("credential-")).sort((e,t)=>e.name.localeCompare(t.name)).flatMap(r=>{const i=t.join(n,r.name),o=t.join(i,"scope.json");if(!e.existsSync(o))return[];const s=e.existsSync(t.join(i,"token")),a=e.existsSync(t.join(i,"public-identity"));return s||a?[{candidate:{id:r.name,kind:s?"https-token":"ssh-key",scope:JSON.parse(e.readFileSync(o,"utf8")),status:"enabled",...a?{pinnedKnownHosts:e.existsSync(t.join(i,"known_hosts"))}:{}},directory:i}]:[]})}(r),o=function(e,t){let n;try{n=function(e){const t=e.trim();if(t&&!t.includes("\0")||Oo("remote is empty or invalid"),/^https?:\/\//i.test(t)||/^ssh:\/\//i.test(t)){let e;Io(t.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]+/i,"").split(/[?#]/,1)[0]||"/");try{e=new URL(t)}catch{Oo("remote URL is invalid")}"https:"!==e.protocol&&"ssh:"!==e.protocol&&Oo("remote scheme is unsupported"),(e.password||"https:"===e.protocol&&e.username)&&Oo("HTTPS userinfo is forbidden"),(e.search||e.hash)&&Oo("query and fragment are forbidden");const n="https:"===e.protocol?"https":"ssh",r=e.port?Number(e.port):void 0;return{...jo({scheme:n,host:e.hostname,port:r,pathPrefix:Eo(e.pathname)}),original:t}}/^[a-z][a-z0-9+.-]*:\/\//i.test(t)&&Oo("remote scheme is unsupported");const n=/^(?:([^@/:\s]+)@)?([^/:\s]+):(.+)$/.exec(t);n||Oo("remote must use HTTPS, ssh://, or scp-like SSH syntax");const[,,r,i]=n;return(i.includes("?")||i.includes("#"))&&Oo("query and fragment are forbidden"),{...jo({scheme:"ssh",host:r,pathPrefix:Eo(i)}),original:t}}(e)}catch(e){return{status:"unsupported",reason:e instanceof Error?e.message:"Unsupported Git remote."}}const r=t.filter(e=>"enabled"===e.status).filter(e=>"https"===n.scheme==("https-token"===e.kind)).filter(e=>function(e,t){const n=jo(e);return n.scheme===t.scheme&&n.host===t.host&&n.port===t.port&&("/"===n.pathPrefix||t.pathPrefix.startsWith(n.pathPrefix))}(e.scope,n)).map(e=>({candidate:e,specificity:jo(e.scope).pathPrefix.length}));if(0===r.length)return{status:"none",remote:n};const i=Math.max(...r.map(e=>e.specificity)),o=r.filter(e=>e.specificity===i).map(e=>e.candidate);if(o.length>1)return{status:"ambiguous",remote:n,credentialIds:o.map(e=>e.id).sort()};const s=o[0];return"ssh-key"===s.kind&&!0!==s.pinnedKnownHosts?{status:"missing-host-key",remote:n,credentialId:s.id}:{status:"unique",remote:n,credential:s}}(n,i.map(e=>e.candidate));if("unique"!==o.status)throw Ro("none"===o.status?"credential-missing":o.status);const s=i.find(e=>e.candidate.id===o.credential.id);if(!s)throw Ro("credential-missing");return s.directory}async function Do(r){const i=function(e){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||e.includes("\0")))return;const t=e;let n,r="";const i=[];for(let e=0;e<t.length;e+=1){const o=t[e];if("-p"===o&&/^\d+$/.test(t[e+1]||"")&&void 0===n){const r=Number(t[++e]);if(r<1||r>65535)return;n=String(r);continue}if("-4"!==o&&"-6"!==o)if("-o"!==o||"SendEnv=GIT_PROTOCOL"!==t[e+1]){if("-oSendEnv=GIT_PROTOCOL"!==o){if(o.startsWith("-"))return;if(r=o,e+=1,e!==t.length-1)return;break}i.push(o)}else i.push("-o",t[++e]);else i.push(o)}if(!r||!/^(?:[a-zA-Z0-9._-]+@)?[^@\s]+$/.test(r))return;const o=r.replace(/^[^@]+@/,""),s=function(e){const t=/^(git-upload-pack|git-receive-pack|git-upload-archive) ([\s\S]+)$/.exec(e);if(!t)return;const n=t[2];let r;if(n.startsWith("'")){if(!n.endsWith("'"))return;if(r=n.slice(1,-1).replace(/'\\''/g,"'"),Fo(r)!==n)return}else{if(!/^[a-zA-Z0-9._~@%+,:\/-]+$/.test(n))return;r=n}return!r||/[\0-\x1f\x7f]/.test(r)?void 0:{service:t[1],repository:r}}(t.at(-1)||"");if(!o||!s)return;const a=`${s.service} ${Fo(s.repository)}`;return{remote:`ssh://${o}${n?`:${n}`:""}/${encodeURIComponent(s.repository.replace(/^\/+/,"")).replace(/%2F/gi,"/")}`,args:[...i,...n?["-p",n]:[],r,a]}}(r);if(!i)throw Ro("remote-unsupported");const o=Co(i.remote),s=t.join(o,"agent.sock"),a=t.join(o,"public-identity"),c=t.join(o,"known_hosts");if(!e.existsSync(s))throw Ro("ssh-agent-unavailable");if(!e.existsSync(c)||0===e.statSync(c).size)throw Ro("host-key-required");return function(e,t,r={}){return new Promise((t,i)=>{const o={...process.env};delete o.SSH_AUTH_SOCK,Object.assign(o,r);const s=n.spawn("ssh",e,{stdio:"inherit",shell:!1,env:o});s.once("error",i),s.once("close",(e,n)=>0===e?t():i(Object.assign(new Error("Git SSH transport failed."),{exitCode:e,signal:n})))})}(["-F","/dev/null","-oBatchMode=yes","-oPasswordAuthentication=no","-oKbdInteractiveAuthentication=no","-oIdentitiesOnly=yes","-oIdentityFile=none","-oStrictHostKeyChecking=yes",`-oUserKnownHostsFile=${c}`,"-oGlobalKnownHostsFile=/dev/null",`-oIdentityAgent=${s}`,"-i",a,...i.args],0,{SSH_AUTH_SOCK:s})}Gi({operationId:yo,instanceId:yo,remoteUrl:di().trim().min(1).max(4096),ref:qi("type",[Gi({type:Qi(["branch","tag"]),name:di().trim().min(1).max(240)}).strict(),Gi({type:to("commit"),commit:di().trim().regex(/^[0-9a-fA-F]{4,64}$/,"commit must be a hexadecimal Git object id")}).strict()]),clone:Gi({depth:Fi().int().positive().max(1e5).optional(),submodules:Ui().default(!1),lfs:Ui().default(!1),subdirectory:di().trim().max(240).refine(e=>!e.startsWith("/")&&!e.split("/").some(e=>".."===e),"subdirectory must be a relative path within the repository").transform(e=>e.split("/").filter(e=>e&&"."!==e).join("/")).default("")}).strict(),credentials:Vi(No).max(256).default([])}).strict(),process.platform,async function(){const[n,...r]=process.argv.slice(2);if("credential"===n)return async function(n){if("get"!==n)return;const r=function(e){const t="https"===e.protocol?"https":void 0,n="string"==typeof e.host?e.host.trim():"",r="string"==typeof e.path?e.path.replace(/^\/+/,""):"";return t&&n?`${t}://${n}/${r}`:void 0}(await new Promise(e=>{let t="";process.stdin.setEncoding("utf8"),process.stdin.on("data",e=>{t+=e}),process.stdin.on("end",()=>e(Object.fromEntries(t.split(/\r?\n/).flatMap(e=>{const t=e.indexOf("=");return t>0?[[e.slice(0,t),e.slice(t+1)]]:[]}))))}));if(!r)throw Ro("remote-unsupported");let i;try{i=Co(r)}catch(e){if("CREDENTIAL_MISSING"===e.code)return void process.stderr.write(`${e.message}\n`);throw e}const o=e.readFileSync(t.join(i,"username"),"utf8"),s=e.readFileSync(t.join(i,"token"),"utf8");process.stdout.write(`username=${o}\npassword=${s}\n\n`)}(r[0]);if("ssh"===n)return Do(r);throw new Error("TASK_HANDOFF_GIT_PROVISIONING_ERROR=REMOTE_UNSUPPORTED")}().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1});
|
|
1
|
+
"use strict";var e=require("node:fs"),t=require("node:path"),n=require("node:child_process");function r(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function i(e,t="|"){return e.map(e=>x(e)).join(t)}function o(e,t){return"bigint"==typeof t?t.toString():t}class s{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function a(e){return new s(e)}function c(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function u(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function d(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function l(e){return d(e._zod.def)??e._zod.def.shape}function f(e,t,n){Object.defineProperty(e,t,{get(){const e=n();return u(this,t,e),e},enumerable:!0,configurable:!0})}function p(e,t,n){t in e?u(e,t,n):e[t]=n}function h(e,t,n,r){const i=l(t);for(const o of n){const n=Object.getOwnPropertyDescriptor(i,o);n.enumerable&&(n.get?f(e,o,()=>{const e=t._zod.def.shape[o];return r?r(e,o):e}):p(e,o,r?r(n.value,o):n.value))}}function m(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function g(e){return JSON.stringify(e)}const y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function v(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const _=a(()=>{if(ie.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function b(e){if(!1===v(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==v(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function w(e){return b(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const z=new Set(["string","number","symbol"]);function k(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function O(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function x(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}const S=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),I={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function j(e,t){const n=l(e),r=[];for(const e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw new Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function E(e,t){const n={};return h(n,e,Reflect.ownKeys(l(e))),function(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?f(e,n,()=>t[n]):p(e,n,r.value))}}(n,t),n}function P(e,t,n,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const o=n?new Set(j(t,n)):void 0,s={};return h(s,t,Reflect.ownKeys(l(t)),e&&((t,n)=>o&&!o.has(n)?t:new e({type:"optional",innerType:t}))),$(t,m(t._zod.def,{shape:s,checks:[]}))}function A(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function T(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function Z(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function N(e){return"string"==typeof e?e:e?.message}function F(e){const t=[];for(const n of e??[]){const e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;const r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function R(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function C(e,t,n){var r;const i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(o?.(e))??N(t?.error?.(e))??N(n.customError?.(e))??N(n.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}const D=/[\uD800-\uDBFF]/;function U(e){const t=e.length;if(!D.test(e))return t;let n=t;for(let r=0;r<t-1;r++)55296==(64512&e.charCodeAt(r))&&56320==(64512&e.charCodeAt(r+1))&&(n--,r++);return n}function J(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function M(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}function L(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function K(e,t,n){return L(e,t,n,!1)}function V(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return L(this,n,r(this))},set(e){L(this,n,e)}})}return t}function W(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?n:L(this,t,n.bind(this))},set(e){L(this,t,e)}})}let G,H=!1;const B={configurable:!0,get(){H=!0}};function q(e,t,n){const r=Object.getPrototypeOf(e._zod);t in r&&G!==e._zod?G=void 0:(G=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,B);const e=H;H=!1;try{const r=n(this);return H?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),H=H||e,r}catch(n){throw delete this[t],H=H||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function X(e){const t=()=>e;return t["~constantCatch"]=!0,t}var Y;const Q={value:void 0,enumerable:!1};let ee="captureStackTrace"in Error?Error:null;function te(e,t,n,r){function i(e){this.def=e,this.constr=d,this.traits=new Set}i.prototype={};const o=n,s=o&&new WeakSet;function a(n,r){if(n._zod){if(n._zod.traits.has(e))return}else{Q.value=new i(r);try{Object.defineProperty(n,"_zod",Q)}finally{Q.value=void 0}}if(n._zod.traits.add(e),t(n,r),s){const e=Object.getPrototypeOf(n),t=n._zod.constr.prototype;let r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);const i=r??e;s.has(i)||(s.add(i),function(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):W(e,n,r.value)}}(i,o))}const a=d.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in n||(n[e]=a[e].bind(n)))}const c=r?.Parent??Object;class u extends c{}function d(e){const t=r?.Parent?function(e){const t=ee;if(t){const n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return ee=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(u):this;a(t,e);const n=t._zod.deferred;if(n){for(const e of n)e();t._zod.deferred=void 0}const i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(u,"name",{value:e}),Object.defineProperty(d,"init",{value:a}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}class ne extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class re extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Y=globalThis).__zod_globalConfig??(Y.__zod_globalConfig={});const ie=globalThis.__zod_globalConfig;function oe(e){return e&&Object.assign(ie,e),ie}const se={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,o,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},ae={value:void 0,enumerable:!1},ce=new WeakSet([Object.prototype,Error.prototype]),ue=te("$ZodError",(e,t)=>{e.name="$ZodError",ae.value=t,Object.defineProperty(e,"issues",ae),ae.value=void 0,Object.defineProperty(e,"message",se);const n=Object.getPrototypeOf(e);ce.has(n)||(ce.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function de(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||("__proto__"===t?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function le(e,t){return{callee:t?.callee??e,Err:t?.Err}}const fe=e=>{const t=(n,r,i,o)=>{const s=i?{...i,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ne;if(a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>C(e,s,oe())));throw y(n,o?.callee??t),n}return a.value};return t},pe=e=>{const t=async(n,r,i,o)=>{const s=i?{...i,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>C(e,s,oe())));throw y(n,o?.callee??t),n}return a.value};return t},he=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ne;return o.issues.length?me(e,o.issues,i):{success:!0,data:o.value}};function me(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>C(e,n,oe()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const ge=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?me(e,o.issues,i):{success:!0,data:o.value}},ye=Symbol.for("zod.compile.invalid"),ve=Symbol.for("zod.compile.fallback"),_e=e=>{const t=fe(e),n=(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return t(e,r,s,le(n,o))};return n},be=e=>{const t=fe(e),n=(e,r,i,o)=>t(e,r,i,le(n,o));return n},we=e=>{const t=pe(e),n=async(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(e,r,s,le(n,o))};return n},ze=e=>{const t=pe(e),n=async(e,r,i,o)=>await t(e,r,i,le(n,o));return n},ke=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return he(e)(t,n,i)},$e=e=>(t,n,r)=>he(e)(t,n,r),Oe=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ge(e)(t,n,i)},xe=e=>async(t,n,r)=>ge(e)(t,n,r),Se=/^[cC][0-9a-z]{6,}$/,Ie=/^[0-9a-z]+$/,je=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ee=/^[0-9a-vA-V]{20}$/,Pe=/^[A-Za-z0-9]{27}$/,Ae=/^[a-zA-Z0-9_-]{21}$/,Te=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ze=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ne=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Fe=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,De=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ue=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Je=/^https?$/,Me=/^\+[1-9]\d{6,14}$/,Le="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Ke(e){return new RegExp(`^${e}$`)}const Ve=Ke(Le);function We(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Ge=/^[\s\S]{0,}$/,He=/^-?\d+(?:\.\d+)?$/,Be=/^(?:true|false)$/i,qe=/^[^A-Z]*$/,Xe=/^[^a-z]*$/,Ye=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Qe=e=>{const t=e.value;return!(null==t||void 0===t.length)},et={number:"number",bigint:"bigint",object:"date"},tt=te("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);const n=et[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:et[typeof r.value]??n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nt=te("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);const n=et[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:et[typeof r.value]??n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rt=te("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),it=te("$ZodCheckNumberFormat",(e,t)=>{Ye.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=S[t.format];e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),ot=te("$ZodCheckMaxLength",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=Qe),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>t.maximum?U(r):i)<=t.maximum)return;const o=J(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),st=te("$ZodCheckMinLength",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=Qe),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>=t.minimum&&i<2*t.minimum?U(r):i)>=t.minimum)return;const o=J(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),at=te("$ZodCheckLengthEquals",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=Qe),e._zod.check=n=>{const r=n.value,i=r.length,o="string"==typeof r&&i>=t.length&&i<=2*t.length?U(r):i;if(o===t.length)return;const s=J(r),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ct=te("$ZodCheckStringFormat",(e,t)=>{var n,r;Ye.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ut=te("$ZodCheckRegex",(e,t)=>{ct.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dt=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qe),ct.init(e,t)}),lt=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xe),ct.init(e,t)}),ft=te("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);const n=k(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),pt=te("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);const n=new RegExp(`^${k(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ht=te("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);const n=new RegExp(`.*${k(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),mt=te("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class gt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join("\n")}\n};`)(...Object.values(this.closed))}}const yt={major:4,minor:6,patch:7},vt=te("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yt;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,n,r)=>{if(t.memo)return t;let i,o=A(t);for(const s of n){if(s._zod.def.when){if(T(t))continue;if(!s._zod.def.when(t))continue}else if(o)continue;const n=t.issues.length,a=s._zod.check(t);if(a instanceof Promise&&!1===r?.async)throw new ne;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,t.issues.length!==n&&(R(t.issues,n,e),o||(o=A(t,n)))});else{if(t.issues.length===n)continue;R(t.issues,n,e),o||(o=A(t,n))}}return i?i.then(()=>t):t},n=(n,r,o)=>{if(A(n))return n.aborted=!0,n;const s=t(r,i,o);if(s instanceof Promise){if(!1===o.async)throw new ne;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if("backward"===o.direction){const t=e._zod.parse({value:r.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}const s=e._zod.parse(r,o);if(s instanceof Promise){if(!1===o.async)throw new ne;return s.then(e=>t(e,i,o))}return t(s,i,o)}}},{get"~standard"(){return K(this,"~standard",bt(this))},set"~standard"(e){L(this,"~standard",e)}}),_t=(e,t)=>e.issues.length?{issues:e.issues.map(e=>C(e,t,oe()))}:{value:e.value};function bt(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return _t(r,n)}catch(e){}return async function(e,t){const n={async:!0};return _t(await e._zod.run({value:t,issues:[]},n),n)}(e,t)},vendor:"zod",version:1}}const wt=te("$ZodString",(e,t)=>{vt.init(e,t),e._zod.pattern=t.pattern??Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),zt=te("$ZodStringFormat",(e,t)=>{ct.init(e,t),wt.init(e,t)}),kt=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ze),zt.init(e,t)}),$t=te("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ne(e))}else t.pattern??(t.pattern=Ne());zt.init(e,t)}),Ot=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fe),zt.init(e,t)});function xt(e){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(e):(new URL(e),!0)}catch{return!1}}const St=/[\t\n\r]/g;function It(e){return e.replace(St,"")}const jt=te("$ZodURL",(e,t)=>{zt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=function(e,t){return"normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===Je.source&&!/^https?:\/\//i.test(e))return 1;try{if("undefined"!=typeof URL){const t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(e,t):xt(e)||2}(r,t);return 1===i?void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort}):2===i?void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort}):!0===i?void(n.value=It(r)):(t.hostname&&!function(e,t){return t.lastIndex=0,t.test(e.hostname)}(i,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!function(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),void(n.value=t.normalize?i.href:It(r)))}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Et=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),zt.init(e,t)}),Pt=te("$ZodNanoID",(e,t)=>{if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);var n;t.pattern??(t.pattern=void 0===t.length?Ae:(n=t.length,new RegExp(`^[a-zA-Z0-9_-]{${n}}$`))),zt.init(e,t)}),At=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Se),zt.init(e,t)}),Tt=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ie),zt.init(e,t)}),Zt=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=je),zt.init(e,t)}),Nt=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ee),zt.init(e,t)}),Ft=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pe),zt.init(e,t)}),Rt=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${We({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${We({precision:e.precision})}`:n;return new RegExp(`^${Le}T(?:${r})$`)}(t)),zt.init(e,t)}),Ct=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ve),zt.init(e,t)}),Dt=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${We(t)}$`)),zt.init(e,t)}),Ut=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Te),zt.init(e,t)}),Jt=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Re),zt.init(e,t)}),Mt=/^[0-9a-fA-F:.]+$/;function Lt(e){return!!Mt.test(e)&&xt(`http://[${e}]`)}const Kt=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ce),zt.init(e,t),e._zod.check=n=>{Lt(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Vt=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=De),zt.init(e,t)}),Wt=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ue),zt.init(e,t),e._zod.check=n=>{(function(e){const t=e.split("/");if(2!==t.length)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`===r&&!(i<0||i>128)&&Lt(n)})(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Gt(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Ht=/^[0-9a-zA-Z+/]*={0,2}$/,Bt=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ht),zt.init(e,t),e._zod.check=n=>{Gt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),qt=/^[A-Za-z0-9_-]*$/,Xt=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=qt),zt.init(e,t),e._zod.check=n=>{(function(e){if(!qt.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Gt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Yt=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Me),zt.init(e,t)}),Qt=te("$ZodJWT",(e,t)=>{zt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),en=te("$ZodNumber",(e,t)=>{vt.init(e,t),e._zod.pattern=He,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),tn=te("$ZodNumberFormat",(e,t)=>{it.init(e,t),en.init(e,t)}),nn=te("$ZodBoolean",(e,t)=>{vt.init(e,t),e._zod.pattern=Be,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),rn=te("$ZodUnknown",(e,t)=>{vt.init(e,t),e._zod.parse=e=>e}),on=te("$ZodNever",(e,t)=>{vt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),sn=e=>Array.isArray(e)?e.length:-1;function an(e,t,n){e.issues.length&&t.issues.push(...Z(n,e.issues)),t.value[n]=e.value}const cn=te("$ZodArray",(e,t)=>{vt.init(e,t);const n=ie.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);const s=[],a=i?.abortEarly;for(let e=0;e<o.length;e++){const n=o[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)s.push(c.then(t=>an(t,r,e)));else if(an(c,r,e),a&&0!==c.issues.length&&A(c))break}return s.length?Promise.all(s).then(()=>r):r},function(e,t){const n=F(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,o)=>{const s=t(n.value);if(s>r&&!o?.skipChecks&&"backward"!==o?.direction)for(const[t,r]of F(e._zod.def.checks))if(s>t&&r._zod.def.when(n)){const t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,R(n.issues,t,e),n}return i(n,o)}}(e,sn)});function un(e,t,n,r,i,o){const s=n in r,a="optional"===o;if(s||!a||"optional"!==i){if(e.issues.length){if(void 0!==i&&a&&!s)return;t.issues.push(...Z(n,e.issues))}s||void 0!==i?void 0===e.value?(s||"defaulted"===i&&!a)&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}}const dn=[];function ln(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:dn,i=r.length?[...t,...r]:t;for(const t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const o=(s=e.shape,Object.keys(s).filter(e=>void 0!==s[e]._zod.optin&&"optional"===s[e]._zod.optout));var s;return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function fn(e,t,n,r,i,o,s){const a=[],c=i.keySet,u=i.catchall._zod,d=u.def.type,l=u.optin,f=u.optout;let p=0;for(const i in t){if(s&&n.issues.length!==p){if(A(n,p))break;p=n.issues.length}if(c.has(i))continue;if("__proto__"===i){"never"===d&&a.push(i);continue}if("never"===d){a.push(i);continue}const o=u.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>un(e,n,i,t,l,f))):un(o,n,i,t,l,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const pn=te("$ZodObject",(e,t)=>{vt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const e=()=>{const n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}const i=a(()=>ln(t));q(e,"propValues",e=>{const t=e.def.shape,n={};for(const e in t){const r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||u(n,e,new Set);for(const t of r.values)n[e].add(t);void 0!==r.optin&&n[e].add(void 0)}}return n});const o=v,s=t.catchall;let c;const d=ie.memoizer;d?.attach(e),e._zod.parse=(t,n)=>{c??(c=i.value);const r=t.value;if(!o(r))return t.issues.push({expected:"object",code:"invalid_type",input:r,inst:e}),t;t.value=d?d.alloc(e,t,{},n):{};const a=[],u=c.shape,l=n?.abortEarly;let f=t.issues.length;for(const e of c.allKeys){if(l&&t.issues.length!==f){if(A(t,f))break;f=t.issues.length}if("__proto__"===e)continue;const i=u[e],o=i._zod.optin,s=i._zod.optout,c=i._zod.run({value:r[e],issues:[]},n);c instanceof Promise?a.push(c.then(n=>un(n,t,e,r,o,s))):un(c,t,e,r,o,s)}return s?fn(a,r,t,n,i.value,e,!0===l):a.length?Promise.all(a).then(()=>t):t}}),hn=te("$ZodObjectJIT",(e,t)=>{pn.init(e,t);const n=e._zod.parse,r=a(()=>ln(t)),i=ie.memoizer;let o;const s=v,c=!ie.jitless,u=c&&_.value,d=t.catchall;let l;e._zod.parse=(a,f)=>{l??(l=r.value);const p=a.value;return s(p)?c&&u&&!1===f?.async&&!0!==f.jitless?(o||(o=(t=>{const n=r.value,o=n.symbolKeys,s=new gt(["payload","ctx"],{shape:t,inst:e,memo:i,syms:o}),a=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;s.write("const input = payload.value;");const u=Object.create(null);let d=0;for(const e of n.allKeys)u[e]="key_"+d++;s.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const e of n.allKeys){if("__proto__"===e)continue;const n=u[e],r="symbol"==typeof e?`syms[${o.indexOf(e)}]`:g(e),i=`${r} in input`,d=t[e],l=d?._zod?.optin,f=void 0!==l,p="optional"===d?._zod?.optout;if(s.write(`const ${n} = ${a(r)};`),f&&p){const e="optional"===l?`${n}_present`:`${n}.value !== undefined || ${n}_present`;s.write(`\n const ${n}_present = ${i};\n if (!${n}.issues.length || ${n}_present) {\n if (${n}.issues.length) {${c(n,r)}\n }\n\n if (${e}) {\n newResult[${r}] = ${n}.value;\n }\n }\n\n `)}else f?(s.write(`\n if (${n}.issues.length) {${c(n,r)}\n }\n `),"defaulted"===l?s.write(`newResult[${r}] = ${n}.value;`):s.write(`\n if (${n}.value !== undefined || ${i}) {\n newResult[${r}] = ${n}.value;\n }\n `)):s.write(`\n const ${n}_present = ${i};\n if (${n}.issues.length) {${c(n,r)}\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${r}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${n}_present) {\n newResult[${r}] = ${n}.value;\n }\n\n `)}return s.write("payload.value = newResult;"),s.write("return payload;"),s.compile()})(t.shape)),a=o(a,f),d?fn([],p,a,f,l,e,!0===f?.abortEarly):a):n(a,f):(a.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),a)}});function mn(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!A(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>C(e,r,oe())))}),t)}const gn=te("$ZodUnion",(e,t)=>{vt.init(e,t),q(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),q(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),q(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),q(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){const t=e.def.options.map(e=>e._zod.pattern);return new RegExp(`^(${t.map(e=>c(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>mn(t,r,e,i)):mn(s,r,e,i)}}),yn=te("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gn.init(e,t);const n=e._zod.parse;q(e,"propValues",e=>{const t={};let n=0;for(const r of e.def.options){const i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw new Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(const[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||u(t,e,new Set);for(const r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{const r=d(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw new Error(`Invalid discriminated union option at index "${n}"`)});const r=a(()=>function(e){const t=new Map;for(const n of e.options){const r=n._zod.propValues?.[e.discriminator];if(!r||0===r.size)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const e of r)if(t.has(e)){if(void 0!==e)throw new Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}(t));e._zod.parse=(i,o)=>{const s=i.value;if(!v(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=s?.[t.discriminator],c=r.value.get(a);return!c||void 0===a&&"backward"===o.direction?t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>null!==r.value.get(e)),input:s,path:[t.discriminator],inst:e}),i):c._zod.run(i,o)}}),vn=te("$ZodIntersection",(e,t)=>{vt.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>bn(e,t,n)):bn(e,i,o)}});function _n(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(b(e)&&b(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const n of r){if("__proto__"===n)continue;const r=_n(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=_n(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function bn(e,t,n){const r=new Map;let i;const o=new Map,s=(e,t)=>{let n;if("unrecognized_keys"!==e.code||e.path?.length){if("invalid_key"!==e.code||"record"!==e.origin||1!==e.path?.length)return!1;{const t=String(e.path[0]);o.has(t)||o.set(t,e),n=[t]}}else i??(i=e),n=e.keys;for(const e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(const n of t.issues)s(n,"l")||e.issues.push(n);for(const t of n.issues)s(t,"r")||e.issues.push(t);const a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length){const t=i?a.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(const n of a)!t.includes(n)&&o.has(n)&&e.issues.push(o.get(n))}const c=_n(t.value,n.value);if(!c.valid){if(A(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const wn=te("$ZodEnum",(e,t)=>{vt.init(e,t);const n=r(t.entries),i=new Set(n);e._zod.values=i,q(e,"pattern",e=>{const t=r(e.def.entries).filter(e=>z.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>k(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,r)=>{const o=t.value;return i.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),zn=te("$ZodLiteral",(e,t)=>{vt.init(e,t);const n=new Set(t.values);e._zod.values=n,q(e,"pattern",e=>{const t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?k(e):e?k(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),kn=te("$ZodTransform",(e,t)=>{vt.init(e,t),e._zod.optin="optional",ie.memoizer?.guard(e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new re(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ne;return n.value=i,n}});function $n(e,t){return e.value=t.issues.length?void 0:t.value,e}const On=te("$ZodOptional",(e,t)=>{vt.init(e,t),q(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",q(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),q(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${c(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>$n(e,t)):$n(e,r)}return t.innerType._zod.run(e,n)}}),xn=te("$ZodExactOptional",(e,t)=>{On.init(e,t),q(e,"values",e=>e.def.innerType._zod.values),q(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sn=te("$ZodNullable",(e,t)=>{vt.init(e,t),q(e,"optin",e=>e.def.innerType._zod.optin),q(e,"optout",e=>e.def.innerType._zod.optout),q(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${c(t.source)}|null)$`):void 0}),q(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),In=te("$ZodDefault",(e,t)=>{vt.init(e,t),e._zod.optin="defaulted",q(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jn(e,t)):jn(r,t)}});function jn(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const En=te("$ZodPrefault",(e,t)=>{vt.init(e,t),e._zod.optin="defaulted",q(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Pn=te("$ZodNonOptional",(e,t)=>{vt.init(e,t),q(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>An(t,e)):An(i,e)}});function An(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Tn(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>C(e,r,oe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Zn=te("$ZodCatch",(e,t)=>{vt.init(e,t),q(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),q(e,"optout",e=>e.def.innerType._zod.optout),q(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Tn(e,r,t,n)):Tn(e,r,t,n)}}),Nn=te("$ZodPipe",(e,t)=>{vt.init(e,t),q(e,"values",e=>e.def.in._zod.values),q(e,"optin",e=>e.def.in._zod.optin),q(e,"optout",e=>e.def.out._zod.optout),q(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Fn(e,t.in,n)):Fn(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Fn(e,t.out,n)):Fn(r,t.out,n)}});function Fn(e,t,n){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Rn=te("$ZodReadonly",(e,t)=>{vt.init(e,t),q(e,"propValues",e=>e.def.innerType._zod.propValues),q(e,"values",e=>e.def.innerType._zod.values),q(e,"optin",e=>e.def.innerType?._zod?.optin),q(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Cn):Cn(r)}});function Cn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Dn=te("$ZodCustom",(e,t)=>{Ye.init(e,t),vt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Un(t,n,r,e));Un(i,n,r,e)}});function Un(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(M(e))}}class Jn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Mn="~memo",Ln=[];function Kn(e){return null!==e&&"object"==typeof e}function Vn(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Wn=new WeakMap;function Gn(e,t,n){const r=Wn.get(e);if(void 0!==r)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0;const o=e=>{if(2!==i&&e?._zod){const n=Gn(e,t);n>i&&(i=n)}},s=e=>{e>i&&(i=e)},a=e._zod.def;switch(a.type){case"object":{const e=d(a);s(e?(e=>{let n=0;for(const r of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,r);if(!i.enumerable)continue;const o=i.get?1:i.value?._zod?Gn(i.value,t):0;o>n&&(n=o)}return n})(e):1),o(a.catchall);break}case"array":o(a.element);break;case"tuple":for(const e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(const e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":{const e=a._cachedInner??void 0;s(e?Gn(e,t):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const e in a){const t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;const n=t.value;if(n&&"object"==typeof n)if(n._zod)o(n);else if(Array.isArray(n))for(const e of n)o(e)}}return t.delete(e),function(e,t){return 1!==t&&Wn.set(e,2===t),t}(e,i)}let Hn;const Bn=[],qn={alloc(e,t,n){const r=Hn;if(!r)return n;Hn=void 0;const i={value:n,issues:null};return r.set(t.value,i),Bn.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,n=(e,n)=>{if("backward"!==n.direction&&function(e,t){const n=e[Mn]?.backEdges;return void 0!==n&&Kn(t)&&n.has(t)}(n,e.value))throw new Jn;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,s=(a,c)=>{if(void 0===n){const r=Gn(e,new Set);if(0===r)return e._zod.parse=t,e._zod.run===s&&(e._zod.run=t),t(a,c);2===r||o?n=!0:o=!0}const u=a.value;if(!Kn(u))return t(a,c);let d,l=c[Mn];l||(l={buckets:new WeakMap,backEdges:void 0},c[Mn]=l),r===c?d=i:(d=function(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}(l,e),r=c,i=d);const f=d.get(u);if(f)return a.value=f.value,f.issues?f.issues.length&&a.issues.push(...Vn(f.issues)):(a.memo=!0,l.backEdges??(l.backEdges=new WeakSet),l.backEdges.add(f.value)),a;Hn=d;const p=Bn.length,h=t(a,c);Hn=void 0;const m=Bn.length>p?Bn.pop():void 0;return h instanceof Promise?h.then(e=>(m&&(m.issues=e.issues.length?Vn(e.issues):Ln),e)):(m&&(m.issues=h.issues.length?Vn(h.issues):Ln),h)};e._zod.parse=s,e._zod.run===t&&(e._zod.run=s)})}},Xn=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?r[e]??e:String(t)}return e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${o(e.expected)}, received ${o(function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input),e.input)}`;case"invalid_value":return 1===e.values.length?`Invalid input: expected ${x(e.values[0])}`:`Invalid option: expected one of ${i(e.values,"|")}`;case"too_big":{const n=e.exact?"exactly ":e.inclusive?"<=":"<",r=t(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.exact?"exactly ":e.inclusive?">=":">",r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${i(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(" | ")}`:!1===e.inclusive?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}}};var Yn;(Yn=globalThis).__zod_globalRegistry??(Yn.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const Qn=globalThis.__zod_globalRegistry;function er(e){return e.checks&&(e.checks=[...e.checks]),e}function tr(e,t){return new tt({check:"less_than",...O(t),value:e,inclusive:!1})}function nr(e,t){return new tt({check:"less_than",...O(t),value:e,inclusive:!0})}function rr(e,t){return new nt({check:"greater_than",...O(t),value:e,inclusive:!1})}function ir(e,t){return new nt({check:"greater_than",...O(t),value:e,inclusive:!0})}function or(e,t){return new rt({check:"multiple_of",...O(t),value:e})}function sr(e,t){return new ot({check:"max_length",...O(t),maximum:e})}function ar(e,t){return new st({check:"min_length",...O(t),minimum:e})}function cr(e,t){return new at({check:"length_equals",...O(t),length:e})}function ur(e){return new mt({check:"overwrite",tx:e})}function dr(e,...t){for(const n of t)for(const t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&u(e,t,n[t]);return e}function lr(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qn,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 fr(e,t,n,r,i){const o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw new Error(i);return Object.assign(n,o),!0}function pr(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),pr(o,t,r),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&dr(s.schema,c),"input"===t.io&&kr(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function hr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function mr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${hr(o)}`}}const i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:"#"};const o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+hr(o)}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;(o||r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function gr(e){const t=e.anyOf;if(!Array.isArray(t)||0===t.length||void 0!==e.type)return;const n=[];for(const e of t){if(!e||"object"!=typeof e)return;gr(e);const t=Object.keys(e);if(1!==t.length||"type"!==t[0])return;const r=e.type;for(const e of Array.isArray(r)?r:[r]){if("string"!=typeof e)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=1===n.length?n[0]:n}const yr=new Set(["type","properties","required","additionalProperties"]),vr=["oneOf","anyOf"];function _r(e){const t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function br(e){const t=[];for(const n of e){if("object"!=typeof n||"object"!==n.type)return null;for(const e in n)if(!yr.has(e))return null;t.push(n)}const n={},r=new Set;for(const e of t){for(const r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;const e=[];for(const n of t){const t=n.properties?.[r]??_r(n);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}u(n,r,1===e.length?e[0]:br(e)??{allOf:e})}for(const t of e.required??[])r.add(t)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{const e=[];for(const n of t){const t=_r(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function wr(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const t of yr)if(t in e)return;const n=t.filter(e=>vr.some(t=>Array.isArray(e[t])));let r=null;if(n.length){const e=n[0],i=vr.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;const o=t.filter(t=>t!==e),s=e[i].map(e=>br([...o,e]));if(s.some(e=>!e))return;r={[i]:s}}else r=br(t);r&&(delete e.allOf,dr(e,r))}function zr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?dr(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),dr(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const t of[...e.seen.entries()].reverse())r(t[0]);if("openapi-3.0"!==e.target)for(const t of e.seen.entries())gr(t[1].def??t[1].schema);for(const t of e.deferred)t();if(e.intersections.length){const t=new Map;for(const n of e.seen.values())for(const e of[n.schema,n.def]){const n=e?.allOf;if(!Array.isArray(n))continue;const r=t.get(n);r?r.push(e):t.set(n,[e])}for(const n of e.intersections)for(const e of t.get(n)??[])wr(e)}}const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}dr(i,n.defId?n.schema:n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,u(s,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:$r(t,"input",e.processors),output:$r(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function kr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return kr(r.element,n);if("set"===r.type)return kr(r.valueType,n);if("lazy"===r.type)return kr(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type||"catch"===r.type)return kr(r.innerType,n);if("intersection"===r.type)return kr(r.left,n)||kr(r.right,n);if("record"===r.type||"map"===r.type)return kr(r.keyType,n)||kr(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||kr(r.in,n)||kr(r.out,n);if("object"===r.type){for(const e in r.shape)if(kr(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(kr(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(kr(e,n))return!0;return!(!r.rest||!kr(r.rest,n))}return!1}const $r=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=lr({...i??{},target:o,io:t,processors:n});return pr(e,s),mr(s,e),zr(s,e)},Or=(e,t,n)=>{(void 0===e[t]||n>e[t])&&(e[t]=n)},xr=(e,t,n)=>{(void 0===e[t]||n<e[t])&&(e[t]=n)},Sr=(e,t)=>{Or(e,"minimum",t),xr(e,"maximum",t)},Ir=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},jr=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Er=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Pr=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Ar=(e,t)=>Or(e,"minimum",t.minimum),Tr=(e,t)=>xr(e,"maximum",t.maximum),Zr=e=>(t,n)=>{Pr(t,n.format);const[r,i]=e[n.format];Or(t,"minimum",r),xr(t,"maximum",i)},Nr={greater_than:(e,t)=>Or(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ir(e,t.value),number_format:Zr(S),bigint_format:Zr(I),min_length:Ar,max_length:Tr,length_equals:(e,t)=>Sr(e,t.length),min_size:Ar,max_size:Tr,size_equals:(e,t)=>Sr(e,t.size),string_format:(e,t)=>{Pr(e,t.format),t.pattern&&jr(e,t.pattern),"base64"!==t.format&&"base64url"!==t.format||(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>Er(e,t.mime)};function Fr(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const e of r)Nr[e._zod.def.check]?.(t,e._zod.def);const i=e._zod.bag;void 0!==i.minimum&&Or(t,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&Or(t,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&xr(t,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&xr(t,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&Ir(t,i.multipleOf),void 0!==i.format&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Er(t,i.mime);for(const e of i.patterns??[])jr(t,e);return t}const Rr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cr=new Map([[Ht,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[qt,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),Dr=e=>Cr.get(e)??e;function Ur(e){const t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?Ur(t.out):"catch"===t.type?Ur(t.innerType):e._zod.optin}const Jr=Symbol();function Mr(e,t,n,r,i){let o=!1;const s=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(fr(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),Jr):JSON.parse(s)}const Lr=(e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType},Kr=new WeakSet([Object.prototype,Error.prototype]);function Vr(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const Wr=(e,t)=>{ue.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);Kr.has(n)||(Kr.add(n),Vr(n,"format",e=>t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i],s=i===e.length-1;if("_errors"===n){s&&r._errors.push(t(o)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const a=r[n];s&&a._errors.push(t(o)),r=a,i++}}}};return r(e),n}(e,t)),Vr(n,"flatten",e=>t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?de(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)),Vr(n,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,o,2)}),Vr(n,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,o,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},Gr=te("ZodError",Wr,void 0,{Parent:Error}),Hr=fe(Gr),Br=pe(Gr),qr=he(Gr),Xr=ge(Gr),Yr=_e(Gr),Qr=be(Gr),ei=we(Gr),ti=ze(Gr),ni=ke(Gr),ri=$e(Gr),ii=Oe(Gr),oi=xe(Gr);function si(){ie.memoizer||oe({memoizer:qn})}const ai=te("ZodType",(e,t)=>(ie.localeError||oe({localeError:Xn()}),vt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(m(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new go({type:"custom",check:"custom",fn:t,...O(n)})}(0,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=function(e,t){const n=new Ye({check:"custom",...O(t)});return n._zod.check=e,n}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(M(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(M(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(ur(e))},optional(){return io(this)},exactOptional(){return new oo({type:"optional",innerType:this})},nullable(){return ao(this)},nullish(){return io(ao(this))},nonoptional(e){return function(e,t){return new lo({type:"nonoptional",innerType:e,...O(t)})}(this,e)},array(){return Vi(this)},or(e){return new Hi({type:"union",options:[this,e],...O(void 0)})},and(e){return new Xi({type:"intersection",left:this,right:e})},transform(e){return ho(this,new no({type:"transform",transform:e}))},default(e){return t=e,new co({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():w(t)}});var t},prefault(e){return t=e,new uo({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():w(t)}});var t},catch(e){return new fo({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:X(t)});var t},pipe(e){return ho(this,e)},readonly(){return new mo({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Qn.add(t,{description:e}),t},meta(...e){if(0===e.length)return Qn.get(this);const t=this.clone();return Qn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return K(this,"~standard",{...bt(this),jsonSchema:{input:$r(this,"input"),output:$r(this,"output")}})},set"~standard"(e){L(this,"~standard",e)},parse:function e(t,n){return Hr(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Br(this,t,n,{callee:e})},safeParse(e,t){return qr(this,e,t)},async safeParseAsync(e,t){return Xr(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){L(this,"spa",e)},validate(e,t){return((e,t,n)=>{const r=e._zod.bag.validator;if(void 0!==r){if(r(t)!==ye)return!0;if(!0===r.definite&&void 0===n)return!1}return function(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let o;if(i?(r[ve]=!0,o=i({value:t,issues:[]},r)):o=e._zod.run({value:t,issues:[]},r),o instanceof Promise)throw new ne;return 0===o.issues.length}(e,t,n)})(this,e,t)},validateAsync(e,t){return(async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),0===i.issues.length})(this,e,t)},encode:function e(t,n){return Yr(this,t,n,{callee:e})},decode:function e(t,n){return Qr(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ei(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ti(this,t,n,{callee:e})},safeEncode(e,t){return ni(this,e,t)},safeDecode(e,t){return ri(this,e,t)},async safeEncodeAsync(e,t){return ii(this,e,t)},async safeDecodeAsync(e,t){return oi(this,e,t)},toJSONSchema(e){return((e,t={})=>n=>{const r=lr({...n,processors:t});return pr(e,r),mr(r,e),zr(r,e)})(this,{})(e)},get description(){return Qn.get(this)?.description},get _def(){return this._zod.def}}),ci=te("_ZodString",(e,t)=>{wt.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:c,laxFormat:u}=Fr(e);if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=Rr[s]??s,""===r.format&&delete r.format,("time"===s||u)&&delete r.format),c&&(r.contentEncoding=c),a&&a.size>0){const e=[...a].map(Dr);1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n)},V({format:e=>Fr(e).format??null,minLength:e=>Fr(e).minimum??null,maxLength:e=>Fr(e).maximum??null},{regex(...e){return this.check(function(e,t){return new ut({check:"string_format",format:"regex",...O(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ft({check:"string_format",format:"includes",...O(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new pt({check:"string_format",format:"starts_with",...O(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ht({check:"string_format",format:"ends_with",...O(t),suffix:e})}(...e))},min(...e){return this.check(ar(...e))},max(...e){return this.check(sr(...e))},length(...e){return this.check(cr(...e))},nonempty(...e){return this.check(ar(1,...e))},lowercase(e){return this.check(function(e){return new dt({check:"string_format",format:"lowercase",...O(e)})}(e))},uppercase(e){return this.check(function(e){return new lt({check:"string_format",format:"uppercase",...O(e)})}(e))},trim(){return this.check(ur(e=>e.trim()))},normalize(...e){return this.check(function(e){return ur(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(ur(e=>e.toLowerCase()))},toUpperCase(){return this.check(ur(e=>e.toUpperCase()))},slugify(){return this.check(ur(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})),ui=te("ZodString",(e,t)=>{wt.init(e,t),ci.init(e,t)},{email(e){return this.check(function(e,t){return new gi({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}(0,e))},url(e){return this.check(function(e,t){return new _i({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}(0,e))},jwt(e){return this.check(function(e,t){return new Zi({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}(0,e))},emoji(e){return this.check(function(e,t){return new bi({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}(0,e))},guid(e){return this.check(function(e,t){return new yi({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}(0,e))},uuid(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}(0,e))},uuidv4(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}(0,e))},uuidv6(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}(0,e))},uuidv7(e){return this.check(function(e,t){return new vi({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}(0,e))},nanoid(e){return this.check(function(e,t){return new wi({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}(0,e))},cuid(e){return this.check(function(e,t){return new zi({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}(0,e))},cuid2(e){return this.check(function(e,t){return new ki({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}(0,e))},ulid(e){return this.check(function(e,t){return new $i({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}(0,e))},base64(e){return this.check(function(e,t){return new Pi({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}(0,e))},base64url(e){return this.check(function(e,t){return new Ai({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}(0,e))},xid(e){return this.check(function(e,t){return new Oi({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}(0,e))},ksuid(e){return this.check(function(e,t){return new xi({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}(0,e))},ipv4(e){return this.check(function(e,t){return new Si({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}(0,e))},ipv6(e){return this.check(function(e,t){return new Ii({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}(0,e))},cidrv4(e){return this.check(function(e,t){return new ji({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}(0,e))},cidrv6(e){return this.check(function(e,t){return new Ei({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}(0,e))},e164(e){return this.check(function(e,t){return new Ti({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}(0,e))},datetime(e){return this.check(function(e,t){return new fi({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}(0,e))},date(e){return this.check(function(e,t){return new pi({type:"string",format:"date",check:"string_format",...O(t)})}(0,e))},time(e){return this.check(function(e,t){return new hi({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}(0,e))},duration(e){return this.check(function(e,t){return new mi({type:"string",format:"duration",check:"string_format",...O(t)})}(0,e))}});function di(e){return function(e,t){return new ui(er({type:"string",...O(t)}))}(0,e)}const li=te("ZodStringFormat",(e,t)=>{zt.init(e,t),ci.init(e,t)}),fi=te("ZodISODateTime",(e,t)=>{Rt.init(e,t),li.init(e,t)}),pi=te("ZodISODate",(e,t)=>{Ct.init(e,t),li.init(e,t)}),hi=te("ZodISOTime",(e,t)=>{Dt.init(e,t),li.init(e,t)}),mi=te("ZodISODuration",(e,t)=>{Ut.init(e,t),li.init(e,t)}),gi=te("ZodEmail",(e,t)=>{Ot.init(e,t),li.init(e,t)}),yi=te("ZodGUID",(e,t)=>{kt.init(e,t),li.init(e,t)}),vi=te("ZodUUID",(e,t)=>{$t.init(e,t),li.init(e,t)}),_i=te("ZodURL",(e,t)=>{jt.init(e,t),li.init(e,t)}),bi=te("ZodEmoji",(e,t)=>{Et.init(e,t),li.init(e,t)}),wi=te("ZodNanoID",(e,t)=>{Pt.init(e,t),li.init(e,t)}),zi=te("ZodCUID",(e,t)=>{At.init(e,t),li.init(e,t)}),ki=te("ZodCUID2",(e,t)=>{Tt.init(e,t),li.init(e,t)}),$i=te("ZodULID",(e,t)=>{Zt.init(e,t),li.init(e,t)}),Oi=te("ZodXID",(e,t)=>{Nt.init(e,t),li.init(e,t)}),xi=te("ZodKSUID",(e,t)=>{Ft.init(e,t),li.init(e,t)}),Si=te("ZodIPv4",(e,t)=>{Jt.init(e,t),li.init(e,t)}),Ii=te("ZodIPv6",(e,t)=>{Kt.init(e,t),li.init(e,t)}),ji=te("ZodCIDRv4",(e,t)=>{Vt.init(e,t),li.init(e,t)}),Ei=te("ZodCIDRv6",(e,t)=>{Wt.init(e,t),li.init(e,t)}),Pi=te("ZodBase64",(e,t)=>{Bt.init(e,t),li.init(e,t)}),Ai=te("ZodBase64URL",(e,t)=>{Xt.init(e,t),li.init(e,t)}),Ti=te("ZodE164",(e,t)=>{Yt.init(e,t),li.init(e,t)}),Zi=te("ZodJWT",(e,t)=>{Qt.init(e,t),li.init(e,t)}),Ni=te("ZodNumber",(e,t)=>{en.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:d}=Fr(e);i.type=d?"integer":"number";const l="number"==typeof u&&u>=(o??Number.NEGATIVE_INFINITY),f="number"==typeof c&&c<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;if(l?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:"number"==typeof o&&(i.minimum=o),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:"number"==typeof s&&(i.maximum=s),a){const n=new Set;for(const o of a)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):fr(e,t,i,r,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);const[o,...s]=n;void 0!==o&&(i.multipleOf=o),s.length&&(i.allOf=[...i.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,n,r),e.isFinite=!0},V({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=Fr(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=Fr(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=Fr(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Fr(e).format??null},{gt(e,t){return this.check(rr(e,t))},gte(e,t){return this.check(ir(e,t))},min(e,t){return this.check(ir(e,t))},lt(e,t){return this.check(tr(e,t))},lte(e,t){return this.check(nr(e,t))},max(e,t){return this.check(nr(e,t))},int(e){return this.check(Ci(e))},safe(e){return this.check(Ci(e))},positive(e){return this.check(rr(0,e))},nonnegative(e){return this.check(ir(0,e))},negative(e){return this.check(tr(0,e))},nonpositive(e){return this.check(nr(0,e))},multipleOf(e,t){return this.check(or(e,t))},step(e,t){return this.check(or(e,t))},finite(){return this}}));function Fi(e){return function(e,t){return new Ni(er({type:"number",checks:[],...O(t)}))}(0,e)}const Ri=te("ZodNumberFormat",(e,t)=>{tn.init(e,t),Ni.init(e,t)});function Ci(e){return function(e,t){return new Ri({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}(0,e)}const Di=te("ZodBoolean",(e,t)=>{nn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function Ui(e){return function(e,t){return new Di({type:"boolean",...O(t)})}(0,e)}const Ji=te("ZodUnknown",(e,t)=>{rn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Mi(){return new Ji({type:"unknown"})}const Li=te("ZodNever",(e,t)=>{on.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const Ki=te("ZodArray",(e,t)=>{si(),cn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=Fr(e);"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=pr(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ar(e,t))},nonempty(e){return this.check(ar(1,e))},max(e,t){return this.check(sr(e,t))},length(e,t){return this.check(cr(e,t))},unwrap(){return this.element}});function Vi(e,t){return function(e,t,n){return new Ki({type:"array",element:t,...O(n)})}(0,e,t)}const Wi=te("ZodObject",(e,t)=>{si(),hn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&fr(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const e in s)u(i.properties,e,pr(s[e],t,{...r,path:[...r.path,"properties",e]}));const a=[];for(const e of Object.keys(s)){const n=o.shape[e];("input"===t.io?void 0===Ur(n):void 0===n._zod.optout)&&a.push(e)}a.length>0&&(i.required=a),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=pr(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),function(e,t,n,r){const i=function(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return Qi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(m(this._zod.def,{catchall:e}))},passthrough(){return this.clone(m(this._zod.def,{catchall:Mi()}))},loose(){return this.clone(m(this._zod.def,{catchall:Mi()}))},strict(){return this.clone(m(this._zod.def,{catchall:function(e,t){return new Li({type:"never",...O(t)})}(0,e)}));var e},strip(){return this.clone(m(this._zod.def,{catchall:void 0}))},extend(e){return function(e,t){if(!b(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=l(e);for(const e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $(e,m(e._zod.def,{shape:E(e,t)}))}(this,e)},safeExtend(e){return function(e,t){if(!b(t))throw new Error("Invalid input to safeExtend: expected a plain object");return $(e,m(e._zod.def,{shape:E(e,t)}))}(this,e)},merge(e){return function(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};return h(n,e,Reflect.ownKeys(l(e))),h(n,t,Reflect.ownKeys(l(t))),$(e,m(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return h(i,e,j(e,t)),$(e,m(n,{shape:i,checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(j(e,t)),o={};return h(o,e,Reflect.ownKeys(l(e)).filter(e=>!i.has(e))),$(e,m(n,{shape:o,checks:[]}))}(this,e)},partial(...e){return P(ro,this,e[0])},exactPartial(...e){return P(oo,this,e[0],"exactPartial")},required(...e){return function(e,t,n){const r=n?new Set(j(t,n)):void 0,i={};return h(i,t,Reflect.ownKeys(l(t)),(t,n)=>r&&!r.has(n)?t:new e({type:"nonoptional",innerType:t})),$(t,m(t._zod.def,{shape:i}))}(lo,this,e[0])}});function Gi(e,t){const n={type:"object",shape:e??{},...O(t)};return new Wi(n)}const Hi=te("ZodUnion",(e,t)=>{gn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>pr(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options}),Bi=te("ZodDiscriminatedUnion",(e,t)=>{Hi.init(e,t),yn.init(e,t)});function qi(e,t,n){return new Bi({type:"union",options:t,discriminator:e,...O(n)})}const Xi=te("ZodIntersection",(e,t)=>{vn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=pr(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=pr(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)})(e,t,n,r)}),Yi=te("ZodEnum",(e,t)=>{wn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n)=>{const i=r(e._zod.def.entries);0!==i.length?(i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=i):n.not={}})(e,0,n),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new Yi({...t,checks:[],...O(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Yi({...t,checks:[],...O(r),entries:i})}});function Qi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Yi({type:"enum",entries:n,...O(t)})}const eo=te("ZodLiteral",(e,t)=>{zn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(0===i.values.length)return void(n.not={});const o=[];for(const s of i.values)if(void 0===s){if(fr(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(fr(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function to(e,t){return new eo({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const no=te("ZodTransform",(e,t)=>{si(),kn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{fr(e,t,n,r,"Transforms cannot be represented in JSON Schema")})(e,t,n,r),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new re(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(M(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=n.value),t.inst??(t.inst=e),n.issues.push(M(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}}),ro=te("ZodOptional",(e,t)=>{On.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function io(e){return new ro({type:"optional",innerType:e})}const oo=te("ZodExactOptional",(e,t)=>{xn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),so=te("ZodNullable",(e,t)=>{Sn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=pr(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new so({type:"nullable",innerType:e})}const co=te("ZodDefault",(e,t)=>{In.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;const o=Mr(i.defaultValue,e,t,n,r);o!==Jr&&(n.default=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),uo=te("ZodPrefault",(e,t)=>{En.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;const o=Mr(i.defaultValue,e,t,n,r);o!==Jr&&(n._prefault=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),lo=te("ZodNonOptional",(e,t)=>{Pn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),fo=te("ZodCatch",(e,t)=>{Zn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{return void fr(e,t,n,r,"Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),po=te("ZodPipe",(e,t)=>{Nn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;pr(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function ho(e,t){return new po({type:"pipe",in:e,out:t})}const mo=te("ZodReadonly",(e,t)=>{Rn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;pr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),go=te("ZodCustom",(e,t)=>{Dn.init(e,t),ai.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{fr(e,t,n,r,"Custom types cannot be represented in JSON Schema")})(e,t,n,r)}),yo=di().trim().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/),vo=di().datetime(),_o=Fi().int().nonnegative(),bo=Qi(["https-token","ssh-key"]),wo=Qi(["operation-only","instance-retained"]),zo=Qi(["enabled","disabled"]),ko=Qi(["pending","synced","deferred","revoking","revoked"]),$o=Gi({scheme:Qi(["https","ssh"]),host:di().trim().min(1).max(253),port:Fi().int().min(1).max(65535).optional(),pathPrefix:di().min(1).max(2048).default("/")});function Oo(e){throw new Error(`Invalid Git credential scope: ${e}`)}function xo(e){const t=e.trim().replace(/^\[|\]$/g,"");(!t||t.includes("*")||/[/?#@\s]/.test(t))&&Oo("host is invalid");try{const e=new URL(t.includes(":")?`http://[${t}]/`:`http://${t}/`).hostname.replace(/^\[|\]$/g,"").toLowerCase();return(!e||e.length>253||e.includes("*"))&&Oo("host is invalid"),e}catch{Oo("host is invalid")}}function So(e){try{return decodeURIComponent(e)}catch{Oo("path contains invalid percent encoding")}}function Io(e){const t=e?.trim()||"/";(t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("\0"))&&Oo("path contains an unsupported delimiter");const n=(t.startsWith("/")?t:`/${t}`).split("/").filter(Boolean);for(const e of n){const t=So(e);("."===t||".."===t||t.includes("/")||t.includes("\\")||t.includes("\0"))&&Oo("path contains an unsafe segment")}return 0===n.length?"/":`/${n.join("/")}/`}function jo(e){const t=$o.parse(e),n="https"===t.scheme?443:22;return $o.parse({scheme:t.scheme,host:xo(t.host),...void 0===t.port||t.port===n?{}:{port:t.port},pathPrefix:Io(t.pathPrefix)})}function Eo(e){return Io(e.replace(/\.git\/?$/,""))}const Po=Gi({id:yo,name:di().trim().min(1).max(160),kind:bo,scope:$o,secretSet:to(!0),status:zo,revision:_o,createdAt:vo,updatedAt:vo}),Ao=qi("kind",[Gi({kind:to("https-token"),username:di().trim().min(1).max(240),token:di().min(1).max(8192)}),Gi({kind:to("ssh-key"),privateKey:di().min(1).max(131072),passphrase:di().max(8192).optional(),pinnedKnownHosts:di().min(1).max(131072)})]);Gi({name:di().trim().min(1).max(160),scope:$o,secret:Ao}).superRefine((e,t)=>{"https"===e.scope.scheme!=("https-token"===e.secret.kind)&&t.addIssue({code:"custom",path:["scope","scheme"],message:"Credential kind must match the remote scheme."});try{jo(e.scope)}catch(e){t.addIssue({code:"custom",path:["scope"],message:e instanceof Error?e.message:"Invalid Git scope."})}}),Gi({name:di().trim().min(1).max(160).optional(),scope:$o.optional(),secret:Ao.optional(),status:zo.optional()}).refine(e=>Object.keys(e).length>0,"At least one credential field must be updated."),Gi({items:Vi(Po).max(1e4)}),Gi({host:di().trim().min(1).max(253),port:Fi().int().min(1).max(65535).optional()});const To=Gi({keyType:di().trim().min(1).max(64),fingerprint:di().trim().min(1).max(256),publicKey:di().trim().min(1).max(8192),knownHosts:di().min(1).max(8192)});Gi({host:di().trim().min(1).max(253),port:Fi().int().min(1).max(65535),fetchedAt:vo,knownHosts:di().min(1).max(65536),entries:Vi(To).min(1).max(32)}),Gi({instanceId:yo,credentialId:yo,credentialRevision:_o,assignmentRevision:_o,status:ko,authorizedAt:vo,updatedAt:vo});const Zo=Gi({credential:Po,secret:Ao}).superRefine((e,t)=>{e.credential.kind!==e.secret.kind&&t.addIssue({code:"custom",path:["secret","kind"],message:"Credential payload kind mismatch."})});Gi({instanceId:yo,generation:_o,credentialIds:Vi(yo).max(256).transform(e=>[...new Set(e)].sort()),updatedAt:vo}),Gi({remoteUrl:di().trim().min(1).max(4096)}),qi("status",[Gi({status:to("ok"),username:di().min(1).max(240),password:di().min(1).max(8192)}),Gi({status:Qi(["none","ambiguous","unsupported","missing-host-key","rejected"])})]),Gi({remoteUrl:di().trim().min(1).max(4096)}),qi("status",[Gi({status:to("ok"),invocationId:yo,publicIdentity:di().min(1).max(131072),pinnedKnownHosts:di().min(1).max(131072)}),Gi({status:Qi(["none","ambiguous","unsupported","missing-host-key","rejected"])})]),Gi({invocationId:yo,frame:di().min(1).max(1048576)}),Gi({frame:di().min(1).max(1048576)});const No=Gi({operationId:yo,retention:wo,payload:Zo});function Fo(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ro(e){const t=e.replace(/-/g,"_").toUpperCase();return Object.assign(new Error(`TASK_HANDOFF_GIT_PROVISIONING_ERROR=${t}`),{code:t})}function Co(n,r=process.env.TASK_HANDOFF_GIT_RUNTIME_DIR||"/run/task-handoff/git-runtime"){const i=function(n){return e.readdirSync(n,{withFileTypes:!0}).filter(e=>e.isDirectory()&&e.name.startsWith("credential-")).sort((e,t)=>e.name.localeCompare(t.name)).flatMap(r=>{const i=t.join(n,r.name),o=t.join(i,"scope.json");if(!e.existsSync(o))return[];const s=e.existsSync(t.join(i,"token")),a=e.existsSync(t.join(i,"public-identity"));return s||a?[{candidate:{id:r.name,kind:s?"https-token":"ssh-key",scope:JSON.parse(e.readFileSync(o,"utf8")),status:"enabled",...a?{pinnedKnownHosts:e.existsSync(t.join(i,"known_hosts"))}:{}},directory:i}]:[]})}(r),o=function(e,t){let n;try{n=function(e){const t=e.trim();if(t&&!t.includes("\0")||Oo("remote is empty or invalid"),/^https?:\/\//i.test(t)||/^ssh:\/\//i.test(t)){let e;Io(t.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]+/i,"").split(/[?#]/,1)[0]||"/");try{e=new URL(t)}catch{Oo("remote URL is invalid")}"https:"!==e.protocol&&"ssh:"!==e.protocol&&Oo("remote scheme is unsupported"),(e.password||"https:"===e.protocol&&e.username)&&Oo("HTTPS userinfo is forbidden"),(e.search||e.hash)&&Oo("query and fragment are forbidden");const n="https:"===e.protocol?"https":"ssh",r=e.port?Number(e.port):void 0;return{...jo({scheme:n,host:e.hostname,port:r,pathPrefix:Eo(e.pathname)}),original:t}}/^[a-z][a-z0-9+.-]*:\/\//i.test(t)&&Oo("remote scheme is unsupported");const n=/^(?:([^@/:\s]+)@)?([^/:\s]+):(.+)$/.exec(t);n||Oo("remote must use HTTPS, ssh://, or scp-like SSH syntax");const[,,r,i]=n;return(i.includes("?")||i.includes("#"))&&Oo("query and fragment are forbidden"),{...jo({scheme:"ssh",host:r,pathPrefix:Eo(i)}),original:t}}(e)}catch(e){return{status:"unsupported",reason:e instanceof Error?e.message:"Unsupported Git remote."}}const r=t.filter(e=>"enabled"===e.status).filter(e=>"https"===n.scheme==("https-token"===e.kind)).filter(e=>function(e,t){const n=jo(e);return n.scheme===t.scheme&&n.host===t.host&&n.port===t.port&&("/"===n.pathPrefix||t.pathPrefix.startsWith(n.pathPrefix))}(e.scope,n)).map(e=>({candidate:e,specificity:jo(e.scope).pathPrefix.length}));if(0===r.length)return{status:"none",remote:n};const i=Math.max(...r.map(e=>e.specificity)),o=r.filter(e=>e.specificity===i).map(e=>e.candidate);if(o.length>1)return{status:"ambiguous",remote:n,credentialIds:o.map(e=>e.id).sort()};const s=o[0];return"ssh-key"===s.kind&&!0!==s.pinnedKnownHosts?{status:"missing-host-key",remote:n,credentialId:s.id}:{status:"unique",remote:n,credential:s}}(n,i.map(e=>e.candidate));if("unique"!==o.status)throw Ro("none"===o.status?"credential-missing":o.status);const s=i.find(e=>e.candidate.id===o.credential.id);if(!s)throw Ro("credential-missing");return s.directory}async function Do(r){const i=function(e){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||e.includes("\0")))return;const t=e;let n,r="";const i=[];for(let e=0;e<t.length;e+=1){const o=t[e];if("-p"===o&&/^\d+$/.test(t[e+1]||"")&&void 0===n){const r=Number(t[++e]);if(r<1||r>65535)return;n=String(r);continue}if("-4"!==o&&"-6"!==o)if("-o"!==o||"SendEnv=GIT_PROTOCOL"!==t[e+1]){if("-oSendEnv=GIT_PROTOCOL"!==o){if(o.startsWith("-"))return;if(r=o,e+=1,e!==t.length-1)return;break}i.push(o)}else i.push("-o",t[++e]);else i.push(o)}if(!r||!/^(?:[a-zA-Z0-9._-]+@)?[^@\s]+$/.test(r))return;const o=r.replace(/^[^@]+@/,""),s=function(e){const t=/^(git-upload-pack|git-receive-pack|git-upload-archive) ([\s\S]+)$/.exec(e);if(!t)return;const n=t[2];let r;if(n.startsWith("'")){if(!n.endsWith("'"))return;if(r=n.slice(1,-1).replace(/'\\''/g,"'"),Fo(r)!==n)return}else{if(!/^[a-zA-Z0-9._~@%+,:\/-]+$/.test(n))return;r=n}return!r||/[\0-\x1f\x7f]/.test(r)?void 0:{service:t[1],repository:r}}(t.at(-1)||"");if(!o||!s)return;const a=`${s.service} ${Fo(s.repository)}`;return{remote:`ssh://${o}${n?`:${n}`:""}/${encodeURIComponent(s.repository.replace(/^\/+/,"")).replace(/%2F/gi,"/")}`,args:[...i,...n?["-p",n]:[],r,a]}}(r);if(!i)throw Ro("remote-unsupported");const o=Co(i.remote),s=t.join(o,"agent.sock"),a=t.join(o,"public-identity"),c=t.join(o,"known_hosts");if(!e.existsSync(s))throw Ro("ssh-agent-unavailable");if(!e.existsSync(c)||0===e.statSync(c).size)throw Ro("host-key-required");return function(e,t,r={}){return new Promise((t,i)=>{const o={...process.env};delete o.SSH_AUTH_SOCK,Object.assign(o,r);const s=n.spawn("ssh",e,{stdio:"inherit",shell:!1,env:o});s.once("error",i),s.once("close",(e,n)=>0===e?t():i(Object.assign(new Error("Git SSH transport failed."),{exitCode:e,signal:n})))})}(["-F","/dev/null","-oBatchMode=yes","-oPasswordAuthentication=no","-oKbdInteractiveAuthentication=no","-oIdentitiesOnly=yes","-oIdentityFile=none","-oStrictHostKeyChecking=yes",`-oUserKnownHostsFile=${c}`,"-oGlobalKnownHostsFile=/dev/null",`-oIdentityAgent=${s}`,"-i",a,...i.args],0,{SSH_AUTH_SOCK:s})}Gi({operationId:yo,instanceId:yo,remoteUrl:di().trim().min(1).max(4096),ref:qi("type",[Gi({type:Qi(["branch","tag"]),name:di().trim().min(1).max(240)}),Gi({type:to("commit"),commit:di().trim().regex(/^[0-9a-fA-F]{4,64}$/,"commit must be a hexadecimal Git object id")})]),clone:Gi({depth:Fi().int().positive().max(1e5).optional(),submodules:Ui().default(!1),lfs:Ui().default(!1),subdirectory:di().trim().max(240).refine(e=>!e.startsWith("/")&&!e.split("/").some(e=>".."===e),"subdirectory must be a relative path within the repository").transform(e=>e.split("/").filter(e=>e&&"."!==e).join("/")).default("")}),credentials:Vi(No).max(256).default([])}),process.platform,async function(){const[n,...r]=process.argv.slice(2);if("credential"===n)return async function(n){if("get"!==n)return;const r=function(e){const t="https"===e.protocol?"https":void 0,n="string"==typeof e.host?e.host.trim():"",r="string"==typeof e.path?e.path.replace(/^\/+/,""):"";return t&&n?`${t}://${n}/${r}`:void 0}(await new Promise(e=>{let t="";process.stdin.setEncoding("utf8"),process.stdin.on("data",e=>{t+=e}),process.stdin.on("end",()=>e(Object.fromEntries(t.split(/\r?\n/).flatMap(e=>{const t=e.indexOf("=");return t>0?[[e.slice(0,t),e.slice(t+1)]]:[]}))))}));if(!r)throw Ro("remote-unsupported");let i;try{i=Co(r)}catch(e){if("CREDENTIAL_MISSING"===e.code)return void process.stderr.write(`${e.message}\n`);throw e}const o=e.readFileSync(t.join(i,"username"),"utf8"),s=e.readFileSync(t.join(i,"token"),"utf8");process.stdout.write(`username=${o}\npassword=${s}\n\n`)}(r[0]);if("ssh"===n)return Do(r);throw new Error("TASK_HANDOFF_GIT_PROVISIONING_ERROR=REMOTE_UNSUPPORTED")}().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "@task-handoff/controlled-instance",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"platform": "linux",
|
|
5
5
|
"arch": "universal",
|
|
6
6
|
"formatVersion": 1,
|
|
7
7
|
"launcherAbi": 1,
|
|
8
8
|
"entrypoint": "dist/controlled-instance-cli.js",
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "6045a92d15c8dd4c4e6047a36c4e13ccb4a3d30b9837cc3510e84e4fd2b3af2b"
|
|
10
10
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
88530a74780ea8caa80cd9ec4d8b1f08671ab2d8587c3d63a18d21220615fabc controlled-instance-runtime-0.0.68-linux-universal.tar.gz
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8aeecea3cd5f957b488ce8499d3be15f498f26787a06f64ea8abe81f2d83f680 controlled-instance-runtime-0.0.66-linux-universal.tar.gz
|