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 _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 { useMemo } from 'react';
import VmCustom from "../_components/vm-custom";
import useGetConfig from "../_hooks/useGetConfig";
import VtxBaseModal from "../vtx-base-modal";
import { BaseService } from "./api";
import { AlarmRecord, BaseInfo, Tfd, ThrowCalendar, ThrowRecord } from "./components";
import "./style";
import { jsx as _jsx } from "react/jsx-runtime";
var TABS_BASE = 'base';
var TABS_CALENDAR = 'calendar';
var TABS_THROW = 'throw';
var TABS_ALARM = 'alarm';
var TABS_TFD = 'tfd';
var tabs = [{
  key: TABS_BASE,
  title: '总览信息'
}, {
  key: TABS_CALENDAR,
  title: '投放日历'
}, {
  key: TABS_THROW,
  title: '投放记录'
}, {
  key: TABS_ALARM,
  title: '违规记录'
}, {
  key: TABS_TFD,
  title: '投放点'
}];
var VtxShxqModal = function VtxShxqModal(props) {
  var id = props.id,
    title = props.title,
    subTitle = props.subTitle,
    theme = props.theme,
    visible = props.visible,
    onCancel = props.onCancel,
    _props$top = props.top,
    top = _props$top === void 0 ? 50 : _props$top,
    _props$frameParams = props.frameParams,
    frameParams = _props$frameParams === void 0 ? {} : _props$frameParams,
    _props$customMapInfo = props.customMapInfo,
    customMapInfo = _props$customMapInfo === void 0 ? {} : _props$customMapInfo,
    _props$tabChose = props.tabChose,
    tabChose = _props$tabChose === void 0 ? '' : _props$tabChose,
    _props$mapPoints = props.mapPoints,
    mapPoints = _props$mapPoints === void 0 ? [] : _props$mapPoints,
    _props$mapCenter = props.mapCenter,
    mapCenter = _props$mapCenter === void 0 ? [] : _props$mapCenter;
  var _BaseService$useBaseI = BaseService.useBaseInfo(id),
    info = _BaseService$useBaseI.info,
    baseInfo = _BaseService$useBaseI.baseInfo;
  var _useGetConfig = useGetConfig(info.typeCode, tabs),
    tabsData = _useGetConfig.tabsData;
  var tabsList = useMemo(function () {
    var tabsList = tabsData;
    return tabsList;
  }, [JSON.stringify(tabsData)]);
  var contents = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TABS_BASE, /*#__PURE__*/_jsx(BaseInfo, {
    id: id,
    info: info,
    baseInfo: baseInfo,
    mapCenter: mapCenter,
    mapPoints: mapPoints,
    customMapInfo: customMapInfo
  })), TABS_CALENDAR, /*#__PURE__*/_jsx(ThrowCalendar, {
    id: id
  })), TABS_THROW, /*#__PURE__*/_jsx(ThrowRecord, {
    id: id
  })), TABS_ALARM, /*#__PURE__*/_jsx(AlarmRecord, {
    id: id
  })), TABS_TFD, /*#__PURE__*/_jsx(Tfd, {
    id: id,
    service: "rykq"
  }));

  // 自定义页签可配置多个，
  if (tabsData !== null && tabsData !== void 0 && tabsData.length) {
    tabsData.forEach(function (ele) {
      if (ele.url) {
        contents[ele.key] = /*#__PURE__*/_jsx(VmCustom, {
          id: id,
          url: ele === null || ele === void 0 ? void 0 : ele.url
        });
      }
    });
  }
  return /*#__PURE__*/_jsx(VtxBaseModal, {
    id: id,
    type: "shxq",
    title: title,
    subTitle: subTitle,
    visible: visible,
    theme: theme,
    onCancel: onCancel,
    frameParams: frameParams,
    tabChose: tabChose,
    top: top,
    tabs: tabsList,
    contents: contents
  });
};
export default VtxShxqModal;