"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.GradientDefs = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var GradientDefs = exports.GradientDefs = function GradientDefs(_ref) {
  var _match$1$match, _parts$find;
  var gradient = _ref.gradient;
  if (!gradient) return null;
  var match = gradient.match(/linear-gradient\((.*)\)$/);
  if (!match) return null;
  var parts = (_match$1$match = match[1].match(/(#[0-9a-fA-F]{3,6}|rgba?\([^)]*\)|[0-9.]+deg)/g)) !== null && _match$1$match !== void 0 ? _match$1$match : [];
  var anglePart = (_parts$find = parts.find(function (p) {
    return /\d+deg/.test(p);
  })) !== null && _parts$find !== void 0 ? _parts$find : "0deg";
  var angle = Number(anglePart.replace("deg", "")) || 0;
  var colors = parts.filter(function (p) {
    return /^#|rgb/.test(p);
  });
  if (colors.length < 2) return null;
  return /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("linearGradient", {
    id: "icon-gradient",
    "data-testid": "icon-gradient",
    gradientTransform: "rotate(".concat(angle, ")")
  }, colors.map(function (color, i) {
    return /*#__PURE__*/_react.default.createElement("stop", {
      key: i,
      offset: "".concat(i / (colors.length - 1) * 100, "%"),
      stopColor: color
    });
  })));
};
var _default = exports.default = GradientDefs;
//# sourceMappingURL=GradientDefs.js.map