text: /*!
  
  =========================================================
  * Vision UI Free Chakra - v1.0.0
  =========================================================
  
  * Product Page: https://www.creative-tim.com/product/vision-ui-free-chakra
  * Copyright 2021 Creative Tim (https://www.creative-tim.com/)
  * Licensed under MIT (https://github.com/creativetimofficial/vision-ui-free-chakra/blob/master LICENSE.md)
  
  * Design and Coded by Simmmple & Creative Tim
  
  =========================================================
  
  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  
  */
  
  // Chakra imports
  import { ChakraProvider, Portal, useDisclosure } from "@chakra-ui/react";
  import { RtlProvider } from "components/RTLProvider/RTLProvider";
  import Configurator from "components/Configurator/Configurator";
  import Footer from "components/Footer/Footer.js";
  // Layout components
  import AdminNavbar from "components/Navbars/AdminNavbar.js";
  import Sidebar from "components/Sidebar/Sidebar.js";
  import React, { useState } from "react";
  import { Redirect, Route, Switch } from "react-router-dom";
  import routes from "routes.js";
  // Custom Chakra theme
  import theme from "theme/themeAdmin";
  import FixedPlugin from "../components/FixedPlugin/FixedPlugin";
  // Custom components
  import MainPanel from "../components/Layout/MainPanel";
  import PanelContainer from "../components/Layout/PanelContainer";
  import PanelContent from "../components/Layout/PanelContent";
  export default function Dashboard(props) {
    const { ...rest } = props;
    // states and functions
    const [sidebarVariant, setSidebarVariant] = useState("transparent");
    const [fixed, setFixed] = useState(false);
    // ref for main panel div
    const mainPanel = React.createRef();
    const getRoute = () => {
      return window.location.pathname !== "/admin/full-screen-maps";
    };
    const getActiveRoute = (routes) => {
      let activeRoute = "Default Brand Text";
      for (let i = 0; i < routes.length; i++) {
        if (routes[i].collapse) {
          let collapseActiveRoute = getActiveRoute(routes[i].views);
          if (collapseActiveRoute !== activeRoute) {
            return collapseActiveRoute;
          }
        } else if (routes[i].category) {
          let categoryActiveRoute = getActiveRoute(routes[i].views);
          if (categoryActiveRoute !== activeRoute) {
            return categoryActiveRoute;
          }
        } else {
          if (
            window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1
          ) {
            return routes[i].name;
          }
        }
      }
      return activeRoute;
    };
    // This changes navbar state(fixed or not)
    const getActiveNavbar = (routes) => {
      let activeNavbar = false;
      for (let i = 0; i < routes.length; i++) {
        if (routes[i].category) {
          let categoryActiveNavbar = getActiveNavbar(routes[i].views);
          if (categoryActiveNavbar !== activeNavbar) {
            return categoryActiveNavbar;
          }
        } else {
          if (
            window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1
          ) {
            if (routes[i].secondaryNavbar) {
              return routes[i].secondaryNavbar;
            }
          }
        }
      }
      return activeNavbar;
    };
    const getRoutes = (routes) => {
      return routes.map((prop, key) => {
        if (prop.collapse) {
          return getRoutes(prop.views);
        }
        if (prop.category === "account") {
          return getRoutes(prop.views);
        }
        if (prop.layout === "/rtl" || prop.layout === "/admin") {
          return (
            <Route
              path={prop.layout + prop.path}
              component={prop.component}
              key={key}
            />
          );
        } else {
          return null;
        }
      });
    };
    const { isOpen, onOpen, onClose } = useDisclosure();
    document.documentElement.dir = "rtl";
    // Chakra Color Mode
    return (
      <ChakraProvider theme={theme} resetCss={false}>
        <RtlProvider>
          <Sidebar
            routes={routes}
            logoText={"VISION UI FREE"}
            display='none'
            sidebarVariant={sidebarVariant}
            {...rest}
          />
          <MainPanel
            variant='rtl'
            ref={mainPanel}
            w={{
              base: "100%",
              xl: "calc(100% - 275px)",
            }}>
            <Portal>
              <AdminNavbar
                onOpen={onOpen}
                logoText={"VISION UI FREE"}
                brandText={getActiveRoute(routes)}
                secondary={getActiveNavbar(routes)}
                fixed={fixed}
                {...rest}
              />
            </Portal>
            {getRoute() ? (
              <PanelContent>
                <PanelContainer>
                  <Switch>
                    {getRoutes(routes)}
                    <Redirect from='/rtl' to='/rtl/rtl-support-page' />
                  </Switch>
                </PanelContainer>
              </PanelContent>
            ) : null}
            <Footer />
            <Portal>
              <FixedPlugin
                secondary={getActiveNavbar(routes)}
                fixed={fixed}
                onOpen={onOpen}
              />
            </Portal>
            <Configurator
              secondary={getActiveNavbar(routes)}
              isOpen={isOpen}
              onClose={onClose}
              isChecked={fixed}
              onSwitch={(value) => {
                setFixed(value);
              }}
              onOpaque={() => setSidebarVariant("opaque")}
              onTransparent={() => setSidebarVariant("transparent")}
            />
          </MainPanel>
        </RtlProvider>
      </ChakraProvider>
    );
  }
  