import { a0 as d, ba as x, gK as m, V as n, gL as p, P as C, bh as f, gh as g, gM as S, d6 as w } from "./684d2f28.js";
import { C as b, S as V } from "./9869e60a.js";
import { Wrapper as y, DropdownStyled as B } from "./7f2964c3.js";
import { useContext as E, useState as h } from "react";
import "react-dom";
import "./b1144c16.js";
import "./d404aae1.js";
import "./926d8ea1.js";
import "./d6402597.js";
const F = d("table.columnValueTooltip"), T = ["none", "success", "error", "default", "warning", "processing"], O = {
  text: x,
  status: m(T, "none")
}, c = (t) => ({
  value: t.text,
  status: t.status
}), j = (t) => {
  const a = E(V), [s, r] = h(a), [u, l] = h(!0);
  return /* @__PURE__ */ n(y, {
    children: /* @__PURE__ */ n(g, {
      autoFocus: !0,
      defaultOpen: !0,
      variant: "borderless",
      optionLabelProp: "children",
      open: u,
      defaultValue: t.value.value,
      style: {
        width: "100%"
      },
      suffixIcon: /* @__PURE__ */ n(S, {}),
      showSearch: !0,
      onSearch: (e) => {
        var o;
        a.findIndex((i) => i.text.includes(e)) < 0 ? r([...a, {
          text: e,
          status: "none"
        }]) : r(a), t.onChange({
          value: e,
          status: ((o = s.find((i) => i.text === e)) == null ? void 0 : o.status) || "none"
        });
      },
      onChange: (e) => {
        var o;
        t.onChange({
          value: e,
          status: ((o = s.find((i) => i.text === e)) == null ? void 0 : o.status) || "none"
        });
      },
      dropdownRender: (e) => /* @__PURE__ */ n(B, {
        children: /* @__PURE__ */ n(w, {
          style: {
            maxHeight: "256px"
          },
          children: e
        })
      }),
      dropdownStyle: {
        marginTop: "7px",
        padding: "8px 0 6px 0"
      },
      onBlur: t.onChangeEnd,
      onKeyDown: (e) => {
        e.key === "Enter" && t.onChangeEnd();
      },
      onClick: () => l(!u),
      children: s.map((e, o) => /* @__PURE__ */ n(g.Option, {
        value: e.text,
        children: e.status === "none" ? e.text : /* @__PURE__ */ n(p, {
          status: e.status,
          text: e.text
        })
      }, o))
    })
  });
}, H = function() {
  return new b(O, (t, a) => {
    var u, l;
    const s = ((u = t.changeValue) == null ? void 0 : u.value) ?? c(t).value, r = ((l = t.changeValue) == null ? void 0 : l.status) ?? c(t).status;
    return r === "none" ? s : /* @__PURE__ */ n(p, {
      status: r,
      text: s
    });
  }, (t) => [t.status.value, t.text.value].filter((a) => a).join(" "), c).setEditViewFn((t) => /* @__PURE__ */ n(j, {
    value: t.value,
    onChange: t.onChange,
    onChangeEnd: t.onChangeEnd
  })).setPropertyViewFn((t) => /* @__PURE__ */ C(f, {
    children: [t.text.propertyView({
      label: d("table.columnValue"),
      tooltip: F
    }), t.status.propertyView({
      label: d("table.status"),
      tooltip: d("table.statusTooltip")
    })]
  })).build();
}();
export {
  H as BadgeStatusComp,
  T as BadgeStatusOptions,
  F as ColumnValueTooltip
};
