import { jsx as o } from "../../../../../preact@10.29.0/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import k from "classnames";
import { u as _, z as x } from "./StoreProvider-CBB99upB.js";
import { a as I } from "./useId-BZ0PA7jP.js";
import { R as v } from "./Radio-BMtxBpnn.js";
try {
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, a = new e.Error().stack;
  a && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[a] = "c12ccf5f-7916-4fee-badb-6e5362fdcd42", e._sentryDebugIdIdentifier = "sentry-dbid-c12ccf5f-7916-4fee-badb-6e5362fdcd42");
} catch {
}
const w = ({
  value: e,
  label: a,
  content: t,
  groupName: d,
  checked: i = !1,
  disabled: r = !1,
  onClick: c
}) => {
  const s = I("radio");
  return /* @__PURE__ */ o("label", { htmlFor: s, className: "adyen-kyc-input-radio", children: [
    /* @__PURE__ */ o(
      v,
      {
        id: s,
        checked: i,
        groupName: d,
        onClick: c,
        value: e,
        disabled: r
      }
    ),
    /* @__PURE__ */ o("div", { className: "adyen-kyc-input-radio__content", children: [
      /* @__PURE__ */ o("span", { className: "adyen-kyc-input-radio__label adyen-kyc-label__text", children: a }),
      t
    ] })
  ] });
};
function T({
  items: e,
  name: a,
  onChange: t,
  value: d,
  disabled: i = !1,
  horizontal: r = !1,
  showContentOnlyOnSelected: c = !1,
  className: s,
  enableTracking: f = !1
}) {
  const { t: u, i18n: y } = _("common"), p = x(), b = (n) => {
    f && p.addFieldEvent("Interacted with form field", {
      actionType: "input",
      field: a,
      returnValue: d
    }), t(n);
  };
  return /* @__PURE__ */ o(
    "div",
    {
      className: k([
        "adyen-kyc-radio-group",
        { "adyen-kyc-radio-group--horizontal": r },
        s
      ]),
      children: e.map((n) => {
        const l = n.id === d, m = l || !c ? n.content : void 0, h = y.exists(n.name, { ns: "common" });
        return /* @__PURE__ */ o(
          w,
          {
            value: n.id,
            label: h ? u((g) => g[n.name]) : n.name,
            content: m,
            groupName: a,
            checked: l,
            disabled: i,
            onClick: () => {
              b(n.id);
            }
          },
          n.id
        );
      })
    }
  );
}
export {
  T as R,
  w as a
};
