import{validateFieldsNatively as r,toNestErrors as e}from"@hookform/resolvers";import{appendErrors as n}from"react-hook-form";import*as o from"zod/v4/core";function t(){return t=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r},t.apply(null,arguments)}function s(r,e){try{var n=r()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function i(r,e){for(var o={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!o[a])if("unionErrors"in t){var u=t.unionErrors[0].errors[0];o[a]={message:u.message,type:u.code}}else o[a]={message:i,type:s};if("unionErrors"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=o[a].types,f=c&&c[t.code];o[a]=n(a,e,o,s,f?[].concat(f,t.message):t.message)}r.shift()}return o}function a(r,e){for(var o={},s=function(){var s=r[0],i=s.code,a=s.message,u=s.path.join(".");if(!o[u])if("invalid_union"===s.code&&s.errors.length>0){var c=s.errors[0][0];o[u]={message:c.message,type:c.code}}else o[u]={message:a,type:i};if("invalid_union"===s.code&&s.errors.forEach(function(e){return e.forEach(function(e){return r.push(t({},e,{path:[].concat(s.path,e.path)}))})}),e){var f=o[u].types,l=f&&f[s.code];o[u]=n(u,e,o,i,l?[].concat(l,s.message):s.message)}r.shift()};r.length;)s();return o}function u(n,t,u){if(void 0===u&&(u={}),function(r){return"_def"in r&&"object"==typeof r._def&&"typeName"in r._def}(n))return function(o,a,c){try{return Promise.resolve(s(function(){return Promise.resolve(n["sync"===u.mode?"parse":"parseAsync"](o,t)).then(function(e){return c.shouldUseNativeValidation&&r({},c),{errors:{},values:u.raw?Object.assign({},o):e}})},function(r){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(r))return{values:{},errors:e(i(r.errors,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw r}))}catch(r){return Promise.reject(r)}};if(function(r){return"_zod"in r&&"object"==typeof r._zod}(n))return function(i,c,f){try{return Promise.resolve(s(function(){return Promise.resolve(("sync"===u.mode?o.parse:o.parseAsync)(n,i,t)).then(function(e){return f.shouldUseNativeValidation&&r({},f),{errors:{},values:u.raw?Object.assign({},i):e}})},function(r){if(function(r){return r instanceof o.$ZodError}(r))return{values:{},errors:e(a(r.issues,!f.shouldUseNativeValidation&&"all"===f.criteriaMode),f)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}export{u as zodResolver};
//# sourceMappingURL=zod.module.js.map
