import{_ as v}from"./settings.consts-BmuAyinH.js";import{d as E,f as n,i as a,F as I,r as F,x as d,k as C,t as b}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as L,u as o}from"./vendor-vue-reactivity-CheHbvBM.js";import{a as _}from"./vendor-vue-shared-DrzsEcag.js";import{_ as R}from"./vendor-vue3-html2pdf-KR020wX8.js";const $=["checked","disabled","onChange"],j={class:"ccb-checkbox__box"},q={key:0,class:"ccb-checkbox__checkmark"},D=["checked","disabled"],G={class:"ccb-checkbox__box"},H={key:0,class:"ccb-checkbox__checkmark"},J=E({__name:"Checkbox",props:{modelValue:{type:[Array,String,Number,Boolean]},label:{},disabled:{type:Boolean},template:{},options:{},name:{}},emits:["update:modelValue","change","change-single"],setup(B,{emit:V}){const m=B,{name:S,modelValue:l,disabled:r,template:p,options:u,label:x}=L(m),h=V,g=e=>Array.isArray(e)?e:e==null?[]:[e],i=e=>g(l.value).some(t=>t===e),w=e=>{if(m.disabled)return;const c=e.target;h("change-single",c.checked)},A=(e,c)=>{var y;if(r.value||c.disabled)return;const t=e.target.checked,s=g(l.value),k=t?N(s,c.value):z(s,c.value),f=(((y=u.value)==null?void 0:y.length)||0)===1?t?c.value:typeof c.value=="boolean"?!1:[]:k;h("update:modelValue",f),h("change",S.value||"",f)},N=(e,c)=>e.some(t=>t===c)?e:[...e,c];function z(e,c){return e.filter(t=>t!==c)}return(e,c)=>{var t;return a(),n("div",{class:_(["ccb-checkbox-group",{"ccb-checkbox-group--columns":o(p)==="columns","ccb-checkbox-group--rows":o(p)==="rows"}])},[(t=o(u))!=null&&t.length?(a(!0),n(I,{key:0},F(o(u)||[],s=>(a(),n("label",{key:String(s.value),class:_(["ccb-checkbox",{"ccb-checkbox--checked":i(s.value),"ccb-checkbox--disabled":o(r)||s.disabled}])},[d("input",{type:"checkbox",class:"ccb-checkbox__input",checked:i(s.value),disabled:o(r)||s.disabled,onChange:k=>A(k,s)},null,40,$),d("span",j,[i(s.value)?(a(),n("span",q)):b("",!0)]),s.label?(a(),C(v,{key:0,class:"ccb-checkbox__label",text:s.label,size:"m",weight:"medium"},null,8,["text"])):b("",!0)],2))),128)):(a(),n("label",{key:1,class:_(["ccb-checkbox",{"ccb-checkbox--checked":o(l),"ccb-checkbox--disabled":o(r)}])},[d("input",{type:"checkbox",class:"ccb-checkbox__input",checked:o(l),disabled:o(r),onChange:w},null,40,D),d("span",G,[o(l)?(a(),n("span",H)):b("",!0)]),o(x)?(a(),C(v,{key:0,class:"ccb-checkbox__label",text:o(x),size:"m",weight:"medium"},null,8,["text"])):b("",!0)],2))],2)}}}),U=R(J,[["__scopeId","data-v-a8ef5de3"]]);export{U as C};
//# sourceMappingURL=Checkbox-CLi7hE7q.js.map
