import _extends from "@babel/runtime/helpers/extends";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import PropTypes from 'prop-types';
import { CommonListHighlight } from './common/CommonListHighlight';
import { getHighlightRegExp, searchStringToRegExp } from '../../utils/regexp';
export var PureListHighlight =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(PureListHighlight, _React$Component);

  function PureListHighlight() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = PureListHighlight.prototype;

  _proto.getTextHighlightPattern = function getTextHighlightPattern() {
    var _this$props = this.props,
        textHighlightPattern = _this$props.textHighlightPattern,
        highlightedText = _this$props.highlightedText;
    return textHighlightPattern || getHighlightRegExp(highlightedText);
  };

  _proto.getTextFilterPattern = function getTextFilterPattern() {
    var _this$props2 = this.props,
        textFilterPattern = _this$props2.textFilterPattern,
        highlightedText = _this$props2.highlightedText;
    return textFilterPattern || searchStringToRegExp(highlightedText);
  };

  _proto.render = function render() {
    return React.createElement(CommonListHighlight, _extends({}, this.props, {
      textHighlightPattern: this.getTextHighlightPattern(),
      textFilterPattern: this.getTextFilterPattern()
    }));
  };

  return PureListHighlight;
}(React.Component);

_defineProperty(PureListHighlight, "propTypes", Object.assign({}, CommonListHighlight.propTypes, {
  highlightedText: PropTypes.string
}));

_defineProperty(PureListHighlight, "defaultProps", Object.assign({}, CommonListHighlight.defaultProps, {
  highlightedText: ''
}));

_defineProperty(PureListHighlight, "HIGHLIGHT_TYPE_BACKGROUND", CommonListHighlight.HIGHLIGHT_TYPE_BACKGROUND);

_defineProperty(PureListHighlight, "HIGHLIGHT_TYPE_BOLD", CommonListHighlight.HIGHLIGHT_TYPE_BOLD);