import { isRecord as p } from "../../../isRecord.js";
import { resolveFieldTypeComponentProps as a } from "../../../resolveFieldContractAliases.js";
import { isPositiveInteger as l } from "../../../isPositiveInteger.js";
import { defaultGetOptionLabel as m } from "./helpers/defaultGetOptionLabel/defaultGetOptionLabel.js";
import { resolveFieldInputLabel as u } from "../../../resolveFieldInputLabel/resolveFieldInputLabel.js";
import { defaultGetOptionValue as s } from "./helpers/defaultGetOptionValue/defaultGetOptionValue.js";
import { buildGetOptionValue as f } from "./helpers/buildGetOptionValue/buildGetOptionValue.js";
import { buildGetOptionLabel as d } from "./helpers/buildGetOptionLabel/buildGetOptionLabel.js";
function b(i) {
  return Array.isArray(i) ? i : [];
}
function G(i, n) {
  const r = u(i, n), e = b(i.options), o = a(i.fieldType);
  if (!p(o))
    return {
      resolvedLabel: r,
      resolvedOptions: e,
      getOptionLabel: m,
      getOptionValue: s
    };
  const t = {};
  return typeof o.optionLabelPath == "string" && o.optionLabelPath.trim() !== "" && (t.optionLabelPath = o.optionLabelPath.trim()), typeof o.optionValuePath == "string" && o.optionValuePath.trim() !== "" && (t.optionValuePath = o.optionValuePath.trim()), typeof o.id == "string" && o.id.trim() !== "" && (t.id = o.id.trim()), typeof o.row == "boolean" && (t.row = o.row), l(o.rowColumns) && (t.rowColumns = o.rowColumns), {
    ...t,
    resolvedLabel: r,
    resolvedOptions: e,
    getOptionLabel: d(t.optionLabelPath),
    getOptionValue: f(t.optionValuePath)
  };
}
export {
  G as normalizeRadioGroupPropsFromBackend
};
