"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const RadioGroup = require("../radio-group/RadioGroup.js");
const index_esm = require("../../../@vant/use/dist/index.esm.js");
const Checker = require("../checkbox/Checker.js");
const basic = require("../utils/basic.js");
const create = require("../utils/create.js");
const radioProps = basic.extend({}, Checker.checkerProps, {
  shape: String
});
const [name, bem] = create.createNamespace("radio");
var stdin_default = Vue.defineComponent({
  name,
  props: radioProps,
  emits: ["update:modelValue"],
  setup(props, {
    emit,
    slots
  }) {
    const {
      parent
    } = index_esm.useParent(RadioGroup.RADIO_KEY);
    const checked = () => {
      const value = parent ? parent.props.modelValue : props.modelValue;
      return value === props.name;
    };
    const toggle = () => {
      if (parent) {
        parent.updateValue(props.name);
      } else {
        emit("update:modelValue", props.name);
      }
    };
    return () => Vue.createVNode(Checker.default, Vue.mergeProps({
      "bem": bem,
      "role": "radio",
      "parent": parent,
      "checked": checked(),
      "onToggle": toggle
    }, props), basic.pick(slots, ["default", "icon"]));
  }
});
exports.default = stdin_default;
exports.radioProps = radioProps;
