import { jsx as e, jsxs as z } from "@emotion/react/jsx-runtime";
import { getPropDataTestId as i } from "../../test/getNameDataTestId.js";
import { WINDOW_BASE_KEY_COMPONENT as o } from "./constants.js";
import { getComponentSlotRoot as T } from "../../utils/getComponentSlotRoot.js";
import N from "clsx";
import { HeaderWindowBase as v } from "./subcomponents/Header/HeaderWindowBase.js";
import { EditionInfo as E } from "./subcomponents/EditionInfo/EditionInfo.js";
import { WindowBaseStyled as P, ToastContainerStyled as D, ContentWindowStyled as O, LinearProgressIndeterminateStyled as _ } from "./slots/WindowBaseSlots.js";
import { useComponentSize as b, AppearanceComponentProvider as j } from "@m4l/graphics";
import { WindowBaseSlots as r } from "./slots/WindowBaseEnum.js";
const G = (u) => {
  const {
    children: S,
    size: a = "medium",
    selected: d = !1,
    maximized: t,
    variant: s = "outlined",
    version: W,
    buildTime: g,
    dataTestId: n,
    onClose: B,
    className: C,
    isLoading: I,
    windowId: x,
    onMouseDown: h,
    editionInfo: m,
    emergeType: p = "layout",
    collapsed: l,
    draggable: c = !0,
    ...y
  } = u, { currentSize: f } = b(a), w = {
    selected: d,
    variant: t ? "text" : s,
    size: f,
    emergeType: p,
    maximized: t,
    collapsed: l,
    draggable: c
  };
  return /* @__PURE__ */ e(j, { defaultSize: f, children: /* @__PURE__ */ z(
    P,
    {
      className: N(T(o), C),
      ...i(o, r.wrapperWindowBase, n),
      ownerState: w,
      onMouseDown: h,
      children: [
        /* @__PURE__ */ e(
          v,
          {
            ...i(o, r.headerContentWindowBase, n),
            version: W,
            buildTime: g,
            size: a,
            variant: s,
            selected: d,
            maximized: t,
            collapsed: l,
            onClose: B,
            emergeType: p,
            draggable: c,
            ...y
          }
        ),
        /* @__PURE__ */ e(D, { fixed: !1, position: "top-right", containerId: x }),
        m && /* @__PURE__ */ e(E, { editionInfo: m }),
        /* @__PURE__ */ e(
          O,
          {
            ...i(o, r.contentWindowBase, n),
            ownerState: w,
            children: S
          }
        ),
        I && /* @__PURE__ */ e(_, {})
      ]
    }
  ) });
};
export {
  G as WindowBase
};
