import{t as f,E as h,av as C,d as p,C as P,Z as b,W as k,b5 as V,c as g,N as G,u as _,G as E,D as O,am as S,v as $,x as y}from"./index.28bb778f.js";import{c as N,s as A}from"./Checker.3f2ba89f.js";const[x,B]=f("checkbox-group"),D={max:h,disabled:Boolean,iconSize:h,direction:String,modelValue:C(),checkedColor:String},v=Symbol(x);var R=p({name:x,props:D,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{children:l,linkChildren:i}=P(v),o=e=>d("update:modelValue",e),u=(e={})=>{typeof e=="boolean"&&(e={checked:e});const{checked:t,skipDisabled:r}=e,c=l.filter(n=>n.props.bindGroup?n.props.disabled&&r?n.checked.value:t!=null?t:!n.checked.value:!1).map(n=>n.name);o(c)};return b(()=>a.modelValue,e=>d("change",e)),k({toggleAll:u}),V(()=>a.modelValue),i({props:a,updateValue:o}),()=>{var e;return g("div",{class:B([a.direction])},[(e=s.default)==null?void 0:e.call(s)])}}});const[K,w]=f("checkbox"),z=G({},N,{bindGroup:_});var F=p({name:K,props:z,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{parent:l}=E(v),i=e=>{const{name:t}=a,{max:r,modelValue:m}=l.props,c=m.slice();if(e)!(r&&c.length>=r)&&!c.includes(t)&&(c.push(t),a.bindGroup&&l.updateValue(c));else{const n=c.indexOf(t);n!==-1&&(c.splice(n,1),a.bindGroup&&l.updateValue(c))}},o=O(()=>l&&a.bindGroup?l.props.modelValue.indexOf(a.name)!==-1:!!a.modelValue),u=(e=!o.value)=>{l&&a.bindGroup?i(e):d("update:modelValue",e)};return b(()=>a.modelValue,e=>d("change",e)),k({toggle:u,props:a,checked:o}),V(()=>a.modelValue),()=>g(A,$({bem:w,role:"checkbox",parent:l,checked:o.value,onToggle:u},a),S(s,["default","icon"]))}});const T=y(F);export{T as C,R as s};
