"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _comparison = _interopRequireDefault(require("./comparison"));
var _select = _interopRequireDefault(require("./select"));
var _search = _interopRequireDefault(require("./search"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
var availableFilters = {
  comparison: _comparison["default"],
  select: _select["default"],
  "default": _search["default"]
};
var Filter = function Filter(_ref) {
  var _meta$filter, _meta$filter2;
  var column = _ref.column,
    testPrefix = _ref.testPrefix,
    index = _ref.index;
  if (!column.getCanFilter()) return null;
  var meta = typeof column.columnDef.meta === "function" ? column.columnDef.meta({}, column, index) : column.columnDef.meta;
  var selectedFilter = meta && meta != null && (_meta$filter = meta.filter) != null && _meta$filter.component ? meta == null || (_meta$filter2 = meta.filter) == null ? void 0 : _meta$filter2.component : "default";
  var filterOptions = meta && meta != null && meta.filter ? meta == null ? void 0 : meta.filter : {};
  var FilterComponent = availableFilters[selectedFilter];
  return /*#__PURE__*/_react["default"].createElement(FilterComponent, _extends({
    column: column,
    testPrefix: testPrefix
  }, filterOptions));
};
var _default = exports["default"] = Filter;