import{n as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,Ht as n,J as r,g as i,gt as a,k as o,tt as s,vn as c}from"./runtime-core.esm-bundler-DkysjgTd.js";import{r as l}from"./en_US-Cv9hrLhb.js";import{F as u,G as d,Tt as f,W as p,X as m,f as h,l as g,m as _,q as v,t as y,u as b,vt as x}from"./useConfigInject-z_xeO0pP.js";import{t as S}from"./Keyframes-K60KFfv3.js";import{t as C}from"./omit-C0ksMpVM.js";import{t as w}from"./vue-types-CFReUAWV.js";import{i as T,n as E}from"./FormItemContext-CEmO5XmM.js";import{t as D}from"./Checkbox-CaX94bng.js";var O=Symbol(`radioGroupContextKey`),k=e=>{a(O,e)},A=()=>r(O,void 0),j=Symbol(`radioOptionTypeContextKey`),M=e=>{a(j,e)},N=()=>r(j,void 0),P=new S(`antRadioEffect`,{"0%":{transform:`scale(1)`,opacity:.5},"100%":{transform:`scale(1.6)`,opacity:0}}),F=e=>{let{componentCls:t,antCls:n}=e,r=`${t}-group`;return{[r]:l(l({},_(e)),{display:`inline-block`,fontSize:0,[`&${r}-rtl`]:{direction:`rtl`},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:`none`}})}},I=e=>{let{componentCls:t,radioWrapperMarginRight:n,radioCheckedColor:r,radioSize:i,motionDurationSlow:a,motionDurationMid:o,motionEaseInOut:s,motionEaseInOutCirc:c,radioButtonBg:u,colorBorder:d,lineWidth:f,radioDotSize:p,colorBgContainerDisabled:m,colorTextDisabled:g,paddingXS:v,radioDotDisabledColor:y,lineType:b,radioDotDisabledSize:x,wireframe:S,colorWhite:C}=e,w=`${t}-inner`;return{[`${t}-wrapper`]:l(l({},_(e)),{position:`relative`,display:`inline-flex`,alignItems:`baseline`,marginInlineStart:0,marginInlineEnd:n,cursor:`pointer`,[`&${t}-wrapper-rtl`]:{direction:`rtl`},"&-disabled":{cursor:`not-allowed`,color:e.colorTextDisabled},"&::after":{display:`inline-block`,width:0,overflow:`hidden`,content:`"\\a0"`},[`${t}-checked::after`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,width:`100%`,height:`100%`,border:`${f}px ${b} ${r}`,borderRadius:`50%`,visibility:`hidden`,animationName:P,animationDuration:a,animationTimingFunction:s,animationFillMode:`both`,content:`""`},[t]:l(l({},_(e)),{position:`relative`,display:`inline-block`,outline:`none`,cursor:`pointer`,alignSelf:`center`}),[`${t}-wrapper:hover &, &:hover ${w}`]:{borderColor:r},[`${t}-input:focus-visible + ${w}`]:l({},h(e)),[`${t}:hover::after, ${t}-wrapper:hover &::after`]:{visibility:`visible`},[`${t}-inner`]:{"&::after":{boxSizing:`border-box`,position:`absolute`,insetBlockStart:`50%`,insetInlineStart:`50%`,display:`block`,width:i,height:i,marginBlockStart:i/-2,marginInlineStart:i/-2,backgroundColor:S?r:C,borderBlockStart:0,borderInlineStart:0,borderRadius:i,transform:`scale(0)`,opacity:0,transition:`all ${a} ${c}`,content:`""`},boxSizing:`border-box`,position:`relative`,insetBlockStart:0,insetInlineStart:0,display:`block`,width:i,height:i,backgroundColor:u,borderColor:d,borderStyle:`solid`,borderWidth:f,borderRadius:`50%`,transition:`all ${o}`},[`${t}-input`]:{position:`absolute`,insetBlockStart:0,insetInlineEnd:0,insetBlockEnd:0,insetInlineStart:0,zIndex:1,cursor:`pointer`,opacity:0},[`${t}-checked`]:{[w]:{borderColor:r,backgroundColor:S?u:r,"&::after":{transform:`scale(${p/i})`,opacity:1,transition:`all ${a} ${c}`}}},[`${t}-disabled`]:{cursor:`not-allowed`,[w]:{backgroundColor:m,borderColor:d,cursor:`not-allowed`,"&::after":{backgroundColor:y}},[`${t}-input`]:{cursor:`not-allowed`},[`${t}-disabled + span`]:{color:g,cursor:`not-allowed`},[`&${t}-checked`]:{[w]:{"&::after":{transform:`scale(${x/i})`}}}},[`span${t} + *`]:{paddingInlineStart:v,paddingInlineEnd:v}})}},L=e=>{let{radioButtonColor:t,controlHeight:n,componentCls:r,lineWidth:i,lineType:a,colorBorder:o,motionDurationSlow:s,motionDurationMid:c,radioButtonPaddingHorizontal:u,fontSize:d,radioButtonBg:f,fontSizeLG:p,controlHeightLG:m,controlHeightSM:g,paddingXS:_,borderRadius:v,borderRadiusSM:y,borderRadiusLG:b,radioCheckedColor:x,radioButtonCheckedBg:S,radioButtonHoverColor:C,radioButtonActiveColor:w,radioSolidCheckedColor:T,colorTextDisabled:E,colorBgContainerDisabled:D,radioDisabledButtonCheckedColor:O,radioDisabledButtonCheckedBg:k}=e;return{[`${r}-button-wrapper`]:{position:`relative`,display:`inline-block`,height:n,margin:0,paddingInline:u,paddingBlock:0,color:t,fontSize:d,lineHeight:`${n-i*2}px`,background:f,border:`${i}px ${a} ${o}`,borderBlockStartWidth:i+.02,borderInlineStartWidth:0,borderInlineEndWidth:i,cursor:`pointer`,transition:[`color ${c}`,`background ${c}`,`border-color ${c}`,`box-shadow ${c}`].join(`,`),a:{color:t},[`> ${r}-button`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:`100%`,height:`100%`},"&:not(:first-child)":{"&::before":{position:`absolute`,insetBlockStart:-i,insetInlineStart:-i,display:`block`,boxSizing:`content-box`,width:1,height:`100%`,paddingBlock:i,paddingInline:0,backgroundColor:o,transition:`background-color ${s}`,content:`""`}},"&:first-child":{borderInlineStart:`${i}px ${a} ${o}`,borderStartStartRadius:v,borderEndStartRadius:v},"&:last-child":{borderStartEndRadius:v,borderEndEndRadius:v},"&:first-child:last-child":{borderRadius:v},[`${r}-group-large &`]:{height:m,fontSize:p,lineHeight:`${m-i*2}px`,"&:first-child":{borderStartStartRadius:b,borderEndStartRadius:b},"&:last-child":{borderStartEndRadius:b,borderEndEndRadius:b}},[`${r}-group-small &`]:{height:g,paddingInline:_-i,paddingBlock:0,lineHeight:`${g-i*2}px`,"&:first-child":{borderStartStartRadius:y,borderEndStartRadius:y},"&:last-child":{borderStartEndRadius:y,borderEndEndRadius:y}},"&:hover":{position:`relative`,color:x},"&:has(:focus-visible)":l({},h(e)),[`${r}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:`none`},[`&-checked:not(${r}-button-wrapper-disabled)`]:{zIndex:1,color:x,background:S,borderColor:x,"&::before":{backgroundColor:x},"&:first-child":{borderColor:x},"&:hover":{color:C,borderColor:C,"&::before":{backgroundColor:C}},"&:active":{color:w,borderColor:w,"&::before":{backgroundColor:w}}},[`${r}-group-solid &-checked:not(${r}-button-wrapper-disabled)`]:{color:T,background:x,borderColor:x,"&:hover":{color:T,background:C,borderColor:C},"&:active":{color:T,background:w,borderColor:w}},"&-disabled":{color:E,backgroundColor:D,borderColor:o,cursor:`not-allowed`,"&:first-child, &:hover":{color:E,backgroundColor:D,borderColor:o}},[`&-disabled${r}-button-wrapper-checked`]:{color:O,backgroundColor:k,borderColor:o,boxShadow:`none`}}}},R=b(`Radio`,e=>{let{padding:t,lineWidth:n,controlItemBgActiveDisabled:r,colorTextDisabled:i,colorBgContainer:a,fontSizeLG:o,controlOutline:s,colorPrimaryHover:c,colorPrimaryActive:l,colorText:u,colorPrimary:d,marginXS:f,controlOutlineWidth:p,colorTextLightSolid:m,wireframe:h}=e,_=`0 0 0 ${p}px ${s}`,v=_,y=o,b=y-8,x=h?b:y-(4+n)*2,S=d,C=u,w=c,T=l,E=t-n,D=g(e,{radioFocusShadow:_,radioButtonFocusShadow:v,radioSize:y,radioDotSize:x,radioDotDisabledSize:b,radioCheckedColor:S,radioDotDisabledColor:i,radioSolidCheckedColor:m,radioButtonBg:a,radioButtonCheckedBg:a,radioButtonColor:C,radioButtonHoverColor:w,radioButtonActiveColor:T,radioButtonPaddingHorizontal:E,radioDisabledButtonCheckedBg:r,radioDisabledButtonCheckedColor:i,radioWrapperMarginRight:f});return[F(D),I(D),L(D)]}),z=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i({prefixCls:String,checked:d(),disabled:d(),isGroup:d(),value:w.any,name:String,id:String,autofocus:d(),onChange:v(),onFocus:v(),onBlur:v(),onClick:v(),"onUpdate:checked":v(),"onUpdate:value":v()}),V=o({compatConfig:{MODE:3},name:`ARadio`,inheritAttrs:!1,props:B(),setup(e,n){let{emit:r,expose:a,slots:o,attrs:s}=n,d=T(),p=E.useInject(),m=N(),h=A(),g=u(),_=i(()=>{var e;return(e=w.value)==null?g.value:e}),v=c(),{prefixCls:b,direction:S,disabled:w}=y(`radio`,e),O=i(()=>(h==null?void 0:h.optionType.value)===`button`||m===`button`?`${b.value}-button`:b.value),k=u(),[j,M]=R(b);a({focus:()=>{v.value.focus()},blur:()=>{v.value.blur()}});let P=e=>{let t=e.target.checked;r(`update:checked`,t),r(`update:value`,t),r(`change`,e),d.onFieldChange()},F=e=>{r(`change`,e),h&&h.onChange&&h.onChange(e)};return()=>{var n;let r=h,{prefixCls:i,id:a=d.id.value}=e,c=z(e,[`prefixCls`,`id`]),u=l(l({prefixCls:O.value,id:a},C(c,[`onUpdate:checked`,`onUpdate:value`])),{disabled:(n=w.value)==null?k.value:n});r?(u.name=r.name.value,u.onChange=F,u.checked=e.value===r.value.value,u.disabled=_.value||r.disabled.value):u.onChange=P;let m=x({[`${O.value}-wrapper`]:!0,[`${O.value}-wrapper-checked`]:u.checked,[`${O.value}-wrapper-disabled`]:u.disabled,[`${O.value}-wrapper-rtl`]:S.value===`rtl`,[`${O.value}-wrapper-in-form-item`]:p.isFormItemInput},s.class,M.value);return j(t(`label`,f(f({},s),{},{class:m}),[t(D,f(f({},u),{},{type:`radio`,ref:v}),null),o.default&&t(`span`,null,[o.default()])]))}}}),H=o({compatConfig:{MODE:3},name:`ARadioGroup`,inheritAttrs:!1,props:{prefixCls:String,value:w.any,size:m(),options:p(),disabled:d(),name:String,buttonStyle:m(`outline`),id:String,optionType:m(`default`),onChange:v(),"onUpdate:value":v()},setup(e,r){let{slots:a,emit:o,attrs:l}=r,u=T(),{prefixCls:d,direction:p,size:m}=y(`radio`,e),[h,g]=R(d),_=c(e.value),v=c(!1);return n(()=>e.value,e=>{_.value=e,v.value=!1}),k({onChange:t=>{let n=_.value,{value:r}=t.target;`value`in e||(_.value=r),!v.value&&r!==n&&(v.value=!0,o(`update:value`,r),o(`change`,t),u.onFieldChange()),s(()=>{v.value=!1})},value:_,disabled:i(()=>e.disabled),name:i(()=>e.name),optionType:i(()=>e.optionType)}),()=>{var n;let{options:r,buttonStyle:i,id:o=u.id.value}=e,s=`${d.value}-group`,c=x(s,`${s}-${i}`,{[`${s}-${m.value}`]:m.value,[`${s}-rtl`]:p.value===`rtl`},l.class,g.value),v=null;return v=r&&r.length>0?r.map(n=>{if(typeof n==`string`||typeof n==`number`)return t(V,{key:n,prefixCls:d.value,disabled:e.disabled,value:n,checked:_.value===n},{default:()=>[n]});let{value:r,disabled:i,label:a}=n;return t(V,{key:`radio-group-value-options-${r}`,prefixCls:d.value,disabled:i||e.disabled,value:r,checked:_.value===r},{default:()=>[a]})}):(n=a.default)==null?void 0:n.call(a),h(t(`div`,f(f({},l),{},{class:c,id:o}),[v]))}}}),U=o({compatConfig:{MODE:3},name:`ARadioButton`,inheritAttrs:!1,props:B(),setup(e,n){let{slots:r,attrs:i}=n,{prefixCls:a}=y(`radio`,e);return M(`button`),()=>{var n;return t(V,f(f(f({},i),e),{},{prefixCls:a.value}),{default:()=>[(n=r.default)==null?void 0:n.call(r)]})}}}),W=e({Button:()=>U,Group:()=>H,RadioButton:()=>U,RadioGroup:()=>H,default:()=>G});V.Group=H,V.Button=U,V.install=function(e){return e.component(V.name,V),e.component(V.Group.name,V.Group),e.component(V.Button.name,V.Button),e};var G=V;export{W as n,G as t};