import{M as C,ak as l,S as h,Q as k,al as b,f as t,am as w,X as S}from"./index-BV0H45HW.js";import{L as y}from"./index-BtHEBb5f.js";const[z,c]=k("switch"),L={size:h,loading:Boolean,disabled:Boolean,modelValue:l,activeColor:String,inactiveColor:String,activeValue:{type:l,default:!0},inactiveValue:{type:l,default:!1}};var P=C({name:z,props:L,emits:["change","update:modelValue"],setup(e,{emit:d,slots:n}){const o=()=>e.modelValue===e.activeValue,u=()=>{if(!e.disabled&&!e.loading){const a=o()?e.inactiveValue:e.activeValue;d("update:modelValue",a),d("change",a)}},r=()=>{if(e.loading){const a=o()?e.activeColor:e.inactiveColor;return t(y,{class:c("loading"),color:a},null)}if(n.node)return n.node()};return b(()=>e.modelValue),()=>{var a;const{size:v,loading:m,disabled:s,activeColor:g,inactiveColor:V}=e,i=o(),f={fontSize:w(v),backgroundColor:i?g:V};return t("div",{role:"switch",class:c({on:i,loading:m,disabled:s}),style:f,tabindex:s?void 0:0,"aria-checked":i,onClick:u},[t("div",{class:c("node")},[r()]),(a=n.background)==null?void 0:a.call(n)])}}});const N=S(P);export{N as S};
