"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var HighlightedText = function HighlightedText(_ref) {
  var _ref$text = _ref.text,
      text = _ref$text === void 0 ? '' : _ref$text,
      _ref$highlight = _ref.highlight,
      highlight = _ref$highlight === void 0 ? '' : _ref$highlight;

  if (!text || !highlight) {
    return text;
  }

  var parts = text.split(new RegExp("(".concat(highlight, ")"), 'gi'));
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, parts.map(function (part, i) {
    return /*#__PURE__*/_react.default.createElement("span", {
      key: i,
      style: part.toLowerCase() === highlight.toLowerCase() ? {
        fontWeight: 'bold',
        color: '#2688F9'
      } : {}
    }, part);
  }));
};

var _default = HighlightedText;
exports.default = _default;