import{a3 as $,a4 as S,r as x,al as y,am as f,ao as l,j as n,aq as m,ar as e,as as C,at as d,ay as z,az as R,aA as b}from"./index-B1H8BCL7.js";import{S as B}from"./SwitchBase-BKMEO22T.js";function j(a){return $("MuiSwitch",a)}const s=S("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),M=["className","color","edge","size","sx"],T=a=>{const{classes:t,edge:o,size:r,color:p,checked:u,disabled:h}=a,g={root:["root",o&&`edge${e(o)}`,`size${e(r)}`],switchBase:["switchBase",`color${e(p)}`,u&&"checked",h&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},w=C(g,j,t);return l({},t,w)},_=d("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(a,t)=>{const{ownerState:o}=a;return[t.root,o.edge&&t[`edge${e(o.edge)}`],t[`size${e(o.size)}`]]}})({display:"inline-flex",width:34+12*2,height:14+12*2,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"},variants:[{props:{edge:"start"},style:{marginLeft:-8}},{props:{edge:"end"},style:{marginRight:-8}},{props:{size:"small"},style:{width:40,height:24,padding:7,[`& .${s.thumb}`]:{width:16,height:16},[`& .${s.switchBase}`]:{padding:4,[`&.${s.checked}`]:{transform:"translateX(16px)"}}}}]}),N=d(B,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(a,t)=>{const{ownerState:o}=a;return[t.switchBase,{[`& .${s.input}`]:t.input},o.color!=="default"&&t[`color${e(o.color)}`]]}})(({theme:a})=>({position:"absolute",top:0,left:0,zIndex:1,color:a.vars?a.vars.palette.Switch.defaultColor:`${a.palette.mode==="light"?a.palette.common.white:a.palette.grey[300]}`,transition:a.transitions.create(["left","transform"],{duration:a.transitions.duration.shortest}),[`&.${s.checked}`]:{transform:"translateX(20px)"},[`&.${s.disabled}`]:{color:a.vars?a.vars.palette.Switch.defaultDisabledColor:`${a.palette.mode==="light"?a.palette.grey[100]:a.palette.grey[600]}`},[`&.${s.checked} + .${s.track}`]:{opacity:.5},[`&.${s.disabled} + .${s.track}`]:{opacity:a.vars?a.vars.opacity.switchTrackDisabled:`${a.palette.mode==="light"?.12:.2}`},[`& .${s.input}`]:{left:"-100%",width:"300%"}}),({theme:a})=>({"&:hover":{backgroundColor:a.vars?`rgba(${a.vars.palette.action.activeChannel} / ${a.vars.palette.action.hoverOpacity})`:b(a.palette.action.active,a.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(a.palette).filter(([,t])=>t.main&&t.light).map(([t])=>({props:{color:t},style:{[`&.${s.checked}`]:{color:(a.vars||a).palette[t].main,"&:hover":{backgroundColor:a.vars?`rgba(${a.vars.palette[t].mainChannel} / ${a.vars.palette.action.hoverOpacity})`:b(a.palette[t].main,a.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${s.disabled}`]:{color:a.vars?a.vars.palette.Switch[`${t}DisabledColor`]:`${a.palette.mode==="light"?z(a.palette[t].main,.62):R(a.palette[t].main,.55)}`}},[`&.${s.checked} + .${s.track}`]:{backgroundColor:(a.vars||a).palette[t].main}}}))]})),O=d("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(a,t)=>t.track})(({theme:a})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:a.transitions.create(["opacity","background-color"],{duration:a.transitions.duration.shortest}),backgroundColor:a.vars?a.vars.palette.common.onBackground:`${a.palette.mode==="light"?a.palette.common.black:a.palette.common.white}`,opacity:a.vars?a.vars.opacity.switchTrack:`${a.palette.mode==="light"?.38:.3}`})),D=d("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(a,t)=>t.thumb})(({theme:a})=>({boxShadow:(a.vars||a).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),A=x.forwardRef(function(t,o){const r=y({props:t,name:"MuiSwitch"}),{className:p,color:u="primary",edge:h=!1,size:g="medium",sx:w}=r,k=f(r,M),i=l({},r,{color:u,edge:h,size:g}),c=T(i),v=n.jsx(D,{className:c.thumb,ownerState:i});return n.jsxs(_,{className:m(c.root,p),sx:w,ownerState:i,children:[n.jsx(N,l({type:"checkbox",icon:v,checkedIcon:v,ref:o,ownerState:i},k,{classes:l({},c,{root:c.switchBase})})),n.jsx(O,{className:c.track,ownerState:i})]})});export{A as S};
