import { a3 as g, am as k, cS as I, H as i, fa as f, eh as x, ad as p, aD as v, fc as C, fk as w, aC as S, f5 as P, hE as B, fj as H } from "./56c67d3b.js";
import { useContext as W, useState as z, useEffect as R } from "react";
import "react-dom";
const u = (e) => S`
    border-color: ${e.border};
    border-width: ${e.borderWidth};
    border-radius: ${e.radius};
    overflow: hidden;
    padding: ${e.padding};
    
    ${P(e)}
  `, O = g.div`
  display: flex;
  flex-flow: column;
  height: 100%;
  border: 1px solid #d7d9e0;
  border-radius: 4px;
  ${(e) => e.$style && u(e.$style)}
`, j = g(B)`;
  ${(e) => e.$style && u(e.$style)}
`, E = g(H)`
  border-top: ${(e) => `${e.$showBorder ? e.$borderWidth : 0} solid ${e.$borderColor}`};
  flex: 1;
  ${(e) => e.$backgroundColor && `background-color: ${e.$backgroundColor};`}
  border-radius: 0;
  ${(e) => e.$backgroundImage && `background-image: ${e.$backgroundImage};`}
  ${(e) => e.$backgroundImageRepeat && `background-repeat: ${e.$backgroundImageRepeat};`}
  ${(e) => e.$backgroundImageSize && `background-size: ${e.$backgroundImageSize};`}
  ${(e) => e.$backgroundImagePosition && `background-position: ${e.$backgroundImagePosition};`}
  ${(e) => e.$backgroundImageOrigin && `background-origin: ${e.$backgroundImageOrigin};`}
`;
function X(e) {
  const {
    container: t,
    icon: d
  } = e, l = t.showVerticalScrollbar, {
    items: $,
    ...h
  } = t.body[0].children.view.getView(), {
    style: a,
    headerStyle: G,
    bodyStyle: r,
    footerStyle: V
  } = t, b = W(k).getAppSettings().maxWidth;
  I(b);
  let [n, m] = z({
    value: "star",
    index: 0
  });
  return R(() => {
    var c, s;
    if ((c = d.props) != null && c.value) {
      let o = (s = d.props) == null ? void 0 : s.value;
      m({
        index: parseInt(o == null ? void 0 : o.split("_")[0]),
        value: o == null ? void 0 : o.split("_")[1]
      });
    }
  }, [d.props]), /* @__PURE__ */ i("div", {
    style: {
      padding: a.margin,
      height: "100%"
    },
    children: /* @__PURE__ */ i(O, {
      $style: a,
      children: /* @__PURE__ */ i(f.Provider, {
        value: r.background,
        children: /* @__PURE__ */ i(x, {
          style: {
            height: t.autoHeight ? "auto" : "100%",
            margin: "0px",
            padding: "0px"
          },
          hideScrollbar: !l,
          children: /* @__PURE__ */ p("div", {
            style: {
              position: "relative",
              height: "100%"
            },
            children: [/* @__PURE__ */ i(j, {
              $style: a,
              type: n == null ? void 0 : n.value,
              noise: !1,
              index: n.index,
              styles: {
                position: "absolute",
                top: "0",
                left: "50%",
                transform: "translateX(-50%)",
                width: v(a.margin),
                height: "100%"
              }
            }), /* @__PURE__ */ i(E, {
              $showBorder: !1,
              ...h,
              items: C($),
              autoHeight: t.autoHeight,
              emptyRows: 14,
              minHeight: "142px",
              hintPlaceholder: e.hintPlaceholder ?? w,
              $backgroundColor: (r == null ? void 0 : r.background) || "transparent",
              $borderColor: a == null ? void 0 : a.border,
              $borderWidth: a == null ? void 0 : a.borderWidth,
              $backgroundImage: r == null ? void 0 : r.backgroundImage,
              $backgroundImageRepeat: r == null ? void 0 : r.backgroundImageRepeat,
              $backgroundImageSize: r == null ? void 0 : r.backgroundImageSize,
              $backgroundImagePosition: r == null ? void 0 : r.backgroundImagePosition,
              $backgroundImageOrigin: r == null ? void 0 : r.backgroundImageOrigin,
              style: {
                zIndex: 999
              }
            })]
          })
        })
      })
    })
  });
}
export {
  X as ShapeTriContainer
};
