"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _util = require("../util");
var Gradient = (0, _vue.defineComponent)({
  name: 'ColorBlock',
  props: ['direction', 'prefixCls', 'type', 'colors'],
  setup: function setup(props, _ref) {
    var slots = _ref.slots;
    var direction = (0, _vue.computed)(function () {
      return props.direction || 'to right';
    });
    var gradientColors = (0, _vue.computed)(function () {
      var colors = props.colors,
        type = props.type;
      return colors.map(function (color, idx) {
        var result = (0, _util.generateColor)(color);
        if (type === 'alpha' && idx === colors.length - 1) {
          result.setAlpha(1);
        }
        return result.toRgbString();
      }).join(',');
    });
    return function () {
      var _slots$children;
      return (0, _vue.createVNode)("div", {
        "class": "".concat(props.prefixCls, "-gradient"),
        "style": {
          position: 'absolute',
          inset: 0,
          background: "linear-gradient(".concat(direction.value, ", ").concat(gradientColors.value, ")")
        }
      }, [(_slots$children = slots.children) === null || _slots$children === void 0 ? void 0 : _slots$children.call(slots)]);
    };
  }
});
var _default = Gradient;
exports.default = _default;