import { jsxs as t, jsx as s } from "react/jsx-runtime";
import { isEmpty as v } from "es-toolkit/compat";
import r from "../../utils/classNames.js";
const y = (d) => {
  const {
    options: n,
    selectedItemIds: m,
    showSelectedItemIcon: c,
    showUnselectedItemIcons: i,
    multiline: p,
    hasInputAddon: h,
    hasFilter: I,
    onRemoveItem: f,
    children: g
  } = d;
  if (!n || v(n))
    return null;
  const o = (e) => m.indexOf(e.id) !== -1, N = (e, l) => {
    if (c) {
      const a = r("margin-right-5", !o(e) && "inactiveIcon");
      return /* @__PURE__ */ s("span", { className: a, children: e.icon }, e.id);
    }
    return /* @__PURE__ */ t("span", { className: "selected-option", children: [
      /* @__PURE__ */ t("span", { className: "selected-label", children: [
        e.icon && /* @__PURE__ */ s("span", { className: "margin-right-5", children: e.icon }),
        e.label
      ] }),
      /* @__PURE__ */ s(
        "span",
        {
          className: "removeIcon",
          onClick: (a) => {
            f(a, e.id);
          },
          children: /* @__PURE__ */ s("span", { className: "rioglyph rioglyph-remove" })
        }
      )
    ] }, l);
  }, u = r(
    !c && !i && "selected-option-list",
    p && "flex-wrap",
    h && "margin-left-0",
    I && "padding-left-1"
  );
  return /* @__PURE__ */ t("span", { className: u, children: [
    n.filter((e) => i ? !e.header : o(e)).map((e, l) => N(e, l)),
    g
  ] });
};
export {
  y as default
};
//# sourceMappingURL=MultiselectToggleSelection.js.map
