import{validateFieldsNatively as e,toNestErrors as r}from"@hookform/resolvers";import{Validator as o}from"ata-validator";import{appendErrors as s}from"react-hook-form";const t=(e,r)=>{const o=Object.create(null);for(let t=0;t<e.length;t+=1){const a=e[t],n=("required"===a.keyword?`${a.instancePath}/${a.params.missingProperty}`:a.instancePath).substring(1).replace(/\//g,".");if(o[n]||(o[n]={message:a.message,type:a.keyword}),r){const e=o[n].types,t=e&&e[a.keyword];o[n]=s(n,r,o,a.keyword,t?[].concat(t,a.message||""):a.message)}}return o},a=(s,a,n={})=>{const i=new o(s,a);return async(o,s,a)=>{const c=i.validate(o);return a.shouldUseNativeValidation&&e({},a),c.valid?{values:n.raw?Object.assign({},o):o,errors:{}}:{values:{},errors:r(t(c.errors,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)}}};export{a as ataResolver};
//# sourceMappingURL=ata-validator.modern.mjs.map
