import { _ as _extends } from '../_rollupPluginBabelHelpers-736b301a.js';
import React__default, { useState, useMemo } from 'react';
import { formatTimeStamp } from '@zenview/micro-utils';
import IconFont from '../IconFont/index.js';
import { R as RowImageTextCard } from '../index-07cebbd5.js';
import ToolsBar from '../ToolsBar/index.js';
import { Checkbox } from 'antd';
import '../ImageView/index.js';
import '../AuthComponent/index.js';
import '@zenview/micro-basic-library';
import 'lodash';
import '../index-19c4ec5b.js';
import 'react-router-dom';

/**
 *
 * 套一层盒子的原因是由于LinkTools存在计算，渲染性能有影响
 *
 */

function CaptureCard({
  className = '',
  width,
  height,
  isFocus,
  checked,
  onChecked,
  imgExt,
  children,
  ...data
}) {
  const {
    imgUrl,
    deviceName,
    captureTime,
    hasLinkTools,
    onClick
  } = useMemo(() => data, [data]);
  const checkable = checked === true || checked === false ? true : false;
  return /*#__PURE__*/React__default.createElement(RowImageTextCard, {
    className: `capture-card-item-box ${className}`,
    width: width,
    height: height,
    isFocus: isFocus,
    src: imgUrl,
    onClick: onClick,
    outChildren: checkable && /*#__PURE__*/React__default.createElement(Checkbox, {
      className: "item-check",
      checked: checked,
      value: data.id
      // disabled={data.latitude && data.longitude ? false : true}
      ,
      onClick: onChecked
    }),
    imgExt: imgExt
  }, children ? children : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
    className: "card-info-item"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Bar_Add"
  }), /*#__PURE__*/React__default.createElement("span", null, deviceName)), /*#__PURE__*/React__default.createElement("div", {
    className: "card-info-item"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Edit_ClockStart"
  }), /*#__PURE__*/React__default.createElement("span", null, formatTimeStamp(captureTime)))), hasLinkTools && /*#__PURE__*/React__default.createElement(ToolsBar.LinkTools, data));
}

/**
 * linkTools直接渲染会造成虚拟列卡顿，所以做一层代理处理
 * @param
 */
function CaptureBox({
  hasLinkTools,
  ...data
}) {
  const [mouseover, setMouseover] = useState(false);
  return hasLinkTools ? /*#__PURE__*/React__default.createElement("div", {
    style: {
      width: '100%',
      height: '100%'
    },
    onMouseMove: () => setMouseover(true)
  }, /*#__PURE__*/React__default.createElement(CaptureCard, _extends({}, data, {
    hasLinkTools: mouseover
  }))) : /*#__PURE__*/React__default.createElement(CaptureCard, data);
}

export { CaptureBox as default };
//# sourceMappingURL=index.js.map
