import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{appendErrors as t}from"react-hook-form";function n(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function o(o,a,i){return void 0===i&&(i={}),function(a,s,u){try{var l=function(){if(c.issues){var o=function(r,e){for(var o,a={},i=function(r){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=function(r,e){if(r){if("string"==typeof r)return n(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(r,e):void 0}}(r))){e&&(r=e);var t=0;return function(){return t>=r.length?{done:!0}:{done:!1,value:r[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Object.assign([],r));!(o=i()).done;){var s=o.value;if(s.path){var u=s.path.join(".");if(a[u]||(a[u]={message:s.message,type:""}),e){var l=a[u].types,c=l&&l[""];a[u]=t(u,e,a,"",c?[].concat(c,s.message):s.message)}}}return a}(c.issues,!u.shouldUseNativeValidation&&"all"===u.criteriaMode);return{values:{},errors:r(o,u)}}return u.shouldUseNativeValidation&&e({},u),{values:i.raw?Object.assign({},a):c.value,errors:{}}},c=o["~standard"].validate(a),f=function(){if(c instanceof Promise)return Promise.resolve(c).then(function(r){c=r})}();return Promise.resolve(f&&f.then?f.then(l):l())}catch(r){return Promise.reject(r)}}}export{o as typeschemaResolver};
//# sourceMappingURL=typeschema.module.js.map
