import{a as e,n as t}from"./preload-helper-DxX6f4wy.js";import{$ as n,E as r,F as i,I as a,P as o,d as s,g as c,h as l}from"./Fade-Bj1YUcWe.js";import{c as u,s as d}from"./InputBase-Twl1xf9g.js";import{n as f}from"./useFormControl-DzT-9k0o.js";var p=e(t());function m(e,t){return p.isValidElement(e)&&t.indexOf(e.type.muiName??e.type?._payload?.value?.muiName)!==-1}var h=m;function g(e){return i(`MuiFormControl`,e)}o(`MuiFormControl`,[`root`,`marginNone`,`marginNormal`,`marginDense`,`fullWidth`,`disabled`]);var _=n(),v=e=>{let{classes:t,margin:n,fullWidth:i}=e;return r({root:[`root`,n!==`none`&&`margin${l(n)}`,i&&`fullWidth`]},g,t)},y=c(`div`,{name:`MuiFormControl`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`margin${l(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:`inline-flex`,flexDirection:`column`,position:`relative`,minWidth:0,padding:0,margin:0,border:0,verticalAlign:`top`,variants:[{props:{margin:`normal`},style:{marginTop:16,marginBottom:8}},{props:{margin:`dense`},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:`100%`}}]}),b=p.forwardRef(function(e,t){let n=s({props:e,name:`MuiFormControl`}),{children:r,className:i,color:o=`primary`,component:c=`div`,disabled:l=!1,error:m=!1,focused:g,fullWidth:b=!1,hiddenLabel:x=!1,margin:S=`none`,required:C=!1,size:w=`medium`,variant:T=`outlined`,...E}=n,D={...n,color:o,component:c,disabled:l,error:m,fullWidth:b,hiddenLabel:x,margin:S,required:C,size:w,variant:T},O=v(D),[k,A]=p.useState(()=>{let e=!1;return r&&p.Children.forEach(r,t=>{if(!h(t,[`Input`,`Select`]))return;let n=h(t,[`Select`])?t.props.input:t;n&&d(n.props)&&(e=!0)}),e}),[j,M]=p.useState(()=>{let e=!1;return r&&p.Children.forEach(r,t=>{h(t,[`Input`,`Select`])&&(u(t.props,!0)||u(t.props.inputProps,!0))&&(e=!0)}),e}),[N,P]=p.useState(!1);l&&N&&P(!1);let F=g!==void 0&&!l?g:N;p.useRef(!1);let I=p.useCallback(()=>{M(!0)},[]),L=p.useCallback(()=>{M(!1)},[]),R=p.useMemo(()=>({adornedStart:k,setAdornedStart:A,color:o,disabled:l,error:m,filled:j,focused:F,fullWidth:b,hiddenLabel:x,size:w,onBlur:()=>{P(!1)},onFocus:()=>{P(!0)},onEmpty:L,onFilled:I,registerEffect:void 0,required:C,variant:T}),[k,o,l,m,j,F,b,x,void 0,L,I,C,w,T]);return(0,_.jsx)(f.Provider,{value:R,children:(0,_.jsx)(y,{as:c,ownerState:D,className:a(O.root,i),ref:t,...E,children:r})})});export{b as t};