import { F as Fuse } from './fuse.esm-80f40788.js';
import { s as state } from './store-97abe726.js';

async function searchServices(query, filter) {
  var _a;
  let results;
  if (!((_a = state.services) === null || _a === void 0 ? void 0 : _a.length) || !(query === null || query === void 0 ? void 0 : query.length)) {
    results = (state === null || state === void 0 ? void 0 : state.services) || [];
  }
  else {
    const fuse = new Fuse(state.services, {
      keys: ["name", "description"],
      fieldNormWeight: 1,
    });
    results = fuse.search(query).map((result) => result === null || result === void 0 ? void 0 : result.item);
  }
  return results.filter((service) => filter && typeof filter === "function" ? filter(service) : true);
}

function getServiceTypes() {
  return [...new Set(((state === null || state === void 0 ? void 0 : state.services) || []).map((service) => service === null || service === void 0 ? void 0 : service.tab))]
    .sort((a, b) => (a > b ? 1 : -1))
    .map((value) => ({
    label: value,
    value,
  }));
}

export { getServiceTypes as g, searchServices as s };

//# sourceMappingURL=getServiceTypes-59345ab4.js.map