import { get as f } from "es-toolkit/compat";
import { computed as l } from "vue";
import { i as s, s as h } from "./searchFuzzy-DVCFTy5v.js";
import { normalizeText as m } from "./utils/helpers.js";
function S({ items: t, fieldNames: u, trackBy: o = "id" }) {
  const c = l(() => {
    const r = {};
    return !u || !u.length || t.value.forEach((e) => {
      const n = String(e[o]);
      r[n] = u.map((a) => m(f(e, a.split(".")))).filter(Boolean).join(" ");
    }), r;
  });
  function i(r, e) {
    return e != null && e.fuzzy && s(t.value) ? h(r, t.value, { fieldNames: u }) : t.value.filter((n) => {
      const a = String(n[o]);
      return c.value[a].includes(r.trim().toLowerCase());
    });
  }
  return {
    searchFor: i
  };
}
export {
  S as default
};
//# sourceMappingURL=useSearch.js.map
