import * as r from "yup";
import { isDynamicFormDateRangeField as c } from "../isDateRangeField.js";
function q(o, i, t, n) {
  if (t instanceof r.ArraySchema)
    return i.required(n).min(1, n);
  if (t instanceof r.ObjectSchema) {
    const d = i;
    return c(o) ? d.required(n).test("date-range-required", n, (u) => {
      if (u == null)
        return !1;
      const e = u.startDate, f = u.endDate;
      return e != null && f !== void 0 && f !== null;
    }) : d.required(n);
  }
  return t instanceof r.StringSchema ? i.nullable().required(n) : (t instanceof r.NumberSchema || t instanceof r.MixedSchema, i.required(n));
}
export {
  q as applyRequiredValidation
};
