import { jsx as r } from "@emotion/react/jsx-runtime";
import { NotificationWarningFill as R } from "@m4l/icons";
import { normalizeTextFieldPropsFromBackend as _ } from "./normalizeTextFieldPropsFromBackend.js";
import { DYNAMIC_FORM_DICTIONARY as i } from "../../../../dictionary.js";
import { resolveFieldHelperMessage as h, resolveFieldMandatory as S, resolveFieldSymbol as k } from "../../../resolveFieldContractAliases.js";
import { Icon as x } from "@m4l/base";
import { DynamicFormFallbackEndIconChipStyled as z } from "../../../../slots/DynamicFormSlots.js";
import { RHFTextField as A } from "../../../../../hook-form/RHFTextField/RHFTextField.js";
const G = {
  componentIds: ["RHFTextField"],
  /** Renders the RHFTextField component for the given field and context. */
  render(d) {
    const { field: o, props: n, isFallback: e } = d, { size: t = "medium", disabled: a, readOnly: c, getLabel: l, assetBasePath: m, slots: p } = n, { name: F, placeholder: I } = o, f = (() => {
      const s = h(o);
      return e && s ? l(i.FIELD_LOAD_ERROR_MESSAGE) : s || "";
    })(), b = S(o), E = _(o, l, m), { resolvedLabel: y, startIcon: M, endIcon: g, ...u } = E, N = /* @__PURE__ */ r(
      z,
      {
        size: t,
        label: l(i.UNKNOWN_COMPONENT_MESSAGE),
        startIcon: /* @__PURE__ */ r(x, { src: /* @__PURE__ */ r(R, {}), color: "chips.warning.contained.color" }),
        color: "warning",
        opacity: !0
      }
    ), O = e ? p?.fallbackEndIcon ?? N : void 0, { suppressLabel: v } = n;
    return /* @__PURE__ */ r(
      A,
      {
        name: F,
        size: t,
        ...!v && { label: y, symbol: k(o), mandatory: b },
        helperMessage: f,
        disabled: e ? a : a || c,
        placeholder: I || void 0,
        ...u,
        startIcon: M,
        endIcon: e ? O : g,
        InputProps: e ? { readOnly: !0 } : void 0
      }
    );
  }
};
export {
  G as textFieldStrategy
};
