"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),R=require("../_util/classNames.js"),G=require("../_util/omit.js"),t=require("../_util/type.js"),N=require("../_util/vue-types/index.js"),v=require("../config-provider/DisabledContext.js"),O=require("../config-provider/hooks/useConfigInject.js"),b=require("../form/FormItemContext.js"),U=require("../vc-checkbox/Checkbox.js"),h=require("./context.js"),M=require("./style/index.js"),m=()=>({prefixCls:String,checked:t.booleanType(),disabled:t.booleanType(),isGroup:t.booleanType(),value:N.default.any,name:String,id:String,autofocus:t.booleanType(),onChange:t.functionType(),onFocus:t.functionType(),onBlur:t.functionType(),onClick:t.functionType(),"onUpdate:checked":t.functionType(),"onUpdate:value":t.functionType()}),V=n.defineComponent({compatConfig:{MODE:3},name:"ARadio",inheritAttrs:!1,props:m(),setup(c,{emit:r,expose:x,slots:d,attrs:p}){const f=b.useInjectFormItemContext(),g=b.FormItemInputContext.useInject(),y=h.useInjectRadioOptionTypeContext(),u=h.useInjectRadioGroupContext(),I=v.useInjectDisabled(),T=n.computed(()=>C.value??I.value),s=n.ref(),{prefixCls:l,direction:k,disabled:C}=O.default("radio",c),a=n.computed(()=>u?.optionType.value==="button"||y==="button"?`${l.value}-button`:l.value),q=v.useInjectDisabled(),[j,S]=M.default(l);x({focus:()=>{s.value.focus()},blur:()=>{s.value.blur()}});const w=e=>{const i=e.target.checked;r("update:checked",i),r("update:value",i),r("change",e),f.onFieldChange()},P=e=>{r("change",e),u&&u.onChange&&u.onChange(e)};return()=>{const e=u,{prefixCls:i,id:$=f.id.value,...D}=c,o={prefixCls:a.value,id:$,...G.default(D,["onUpdate:checked","onUpdate:value"]),disabled:C.value??q.value};e?(o.name=e.name.value,o.onChange=P,o.checked=c.value===e.value.value,o.disabled=T.value||e.disabled.value):o.onChange=w;const F=R.default({[`${a.value}-wrapper`]:!0,[`${a.value}-wrapper-checked`]:o.checked,[`${a.value}-wrapper-disabled`]:o.disabled,[`${a.value}-wrapper-rtl`]:k.value==="rtl",[`${a.value}-wrapper-in-form-item`]:g.isFormItemInput},p.class,S.value);return j(n.createVNode("label",{...p,class:F},[n.createVNode(U.default,{...o,type:"radio",ref:s},null),d.default&&n.createVNode("span",null,[d.default()])]))}}});exports.default=V;exports.radioProps=m;
