import { a as u, g as d, c as f, b as m } from "./number-BVg7EKPV.js";
import { b, c as p } from "./date2-DpnYOzUg.js";
function M() {
  return function(e) {
    return !!e || "Required";
  };
}
function s(n) {
  return n && typeof n == "object" && Object.prototype.hasOwnProperty.call(n, "amount") && Object.prototype.hasOwnProperty.call(n, "precision");
}
function A(n, e) {
  const o = typeof n == "object" ? +u(n) : n;
  function i(t) {
    return Object.prototype.hasOwnProperty.call(t, "length");
  }
  return function(r) {
    return s(r) && (r = +u(r)), Number.isFinite(+r) && (r = +r), i(r) ? r.length >= o ? !0 : typeof e == "function" ? e(r.length) : e ?? `Must be at least ${o}` : typeof r == "number" ? r >= o ? !0 : typeof e == "function" ? e(r) : e ?? `Must be at least ${o}` : `Cannot validate at least ${o}`;
  };
}
function $(n) {
  const e = typeof n == "object" ? +u(n) : n;
  function o(i) {
    return Object.prototype.hasOwnProperty.call(i, "length");
  }
  return function(t, r) {
    return s(t) && (t = +u(t)), o(t) ? t.length > e ? !0 : typeof r == "function" ? r(t.length) : r ?? `Must be more than ${e}` : typeof t == "number" ? t > e ? !0 : typeof r == "function" ? r(t) : r ?? `Must be more than ${e}` : `Cannot validate more than ${e}`;
  };
}
function P(n, e) {
  return n instanceof Date && e instanceof Date ? function(i) {
    const t = new Date(i);
    return isNaN(t.getTime()) ? "Invalid date" : t.getTime() < n.getTime() ? `Date must be at least ${b(n)} ${p(n)}` : t.getTime() >= e.getTime() ? `Date must be less than ${b(e)} ${p(e)}` : !0;
  } : typeof n == "number" && typeof e == "number" ? function(i) {
    const t = +i;
    return isNaN(t) ? "Invalid number" : t < n ? `Value must be at least ${n}` : t >= e ? `Value must be less than ${e}` : !0;
  } : function() {
    return "Progamming error: invalid range parameter.";
  };
}
function c() {
  return function(n) {
    if (n = String(n), n.length === 0)
      return !0;
    const e = +n;
    return isFinite(e) || "Must be a number";
  };
}
function j(n, e) {
  return typeof n == "number" ? function(i) {
    const t = c()(i);
    return typeof t == "string" ? t : f(+i).precision > n ? `Precision cannot be more than ${n} decimal point.` : !0;
  } : function(i) {
    const t = c()(i);
    if (typeof t == "string")
      return t;
    const r = d(n, e);
    return f(+i).precision > r ? `Precision cannot be more than ${r} decimal point.` : !0;
  };
}
function g(n, e) {
  return function(i) {
    const t = c()(i);
    if (typeof t == "string")
      return t;
    const r = f(+i);
    return r.precision > n ? typeof e == "function" ? e(r.precision) : e ?? `Precision cannot be more than ${n}` : !0;
  };
}
function D(n, e, o) {
  return function(t) {
    if (t === e) return !0;
    const r = n.find((a) => a.value === t);
    return r ? o ? o(r) : `Already used in ${r.label}` : !0;
  };
}
function N(n) {
  let e = typeof n == "number" ? f(n) : n;
  e = m(e);
  const o = u(e);
  return function(t) {
    if (!s(t)) {
      if (t = +t, Number.isNaN(t)) return !0;
      t = f(t);
    }
    return t = m(t), t.amount % e.amount === 0 && t.precision <= e.precision ? !0 : `${u(t)} must be a multiple of ${o}`;
  };
}
export {
  A,
  P as B,
  c as I,
  j as M,
  M as R,
  D as U,
  N as a,
  g as b,
  $ as c
};
