const emailRegExp = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const emailPrefixRegExp = /^[a-zA-Z0-9._-]{6,30}$/;
const emailFirstCharRegExp = /^[a-zA-Z0-9]/;
const emailLastCharRegExp = /[a-zA-Z0-9]$/;
const phoneRegExp = /^((8|\+7)[- ]?)?(\(?\d{3}\)?[- ]?)?[\d\- ]{7,10}$/;
const getValidateErrors = (validateScheme, values) => {
  const formErrors = {};
  const res = validateScheme.safeParse(values);
  if (!res.success) {
    const errors = res.error.errors;
    if (errors.some((e) => e.code === "invalid_union")) {
      const unionErrors = errors.map((e) => {
        if ("unionErrors" in e) {
          return e.unionErrors.map((ue) => ue.errors);
        } else {
          return [];
        }
      }).flat(2);
      if (unionErrors.length) {
        unionErrors.forEach((uerr) => {
          const key = uerr.path.join(".");
          formErrors[key] = uerr.message;
        });
      }
    } else if (errors.length) {
      errors.forEach((err) => {
        const key = err.path.join(".");
        formErrors[key] = err.message;
      });
    }
  }
  return formErrors;
};
export {
  emailPrefixRegExp as a,
  emailLastCharRegExp as b,
  emailFirstCharRegExp as c,
  emailRegExp as e,
  getValidateErrors as g,
  phoneRegExp as p
};
//# sourceMappingURL=validation-Ds00Zghx.js.map
