import { jsx as o, jsxs as m } from "react/jsx-runtime";
import { useEffect as h } from "react";
import { useLayoutContainer as u } from "../../contexts/LayoutContainerContext.js";
import { Container as y } from "./Container.js";
import { ViewportProvider as L } from "../../contexts/ViewportContext.js";
import { ToolbarLayout as C } from "./toolbar/ToolbarLayout.js";
import { WrapperLayout as g } from "./WrapperLayout.js";
import { useDocumentContext as x } from "../../contexts/RPDocumentContext.js";
import "../../contexts/DocumentPasswordContext.js";
import { L as b, e as j } from "../../ToolbarLayout.module-cbc8e216.js";
import "../../contexts/DarkModeContext.js";
import "../../contexts/RotationContext.js";
import "../../contexts/LayerContext.js";
import "../../contexts/ZoomContext.js";
import "../../contexts/ViewModeContext.js";
import "../../contexts/ScrollModeContext.js";
import "../../contexts/VirtualScrollContext.js";
import "../../contexts/VirtualGridContext.js";
import "../../contexts/SelectionModeContext.js";
import "../../contexts/InitialStateContext.js";
import "../../contexts/FullScreenContext.js";
import "../../contexts/FileInputContext.js";
import "../../contexts/DropFileZoneContext.js";
import "../../contexts/DimensionPagesContext.js";
import "../../contexts/LocalizationContext.js";
import "../../contexts/HighlightContext.js";
import "../../contexts/LicenseContext.js";
import "../../contexts/DownloadContext.js";
import "../../contexts/SmoothScrollContext.js";
import "../../contexts/ElementPageContext.js";
import "../../contexts/PagesRotateContext.js";
import "../../contexts/GlobalCurrentPage.js";
import { useLoaderContext as v } from "../../contexts/LoaderContext.js";
import "../../contexts/ToolComponentContext.js";
import "../../contexts/IconToolContext.js";
import "../../contexts/OtherToolContext.js";
import "../RPConfig.js";
import "../../contexts/ThemeContext.js";
import { RPDropFileZone as w } from "../RPDropFileZone.js";
import "../ui/Button.js";
import "../../SearchCloseButton-cbf182aa.js";
import "../ui/Input.js";
import "../ui/Checkbox.js";
import "../icons/LoaderIcon.js";
import "../../contexts/IconContext.js";
import "../ui/RPTooltip.js";
import "../../contexts/ToolbarComponentContext.js";
import "../ui/DropDown.js";
import "../../ZoomTool.module-6c5eabbb.js";
import "./toolbar/MenuItem.js";
import "./toolbar/MenuSeparator.js";
import "../../utils/dateFormatter.js";
import "./toolbar/PropertyItem.js";
import "./toolbar/RotateTool.js";
const Ro = (p) => {
  const {
    children: e,
    style: n,
    className: a,
    mobileWidth: s,
    onLoaded: t,
    cleanupOnLoaded: r,
    onLayoutWidthChange: l,
    toolbar: d
  } = p, { setContainer: c } = u(), { loading: f } = x(), { LoaderImageComponent: i } = v();
  return h(() => (t && t(), () => {
    r && r();
  }), [t, r]), // TODO: deprecated in v2.0.0, remove later ("LayoutContainer") ~
  /* @__PURE__ */ o(b, { children: /* @__PURE__ */ o(L, { mobileWidth: s, onLayoutWidthChange: l, children: /* @__PURE__ */ m(y, { getContainerRef: c, style: n, className: a, children: [
    /* @__PURE__ */ m(g, { children: [
      /* @__PURE__ */ o(C, { toolbar: d, children: e }),
      /* @__PURE__ */ o(w, {})
    ] }),
    f ? /* @__PURE__ */ o(
      "div",
      {
        className: j["rp-loader"],
        style: {
          position: "absolute",
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          width: "100%",
          height: "100%"
        },
        children: /* @__PURE__ */ o(
          "div",
          {
            style: {
              display: "flex",
              justifyContent: "center",
              alignItems: "center",
              height: "100%",
              width: "100%"
            },
            children: i && /* @__PURE__ */ o(i, {})
          }
        )
      }
    ) : null
  ] }) }) });
};
export {
  Ro as RPLayout
};
