import { jsxs as n, Fragment as u, jsx as t } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as s } from "@m4l/core";
import { useMemo as f } from "react";
import { useFormContext as b, useWatch as c } from "react-hook-form";
import { NUMBER_OPERATORS as d } from "../../../constants.js";
import { DYNAMIC_FILTER_DICTIONARY_ID as O, DICCTIONARY as a } from "../../../dictionary.js";
import { useDynamicFilterStore as _ } from "../../../store/useDynamicFilterStore.js";
import { RHFAutocomplete as F } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
import { RHFNumberInput as R } from "../../../../hook-form/RHFNumberInput/RHFNumberInput.js";
import { RHFTextField as D } from "../../../../hook-form/RHFTextField/RHFTextField.js";
function h() {
  const { getLabel: r } = s(), { control: l } = b(), o = _((e) => e.popoverFilterData?.field)?.restritcOperatorsTo, m = c({
    control: l,
    name: "formValueOperator"
  }), i = f(
    () => d.map((e) => ({
      id: e,
      label: r(`${O}.operator_${e}`)
    })).filter((e) => o ? o.includes(e.id) : !0),
    [r, o]
  );
  return /* @__PURE__ */ n(u, { children: [
    /* @__PURE__ */ t(
      F,
      {
        type: "text",
        name: "formValueOperator",
        autoComplete: "off",
        options: i,
        getOptionLabel: (e) => e.label,
        isOptionEqualToValue: (e, p) => e.id === p.id,
        label: r(a.label_operator_number)
      }
    ),
    /* @__PURE__ */ t(
      R,
      {
        name: "formValueOperand1",
        withDecimal: !1,
        label: r(a.label_operand1_number)
      }
    ),
    m && m.id === "b" && /* @__PURE__ */ t(
      D,
      {
        name: "formValueOperand2",
        type: "number",
        label: r(a.label_operand2_number)
      }
    )
  ] });
}
export {
  h as NumberFilter
};
