const sortTabularGridColumn = (t, r, n = "string", e) => {
  const {columnId: s, sortDirection: c} = t.detail;
  // date or dateString
    if (n === "date" || n === "dateString") {
    return r.sort(((t, r) => {
      const e = t[s];
      const i = r[s];
      if (n === "dateString") {
        t = new Date(e);
        r = new Date(i);
      }
      if (e.getTime() < i.getTime()) {
        return c === "asc" ? -1 : 1;
      }
      if (e.getTime() > i.getTime()) {
        return c === "asc" ? 1 : -1;
      }
      return 0;
    }));
  }
  // string or objectProperty
    return r.sort(((t, r) => {
    const n = e ? t[s][e] : t[s];
    const i = e ? r[s][e] : r[s];
    if (n < i) {
      return c === "asc" ? -1 : 1;
    }
    if (n > i) {
      return c === "asc" ? 1 : -1;
    }
    return 0;
  }));
};

export { sortTabularGridColumn as s };
//# sourceMappingURL=p-02fb496a.js.map