function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import React, { useRef, useMemo, lazy, Suspense } from 'react';
import { observer } from 'mobx-react-lite';
import Sidebar from "./sidebar";
import DragBar from "../../../components/drag-bar";
import Loading from "../../../components/loading";
import { useClusterStore } from "../stores";
import { useClusterMainStore } from "./stores";
import "./index.less";
import "./theme4.less";
var ClusterContent = /*#__PURE__*/lazy(function () {
  return import("./contents/cluster-content");
});
var NodeContent = /*#__PURE__*/lazy(function () {
  return import("./contents/node-content");
});
var EmptyShown = /*#__PURE__*/lazy(function () {
  return import("./contents/empty");
});
export default observer(function () {
  var _useClusterStore = useClusterStore(),
      prefixCls = _useClusterStore.prefixCls,
      itemType = _useClusterStore.clusterStore.getSelectedMenu.itemType,
      _useClusterStore$item = _useClusterStore.itemType,
      CLU_ITEM = _useClusterStore$item.CLU_ITEM,
      NODE_ITEM = _useClusterStore$item.NODE_ITEM,
      treeDs = _useClusterStore.treeDs;

  var _useClusterMainStore = useClusterMainStore(),
      mainStore = _useClusterMainStore.mainStore;

  var rootRef = useRef(null);
  var content = useMemo(function () {
    var _cmMaps;

    var cmMaps = (_cmMaps = {}, _defineProperty(_cmMaps, CLU_ITEM, /*#__PURE__*/React.createElement(ClusterContent, null)), _defineProperty(_cmMaps, NODE_ITEM, /*#__PURE__*/React.createElement(NodeContent, null)), _cmMaps);
    return cmMaps[itemType] ? /*#__PURE__*/React.createElement(Suspense, {
      fallback: /*#__PURE__*/React.createElement(Loading, {
        display: true
      })
    }, cmMaps[itemType]) : /*#__PURE__*/React.createElement(Loading, {
      display: true
    });
  }, [itemType]);
  return !treeDs.length && treeDs.status === 'ready' ? /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefixCls, "-wrap")
  }, /*#__PURE__*/React.createElement(Suspense, {
    fallback: /*#__PURE__*/React.createElement("span", null)
  }, /*#__PURE__*/React.createElement(EmptyShown, null))) : /*#__PURE__*/React.createElement("div", {
    ref: rootRef,
    className: "".concat(prefixCls, "-wrap")
  }, /*#__PURE__*/React.createElement(DragBar, {
    parentRef: rootRef,
    store: mainStore
  }), /*#__PURE__*/React.createElement(Sidebar, null), /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefixCls, "-main ").concat(prefixCls, "-animate")
  }, content));
});