import { r as u, j as m, aJ as ge, m as ye, aI as ve, aV as we, aK as Oe, ap as Re, H as re, aB as oe, bA as ne, aX as R, b9 as ke, aY as w } from "./index-6wLGsgHc.js";
import { S as je } from "./useBasicWidgetState-DqA4I-I_-Cy-zNgyc.js";
var ie = {
  vertical: "vertical",
  horizontal: "horizontal"
};
function ae(e, t) {
  var o = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var r = Object.getOwnPropertySymbols(e);
    t && (r = r.filter(function(n) {
      return Object.getOwnPropertyDescriptor(e, n).enumerable;
    })), o.push.apply(o, r);
  }
  return o;
}
function A(e) {
  for (var t = 1; t < arguments.length; t++) {
    var o = arguments[t] != null ? arguments[t] : {};
    t % 2 ? ae(Object(o), !0).forEach(function(r) {
      O(e, r, o[r]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : ae(Object(o)).forEach(function(r) {
      Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(o, r));
    });
  }
  return e;
}
function O(e, t, o) {
  return t in e ? Object.defineProperty(e, t, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = o, e;
}
var x = 0, E = 1, I = 2;
function B(e) {
  return e.$isActive ? I : e.$isHovered ? E : x;
}
function Se(e) {
  var t = e.$theme.colors, o = e.$disabled, r = e.$checked, n = e.$isFocusVisible, i = e.$error;
  if (o) return t.tickFillDisabled;
  if (r)
    if (i) switch (B(e)) {
      case x:
        return t.tickFillErrorSelected;
      case E:
        return t.tickFillErrorSelectedHover;
      case I:
        return t.tickFillErrorSelectedHoverActive;
    }
    else switch (B(e)) {
      case x:
        return t.tickFillSelected;
      case E:
        return t.tickFillSelectedHover;
      case I:
        return t.tickFillSelectedHoverActive;
    }
  else return n ? t.borderSelected : i ? t.tickBorderError : t.tickBorder;
  return null;
}
function Me(e) {
  var t = e.$theme.colors;
  if (e.$disabled) return t.tickMarkFillDisabled;
  if (e.$checked) return t.tickMarkFill;
  if (e.$error) switch (B(e)) {
    case x:
      return t.tickFillError;
    case E:
      return t.tickFillErrorHover;
    case I:
      return t.tickFillErrorHoverActive;
  }
  else switch (B(e)) {
    case x:
      return t.tickFill;
    case E:
      return t.tickFillHover;
    case I:
      return t.tickFillActive;
  }
}
function $e(e) {
  var t = e.$labelPlacement, o = t === void 0 ? "" : t, r = e.$theme, n;
  switch (o) {
    case "top":
      n = "Bottom";
      break;
    case "bottom":
      n = "Top";
      break;
    case "left":
      n = r.direction === "rtl" ? "Left" : "Right";
      break;
    default:
    case "right":
      n = r.direction === "rtl" ? "Right" : "Left";
      break;
  }
  var i = r.sizing, a = i.scale300;
  return O({}, "padding".concat(n), a);
}
function Fe(e) {
  var t = e.$disabled, o = e.$theme, r = o.colors;
  return t ? r.contentSecondary : r.contentPrimary;
}
var W = R("div", function(e) {
  var t = e.$disabled, o = e.$align;
  return {
    display: "flex",
    flexWrap: "wrap",
    flexDirection: o === "horizontal" ? "row" : "column",
    alignItems: o === "horizontal" ? "center" : "flex-start",
    cursor: t ? "not-allowed" : "pointer",
    "-webkit-tap-highlight-color": "transparent"
  };
});
W.displayName = "RadioGroupRoot";
W.displayName = "RadioGroupRoot";
var X = R("label", function(e) {
  var t, o = e.$disabled, r = e.$hasDescription, n = e.$labelPlacement, i = e.$theme, a = e.$align, s = i.sizing, c = a === "horizontal", d = i.direction === "rtl" ? "Left" : "Right";
  return t = {
    flexDirection: n === "top" || n === "bottom" ? "column" : "row",
    display: "flex",
    alignItems: "center",
    cursor: o ? "not-allowed" : "pointer",
    marginTop: s.scale200
  }, O(t, "margin".concat(d), c ? s.scale200 : null), O(t, "marginBottom", r && !c ? null : s.scale200), t;
});
X.displayName = "Root";
X.displayName = "Root";
var J = R("div", function(e) {
  var t = e.$theme, o = t.animation, r = t.sizing;
  return {
    backgroundColor: Me(e),
    borderTopLeftRadius: "50%",
    borderTopRightRadius: "50%",
    borderBottomRightRadius: "50%",
    borderBottomLeftRadius: "50%",
    height: e.$checked ? r.scale200 : r.scale550,
    transitionDuration: o.timing200,
    transitionTimingFunction: o.easeOutCurve,
    width: e.$checked ? r.scale200 : r.scale550
  };
});
J.displayName = "RadioMarkInner";
J.displayName = "RadioMarkInner";
var K = R("div", function(e) {
  var t = e.$theme, o = t.animation, r = t.sizing;
  return {
    alignItems: "center",
    backgroundColor: Se(e),
    borderTopLeftRadius: "50%",
    borderTopRightRadius: "50%",
    borderBottomRightRadius: "50%",
    borderBottomLeftRadius: "50%",
    boxShadow: e.$isFocusVisible && e.$checked ? "0 0 0 3px ".concat(e.$theme.colors.accent) : "none",
    display: "flex",
    height: r.scale700,
    justifyContent: "center",
    marginTop: r.scale0,
    marginRight: r.scale0,
    marginBottom: r.scale0,
    marginLeft: r.scale0,
    outline: "none",
    verticalAlign: "middle",
    width: r.scale700,
    flexShrink: 0,
    transitionDuration: o.timing200,
    transitionTimingFunction: o.easeOutCurve
  };
});
K.displayName = "RadioMarkOuter";
K.displayName = "RadioMarkOuter";
var Y = R("div", function(e) {
  var t = e.$theme.typography;
  return A(A({
    verticalAlign: "middle"
  }, $e(e)), {}, {
    color: Fe(e)
  }, t.LabelMedium);
});
Y.displayName = "Label";
Y.displayName = "Label";
var Q = R("input", {
  width: 0,
  height: 0,
  marginTop: 0,
  marginRight: 0,
  marginBottom: 0,
  marginLeft: 0,
  paddingTop: 0,
  paddingRight: 0,
  paddingBottom: 0,
  paddingLeft: 0,
  clip: "rect(0 0 0 0)",
  position: "absolute"
});
Q.displayName = "Input";
Q.displayName = "Input";
var Z = R("div", function(e) {
  var t, o = e.$theme, r = e.$align, n = r === "horizontal", i = o.direction === "rtl" ? "Right" : "Left", a = o.direction === "rtl" ? "Left" : "Right";
  return A(A({}, o.typography.ParagraphSmall), {}, (t = {
    color: o.colors.contentSecondary,
    cursor: "auto"
  }, O(t, "margin".concat(i), r === "horizontal" ? null : o.sizing.scale900), O(t, "margin".concat(a), n ? o.sizing.scale200 : null), O(t, "maxWidth", "240px"), t));
});
Z.displayName = "Description";
Z.displayName = "Description";
function N(e) {
  "@babel/helpers - typeof";
  return N = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, N(e);
}
function _() {
  return _ = Object.assign ? Object.assign.bind() : function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var o = arguments[t];
      for (var r in o) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
    }
    return e;
  }, _.apply(this, arguments);
}
function Pe(e, t) {
  return Le(e) || Ie(e, t) || Ee(e, t) || xe();
}
function xe() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Ee(e, t) {
  if (e) {
    if (typeof e == "string") return se(e, t);
    var o = Object.prototype.toString.call(e).slice(8, -1);
    if (o === "Object" && e.constructor && (o = e.constructor.name), o === "Map" || o === "Set") return Array.from(e);
    if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return se(e, t);
  }
}
function se(e, t) {
  (t == null || t > e.length) && (t = e.length);
  for (var o = 0, r = new Array(t); o < t; o++) r[o] = e[o];
  return r;
}
function Ie(e, t) {
  var o = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
  if (o != null) {
    var r = [], n = !0, i = !1, a, s;
    try {
      for (o = o.call(e); !(n = (a = o.next()).done) && (r.push(a.value), !(t && r.length === t)); n = !0) ;
    } catch (c) {
      i = !0, s = c;
    } finally {
      try {
        !n && o.return != null && o.return();
      } finally {
        if (i) throw s;
      }
    }
    return r;
  }
}
function Le(e) {
  if (Array.isArray(e)) return e;
}
function Te(e, t) {
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}
function Ce(e, t) {
  for (var o = 0; o < t.length; o++) {
    var r = t[o];
    r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
  }
}
function Ae(e, t, o) {
  return t && Ce(e.prototype, t), Object.defineProperty(e, "prototype", {
    writable: !1
  }), e;
}
function Be(e, t) {
  if (typeof t != "function" && t !== null) throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(t && t.prototype, {
    constructor: {
      value: e,
      writable: !0,
      configurable: !0
    }
  }), Object.defineProperty(e, "prototype", {
    writable: !1
  }), t && U(e, t);
}
function U(e, t) {
  return U = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, r) {
    return o.__proto__ = r, o;
  }, U(e, t);
}
function De(e) {
  var t = ze();
  return function() {
    var o = D(e), r;
    if (t) {
      var n = D(this).constructor;
      r = Reflect.construct(o, arguments, n);
    } else r = o.apply(this, arguments);
    return Ve(this, r);
  };
}
function Ve(e, t) {
  if (t && (N(t) === "object" || typeof t == "function")) return t;
  if (t !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
  return T(e);
}
function T(e) {
  if (e === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e;
}
function ze() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
  if (typeof Proxy == "function") return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), !0;
  } catch {
    return !1;
  }
}
function D(e) {
  return D = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
    return t.__proto__ || Object.getPrototypeOf(t);
  }, D(e);
}
function C(e, t, o) {
  return t in e ? Object.defineProperty(e, t, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = o, e;
}
var ue = /* @__PURE__ */ (function(e) {
  Be(o, e);
  var t = De(o);
  function o() {
    var r;
    Te(this, o);
    for (var n = arguments.length, i = new Array(n), a = 0; a < n; a++) i[a] = arguments[a];
    return r = t.call.apply(t, [this].concat(i)), C(T(r), "state", {
      isFocusVisible: !1,
      focusedRadioIndex: -1
    }), C(T(r), "handleFocus", function(s, c) {
      ke(s) && r.setState({
        isFocusVisible: !0
      }), r.setState({
        focusedRadioIndex: c
      }), r.props.onFocus && r.props.onFocus(s);
    }), C(T(r), "handleBlur", function(s, c) {
      r.state.isFocusVisible !== !1 && r.setState({
        isFocusVisible: !1
      }), r.setState({
        focusedRadioIndex: -1
      }), r.props.onBlur && r.props.onBlur(s);
    }), r;
  }
  return Ae(o, [{
    key: "render",
    value: function() {
      var r = this, n = this.props.overrides, i = n === void 0 ? {} : n, a = w(i.RadioGroupRoot, W), s = Pe(a, 2), c = s[0], d = s[1];
      return /* @__PURE__ */ u.createElement(c, _({
        id: this.props.id,
        role: "radiogroup",
        "aria-describedby": this.props["aria-describedby"],
        "aria-errormessage": this.props["aria-errormessage"],
        "aria-invalid": this.props.error || null,
        "aria-label": this.props["aria-label"],
        "aria-labelledby": this.props["aria-labelledby"],
        $align: this.props.align,
        $disabled: this.props.disabled,
        $error: this.props.error,
        $required: this.props.required
      }, d), u.Children.map(this.props.children, function(p, b) {
        if (!/* @__PURE__ */ u.isValidElement(p)) return null;
        var l = r.props.value === p.props.value;
        return /* @__PURE__ */ u.cloneElement(p, {
          align: r.props.align,
          autoFocus: r.props.autoFocus,
          checked: l,
          disabled: r.props.disabled || p.props.disabled,
          error: r.props.error,
          isFocused: r.state.focusedRadioIndex === b,
          isFocusVisible: r.state.isFocusVisible,
          tabIndex: b === 0 && !r.props.value || l ? "0" : "-1",
          labelPlacement: r.props.labelPlacement,
          name: r.props.name,
          onBlur: function(f) {
            return r.handleBlur(f, b);
          },
          onFocus: function(f) {
            return r.handleFocus(f, b);
          },
          onChange: r.props.onChange,
          onMouseEnter: r.props.onMouseEnter,
          onMouseLeave: r.props.onMouseLeave
        });
      }));
    }
  }]), o;
})(u.Component);
C(ue, "defaultProps", {
  name: "",
  value: "",
  disabled: !1,
  autoFocus: !1,
  labelPlacement: "right",
  align: "vertical",
  error: !1,
  required: !1,
  onChange: function() {
  },
  onMouseEnter: function() {
  },
  onMouseLeave: function() {
  },
  onFocus: function() {
  },
  onBlur: function() {
  },
  overrides: {}
});
function q(e) {
  "@babel/helpers - typeof";
  return q = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, q(e);
}
function v() {
  return v = Object.assign ? Object.assign.bind() : function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var o = arguments[t];
      for (var r in o) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
    }
    return e;
  }, v.apply(this, arguments);
}
function S(e, t) {
  return Ue(e) || _e(e, t) || Ne(e, t) || He();
}
function He() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Ne(e, t) {
  if (e) {
    if (typeof e == "string") return le(e, t);
    var o = Object.prototype.toString.call(e).slice(8, -1);
    if (o === "Object" && e.constructor && (o = e.constructor.name), o === "Map" || o === "Set") return Array.from(e);
    if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return le(e, t);
  }
}
function le(e, t) {
  (t == null || t > e.length) && (t = e.length);
  for (var o = 0, r = new Array(t); o < t; o++) r[o] = e[o];
  return r;
}
function _e(e, t) {
  var o = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
  if (o != null) {
    var r = [], n = !0, i = !1, a, s;
    try {
      for (o = o.call(e); !(n = (a = o.next()).done) && (r.push(a.value), !(t && r.length === t)); n = !0) ;
    } catch (c) {
      i = !0, s = c;
    } finally {
      try {
        !n && o.return != null && o.return();
      } finally {
        if (i) throw s;
      }
    }
    return r;
  }
}
function Ue(e) {
  if (Array.isArray(e)) return e;
}
function qe(e, t) {
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}
function Ge(e, t) {
  for (var o = 0; o < t.length; o++) {
    var r = t[o];
    r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
  }
}
function We(e, t, o) {
  return t && Ge(e.prototype, t), Object.defineProperty(e, "prototype", {
    writable: !1
  }), e;
}
function Xe(e, t) {
  if (typeof t != "function" && t !== null) throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(t && t.prototype, {
    constructor: {
      value: e,
      writable: !0,
      configurable: !0
    }
  }), Object.defineProperty(e, "prototype", {
    writable: !1
  }), t && G(e, t);
}
function G(e, t) {
  return G = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, r) {
    return o.__proto__ = r, o;
  }, G(e, t);
}
function Je(e) {
  var t = Ye();
  return function() {
    var o = V(e), r;
    if (t) {
      var n = V(this).constructor;
      r = Reflect.construct(o, arguments, n);
    } else r = o.apply(this, arguments);
    return Ke(this, r);
  };
}
function Ke(e, t) {
  if (t && (q(t) === "object" || typeof t == "function")) return t;
  if (t !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
  return M(e);
}
function M(e) {
  if (e === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e;
}
function Ye() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
  if (typeof Proxy == "function") return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), !0;
  } catch {
    return !1;
  }
}
function V(e) {
  return V = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
    return t.__proto__ || Object.getPrototypeOf(t);
  }, V(e);
}
function $(e, t, o) {
  return t in e ? Object.defineProperty(e, t, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = o, e;
}
function Qe(e) {
  return e === "top" || e === "left";
}
function Ze(e) {
  return e === "bottom" || e === "right";
}
var et = function(e) {
  return e.stopPropagation();
}, ce = /* @__PURE__ */ (function(e) {
  Xe(o, e);
  var t = Je(o);
  function o() {
    var r;
    qe(this, o);
    for (var n = arguments.length, i = new Array(n), a = 0; a < n; a++) i[a] = arguments[a];
    return r = t.call.apply(t, [this].concat(i)), $(M(r), "state", {
      isActive: !1,
      isHovered: !1
    }), $(M(r), "onMouseEnter", function(s) {
      r.setState({
        isHovered: !0
      }), r.props.onMouseEnter && r.props.onMouseEnter(s);
    }), $(M(r), "onMouseLeave", function(s) {
      r.setState({
        isHovered: !1
      }), r.props.onMouseLeave && r.props.onMouseLeave(s);
    }), $(M(r), "onMouseDown", function(s) {
      r.setState({
        isActive: !0
      }), r.props.onMouseDown && r.props.onMouseDown(s);
    }), $(M(r), "onMouseUp", function(s) {
      r.setState({
        isActive: !1
      }), r.props.onMouseUp && r.props.onMouseUp(s);
    }), r;
  }
  return We(o, [{
    key: "componentDidMount",
    value: function() {
      var r;
      this.props.autoFocus && (r = this.props.inputRef) !== null && r !== void 0 && r.current && this.props.inputRef.current.focus();
    }
  }, {
    key: "render",
    value: function() {
      var r = this.props.overrides, n = r === void 0 ? {} : r, i = w(n.Root, X), a = S(i, 2), s = a[0], c = a[1], d = w(n.Label, Y), p = S(d, 2), b = p[0], l = p[1], f = w(n.Input, Q), F = S(f, 2), z = F[0], k = F[1], H = w(n.Description, Z), P = S(H, 2), L = P[0], g = P[1], y = w(n.RadioMarkInner, J), h = S(y, 2), pe = h[0], fe = h[1], de = w(n.RadioMarkOuter, K), ee = S(de, 2), be = ee[0], he = ee[1], j = {
        $align: this.props.align,
        $checked: this.props.checked,
        $disabled: this.props.disabled,
        $hasDescription: !!this.props.description,
        $isActive: this.state.isActive,
        $error: this.props.error,
        $isFocused: this.props.isFocused,
        $isFocusVisible: this.props.isFocused && this.props.isFocusVisible,
        $isHovered: this.state.isHovered,
        $labelPlacement: this.props.labelPlacement,
        $required: this.props.required,
        $value: this.props.value
      }, te = /* @__PURE__ */ u.createElement(b, v({}, j, l), this.props.containsInteractiveElement ? (
        // Prevents the event from bubbling up to the label and moving focus to the radio button
        // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
        /* @__PURE__ */ u.createElement("div", {
          onClick: function(me) {
            return me.preventDefault();
          }
        }, this.props.children)
      ) : this.props.children);
      return /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement(s, v({
        "data-baseweb": "radio",
        onMouseEnter: this.onMouseEnter,
        onMouseLeave: this.onMouseLeave,
        onMouseDown: this.onMouseDown,
        onMouseUp: this.onMouseUp
      }, j, c), Qe(this.props.labelPlacement) && te, /* @__PURE__ */ u.createElement(be, v({}, j, he), /* @__PURE__ */ u.createElement(pe, v({}, j, fe))), /* @__PURE__ */ u.createElement(z, v({
        "aria-invalid": this.props.error || null,
        checked: this.props.checked,
        disabled: this.props.disabled,
        name: this.props.name,
        onBlur: this.props.onBlur,
        onFocus: this.props.onFocus,
        onClick: et,
        onChange: this.props.onChange,
        ref: this.props.inputRef,
        required: this.props.required,
        tabIndex: this.props.tabIndex,
        type: "radio",
        value: this.props.value
      }, j, k)), Ze(this.props.labelPlacement) && te), !!this.props.description && /* @__PURE__ */ u.createElement(L, v({}, j, g), this.props.description));
    }
  }]), o;
})(u.Component);
$(ce, "defaultProps", {
  overrides: {},
  containsInteractiveElement: !1,
  checked: !1,
  disabled: !1,
  autoFocus: !1,
  inputRef: /* @__PURE__ */ u.createRef(),
  align: "vertical",
  error: !1,
  onChange: function() {
  },
  onMouseEnter: function() {
  },
  onMouseLeave: function() {
  },
  onMouseDown: function() {
  },
  onMouseUp: function() {
  },
  onFocus: function() {
  },
  onBlur: function() {
  }
});
function tt(e) {
  const t = parseFloat(e.sizes.checkbox), o = parseFloat(e.spacing.threeXS), r = oe(t.toString()), n = Math.round(r * 0.375);
  let i = Math.round(oe((t - o).toString()));
  return i >= r && (i -= 1), [ne(n, "px"), ne(i, "px")];
}
function rt({
  disabled: e,
  horizontal: t,
  value: o,
  onChange: r,
  options: n,
  captions: i,
  label: a,
  labelVisibility: s,
  help: c
}) {
  const [d, p] = u.useState(o ?? null);
  u.useEffect(() => {
    o !== d && p(o ?? null);
  }, [o]);
  const b = u.useCallback((g) => {
    const y = parseInt(g.target.value, 10);
    p(y), r(y);
  }, [r]), l = ye(), f = i.length > 0, F = n.length > 0, z = F ? n : ["No options to select."], k = e || !F, H = (g) => g == "" && t && f ? "&nbsp;" : g, [P, L] = tt(l);
  return /* @__PURE__ */ m.jsxs("div", {
    className: "stRadio",
    "data-testid": "stRadio",
    children: [/* @__PURE__ */ m.jsx(ve, {
      label: a,
      disabled: k,
      labelVisibility: s,
      children: c && /* @__PURE__ */ m.jsx(we, {
        children: /* @__PURE__ */ m.jsx(Oe, {
          content: c,
          placement: Re.TOP_RIGHT
        })
      })
    }), /* @__PURE__ */ m.jsx(ue, {
      onChange: b,
      value: d !== null ? d.toString() : void 0,
      disabled: k,
      align: t ? ie.horizontal : ie.vertical,
      "aria-label": a,
      "data-testid": "stRadioGroup",
      overrides: {
        RadioGroupRoot: {
          style: {
            gap: f ? l.spacing.sm : l.spacing.none,
            minHeight: l.sizes.minElementHeight
          }
        }
      },
      children: z.map((g, y) => /* @__PURE__ */ m.jsxs(ce, {
        value: y.toString(),
        overrides: {
          Root: {
            style: ({
              $isFocusVisible: h
            }) => ({
              marginBottom: l.spacing.none,
              marginTop: l.spacing.none,
              marginRight: f ? l.spacing.sm : l.spacing.lg,
              // Make left and right padding look the same visually.
              paddingLeft: l.spacing.none,
              alignItems: "start",
              paddingRight: l.spacing.threeXS,
              backgroundColor: h ? l.colors.darkenedBgMix25 : ""
            })
          },
          RadioMarkOuter: {
            style: ({
              $checked: h
            }) => ({
              width: l.sizes.checkbox,
              height: l.sizes.checkbox,
              // The margin top is needed to align the radio buttons
              // with the text label baseline.
              // The text label has a line-height of 1.6
              // making the font height around 1.6rem
              // while the radio icon has a height of 1rem.
              //eslint-disable-next-line streamlit-custom/no-hardcoded-theme-values
              marginTop: "0.35rem",
              marginRight: l.spacing.none,
              marginLeft: l.spacing.none,
              backgroundColor: h && !k ? l.colors.primary : l.colors.fadedText40
            })
          },
          RadioMarkInner: {
            style: ({
              $checked: h
            }) => ({
              height: h ? P : L,
              width: h ? P : L
            })
          },
          Label: {
            style: {
              color: k ? l.colors.fadedText40 : l.colors.bodyText,
              position: "relative",
              top: l.spacing.px
            }
          }
        },
        children: [/* @__PURE__ */ m.jsx(re, {
          source: g,
          allowHTML: !1,
          isLabel: !0,
          largerLabel: !0
        }), f && /* @__PURE__ */ m.jsx(re, {
          source: H(i[y]),
          allowHTML: !1,
          isCaption: !0,
          isLabel: !0
        })]
      }, y))
    })]
  });
}
const ot = u.memo(rt);
function nt({
  disabled: e,
  element: t,
  widgetMgr: o,
  fragmentId: r
}) {
  const [n, i] = je({
    getStateFromWidgetMgr: it,
    getDefaultStateFromProto: at,
    getCurrStateFromProto: st,
    updateWidgetMgrState: lt,
    element: t,
    widgetMgr: o,
    fragmentId: r
  }), a = u.useCallback((f) => {
    i({
      value: f,
      fromUi: !0
    });
  }, [i]), {
    horizontal: s,
    options: c,
    captions: d,
    label: p,
    labelVisibility: b,
    help: l
  } = t;
  return /* @__PURE__ */ m.jsx(ot, {
    label: p,
    onChange: a,
    options: c,
    captions: d,
    disabled: e,
    horizontal: s,
    labelVisibility: ge(b?.value),
    value: n ?? null,
    help: l
  });
}
function it(e, t) {
  return e.getIntValue(t);
}
function at(e) {
  return e.default ?? null;
}
function st(e) {
  return e.value ?? null;
}
function lt(e, t, o, r) {
  t.setIntValue(e, o.value ?? null, {
    fromUi: o.fromUi
  }, r);
}
const pt = u.memo(nt);
export {
  pt as default
};
//# sourceMappingURL=index-vYM99bZC-B-G9-n-G.js.map
