import{M as x,ak as C,S as y,W as z,r as _,l as r,f as t,N as B,b4 as D,I as G,am as k}from"./index-BV0H45HW.js";const I={name:C,disabled:Boolean,iconSize:y,modelValue:C,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var w=x({props:z({},I,{bem:D(Function),role:String,shape:String,parent:Object,checked:Boolean,bindGroup:B,indeterminate:{type:Boolean,default:null}}),emits:["click","toggle"],setup(e,{emit:v,slots:d}){const h=_(),o=n=>{if(e.parent&&e.bindGroup)return e.parent.props[n]},a=r(()=>{if(e.parent&&e.bindGroup){const n=o("disabled")||e.disabled;if(e.role==="checkbox"){const c=o("modelValue").length,l=o("max"),i=l&&c>=+l;return n||i&&!e.checked}return n}return e.disabled}),S=r(()=>o("direction")),u=r(()=>{const n=e.checkedColor||o("checkedColor");if(n&&e.checked&&!a.value)return{borderColor:n,backgroundColor:n}}),s=r(()=>e.shape||o("shape")||"round"),P=n=>{const{target:c}=n,l=h.value,i=l===c||(l==null?void 0:l.contains(c));!a.value&&(i||!e.labelDisabled)&&v("toggle"),v("click",n)},m=()=>{var n,c;const{bem:l,checked:i,indeterminate:g}=e,b=e.iconSize||o("iconSize");return t("div",{ref:h,class:l("icon",[s.value,{disabled:a.value,checked:i,indeterminate:g}]),style:s.value!=="dot"?{fontSize:k(b)}:{width:k(b),height:k(b),borderColor:(n=u.value)==null?void 0:n.borderColor}},[d.icon?d.icon({checked:i,disabled:a.value}):s.value!=="dot"?t(G,{name:g?"minus":"success",style:u.value},null):t("div",{class:l("icon--dot__icon"),style:{backgroundColor:(c=u.value)==null?void 0:c.backgroundColor}},null)])},f=()=>{const{checked:n}=e;if(d.default)return t("span",{class:e.bem("label",[e.labelPosition,{disabled:a.value}])},[d.default({checked:n,disabled:a.value})])};return()=>{const n=e.labelPosition==="left"?[f(),m()]:[m(),f()];return t("div",{role:e.role,class:e.bem([{disabled:a.value,"label-disabled":e.labelDisabled},S.value]),tabindex:a.value?void 0:0,"aria-checked":e.checked,onClick:P},[n])}}});export{I as c,w as s};
