import { jsxs as a, jsx as e } from "react/jsx-runtime";
import { useState as p, useEffect as $ } from "react";
import P from "react-helmet";
import { Box as c, Drawer as z, Container as H } from "@mui/material";
import { useSize as S } from "ahooks";
import W from "./sidebar.js";
import j from "./header.js";
import C from "../../Footer/index.js";
import { styled as F } from "../../Theme/index.js";
const O = F("div")`
  &.dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  .dashboard__body {
    overflow: hidden;
    flex: 1;
  }
  .dashboard__main {
    display: flex;
    flex-direction: column;
    overflow: auto;
    flex: 1;
  }
  .dashboard__content {
    flex: 1;
  }

  .drawerPaper {
    position: relative;
    white-space: nowrap;
    width: 120px;
    background: ${(o) => o.theme.palette.background.default};
    box-shadow: 2px 16px 10px 0 rgba(0, 0, 0, ${(o) => o.theme.palette.mode === "light" ? 0.05 : 0.5});
    border: 0;
  }
`;
function R({
  links: o = [],
  brand: t = "",
  description: h = "",
  images: f,
  title: b = "Home",
  brandAddon: u = void 0,
  headerAddon: w = void 0,
  prefix: x = "/images",
  fullWidth: _ = !1,
  contentLayout: g = "column",
  className: y = "",
  homeUrl: v = "/",
  logo: d = void 0,
  children: N,
  ...k
}) {
  const r = S(document.body)?.width || 0, [s, M] = p(r >= 960 ? "permanent" : "temporary"), [n, i] = p(s === "permanent");
  $(() => {
    const m = r >= 960 ? "permanent" : "temporary";
    M(m), i(m !== "temporary");
  }, [r]);
  const l = () => {
    i(!n);
  }, D = _ || g === "row";
  return /* @__PURE__ */ a(O, { className: `dashboard ${y}`, ...k, children: [
    /* @__PURE__ */ e(P, { title: `${b}-${t}` }),
    /* @__PURE__ */ e(
      j,
      {
        className: "dashboard__header",
        onToggleMenu: l,
        brand: t,
        brandAddon: u,
        description: h,
        addons: w,
        homeUrl: v,
        logo: d
      }
    ),
    /* @__PURE__ */ a(
      c,
      {
        className: "dashboard__body",
        sx: {
          display: "flex"
        },
        children: [
          /* @__PURE__ */ e(
            z,
            {
              variant: s,
              className: "drawer",
              classes: { paper: "drawerPaper" },
              open: n,
              onClose: l,
              ModalProps: { disablePortal: !0, keepMounted: !0 },
              children: /* @__PURE__ */ e(W, { className: "dashboard__sidebar", images: f, links: o, prefix: x, logo: d })
            }
          ),
          /* @__PURE__ */ a(c, { className: "dashboard__main", children: [
            /* @__PURE__ */ e(H, { maxWidth: D ? !1 : "lg", className: "dashboard__content", children: N }),
            /* @__PURE__ */ e(C, {})
          ] })
        ]
      }
    )
  ] });
}
export {
  R as default
};
