import { E as compilerRuntimeExports, j as jsxRuntimeExports } from "./vendor-react-DYNCg6N5.js";
import { c as createStyles, ae as Input } from "./vendor-mantine-h0WlM2Mj.js";
import { w as qXe } from "./vendor-icons-xWhXK_Ui.js";
const useStyles = createStyles((theme, {
  fullSize
}) => ({
  search: {
    width: fullSize ? "100%" : "auto",
    "& input": {
      borderRadius: "8px",
      border: "none",
      fontWeight: 400
    },
    "& .mantine-Input-input[data-with-icon]": {
      paddingLeft: "56px"
    },
    "& .mantine-Input-icon": {
      marginLeft: theme.spacing.sm
    }
  },
  clearIcon: {
    cursor: "pointer"
  }
}));
const Search = (t0) => {
  const $ = compilerRuntimeExports.c(32);
  let className;
  let fullSize;
  let hideClearIcon;
  let icon;
  let props;
  let setSearch;
  let t1;
  let value;
  if ($[0] !== t0) {
    ({
      placeholder: t1,
      className,
      fullSize,
      setSearch,
      hideClearIcon,
      icon,
      value,
      ...props
    } = t0);
    $[0] = t0;
    $[1] = className;
    $[2] = fullSize;
    $[3] = hideClearIcon;
    $[4] = icon;
    $[5] = props;
    $[6] = setSearch;
    $[7] = t1;
    $[8] = value;
  } else {
    className = $[1];
    fullSize = $[2];
    hideClearIcon = $[3];
    icon = $[4];
    props = $[5];
    setSearch = $[6];
    t1 = $[7];
    value = $[8];
  }
  const placeholder = t1 === void 0 ? "Search..." : t1;
  let t2;
  if ($[9] !== fullSize) {
    t2 = {
      fullSize
    };
    $[9] = fullSize;
    $[10] = t2;
  } else {
    t2 = $[10];
  }
  const {
    classes,
    cx
  } = useStyles(t2);
  let t3;
  if ($[11] !== setSearch) {
    t3 = (event) => {
      setSearch(event.target.value);
    };
    $[11] = setSearch;
    $[12] = t3;
  } else {
    t3 = $[12];
  }
  const onSearchChange = t3;
  let t4;
  if ($[13] !== setSearch) {
    t4 = () => {
      setSearch("");
    };
    $[13] = setSearch;
    $[14] = t4;
  } else {
    t4 = $[14];
  }
  const clearValue = t4;
  let t5;
  if ($[15] !== className || $[16] !== classes.search || $[17] !== cx) {
    t5 = cx(classes.search, className);
    $[15] = className;
    $[16] = classes.search;
    $[17] = cx;
    $[18] = t5;
  } else {
    t5 = $[18];
  }
  let t6;
  if ($[19] !== classes.clearIcon || $[20] !== clearValue || $[21] !== hideClearIcon || $[22] !== value) {
    t6 = !hideClearIcon && value && /* @__PURE__ */ jsxRuntimeExports.jsx(qXe, { size: "18", className: classes.clearIcon, onClick: clearValue });
    $[19] = classes.clearIcon;
    $[20] = clearValue;
    $[21] = hideClearIcon;
    $[22] = value;
    $[23] = t6;
  } else {
    t6 = $[23];
  }
  let t7;
  if ($[24] !== icon || $[25] !== onSearchChange || $[26] !== placeholder || $[27] !== props || $[28] !== t5 || $[29] !== t6 || $[30] !== value) {
    t7 = /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { "data-lpignore": "true", autoComplete: "new-password", type: "search", className: t5, leftSection: icon, placeholder, onChange: onSearchChange, value, rightSectionPointerEvents: "all", rightSection: t6, ...props });
    $[24] = icon;
    $[25] = onSearchChange;
    $[26] = placeholder;
    $[27] = props;
    $[28] = t5;
    $[29] = t6;
    $[30] = value;
    $[31] = t7;
  } else {
    t7 = $[31];
  }
  return t7;
};
export {
  Search as S
};
//# sourceMappingURL=index-CcqTjOWY.js.map
