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-5ae5cc5e.js";import{a as j}from"./Radio-d3cc3961.js";import{a as N,f as P,u as $}from"./Grow-d70e9b6d.js";import{u as D}from"./Select-6f375e89.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};
