function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { Col, Row, Select } from 'antd';
import { useState } from 'react';
import { VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { alarmService } from "../../api";
import FLZLFX from "./FLZL";
import FSCSFB from "./FSCSFB";
import FSSD from "./FSSD";
import FSYZQS from "./FSYZQS";
import GDCLXL from "./GDCLXL";
import MYFX from "./MYFX";
import "./index.less";
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
var Option = Select.Option;
var WGXW = function WGXW(_ref) {
  var _ref$classPrefix = _ref.classPrefix,
    classPrefix = _ref$classPrefix === void 0 ? '' : _ref$classPrefix,
    id = _ref.id,
    _ref$throwPoints = _ref.throwPoints,
    throwPoints = _ref$throwPoints === void 0 ? [] : _ref$throwPoints,
    serviceList = _ref.serviceList;
  var prefix = "".concat(classPrefix, "-alarm");
  var _useState = useState('LANDING'),
    _useState2 = _slicedToArray(_useState, 2),
    tab = _useState2[0],
    setTab = _useState2[1];
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var tabs = alarmService.useGetTabs({
    housingEstateId: id
  }) || [];
  var onTabChange = function onTabChange(tab) {
    setTab(tab);
  };
  var blackRank = alarmService.useBlackRank({
    thisAreaId: id,
    businessPackage: tab,
    areaDimension: 'COMMUNITY'
  });
  return /*#__PURE__*/_jsx("div", {
    className: prefix,
    children: /*#__PURE__*/_jsxs(VmWrapper, {
      tabList: tabs === null || tabs === void 0 ? void 0 : tabs.filter(function (ele) {
        return ['LANDING', 'CHUYU_QUALITY', 'OVERFLOW'].includes(ele);
      }).reverse().map(function (ele) {
        return {
          label: {
            LANDING: '落地包分析',
            CHUYU_QUALITY: '分类质量分析',
            OVERFLOW: '满溢分析'
          }[ele],
          key: ele
        };
      }),
      activeKey: tab,
      onChangeTab: onTabChange,
      extra: /*#__PURE__*/_jsx("div", {
        className: "".concat(prefix, "-rank ").concat(isDark ? 'dark' : ''),
        children: /*#__PURE__*/_jsxs("div", {
          className: "rankText",
          children: ["\u9ED1\u699C\u6392\u540D ", "".concat((blackRank === null || blackRank === void 0 ? void 0 : blackRank.ranking) || 0, "/").concat((blackRank === null || blackRank === void 0 ? void 0 : blackRank.total) || 0)]
        })
      }),
      children: [tab === 'LANDING' && /*#__PURE__*/_jsxs(Row, {
        gutter: [128, 24],
        children: [/*#__PURE__*/_jsx(Col, {
          span: 12,
          children: /*#__PURE__*/_jsx(GDCLXL, {
            classPrefix: prefix,
            id: id
          })
        }), /*#__PURE__*/_jsx(Col, {
          span: 12,
          children: /*#__PURE__*/_jsx(FSSD, {
            classPrefix: prefix,
            id: id
          })
        }), /*#__PURE__*/_jsx(Col, {
          span: 12,
          children: /*#__PURE__*/_jsx(FSCSFB, {
            classPrefix: prefix,
            id: id
          })
        }), /*#__PURE__*/_jsx(Col, {
          span: 12,
          children: /*#__PURE__*/_jsx(FSYZQS, {
            classPrefix: prefix,
            id: id
          })
        })]
      }), tab === 'OVERFLOW' && /*#__PURE__*/_jsx(FLZLFX, {
        classPrefix: prefix,
        id: id
      }), tab === 'CHUYU_QUALITY' && /*#__PURE__*/_jsx(MYFX, {
        classPrefix: prefix,
        id: id
      })]
    })
  });
};
export default WGXW;