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