import{bi as T,bh as P,d as u,bo as r,bj as p,r as R,bk as j,bl as v,bm as M,j as d,bn as D,bp as I}from"./index-d2b25495.js";import{S as N}from"./SwitchBase-8b4bccce.js";function U(t){return P("MuiSwitch",t)}const E=T("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),o=E,O=t=>{const{classes:a,edge:s,size:l,color:h,checked:w,disabled:b}=t,g={root:["root",s&&`edge${r(s)}`,`size${r(l)}`],switchBase:["switchBase",`color${r(h)}`,w&&"checked",b&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},S=D(g,U,a);return{...a,...S}},A=u("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(t,a)=>{const{ownerState:s}=t;return[a.root,s.edge&&a[`edge${r(s.edge)}`],a[`size${r(s.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,[`& .${o.thumb}`]:{width:16,height:16},[`& .${o.switchBase}`]:{padding:4,[`&.${o.checked}`]:{transform:"translateX(16px)"}}}}]}),F=u(N,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(t,a)=>{const{ownerState:s}=t;return[a.switchBase,{[`& .${o.input}`]:a.input},s.color!=="default"&&a[`color${r(s.color)}`]]}})(p(({theme:t})=>({position:"absolute",top:0,left:0,zIndex:1,color:t.vars?t.vars.palette.Switch.defaultColor:`${t.palette.mode==="light"?t.palette.common.white:t.palette.grey[300]}`,transition:t.transitions.create(["left","transform"],{duration:t.transitions.duration.shortest}),[`&.${o.checked}`]:{transform:"translateX(20px)"},[`&.${o.disabled}`]:{color:t.vars?t.vars.palette.Switch.defaultDisabledColor:`${t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]}`},[`&.${o.checked} + .${o.track}`]:{opacity:.5},[`&.${o.disabled} + .${o.track}`]:{opacity:t.vars?t.vars.opacity.switchTrackDisabled:`${t.palette.mode==="light"?.12:.2}`},[`& .${o.input}`]:{left:"-100%",width:"300%"}})),p(({theme:t})=>({"&:hover":{backgroundColor:t.alpha((t.vars||t).palette.action.active,(t.vars||t).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(t.palette).filter(I(["light"])).map(([a])=>({props:{color:a},style:{[`&.${o.checked}`]:{color:(t.vars||t).palette[a].main,"&:hover":{backgroundColor:t.alpha((t.vars||t).palette[a].main,(t.vars||t).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${o.disabled}`]:{color:t.vars?t.vars.palette.Switch[`${a}DisabledColor`]:`${t.palette.mode==="light"?t.lighten(t.palette[a].main,.62):t.darken(t.palette[a].main,.55)}`}},[`&.${o.checked} + .${o.track}`]:{backgroundColor:(t.vars||t).palette[a].main}}}))]}))),X=u("span",{name:"MuiSwitch",slot:"Track"})(p(({theme:t})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:t.transitions.create(["opacity","background-color"],{duration:t.transitions.duration.shortest}),backgroundColor:t.vars?t.vars.palette.common.onBackground:`${t.palette.mode==="light"?t.palette.common.black:t.palette.common.white}`,opacity:t.vars?t.vars.opacity.switchTrack:`${t.palette.mode==="light"?.38:.3}`}))),L=u("span",{name:"MuiSwitch",slot:"Thumb"})(p(({theme:t})=>({boxShadow:(t.vars||t).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"}))),V=R.forwardRef(function(a,s){const l=j({props:a,name:"MuiSwitch"}),{className:h,color:w="primary",edge:b=!1,size:g="medium",sx:S,slots:c={},slotProps:e={},...f}=l,i={...l,color:w,edge:b,size:g},n=O(i),k={slots:c,slotProps:e},[y,m]=v("root",{className:M(n.root,h),elementType:A,externalForwardedProps:k,ownerState:i,additionalProps:{sx:S}}),[x,C]=v("thumb",{className:n.thumb,elementType:L,externalForwardedProps:k,ownerState:i}),$=d.jsx(x,{...C}),[B,z]=v("track",{className:n.track,elementType:X,externalForwardedProps:k,ownerState:i});return d.jsxs(y,{...m,children:[d.jsx(F,{type:"checkbox",icon:$,checkedIcon:$,ref:s,ownerState:i,...f,classes:{...n,root:n.switchBase},slots:{...c.switchBase&&{root:c.switchBase},...c.input&&{input:c.input}},slotProps:{...e.switchBase&&{root:typeof e.switchBase=="function"?e.switchBase(i):e.switchBase},input:{role:"switch"},...e.input&&{input:typeof e.input=="function"?e.input(i):e.input}}}),d.jsx(B,{...z})]})}),H=V;export{H as S};
