import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
//  strict
import PropTypes from 'prop-types';
import * as React from 'react';
import styled, { css } from 'styled-components';
import { theme } from '../../Tools/interpolation';
var themeColorTemplate =
/*#__PURE__*/
css(["\n  fill: ", ";\n  cursor: ", ";\n\n  &:hover {\n    fill: ", ";\n  }\n"], theme('iconColor'), function (props) {
  return props.selectable === 1 ? 'pointer' : 'default';
}, function (props) {
  return props.selectable === 1 ? theme('iconHoverColor')(props) : theme('iconColor')(props);
});
var svgColorTemplate =
/*#__PURE__*/
css(["\n  cursor: ", ";\n"], function (props) {
  return props.selectable === 1 ? 'pointer' : 'default';
});
export default (function (Svg, name) {
  var keepSvgColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  var template = keepSvgColor ? svgColorTemplate : themeColorTemplate;
  var Icon =
  /*#__PURE__*/
  styled(Svg).withConfig({
    componentId: "sc-1pmbxjh-0"
  })(["\n    ", ";\n  "], template);
  /* eslint-disable react/prefer-stateless-function */

  var WithStyle =
  /*#__PURE__*/
  function (_React$PureComponent) {
    _inherits(WithStyle, _React$PureComponent);

    function WithStyle() {
      _classCallCheck(this, WithStyle);

      return _possibleConstructorReturn(this, _getPrototypeOf(WithStyle).apply(this, arguments));
    }

    _createClass(WithStyle, [{
      key: "render",
      value: function render() {
        var _this$props = this.props,
            selectable = _this$props.selectable,
            size = _this$props.size,
            rest = _objectWithoutProperties(_this$props, ["selectable", "size"]);

        return React.createElement(Icon, _extends({}, rest, {
          height: size,
          selectable: selectable === true ? 1 : 0,
          width: size
        }));
      }
    }]);

    return WithStyle;
  }(React.PureComponent);

  _defineProperty(WithStyle, "defaultProps", {
    selectable: false,
    size: '44px'
  });

  WithStyle.propTypes = process.env.NODE_ENV !== "production" ? {
    selectable: PropTypes.bool,
    size: PropTypes.string
  } : {};
  WithStyle.displayName = name;
  return WithStyle;
});