import { F as Fuse } from './fuse.esm-7454d4cc.js';
import { s as state } from './store-163687da.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"],
    });
    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)),
  ].map((value) => ({
    label: value,
    value,
  }));
}

export { getServiceTypes as g, searchServices as s };

//# sourceMappingURL=getServiceTypes-f3175d53.js.map