"use strict";

exports.__esModule = true;
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _excluded = ["list", "caseAttribute", "lineAttribute", "lineCross", "badgeAttribute", "dotAttribute", "contentAttribute"];

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _extends() { _extends = Object.assign || 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); }

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 Timeline(_ref) {
  var list = _ref.list,
      _ref$caseAttribute = _ref.caseAttribute,
      caseAttribute = _ref$caseAttribute === void 0 ? {} : _ref$caseAttribute,
      _ref$lineAttribute = _ref.lineAttribute,
      lineAttribute = _ref$lineAttribute === void 0 ? {} : _ref$lineAttribute,
      _ref$lineCross = _ref.lineCross,
      lineCross = _ref$lineCross === void 0 ? true : _ref$lineCross,
      _ref$badgeAttribute = _ref.badgeAttribute,
      badgeAttribute = _ref$badgeAttribute === void 0 ? {} : _ref$badgeAttribute,
      _ref$dotAttribute = _ref.dotAttribute,
      dotAttribute = _ref$dotAttribute === void 0 ? {} : _ref$dotAttribute,
      _ref$contentAttribute = _ref.contentAttribute,
      contentAttribute = _ref$contentAttribute === void 0 ? {} : _ref$contentAttribute,
      others = _objectWithoutPropertiesLoose(_ref, _excluded);

  var rootRef = (0, _react.useRef)(null);
  if (!list) return null;
  return /*#__PURE__*/_react["default"].createElement("div", _extends({
    ref: rootRef
  }, others, {
    className: "timeline" + (others.className ? ' ' + others.className : '')
  }), list.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement("div", _extends({
      key: index
    }, caseAttribute, {
      className: "timeline-case" + (item.active ? ' active' : '') + (caseAttribute.className ? ' ' + caseAttribute.className : '')
    }), /*#__PURE__*/_react["default"].createElement("div", _extends({}, lineAttribute, {
      className: "timeline-line" + (lineAttribute.className ? ' ' + lineAttribute.className : '')
    })), /*#__PURE__*/_react["default"].createElement("div", _extends({}, badgeAttribute, {
      className: "timeline-badge" + (badgeAttribute.className ? ' ' + badgeAttribute.className : '')
    }), item.icon || /*#__PURE__*/_react["default"].createElement("i", _extends({}, dotAttribute, {
      className: "timeline-dot" + (dotAttribute.className ? ' ' + dotAttribute.className : '')
    }))), /*#__PURE__*/_react["default"].createElement("div", _extends({}, contentAttribute, {
      className: "timeline-content" + (contentAttribute.className ? ' ' + contentAttribute.className : '')
    }), item.content, item.contentHTML && /*#__PURE__*/_react["default"].createElement("div", {
      dangerouslySetInnerHTML: {
        __html: item.contentHTML
      }
    })));
  }));
}

var _default = Timeline;
exports["default"] = _default;
module.exports = exports.default;