import { useContext as m, useRef as w, useState as g, useEffect as b } from "react";
import { a3 as H, aC as x, aD as V, aE as v, a5 as h, aF as E, aG as I, w as c, a9 as k, U as z, H as a, ad as s, I as $, ae as i, af as n, a4 as r, am as f, ag as P, ah as j, ai as R, P as A, aH as D, ak as F, aI as M, ar as N } from "./56c67d3b.js";
import "react-dom";
const W = H.div`
  display: flex;
  align-items: center;
  justify-content: center;
  ${(t) => t.$animationStyle}
  ${(t) => t.$style && x`
      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: ${V(t.$style.margin)};
        max-height: ${v(t.$style.margin)};
        color: ${t.$style.fill};
        object-fit: contain;
        pointer-events: auto;
      }
    `}
`, B = [N], T = {
  style: h(E, "style"),
  animationStyle: h(I, "animationStyle"),
  icon: c(A, "/icon:antd/homefilled"),
  autoHeight: c(D, "auto"),
  iconSize: c(F, 20),
  onEvent: k(B)
}, U = (t) => {
  const y = w(null), [o, C] = g(0), [l, S] = g(0);
  b(() => {
    l && o && u();
  }, [l, o]);
  const u = () => {
    const e = y.current;
    C((e == null ? void 0 : e.clientWidth) ?? 0), S((e == null ? void 0 : e.clientHeight) ?? 0);
  };
  return /* @__PURE__ */ a(M, {
    onResize: u,
    render: () => /* @__PURE__ */ a(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 z(T, (t) => /* @__PURE__ */ a(U, {
    ...t
  })).setPropertyViewFn((t) => /* @__PURE__ */ s($, {
    children: [/* @__PURE__ */ a(i, {
      name: n.basic,
      children: t.icon.propertyView({
        label: r("iconComp.icon"),
        IconType: "All"
      })
    }), ["logic", "both"].includes(m(f).editorModeStatus) && /* @__PURE__ */ s(i, {
      name: n.interaction,
      children: [t.onEvent.getPropertyView(), P(t)]
    }), ["layout", "both"].includes(m(f).editorModeStatus) && /* @__PURE__ */ s($, {
      children: [/* @__PURE__ */ s(i, {
        name: n.layout,
        children: [t.autoHeight.propertyView({
          label: r("iconComp.autoSize")
        }), !t.autoHeight.getView() && t.iconSize.propertyView({
          label: r("iconComp.iconSize")
        })]
      }), /* @__PURE__ */ a(i, {
        name: n.style,
        children: t.style.getPropertyView()
      }), /* @__PURE__ */ a(i, {
        name: n.animationStyle,
        hasTooltip: !0,
        children: t.animationStyle.getPropertyView()
      })]
    })]
  })).build();
}();
d = class extends d {
  autoHeight() {
    return !1;
  }
};
const J = j(d, [R]);
export {
  J as IconComp
};
