import { useContext as m, useRef as S, useState as g, useEffect as b } from "react";
import { X as x, av as v, aw as H, ax as V, Z as h, ay as z, az as k, w as c, a2 as E, U as I, F as i, a6 as s, G as $, a7 as a, a8 as n, Y as r, af as f, a9 as P, aa as j, ab as A, L as R, aA as B, ad as F, aB as M, ak as N } from "./603b75d9.js";
import "react-dom";
const W = x.div`
  display: flex;
  align-items: center;
  justify-content: center;
  ${(t) => t.$animationStyle}
  ${(t) => t.$style && v`
      height: calc(100% - ${t.$style.margin});
      width: calc(100% - ${t.$style.margin});
      padding: ${t.$style.padding};
      margin: ${t.$style.margin};
      border: ${t.$style.borderWidth} solid ${t.$style.border};
      border-radius: ${t.$style.radius};
      background: ${t.$style.background};
      rotate:${t.$style.rotation};
      svg {
        max-width: ${H(t.$style.margin)};
        max-height: ${V(t.$style.margin)};
        color: ${t.$style.fill};
        object-fit: contain;
        pointer-events: auto;
      }
    `}
`, D = [N], T = {
  style: h(z, "style"),
  animationStyle: h(k, "animationStyle"),
  icon: c(R, "/icon:antd/homefilled"),
  autoHeight: c(B, "auto"),
  iconSize: c(F, 20),
  onEvent: E(D)
}, U = (t) => {
  const y = S(null), [o, w] = g(0), [l, C] = g(0);
  b(() => {
    l && o && u();
  }, [l, o]);
  const u = () => {
    const e = y.current;
    w((e == null ? void 0 : e.clientWidth) ?? 0), C((e == null ? void 0 : e.clientHeight) ?? 0);
  };
  return /* @__PURE__ */ i(M, {
    onResize: u,
    render: () => /* @__PURE__ */ i(W, {
      ref: y,
      $style: t.style,
      $animationStyle: t.animationStyle,
      style: {
        fontSize: t.autoHeight ? `${l < o ? l : o}px` : t.iconSize,
        background: t.style.background
      },
      onClick: () => t.onEvent("click"),
      children: t.icon
    })
  });
};
let d = function() {
  return new I(T, (t) => /* @__PURE__ */ i(U, {
    ...t
  })).setPropertyViewFn((t) => /* @__PURE__ */ s($, {
    children: [/* @__PURE__ */ i(a, {
      name: n.basic,
      children: t.icon.propertyView({
        label: r("iconComp.icon"),
        IconType: "All"
      })
    }), ["logic", "both"].includes(m(f).editorModeStatus) && /* @__PURE__ */ s(a, {
      name: n.interaction,
      children: [t.onEvent.getPropertyView(), P(t)]
    }), ["layout", "both"].includes(m(f).editorModeStatus) && /* @__PURE__ */ s($, {
      children: [/* @__PURE__ */ s(a, {
        name: n.layout,
        children: [t.autoHeight.propertyView({
          label: r("iconComp.autoSize")
        }), !t.autoHeight.getView() && t.iconSize.propertyView({
          label: r("iconComp.iconSize")
        })]
      }), /* @__PURE__ */ i(a, {
        name: n.style,
        children: t.style.getPropertyView()
      }), /* @__PURE__ */ i(a, {
        name: n.animationStyle,
        hasTooltip: !0,
        children: t.animationStyle.getPropertyView()
      })]
    })]
  })).build();
}();
d = class extends d {
  autoHeight() {
    return !1;
  }
};
const X = j(d, [A]);
export {
  X as IconComp
};
