import{aH as z,aI as R,aJ as v,aL as d,bo as C,bp as B,bq as M,r as m,aN as N,aO as O,aM as w,j as i,aP as D,aQ as I,E as T,A as x,at as _}from"./index-DnB1XXdB.js";import{S as H,u as E,a as P}from"./Checkbox-BEJf4qTi.js";function U(a){return R("MuiSwitch",a)}const t=z("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),A=["className","color","edge","size","sx"],L=a=>{const{classes:s,edge:e,size:r,color:p,checked:u,disabled:n}=a,o={root:["root",e&&`edge${d(e)}`,`size${d(r)}`],switchBase:["switchBase",`color${d(p)}`,u&&"checked",n&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},h=I(o,U,s);return w({},s,h)},F=v("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(a,s)=>{const{ownerState:e}=a;return[s.root,e.edge&&s[`edge${d(e.edge)}`],s[`size${d(e.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,[`& .${t.thumb}`]:{width:16,height:16},[`& .${t.switchBase}`]:{padding:4,[`&.${t.checked}`]:{transform:"translateX(16px)"}}}}]}),Q=v(H,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(a,s)=>{const{ownerState:e}=a;return[s.switchBase,{[`& .${t.input}`]:s.input},e.color!=="default"&&s[`color${d(e.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}),[`&.${t.checked}`]:{transform:"translateX(20px)"},[`&.${t.disabled}`]:{color:a.vars?a.vars.palette.Switch.defaultDisabledColor:`${a.palette.mode==="light"?a.palette.grey[100]:a.palette.grey[600]}`},[`&.${t.checked} + .${t.track}`]:{opacity:.5},[`&.${t.disabled} + .${t.track}`]:{opacity:a.vars?a.vars.opacity.switchTrackDisabled:`${a.palette.mode==="light"?.12:.2}`},[`& .${t.input}`]:{left:"-100%",width:"300%"}}),({theme:a})=>({"&:hover":{backgroundColor:a.vars?`rgba(${a.vars.palette.action.activeChannel} / ${a.vars.palette.action.hoverOpacity})`:C(a.palette.action.active,a.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(a.palette).filter(([,s])=>s.main&&s.light).map(([s])=>({props:{color:s},style:{[`&.${t.checked}`]:{color:(a.vars||a).palette[s].main,"&:hover":{backgroundColor:a.vars?`rgba(${a.vars.palette[s].mainChannel} / ${a.vars.palette.action.hoverOpacity})`:C(a.palette[s].main,a.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${t.disabled}`]:{color:a.vars?a.vars.palette.Switch[`${s}DisabledColor`]:`${a.palette.mode==="light"?B(a.palette[s].main,.62):M(a.palette[s].main,.55)}`}},[`&.${t.checked} + .${t.track}`]:{backgroundColor:(a.vars||a).palette[s].main}}}))]})),X=v("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(a,s)=>s.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}`})),q=v("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(a,s)=>s.thumb})(({theme:a})=>({boxShadow:(a.vars||a).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),J=m.forwardRef(function(s,e){const r=N({props:s,name:"MuiSwitch"}),{className:p,color:u="primary",edge:n=!1,size:o="medium",sx:h}=r,k=O(r,A),c=w({},r,{color:u,edge:n,size:o}),l=L(c),g=i.jsx(q,{className:l.thumb,ownerState:c});return i.jsxs(F,{className:D(l.root,p),sx:h,ownerState:c,children:[i.jsx(Q,w({type:"checkbox",icon:g,checkedIcon:g,ref:e,ownerState:c},k,{classes:w({},l,{root:l.switchBase})})),i.jsx(X,{className:l.track,ownerState:c})]})});function V({background:a=!1,fullBackground:s=!1,center:e=!1,label:r="",style:p={},className:u="",hintText:n="",...o}){const{wrapper:h,center:k,background:c,fullBackground:l,label:g,checkbox:W,...b}=E({...o,classes:o.classes||{}}),y=T("lgDown"),[S,$]=m.useState(!1),f=()=>$(!0),j=()=>$(!1);return i.jsxs("div",{className:b.switchRoot,children:[i.jsxs("label",{className:x(["checkbox-wrapper",u,h],{[k]:e,[c]:a||s,[l]:s,[b.disabled]:o.disabled}),htmlFor:o.id,style:p,children:[i.jsx(J,{...o,classes:o.classes||{},checked:o.checked||o.value,color:"primary"}),!!r&&i.jsx("span",{className:x(g,{[b.disabled]:o.disabled}),children:r})]}),n&&i.jsx(_,{title:n,open:S,onOpen:f,onClose:j,children:i.jsx(P,{className:x([b.hintIcon,{openHint:S}]),size:14,onClick:()=>{y&&f()}})})]})}export{V as S};