import g from "../../../@babel/runtime/helpers/esm/typeof.mjs";
import i from "../TransBtn.mjs";
import t from "react";
function v(a, f, u, e, n) {
  var o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !1, r = arguments.length > 6 ? arguments[6] : void 0, m = arguments.length > 7 ? arguments[7] : void 0, s = t.useMemo(function() {
    if (g(e) === "object")
      return e.clearIcon;
    if (n)
      return n;
  }, [e, n]), c = t.useMemo(function() {
    return !!(!o && e && (u.length || r) && !(m === "combobox" && r === ""));
  }, [e, o, u.length, r, m]);
  return {
    allowClear: c,
    clearIcon: /* @__PURE__ */ t.createElement(i, {
      className: "".concat(a, "-clear"),
      onMouseDown: f,
      customizeIcon: s
    }, "×")
  };
}
export {
  v as useAllowClear
};
