import { isPlainObject as d, camelCase as g } from "es-toolkit";
import { isFinite as C, get as f } from "es-toolkit/compat";
import { INBOUND_LEADS as b, SELLER_STATUSES as y, ORDER as S, LICENSE_COLORS as w } from "../constants.js";
const N = "BULK", a = ".mount-point-container";
function D(r, e) {
  return Object.keys(e).length ? r.filter((t) => {
    for (const c in e) {
      const s = e[c], u = s.filterBy;
      let i = f(t, c.split("."));
      if (d(i) && (i = t[c].id), "customFilter" in s) {
        if (!s.customFilter(u, i, t))
          return !1;
      } else if (!Array.isArray(i) && !~u.indexOf(i))
        return !1;
    }
    return !0;
  }) : r;
}
function U(r, e) {
  const { sortBy: t, sortDesc: c, customSorter: s, locale: u = "en" } = e, i = r.length && typeof r[0] == "object";
  return !t && i ? r : [...r].sort((p, m) => {
    let o = f(p, t) || p, n = f(m, t) || m;
    if (c && ([o, n] = [n, o]), s)
      return s(o, n);
    if ([o, n] = [o, n].map((l) => (l || "").toString().toLocaleLowerCase()), o !== n) {
      const l = !isNaN(o) && !isNaN(n) ? Number(o) - Number(n) : o.localeCompare(n, u);
      if (l)
        return l;
    }
    return 0;
  });
}
function A(r) {
  return C(r) && (r = r.toString()), !r || typeof r != "string" ? "" : r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
function T(r) {
  return r.split("").reduce((e, t) => (e = (e << 5) - e + t.charCodeAt(0), e & e), 0);
}
function k(r = document) {
  const e = r.querySelector(a);
  if (!e) {
    const t = r.createElement("div");
    return t.className = a.slice(1, a.length), r.body.appendChild(t);
  }
  return e;
}
function B(r) {
  const e = (r == null ? void 0 : r.ownerDocument) || document;
  return {
    ownerDoc: e,
    ownerWin: e.defaultView || window
  };
}
function V(r, e = document) {
  let t = r;
  return t.substring(0, 2) !== "--" && (t = `--${t}`), (e.defaultView || window).getComputedStyle(e.documentElement).getPropertyValue(t);
}
function L(r = "") {
  const e = r.toUpperCase();
  return e === N ? e : e.slice(0, 3);
}
function I(r, e) {
  let t;
  try {
    switch (r) {
      case "license":
        e = L(e), t = w[e];
        break;
      case "order":
        t = "bg-" + S[e.toUpperCase()].color;
        break;
      case "certified-seller":
        t = y[g(e)].color;
        break;
      case "inbound-leads":
        t = b[e.toUpperCase()].color;
        break;
    }
    return t || "bg-ice-500";
  } catch {
    return "bg-ice-500";
  }
}
export {
  D as filterItems,
  L as formatLicenseTypeText,
  I as generateColorClass,
  V as getCssVar,
  k as getMountPoint,
  B as getOwnerDomContext,
  T as hashCode,
  A as normalizeText,
  U as sortItems
};
//# sourceMappingURL=helpers.js.map
