import{w as T,t as I}from"./widget-BUAABBRb.js";import{u as B}from"./translationsStore-DBJu9sBR.js";import{_ as N}from"./RequiredHint.vue_vue_type_style_index_0_lang-R4Bqx90z.js";import{a as O,C as R,b as u,m as d,g as n,p as o,f as S,q as h,u as t,L as w,D as v,I as k,F as D,H as L}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import{_ as $}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";const z={class:"ccb-order-field__wrapper"},E={class:"ccb-order-field__title"},H={class:"ccb-order-field__label"},M={key:0,class:"ccb-order-required-mark"},W=["for"],j=["id","name","value","checked","onChange"],A={class:"ccb-checkbox-label"},G=O({__name:"OrderCheckbox",props:{field:{}},setup(x){const g=x,{field:e}=R(g),{checkFieldRequired:q}=T(),C=B(),_=u(()=>e.value.required?q(e.value):!1),p=u(()=>e.value.selectedIdx||[]),F=u(()=>Math.random().toString(36).substring(2,15)),V=i=>{var b,f,m;let a=e.value.selectedIdx||[];p.value.includes(i)?a=((b=e.value.selectedIdx)==null?void 0:b.filter(r=>r!==i))||[]:a.push(i);let c=[];const l=((m=(f=e.value)==null?void 0:f.attributes)==null?void 0:m.options)||[];for(let r=0;r<l.length;r++){const y=l[r];a.includes(r)&&c.push(y.optionText||"")}const{updateValue:s}=I();e.value.value=c,s(e.value.id,e.value.value,a)};return(i,a)=>{var c;return n(),d("div",{class:k(["ccb-order-field ccb-order-checkbox",{[`ccb-col-${t(e).fieldWidth}`]:!0,"ccb-order-field--required":_.value}])},[o("div",z,[o("div",E,[_.value?(n(),S(N,{key:0,text:t(C).getTranslations.requiredField},null,8,["text"])):h("",!0),o("label",H,[w(v(t(e).label)+" ",1),t(e).required?(n(),d("span",M,"*")):h("",!0)])]),o("div",{class:k(["ccb-default-checkbox",{[((c=t(e).attributes)==null?void 0:c.display)||""]:!0}])},[(n(!0),d(D,null,L(t(e).attributes.options,(l,s)=>(n(),d("label",{for:t(e).id+"order_checkbox_"+s,key:s},[o("input",{type:"checkbox",id:t(e).id+"order_checkbox_"+s,name:F.value,value:l.optionText,checked:p.value.includes(s),onChange:()=>V(s)},null,40,j),o("span",A,v(l.optionText),1)],8,W))),128))],2)])],2)}}}),Z=$(G,[["__scopeId","data-v-4cb03ba0"]]);export{Z as default};
//# sourceMappingURL=OrderCheckbox-DYNQsZN-.js.map
