"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const event = require("../../../constants/event.js");
const index = require("../../../hooks/use-namespace/index.js");
const radio = require("./radio.js");
const useRadio = require("./use-radio.js");
const Vue = require("vue");
const _hoisted_1 = [
  "value",
  "name",
  "disabled",
  "checked"
];
var radio_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElRadio",
  __name: "radio",
  props: radio.radioProps,
  emits: radio.radioEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const ns = index.useNamespace("radio");
    const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio.useRadio(props, emit);
    function handleChange() {
      Vue.nextTick(() => emit(event.CHANGE_EVENT, modelValue.value));
    }
    return (_ctx, _cache) => {
      var _a;
      return Vue.openBlock(), Vue.createElementBlock("label", { class: Vue.normalizeClass([
        Vue.unref(ns).b(),
        Vue.unref(ns).is("disabled", Vue.unref(disabled)),
        Vue.unref(ns).is("focus", Vue.unref(focus)),
        Vue.unref(ns).is("bordered", __props.border),
        Vue.unref(ns).is("checked", Vue.unref(modelValue) === Vue.unref(actualValue)),
        Vue.unref(ns).m(Vue.unref(size))
      ]) }, [Vue.createElementVNode("span", { class: Vue.normalizeClass([
        Vue.unref(ns).e("input"),
        Vue.unref(ns).is("disabled", Vue.unref(disabled)),
        Vue.unref(ns).is("checked", Vue.unref(modelValue) === Vue.unref(actualValue))
      ]) }, [Vue.withDirectives(Vue.createElementVNode("input", {
        ref_key: "radioRef",
        ref: radioRef,
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.isRef(modelValue) ? modelValue.value = $event : null),
        class: Vue.normalizeClass(Vue.unref(ns).e("original")),
        value: Vue.unref(actualValue),
        name: __props.name || ((_a = Vue.unref(radioGroup)) == null ? void 0 : _a.name),
        disabled: Vue.unref(disabled),
        checked: Vue.unref(modelValue) === Vue.unref(actualValue),
        type: "radio",
        onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
        onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
        onChange: handleChange,
        onClick: _cache[3] || (_cache[3] = Vue.withModifiers(() => {
        }, ["stop"]))
      }, null, 42, _hoisted_1), [[Vue.vModelRadio, Vue.unref(modelValue)]]), Vue.createElementVNode("span", { class: Vue.normalizeClass(Vue.unref(ns).e("inner")) }, null, 2)], 2), Vue.createElementVNode("span", {
        class: Vue.normalizeClass(Vue.unref(ns).e("label")),
        onKeydown: _cache[4] || (_cache[4] = Vue.withModifiers(() => {
        }, ["stop"]))
      }, [Vue.renderSlot(_ctx.$slots, "default", {}, () => [Vue.createTextVNode(Vue.toDisplayString(__props.label), 1)])], 34)], 2);
    };
  }
});
exports.default = radio_vue_vue_type_script_setup_true_lang_default;
