"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

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

var _classnames = _interopRequireDefault(require("classnames"));

var _timer = _interopRequireDefault(require("../timer"));

var _context = _interopRequireDefault(require("../context"));

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; }

/**
 * 实时感知（雷达动画）
 * @param props IProps
 */
var RadarTip = function RadarTip(props) {
  var _ref;

  var _useContext = (0, _react.useContext)(_context["default"]),
      _cssPrefix = _useContext._cssPrefix;

  var className = props.className,
      _props$label = props.label,
      label = _props$label === void 0 ? '实时感知中' : _props$label,
      _props$withTimer = props.withTimer,
      withTimer = _props$withTimer === void 0 ? true : _props$withTimer,
      _props$withDot = props.withDot,
      withDot = _props$withDot === void 0 ? true : _props$withDot,
      timeFormat = props.timeFormat,
      _props$backgroundImag = props.backgroundImage,
      backgroundImage = _props$backgroundImag === void 0 ? '//img.alicdn.com/tfs/TB1u6lfd9R26e4jSZFEXXbwuXXa-330-330.png' : _props$backgroundImag,
      _props$rotateImage = props.rotateImage,
      rotateImage = _props$rotateImage === void 0 ? '//img.alicdn.com/tfs/TB1zpkLe2zO3e4jSZFxXXaP_FXa-330-330.png' : _props$rotateImage;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])([_cssPrefix + "radar-tip", (_ref = {}, _ref[_cssPrefix + "without-time"] = !withTimer, _ref), className])
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: _cssPrefix + "left",
    style: {
      backgroundImage: "url(" + backgroundImage + ")"
    }
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: rotateImage,
    alt: "rotateImage"
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: _cssPrefix + "right"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: _cssPrefix + "tip"
  }, label, withDot && /*#__PURE__*/_react["default"].createElement("span", {
    className: _cssPrefix + "dot"
  })), withTimer && /*#__PURE__*/_react["default"].createElement(_timer["default"], {
    className: _cssPrefix + "timer",
    format: timeFormat
  })));
};

var _default = RadarTip;
exports["default"] = _default;