function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { VtxImage } from '@vtx/components';
import { getVtxToken } from '@vtx/utils';
import { VmEmpty, VmInfoCollection, VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { overViewService } from "../../api";
import { OverViewLeftFields } from "../../config";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var Left = function Left(_ref) {
  var _alarmData$overflow, _alarmData$overflow2, _alarmData$rightTimeO, _alarmData$rightTimeO2, _alarmData$trashBag, _alarmData$trashBag2, _alarmData$wrongTimeO, _alarmData$wrongTimeO2, _alarmData$mixedThrow, _alarmData$mixedThrow2;
  var classPrefix = _ref.classPrefix,
    id = _ref.id,
    basicInfo = _ref.basicInfo;
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var fieldsData = OverViewLeftFields.map(function (item) {
    return _objectSpread(_objectSpread({}, item), {}, {
      value: (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo[item.key]) === false ? '否' : (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo[item.key]) === true ? '是' : basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo[item.key]
    });
  });
  var alarmData = overViewService.useThrowCount({
    throwPointId: id
  });
  var photos = JSON.parse((basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.photos) || '[]');
  return /*#__PURE__*/_jsx("div", {
    className: "".concat(classPrefix, "-left"),
    children: /*#__PURE__*/_jsxs(VmWrapper, {
      title: "\u57FA\u672C\u4FE1\u606F",
      children: [photos && /*#__PURE__*/_jsx("div", {
        className: "".concat(classPrefix, "-left-img"),
        children: photos.length ? /*#__PURE__*/_jsx(VtxImage.PreviewGroup, {
          children: photos.map(function (item) {
            return /*#__PURE__*/_jsx(VtxImage, {
              src: "/cloudFile/common/downloadFile?id=".concat(item.id, "&token=").concat(getVtxToken('token')),
              alt: item.name
            }, item.id);
          })
        }) : /*#__PURE__*/_jsx(VmEmpty, {
          type: "NO_PICTURE",
          showText: false
        })
      }), /*#__PURE__*/_jsxs("div", {
        className: "".concat(classPrefix, "-left-throws ").concat(isDark ? 'dark' : ''),
        children: [/*#__PURE__*/_jsxs("div", {
          className: "manyiBg",
          children: [/*#__PURE__*/_jsx("div", {
            className: "".concat(classPrefix, "-left-throws-title"),
            children: "\u6EE1\u6EA2"
          }), /*#__PURE__*/_jsxs("div", {
            className: "".concat(classPrefix, "-left-throws-value"),
            children: [alarmData === null || alarmData === void 0 || (_alarmData$overflow = alarmData.overflow) === null || _alarmData$overflow === void 0 ? void 0 : _alarmData$overflow.happeningCount, /*#__PURE__*/_jsxs("span", {
              children: ["/", alarmData === null || alarmData === void 0 || (_alarmData$overflow2 = alarmData.overflow) === null || _alarmData$overflow2 === void 0 ? void 0 : _alarmData$overflow2.todayCount, "\u4EF6"]
            })]
          })]
        }), /*#__PURE__*/_jsxs("div", {
          children: [/*#__PURE__*/_jsxs("div", {
            className: "twtfBg",
            children: [/*#__PURE__*/_jsx("div", {
              className: "".concat(classPrefix, "-left-throws-title"),
              children: "\u6876\u5916\u6295\u653E"
            }), /*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-left-throws-value"),
              children: [alarmData === null || alarmData === void 0 || (_alarmData$rightTimeO = alarmData.rightTimeOut) === null || _alarmData$rightTimeO === void 0 ? void 0 : _alarmData$rightTimeO.happeningCount, /*#__PURE__*/_jsxs("span", {
                children: ["/", alarmData === null || alarmData === void 0 || (_alarmData$rightTimeO2 = alarmData.rightTimeOut) === null || _alarmData$rightTimeO2 === void 0 ? void 0 : _alarmData$rightTimeO2.todayCount, "\u4EF6"]
              })]
            })]
          }), /*#__PURE__*/_jsxs("div", {
            className: "wpdBg",
            children: [/*#__PURE__*/_jsx("div", {
              className: "".concat(classPrefix, "-left-throws-title"),
              children: "\u672A\u7834\u888B"
            }), /*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-left-throws-value"),
              children: [alarmData === null || alarmData === void 0 || (_alarmData$trashBag = alarmData.trashBag) === null || _alarmData$trashBag === void 0 ? void 0 : _alarmData$trashBag.happeningCount, /*#__PURE__*/_jsxs("span", {
                children: ["/", alarmData === null || alarmData === void 0 || (_alarmData$trashBag2 = alarmData.trashBag) === null || _alarmData$trashBag2 === void 0 ? void 0 : _alarmData$trashBag2.todayCount, "\u4EF6"]
              })]
            })]
          })]
        }), /*#__PURE__*/_jsxs("div", {
          children: [/*#__PURE__*/_jsxs("div", {
            className: "wstfBg",
            children: [/*#__PURE__*/_jsx("div", {
              className: "".concat(classPrefix, "-left-throws-title"),
              children: "\u8BEF\u65F6\u6295\u653E"
            }), /*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-left-throws-value"),
              children: [alarmData === null || alarmData === void 0 || (_alarmData$wrongTimeO = alarmData.wrongTimeOut) === null || _alarmData$wrongTimeO === void 0 ? void 0 : _alarmData$wrongTimeO.happeningCount, /*#__PURE__*/_jsxs("span", {
                children: ["/", alarmData === null || alarmData === void 0 || (_alarmData$wrongTimeO2 = alarmData.wrongTimeOut) === null || _alarmData$wrongTimeO2 === void 0 ? void 0 : _alarmData$wrongTimeO2.todayCount, "\u4EF6"]
              })]
            })]
          }), /*#__PURE__*/_jsxs("div", {
            className: "htBg",
            children: [/*#__PURE__*/_jsx("div", {
              className: "".concat(classPrefix, "-left-throws-title"),
              children: "\u6DF7\u6295"
            }), /*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-left-throws-value"),
              children: [alarmData === null || alarmData === void 0 || (_alarmData$mixedThrow = alarmData.mixedThrow) === null || _alarmData$mixedThrow === void 0 ? void 0 : _alarmData$mixedThrow.happeningCount, /*#__PURE__*/_jsxs("span", {
                children: ["/", alarmData === null || alarmData === void 0 || (_alarmData$mixedThrow2 = alarmData.mixedThrow) === null || _alarmData$mixedThrow2 === void 0 ? void 0 : _alarmData$mixedThrow2.todayCount, "\u4EF6"]
              })]
            })]
          })]
        })]
      }), /*#__PURE__*/_jsx(VmInfoCollection, {
        data: fieldsData,
        gap: 12,
        horizontal: true,
        labelStyle: {
          minWidth: 'unset'
        },
        style: {
          marginTop: 16
        }
      })]
    })
  });
};
export default Left;