function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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; }
import { getUrlParam } from '@vtx/utils';
import { Col, Row } from 'antd';
import _ from 'lodash';
import { VmInfoCollection, VmMap, VmTitle, VmWrapper } from "../../../_components";
import { BaseInfo as DefaultBaseInfo } from "../../../vtx-default-modal/components";
import "./index.less";
import Rules from "./Rules";
import Work from "./Work";
import { BaseService } from "../../api";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var BaseInfo = function BaseInfo(_ref) {
  var _info$lngLats, _jcssInfo$geometryInf;
  var id = _ref.id,
    jcssInfo = _ref.jcssInfo,
    _ref$hasRule = _ref.hasRule,
    hasRule = _ref$hasRule === void 0 ? false : _ref$hasRule,
    setIframeModalInfo = _ref.setIframeModalInfo;
  var _BaseService$useBaseI = BaseService.useBaseInfo(id, hasRule),
    info = _BaseService$useBaseI.info,
    baseInfo = _BaseService$useBaseI.baseInfo,
    rules = _BaseService$useBaseI.rules,
    workTypeColorMap = _BaseService$useBaseI.workTypeColorMap;
  var rings = (info === null || info === void 0 || (_info$lngLats = info.lngLats) === null || _info$lngLats === void 0 ? void 0 : _info$lngLats.wgs84) || (jcssInfo === null || jcssInfo === void 0 || (_jcssInfo$geometryInf = jcssInfo.geometryInfo) === null || _jcssInfo$geometryInf === void 0 ? void 0 : _jcssInfo$geometryInf.lngLats) || '';
  var mapPolygons = _.isEmpty(rings) ? [] : [{
    rings: rings
  }];
  return hasRule ? /*#__PURE__*/_jsxs(Row, {
    gutter: [16, 16],
    style: {
      height: '100%'
    },
    children: [/*#__PURE__*/_jsx(Col, {
      flex: '400px',
      children: /*#__PURE__*/_jsxs(VmWrapper, {
        title: '基本信息',
        children: [/*#__PURE__*/_jsx(VmInfoCollection, {
          data: [].concat(_toConsumableArray(baseInfo), [{
            label: '路段等级',
            key: 'levelName',
            value: info === null || info === void 0 ? void 0 : info.levelName
          }, !getUrlParam('hideType') && {
            label: '路段类型',
            key: 'roadTypeName',
            value: info === null || info === void 0 ? void 0 : info.roadTypeName
          }])
        }), /*#__PURE__*/_jsx("div", {
          style: {
            height: 194
          },
          children: /*#__PURE__*/_jsx(VmMap, {
            mapPolygons: mapPolygons,
            mapType: 'wgs84',
            geometryType: 'polyline'
          })
        }), /*#__PURE__*/_jsx(VmTitle, {
          title: '作业规则',
          border: false
        }), /*#__PURE__*/_jsx(Rules, {
          rules: rules,
          workTypeColorMap: workTypeColorMap
        })]
      })
    }), /*#__PURE__*/_jsx(Col, {
      flex: '1',
      style: {
        minWidth: 0
      },
      children: /*#__PURE__*/_jsx(Work, {
        id: id,
        setIframeModalInfo: setIframeModalInfo,
        workTypeColorMap: workTypeColorMap
      })
    })]
  }) : /*#__PURE__*/_jsx(DefaultBaseInfo, {
    id: id,
    info: jcssInfo,
    data: [],
    geometryType: 'polyline',
    lineLayer: {
      id: 'roadLine',
      rings: rings,
      config: {}
    }
  });
};
export default BaseInfo;