import{O as f,y as g,E as P,d as C,N as S,aB as z,u as y,R as B,D as r,c as d,a5 as D,U as x}from"./index.27735e87.js";const R={name:f,shape:g("round"),disabled:Boolean,iconSize:P,modelValue:f,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var I=C({props:S({},R,{bem:z(Function),role:String,parent:Object,checked:Boolean,bindGroup:y}),emits:["click","toggle"],setup(e,{emit:s,slots:c}){const u=B(),l=n=>{if(e.parent&&e.bindGroup)return e.parent.props[n]},a=r(()=>l("disabled")||e.disabled),m=r(()=>l("direction")),v=r(()=>{const n=e.checkedColor||l("checkedColor");if(n&&e.checked&&!a.value)return{borderColor:n,backgroundColor:n}}),h=n=>{const{target:i}=n,o=u.value,t=o===i||(o==null?void 0:o.contains(i));!a.value&&(t||!e.labelDisabled)&&s("toggle"),s("click",n)},b=()=>{const{bem:n,shape:i,checked:o}=e,t=e.iconSize||l("iconSize");return d("div",{ref:u,class:n("icon",[i,{disabled:a.value,checked:o}]),style:{fontSize:x(t)}},[c.icon?c.icon({checked:o,disabled:a.value}):d(D,{name:"success",style:v.value},null)])},k=()=>{if(c.default)return d("span",{class:e.bem("label",[e.labelPosition,{disabled:a.value}])},[c.default()])};return()=>{const n=e.labelPosition==="left"?[k(),b()]:[b(),k()];return d("div",{role:e.role,class:e.bem([{disabled:a.value,"label-disabled":e.labelDisabled},m.value]),tabindex:a.value?void 0:0,"aria-checked":e.checked,onClick:h},[n])}}});export{R as c,I as s};
