text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports["default"] = void 0;
  
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
  
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
  
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
  
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
  
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
  
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
  
  var _react = _interopRequireDefault(require("react"));
  
  var _propTypes = _interopRequireDefault(require("prop-types"));
  
  var Anchors =
  /*#__PURE__*/
  function (_React$PureComponent) {
    (0, _inherits2["default"])(Anchors, _React$PureComponent);
  
    function Anchors(props) {
      var _this;
  
      (0, _classCallCheck2["default"])(this, Anchors);
      _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Anchors).call(this, props));
      var defaultCategory = props.categories.filter(function (category) {
        return category.first;
      })[0];
      _this.state = {
        selected: defaultCategory.name
      };
      _this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2["default"])(_this));
      return _this;
    }
  
    (0, _createClass2["default"])(Anchors, [{
      key: "handleClick",
      value: function handleClick(e) {
        var index = e.currentTarget.getAttribute('data-index');
        var _this$props = this.props,
            categories = _this$props.categories,
            onAnchorClick = _this$props.onAnchorClick;
        onAnchorClick(categories[index], index);
      }
    }, {
      key: "render",
      value: function render() {
        var _this2 = this;
  
        var _this$props2 = this.props,
            categories = _this$props2.categories,
            color = _this$props2.color,
            i18n = _this$props2.i18n,
            icons = _this$props2.icons,
            selected = this.state.selected;
        return _react["default"].createElement("nav", {
          className: "emoji-mart-anchors",
          "aria-label": i18n.categorieslabel
        }, categories.map(function (category, i) {
          var id = category.id,
              name = category.name,
              anchor = category.anchor,
              isSelected = name == selected;
  
          if (anchor === false) {
            return null;
          }
  
          var iconId = id.startsWith('custom-') ? 'custom' : id;
          return _react["default"].createElement("button", {
            key: id,
            "aria-label": i18n.categories[iconId],
            title: i18n.categories[iconId],
            "data-index": i,
            type: 'button',
            onClick: _this2.handleClick,
            className: "emoji-mart-anchor ".concat(isSelected ? 'emoji-mart-anchor-selected' : ''),
            style: {
              color: isSelected ? color : null
            }
          }, _react["default"].createElement("div", {
            className: "emoji-mart-anchor-icon"
          }, icons.categories[iconId]()), _react["default"].createElement("span", {
            className: "emoji-mart-anchor-bar",
            style: {
              backgroundColor: color
            }
          }));
        }));
      }
    }]);
    return Anchors;
  }(_react["default"].PureComponent);
  
  exports["default"] = Anchors;
  Anchors.propTypes
  /* remove-proptypes */
  = {
    categories: _propTypes["default"].array,
    onAnchorClick: _propTypes["default"].func,
    icons: _propTypes["default"].object
  };
  Anchors.defaultProps = {
    categories: [],
    onAnchorClick: function onAnchorClick() {},
    icons: {}
  };