import { Y as d, S as C, gI as S, F as n, ai as x, a6 as w, G as V, gf as m, gJ as b, dk as y } from "./603b75d9.js";
import { C as B, S as F } from "./4963ac97.js";
import { Wrapper as O, DropdownStyled as E } from "./98f17e53.js";
import { useContext as T, useState as p } from "react";
import "react-dom";
import "./ffcffc16.js";
import "./62f393ec.js";
import "./26dac75c.js";
const j = d("table.columnValueTooltip"), f = ["none", "success", "error", "default", "warning", "processing"], I = {
  text: C,
  status: S(f, "none")
}, g = (t) => ({
  value: t.text,
  status: t.status
}), k = (t) => {
  const a = T(F), [o, r] = p(a), [u, c] = p(f), [h, i] = p(!1);
  return /* @__PURE__ */ n(O, {
    children: /* @__PURE__ */ n(m, {
      autoFocus: !0,
      defaultOpen: !0,
      variant: "borderless",
      optionLabelProp: "children",
      open: h,
      defaultValue: t.value.value,
      style: {
        width: "100%"
      },
      suffixIcon: /* @__PURE__ */ n(b, {}),
      showSearch: !0,
      onSearch: (e) => {
        var s;
        a.findIndex((l) => l.text.includes(e)) < 0 ? r([...a, {
          text: e,
          status: "none"
        }]) : r(a), t.onChange({
          value: e,
          status: ((s = o.find((l) => l.text === e)) == null ? void 0 : s.status) || "none"
        });
      },
      onChange: (e) => {
        var s;
        t.onChange({
          value: e,
          status: ((s = o.find((l) => l.text === e)) == null ? void 0 : s.status) || "none"
        }), i(!1);
      },
      dropdownRender: (e) => /* @__PURE__ */ n(E, {
        children: /* @__PURE__ */ n(y, {
          style: {
            maxHeight: "256px"
          },
          children: e
        })
      }),
      dropdownStyle: {
        marginTop: "7px",
        padding: "8px 0 6px 0"
      },
      onBlur: () => {
        t.onChangeEnd(), i(!1);
      },
      onFocus: () => {
        i(!0);
      },
      onClick: () => i(!h),
      children: u.map((e, s) => /* @__PURE__ */ n(m.Option, {
        value: e,
        children: e === "none" ? e : /* @__PURE__ */ n(x, {
          status: e,
          text: e
        })
      }, s))
    })
  });
}, L = function() {
  return new B(I, (t, a) => {
    var u, c;
    const o = ((u = t.changeValue) == null ? void 0 : u.value) ?? g(t).value, r = ((c = t.changeValue) == null ? void 0 : c.status) ?? g(t).status;
    return r === "none" ? o : /* @__PURE__ */ n(x, {
      status: r,
      text: o
    });
  }, (t) => [t.status.value, t.text.value].filter((a) => a).join(" "), g).setEditViewFn((t) => /* @__PURE__ */ n(k, {
    value: t.value,
    onChange: t.onChange,
    onChangeEnd: t.onChangeEnd
  })).setPropertyViewFn((t) => /* @__PURE__ */ w(V, {
    children: [t.text.propertyView({
      label: d("table.columnValue"),
      tooltip: j
    }), t.status.propertyView({
      label: d("table.status"),
      tooltip: d("table.statusTooltip")
    })]
  })).build();
}();
export {
  L as BadgeStatusComp,
  f as BadgeStatusOptions,
  j as ColumnValueTooltip
};
