import { X as m, dh as k, af as H, di as R, F as i, a6 as z, dj as I, dl as s, dk as O, du as W, av as p, dt as b } from "./603b75d9.js";
import { useContext as G } from "react";
import "react-dom";
const F = (o) => p`
    border-color: ${o.border};
    border-width: ${o.borderWidth};
    border-radius: ${o.radius};
    border-style: ${o.borderStyle};
    overflow: hidden;
    padding: ${o.padding};
    ${k(o)}
  `, j = m.div`
  display: flex;
  flex-flow: column;
  height: 100%;
  border: 1px solid #d7d9e0;
  border-radius: 4px;
  ${(o) => o.$style && F(o.$style)}
  ${(o) => o.$animationStyle && o.$animationStyle}
`, M = m(b)`
  overflow: visible;
  border-radius: 0;
  ${(o) => k({
  background: o.$backgroundColor,
  backgroundImage: o.$headerBackgroundImage,
  backgroundImageSize: o.$headerBackgroundImageSize,
  backgroundImageRepeat: o.$headerBackgroundImageRepeat,
  backgroundImageOrigin: o.$headerBackgroundImageOrigin,
  backgroundImagePosition: o.$headerBackgroundImagePosition
})}
`, V = m(b)`
  border-top: ${(o) => `${o.$showBorder ? o.$borderWidth : 0} solid ${o.$borderColor}`};
  flex: 1;
  border-radius: 0;
  ${(o) => k({
  background: o.$backgroundColor,
  backgroundImage: o.$backgroundImage,
  backgroundImageSize: o.$backgroundImageSize,
  backgroundImageRepeat: o.$backgroundImageRepeat,
  backgroundImageOrigin: o.$backgroundImageOrigin,
  backgroundImagePosition: o.$backgroundImagePosition
})}
`, N = m(b)`
  border-top: ${(o) => `${o.$showBorder ? o.$borderWidth : 0} solid ${o.$borderColor}`};
  overflow: visible;
  border-radius: 0;
  ${(o) => k({
  background: o.$backgroundColor,
  backgroundImage: o.$footerBackgroundImage,
  backgroundImageSize: o.$footerBackgroundImageSize,
  backgroundImageRepeat: o.$footerBackgroundImageRepeat,
  backgroundImageOrigin: o.$footerBackgroundImageOrigin,
  backgroundImagePosition: o.$footerBackgroundImagePosition
})}
`;
function D(o) {
  const {
    container: n,
    animationStyle: h
  } = o, {
    showHeader: g,
    showFooter: u,
    horizontalGridCells: $
  } = n, t = n.showBody || !g && !u, B = n.showVerticalScrollbar, {
    items: l,
    ...P
  } = n.header, {
    items: w,
    ...f
  } = n.body[0].children.view.getView(), {
    items: x,
    ...C
  } = n.footer, {
    style: d,
    headerStyle: r,
    bodyStyle: a,
    footerStyle: e
  } = n, v = G(H).getAppSettings().maxWidth, c = R(v) ? 8 : 0;
  return /* @__PURE__ */ i("div", {
    style: {
      padding: d.margin,
      height: "100%"
    },
    children: /* @__PURE__ */ z(j, {
      $style: d,
      $animationStyle: h,
      children: [g && /* @__PURE__ */ i(I.Provider, {
        value: r.headerBackground,
        children: /* @__PURE__ */ i(M, {
          ...P,
          horizontalGridCells: $,
          items: s(l),
          autoHeight: !0,
          emptyRows: 5,
          minHeight: "46px",
          containerPadding: [c, 3],
          showName: {
            bottom: t || u ? 20 : 0
          },
          $backgroundColor: (r == null ? void 0 : r.headerBackground) || "transparent",
          $headerBackgroundImage: r == null ? void 0 : r.headerBackgroundImage,
          $headerBackgroundImageRepeat: r == null ? void 0 : r.headerBackgroundImageRepeat,
          $headerBackgroundImageSize: r == null ? void 0 : r.headerBackgroundImageSize,
          $headerBackgroundImagePosition: r == null ? void 0 : r.headerBackgroundImagePosition,
          $headerBackgroundImageOrigin: r == null ? void 0 : r.headerBackgroundImageOrigin,
          style: {
            padding: r.containerHeaderPadding
          }
        })
      }), t && /* @__PURE__ */ i(I.Provider, {
        value: a.background,
        children: /* @__PURE__ */ i(O, {
          style: {
            height: n.autoHeight ? "auto" : "100%",
            margin: "0px",
            padding: "0px"
          },
          hideScrollbar: !B,
          overflow: n.autoHeight ? "hidden" : "scroll",
          children: /* @__PURE__ */ i(V, {
            $showBorder: g,
            ...f,
            horizontalGridCells: $,
            items: s(w),
            autoHeight: n.autoHeight,
            emptyRows: 14,
            minHeight: g ? "143px" : "142px",
            containerPadding: g && u || g ? [c, 11.5] : [c, 11],
            hintPlaceholder: o.hintPlaceholder ?? W,
            $backgroundColor: (a == null ? void 0 : a.background) || "transparent",
            $borderColor: d == null ? void 0 : d.border,
            $borderWidth: d == null ? void 0 : d.borderWidth,
            $backgroundImage: a == null ? void 0 : a.backgroundImage,
            $backgroundImageRepeat: a == null ? void 0 : a.backgroundImageRepeat,
            $backgroundImageSize: a == null ? void 0 : a.backgroundImageSize,
            $backgroundImagePosition: a == null ? void 0 : a.backgroundImagePosition,
            $backgroundImageOrigin: a == null ? void 0 : a.backgroundImageOrigin,
            style: {
              padding: a.containerBodyPadding
            }
          })
        })
      }), u && /* @__PURE__ */ i(I.Provider, {
        value: e.footerBackground,
        children: /* @__PURE__ */ i(N, {
          $showBorder: g || t,
          ...C,
          horizontalGridCells: $,
          items: s(x),
          autoHeight: !0,
          emptyRows: 5,
          minHeight: t ? "47px" : "46px",
          containerPadding: t || g ? [c, 3.5] : [c, 3],
          showName: {
            top: g || t ? 20 : 0
          },
          $backgroundColor: (e == null ? void 0 : e.footerBackground) || "transparent",
          $footerBackgroundImage: e == null ? void 0 : e.footerBackgroundImage,
          $footerBackgroundImageRepeat: e == null ? void 0 : e.footerBackgroundImageRepeat,
          $footerBackgroundImageSize: e == null ? void 0 : e.footerBackgroundImageSize,
          $footerBackgroundImagePosition: e == null ? void 0 : e.footerBackgroundImagePosition,
          $footerBackgroundImageOrigin: e == null ? void 0 : e.footerBackgroundImageOrigin,
          $borderColor: d == null ? void 0 : d.border,
          $borderWidth: d == null ? void 0 : d.borderWidth,
          style: {
            padding: e.containerFooterPadding
          }
        })
      })]
    })
  });
}
export {
  D as TriContainer
};
