import{m as x,n as C,f as M,r as u,t as S,j as d,v as F,w as v,c$ as U}from"./index-c121b02d.js";import{a as j}from"./Radio-6ba053f5.js";import{a as N,f as P,u as $}from"./Grow-9a484472.js";import{u as D}from"./Select-dd7adaf8.js";function V(o){return x("MuiFormGroup",o)}C("MuiFormGroup",["root","row","error"]);const b=o=>{const{classes:r,row:e,error:t}=o;return v({root:["root",e&&"row",t&&"error"]},V,r)},k=M("div",{name:"MuiFormGroup",slot:"Root",overridesResolver:(o,r)=>{const{ownerState:e}=o;return[r.root,e.row&&r.row]}})({display:"flex",flexDirection:"column",flexWrap:"wrap",variants:[{props:{row:!0},style:{flexDirection:"row"}}]}),q=u.forwardRef(function(r,e){const t=S({props:r,name:"MuiFormGroup"}),{className:a,row:c=!1,...i}=t,p=N(),n=P({props:t,muiFormControl:p,states:["error"]}),l={...t,row:c,error:n.error},m=b(l);return d.jsx(k,{className:F(m.root,a),ownerState:l,ref:e,...i})}),E=q;function I(o){return x("MuiRadioGroup",o)}C("MuiRadioGroup",["root","row","error"]);const H=o=>{const{classes:r,row:e,error:t}=o;return v({root:["root",e&&"row",t&&"error"]},I,r)},W=u.forwardRef(function(r,e){const{actions:t,children:a,className:c,defaultValue:i,name:p,onChange:n,value:l,...m}=r,f=u.useRef(null),y=H(r),[R,w]=$({controlled:l,default:i,name:"RadioGroup"});u.useImperativeHandle(t,()=>({focus:()=>{let s=f.current.querySelector("input:not(:disabled):checked");s||(s=f.current.querySelector("input:not(:disabled)")),s&&s.focus()}}),[]);const g=U(e,f),G=D(p),h=u.useMemo(()=>({name:G,onChange(s){w(s.target.value),n&&n(s,s.target.value)},value:R}),[G,n,w,R]);return d.jsx(j.Provider,{value:h,children:d.jsx(E,{role:"radiogroup",ref:g,className:F(y.root,c),...m,children:a})})}),K=W;export{K as R};
