import React from 'react';
import isEmpty from 'lodash/isEmpty';
import Center from '@arcblock/ux/lib/Center';
import { CircularProgress } from '@mui/material';
import Disconnect from './disconnect';
import Connected from './connected';
import { BlockletStorageProvider, useBlockletStorageContext } from '../../../contexts/blocklet-storage';
import { jsx as _jsx } from "react/jsx-runtime";
function Backup() {
  const {
    spaceGatewaysFirstLoading,
    spaceGateways
  } = useBlockletStorageContext();
  if (spaceGatewaysFirstLoading) {
    return /*#__PURE__*/_jsx(Center, {
      relative: "parent",
      children: /*#__PURE__*/_jsx(CircularProgress, {})
    });
  }
  if (isEmpty(spaceGateways)) {
    return /*#__PURE__*/_jsx(Disconnect, {});
  }
  return /*#__PURE__*/_jsx(Connected, {});
}
export default function BlockletBackup() {
  return /*#__PURE__*/_jsx(BlockletStorageProvider, {
    children: /*#__PURE__*/_jsx(Backup, {})
  });
}