import { jsx as c, Fragment as z } from "react/jsx-runtime";
import { Search as u } from "semantic-ui-react";
import o from "react";
import A from "clsx";
import { useKeyOnly as n, useValueAndKey as H, getUnhandledProps as I, partitionHTMLProps as K, htmlInputAttrs as O } from "../utils/semanticUtils.js";
const G = (e) => {
  const { results: r, resultRenderer: i, onSearchChange: d, value: h, showNoResults: m, onResultSelect: f, loading: a } = e, [g, T] = o.useState(""), [b, l] = o.useState(!1), [S, y] = o.useState(!1), F = (s, t) => {
    l(!1), e.onBlur && e.onBlur(s, t);
  }, w = (s, t) => {
    l(!0), e.onFocus && e.onFocus(s, t);
  }, M = (s) => {
    y(!0), e.onMouseDown && e.onMouseDown(s);
  }, { aligned: x, category: B, className: C, fluid: D, size: P, searchTextHandler: j } = e, R = A(
    "ui",
    S && "active visible",
    P,
    g,
    n(B, "category"),
    n(D, "fluid"),
    n(a, "loading"),
    H(x, "aligned"),
    "search",
    C
  ), v = I(u, e), [L, N] = K(v, {
    htmlProps: O
  });
  return /* @__PURE__ */ c(z, { children: /* @__PURE__ */ c(
    u,
    {
      ...N,
      className: R,
      placeholder: e.placeholder,
      onBlur: F,
      size: "tiny",
      onFocus: w,
      onMouseDown: M,
      resultRenderer: i,
      onSearchChange: d,
      results: r,
      value: h,
      showNoResults: m,
      onResultSelect: f,
      loading: a
    }
  ) });
};
export {
  G as default
};
