import{g as K,f as Q,r as V,D as F,j as b,E as W,d as X,s as k,G as Y,S as Z}from"./render-D1ZqzUbP.js";import{u as _,d as ee}from"./formControlState-C1XOL3mQ.js";function oe(t){return K("PrivateSwitchBase",t)}Q("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const te=t=>{const{classes:s,checked:l,disabled:d,edge:n}=t,c={root:["root",l&&"checked",d&&"disabled",n&&`edge${W(n)}`],input:["input"]};return X(c,oe,s)},se=k(Y,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:t,ownerState:s})=>t==="start"&&s.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:t,ownerState:s})=>t==="end"&&s.size!=="small",style:{marginRight:-12}}]}),ae=k("input",{name:"MuiSwitchBase",shouldForwardProp:Z})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),ie=V.forwardRef(function(s,l){const{autoFocus:d,checked:n,checkedIcon:c,defaultChecked:u,disabled:y,disableFocusRipple:h=!1,edge:x=!1,icon:R,id:I,inputProps:z,inputRef:E,name:j,onBlur:f,onChange:g,onFocus:m,readOnly:S,required:U=!1,tabIndex:v,type:r,value:w,slots:L={},slotProps:M={},...N}=s,[B,T]=_({controlled:n,default:!!u,name:"SwitchBase",state:"checked"}),a=ee(),q=e=>{m&&m(e),a&&a.onFocus&&a.onFocus(e)},D=e=>{f&&f(e),a&&a.onBlur&&a.onBlur(e)},G=e=>{if(e.nativeEvent.defaultPrevented||S)return;const o=e.target.checked;T(o),g&&g(e,o)};let i=y;a&&typeof i>"u"&&(i=a.disabled);const O=r==="checkbox"||r==="radio",p={...s,checked:B,disabled:i,disableFocusRipple:h,edge:x},P=te(p),C={slots:L,slotProps:{input:z,...M}},[$,A]=F("root",{ref:l,elementType:se,className:P.root,shouldForwardComponentProp:!0,externalForwardedProps:{...C,component:"span",...N},getSlotProps:e=>({...e,onFocus:o=>{e.onFocus?.(o),q(o)},onBlur:o=>{e.onBlur?.(o),D(o)}}),ownerState:p,additionalProps:{centerRipple:!0,focusRipple:!h,role:void 0,tabIndex:null}}),[H,J]=F("input",{ref:E,elementType:ae,className:P.input,externalForwardedProps:C,getSlotProps:e=>({...e,onChange:o=>{e.onChange?.(o),G(o)}}),ownerState:p,additionalProps:{autoFocus:d,checked:n,defaultChecked:u,disabled:i,id:O?I:void 0,name:j,readOnly:S,required:U,tabIndex:v,type:r,...r==="checkbox"&&w===void 0?{}:{value:w}}});return b.jsxs($,{...A,children:[b.jsx(H,{...J}),B?c:R]})});export{ie as S};
//# sourceMappingURL=SwitchBase-BdpsuNf_.js.map
