import _omit from "ramda/src/omit";
var _excluded = ["className", "children", "title", "size", "color", "fill", "inline", "viewBox"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import styled from 'styled-components';
import { assert } from '../../common/utils';
var ALLOWED_COLOR_STRINGS = ['transparent', 'inherit', 'currentColor'];
export var getColor = function getColor(theme, defaultColor, colorFnOrColor) {
  if (typeof colorFnOrColor !== 'undefined') {
    if (typeof colorFnOrColor === 'function') {
      return colorFnOrColor(theme);
    }
    if (ALLOWED_COLOR_STRINGS.includes(colorFnOrColor)) {
      return colorFnOrColor;
    }
    assert(ALLOWED_COLOR_STRINGS.includes(colorFnOrColor), "Incorrect string value for color, use t => t.colorTokens instead. Allowed string values are: ".concat(ALLOWED_COLOR_STRINGS.join(', '), "."));
  }
  return defaultColor;
};
var CleanSvg = React.forwardRef(function (props, ref) {
  return React.createElement("svg", _extends({
    ref: ref
  }, _omit(['size', 'colorFn', 'inline', 'focus'])(props)));
});
var StyledIconBase = styled(CleanSvg).withConfig({
  displayName: "IconBase__StyledIconBase",
  componentId: "sc-1gotiw9-0"
})(["", ""], function (p) {
  var size = p.size || 5;
  var fill = getColor(p.theme, p.theme.color.svgFill, p.colorFn);
  return "\n      user-select: none;\n      width: ".concat(p.theme.spacing.unit(size), "px;\n      height: ").concat(p.theme.spacing.unit(size), "px;\n      fill: ").concat(fill, ";\n      flex-shrink: 0;\n\n      display: ").concat(p.inline ? 'inline-block' : 'block', ";\n      ").concat(p.inline ? 'vertical-align: middle;' : '', "\n    ");
});
export var IconBase = React.forwardRef(function (props, ref) {
  var className = props.className,
    children = props.children,
    title = props.title,
    _props$size = props.size,
    size = _props$size === void 0 ? 5 : _props$size,
    color = props.color,
    fill = props.fill,
    inline = props.inline,
    _props$viewBox = props.viewBox,
    viewBox = _props$viewBox === void 0 ? '0 0 24 24' : _props$viewBox,
    rest = _objectWithoutProperties(props, _excluded);
  return React.createElement(StyledIconBase, _extends({
    className: className,
    preserveAspectRatio: "xMidYMid meet",
    size: size,
    focusable: "false",
    viewBox: viewBox,
    "aria-hidden": title ? 'false' : 'true',
    role: title ? 'img' : 'presentation',
    colorFn: fill || color,
    inline: inline,
    ref: ref
  }, rest), children, title ? React.createElement("title", null, title) : null);
});