import { av as d, X as g, Y as t, a2 as u, a4 as b, Z as p, hO as w, hP as h, a3 as y, O as c, w as m, eb as f, U as P, F as o, _ as C, a6 as i, G as v, a7 as a, a8 as l, bJ as x, a9 as k, ac as n, cn as V, hQ as $ } from "./603b75d9.js";
import "react";
import { FormDataPropertyView as S } from "./f9847c56.js";
import { textInputChildren as E } from "./41aba172.js";
import { presets as O } from "./dd65c218.js";
import "react-dom";
function j(e) {
  return d`
    border-radius: ${e.radius};
    &:not(.ant-input-disabled, .ant-input-affix-wrapper-disabled),
    input {
      background-color: ${e.background};
      color:${e.text};
      font-weight:${e.textWeight};
      font-family:${e.fontFamily};
      border-color: ${e.border};
      &:focus,
      &.ant-input-affix-wrapper-focused {
        border-color: ${e.accent};
      }
      &:hover {
        border-color: ${e.accent};
      }
      .ant-input-clear-icon svg:hover {
        opacity: 0.65;
      }
    }
  `;
}
const A = g($)`
  width: 100%;
  display: flex;
  justify-content: flex-start;
  ${(e) => e.$style && j(e.$style)}
`, F = [{
  label: t("colorPicker.click"),
  value: "click"
}, {
  label: t("colorPicker.hover"),
  value: "hover"
}], H = u([V]), U = {
  ...E,
  value: b("value", "#3377ff"),
  style: p(w, "style"),
  color: h("color", {}),
  trigger: y(F, "click"),
  disabledAlpha: c,
  showPresets: c,
  onEvent: H,
  presets: m(f, JSON.stringify(O, null, 2))
}, W = new P(U, (e) => {
  var s;
  return e.label({
    children: /* @__PURE__ */ o(A, {
      $style: e.style,
      value: (s = e == null ? void 0 : e.value) == null ? void 0 : s.value,
      disabledAlpha: e.disabledAlpha,
      showText: (r) => r.toHexString().toUpperCase(),
      allowClear: !0,
      trigger: e.trigger,
      disabled: e.disabled,
      onChange: (r) => {
        e.value.onChange(r.toHexString().toUpperCase()), e.color.onChange({
          hex: r.toHexString().toUpperCase(),
          hsb: r.toHsb(),
          rgb: r.toRgb()
        }), e.onEvent("change");
      },
      presets: e.showPresets && !C.isEmpty(e.presets) ? [e.presets] : []
    }),
    style: e.style
  });
}).setPropertyViewFn((e) => /* @__PURE__ */ i(v, {
  children: [/* @__PURE__ */ o(a, {
    name: l.basic,
    children: e.value.propertyView({
      label: t("prop.defaultValue")
    })
  }), /* @__PURE__ */ o(S, {
    ...e
  }), e.label.getPropertyView(), /* @__PURE__ */ i(a, {
    name: l.interaction,
    children: [e.onEvent.getPropertyView(), x(e)]
  }), /* @__PURE__ */ i(a, {
    name: l.advanced,
    children: [e.trigger.propertyView({
      label: t("colorPicker.trigger"),
      radioButton: !0
    }), e.disabledAlpha.propertyView({
      label: t("colorPicker.disabledAlpha")
    }), e.showPresets.propertyView({
      label: t("colorPicker.showPresets")
    }), e.showPresets.getView() && e.presets.propertyView({
      label: t("colorPicker.recommended")
    })]
  }), /* @__PURE__ */ o(a, {
    name: l.layout,
    children: k(e)
  }), /* @__PURE__ */ o(a, {
    name: l.style,
    children: e.style.getPropertyView()
  })]
})).setExposeStateConfigs([new n("value", t("export.inputValueDesc")), new n("color", t("export.inputValueDesc")), new n("disabled", t("prop.disabled"))]).build();
export {
  W as ColorPickerComp,
  H as colorPickerEvent,
  j as getStyle
};
