import { jsx as o } from "@emotion/react/jsx-runtime";
import { useFormContext as a, Controller as C } from "react-hook-form";
import { FormGroup as h, FormControlLabel as s, Checkbox as x } from "@mui/material";
function k({ name: n, options: l, ...c }) {
  const { control: t } = a();
  return /* @__PURE__ */ o(
    C,
    {
      name: n,
      control: t,
      render: ({ field: e }) => {
        const u = (r) => e.value.includes(r) ? e.value.filter((m) => m !== r) : [...e.value, r];
        return /* @__PURE__ */ o(h, { children: l.map((r) => /* @__PURE__ */ o(
          s,
          {
            control: /* @__PURE__ */ o(
              x,
              {
                checked: e.value.includes(r),
                onChange: () => e.onChange(u(r))
              }
            ),
            label: r,
            ...c
          },
          r
        )) });
      }
    }
  );
}
export {
  k as RHFMultiCheckbox
};
