import { b9 as r, cI as h, g_ as u, c1 as p, P as f, V as i, fV as b, g$ as g, h0 as w, gh as c } from "./684d2f28.js";
import "react";
import "react-dom";
const x = r.div`
  flex-shrink: 0;
  width: ${(n) => n.$placement === "right" ? "96px" : "112px"};
`, v = r.div`
  ${h};
  width: 100%;
  font-size: 13px;
  line-height: 15px;
`, C = r.div`
  display: flex;
  justify-content: space-between;
  width: 100%;
  flex-direction: row;
  align-items: center;

  .ant-select .ant-select-selector {
    margin: 0;
  }

  .ant-select-selection-item {
    height: 26px;
  }
`;
function D(n, s) {
  return class extends u {
    getDefaultValue() {
      return s;
    }
    propertyView(e) {
      const {
        placement: a = "right"
      } = e, d = p.fromPairs(n.map((l) => [l.value, l]));
      return /* @__PURE__ */ f(C, {
        children: [e.label && /* @__PURE__ */ i(x, {
          $placement: a,
          children: /* @__PURE__ */ i(b, {
            title: e.tooltip,
            label: e.label
          })
        }), /* @__PURE__ */ i(g, {
          title: e.label ? void 0 : e.tooltip,
          children: /* @__PURE__ */ i(w, {
            $placement: a,
            children: /* @__PURE__ */ i(c, {
              mode: "multiple",
              popupClassName: "ob-dropdown-control-select",
              filterOption: (l, t) => {
                if (!(t != null && t.value))
                  return !1;
                const o = d[t.value].label;
                return typeof o == "number" || typeof o == "string" || typeof o == "boolean" ? o.toString().toLowerCase().includes(l) : !1;
              },
              border: e.border,
              defaultValue: this.getDefaultValue(),
              value: this.value,
              style: {
                width: "100%"
              },
              onChange: (l) => {
                var t;
                e.disableDispatchValueChange || this.dispatchChangeValueAction(l), (t = e.onChange) == null || t.call(e, l);
              },
              disabled: e.disabled,
              allowClear: !0,
              placeholder: e.placeholder,
              optionLabelProp: "children",
              children: n.map((l) => /* @__PURE__ */ i(c.Option, {
                value: l.value,
                children: /* @__PURE__ */ i(v, {
                  children: l.label
                })
              }, l.value))
            })
          })
        })]
      });
    }
    getPropertyView() {
      throw new Error("Method not implemented.");
    }
  };
}
export {
  D as multiSelectControl
};
