import { useState, Fragment } from "react";
import { Tabs } from "../components/Tabs.js";
import { Sidebar } from "./Sidebar.js";
import { SideNav } from "./SideNav.js";
import { PageContent } from "./Content.js";
import { PageTile } from "./PageTile.js";
import { Toaster } from "react-hot-toast";
import { useAppState } from "../lib/useAppState.js";
import { jsx, jsxs } from "../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
const Layout = ({
  pageHeader,
  content,
  secondarContent,
  sidebar,
  nav,
  header,
  top,
  bottomBar,
  panelled = false,
  extendedBorder = false,
  centeredContent = false,
  emptyPrompt,
  tabs,
  restrictWidth,
  children
}) => {
  const {
    Link,
    NavLink
  } = useAppState();
  useState(false);
  return /* @__PURE__ */ jsx(Fragment, {
    children: /* @__PURE__ */ jsx("div", {
      className: "relative w-full h-screen overflow-hidden bg-slate-100",
      children: /* @__PURE__ */ jsxs("div", {
        className: "flex flex-1 grow",
        children: [sidebar ? /* @__PURE__ */ jsx("div", {
          className: "sticky w-64 bg-white",
          children: /* @__PURE__ */ jsx(Sidebar, {
            data: sidebar
          })
        }) : "", nav && nav.type === "nav" ? /* @__PURE__ */ jsx("div", {
          className: "sticky w-64 p-6 ease-in-out border-r",
          children: /* @__PURE__ */ jsx(SideNav, {
            ...nav
          })
        }) : "", /* @__PURE__ */ jsxs("div", {
          className: "flex-col flex-1",
          children: [top && /* @__PURE__ */ jsx("div", {
            className: "",
            children: top
          }), pageHeader && /* @__PURE__ */ jsx(PageTile, {
            ...pageHeader,
            Link
          }), secondarContent && /* @__PURE__ */ jsx("div", {
            className: "",
            children: secondarContent
          }), tabs && /* @__PURE__ */ jsx("div", {
            className: "",
            children: /* @__PURE__ */ jsx(Tabs, {
              ...tabs
            })
          }), children, emptyPrompt ? /* @__PURE__ */ jsxs("div", {
            className: "",
            children: [/* @__PURE__ */ jsx("div", {
              className: "",
              children: "\u6CA1\u6709\u5185\u5BB9"
            }), /* @__PURE__ */ jsx("div", {
              className: "",
              children: "\u7A7A\u7A7A\u5982\u4E5F\uFF01"
            })]
          }) : /* @__PURE__ */ jsx("div", {
            className: "",
            children: content && typeof content === "object" ? /* @__PURE__ */ jsx(PageContent, {
              ...content
            }) : content
          }), bottomBar && /* @__PURE__ */ jsx("div", {
            children: bottomBar
          }), /* @__PURE__ */ jsx(Toaster, {
            position: "top-center",
            reverseOrder: false
          })]
        })]
      })
    })
  });
};
export {
  Layout
};
//# sourceMappingURL=Layout.js.map
