'use strict';

const fuse_esm = require('./fuse.esm-847a739f.js');
const store = require('./store-03756ad8.js');

async function searchServices(query, filter) {
  var _a;
  let results;
  if (!((_a = store.state.services) === null || _a === void 0 ? void 0 : _a.length) || !(query === null || query === void 0 ? void 0 : query.length)) {
    results = (store.state === null || store.state === void 0 ? void 0 : store.state.services) || [];
  }
  else {
    const fuse = new fuse_esm.Fuse(store.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(((store.state === null || store.state === void 0 ? void 0 : store.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,
  }));
}

exports.getServiceTypes = getServiceTypes;
exports.searchServices = searchServices;

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