import { getValidDate as s } from "../../../utils/getValidDate.js";
const f = (t, n, i, e) => {
  if (t === null || n === null)
    return 0;
  switch (i) {
    case "string":
      return typeof t == "string" && typeof n == "string" ? e === "asc" ? t.localeCompare(n) : n.localeCompare(t) : 0;
    case "number":
      return typeof t == "number" && typeof n == "number" ? e === "asc" ? t - n : n - t : 0;
    case "boolean":
      if (typeof t == "boolean" && typeof n == "boolean") {
        const r = t === n ? 0 : t ? 1 : -1;
        if (r !== 0)
          return e === "asc" ? r : -r;
      }
      return 0;
    case "date": {
      const r = s(t), o = s(n);
      return r === null || o === null ? 0 : e === "asc" ? r.getTime() - o.getTime() : o.getTime() - r.getTime();
    }
    default:
      return 0;
  }
};
export {
  f as SortCompareValues
};
