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