import{n as h,d as O,c as C,a as b,o as q}from"./widget-BUAABBRb.js";import{C as P,k as p,b as i}from"./convert-case-to-camel-case.utils-DDUpNI96.js";function B(g){const{field:t}=P(g),v=h(),f=O(),l=C(),S=q(),V=p("default"),o=p([]),F=i(()=>l.checkFieldRequired(t.value)),m=i(()=>t.value.selectedOption||[]),r=i(()=>{var e;return(e=m.value)==null?void 0:e.map(a=>a.optionValue)}),y=i(()=>{var e;return((e=r.value)==null?void 0:e.map(a=>a.split("_")[1]||9999).join("_"))||9999}),c=e=>{var n,s;t.value.selectedOption=e;let a=0;if(Array.isArray(e))for(const u of e){const d=+((s=(n=u.optionValue)==null?void 0:n.toString())==null?void 0:s.split("_"))[0];!isNaN(d)&&t.value.summaryView!=="show_label_not_calculable"&&(a+=d)}t.value.value=a,t.value.displayValue=S.getMultipleOptionsFieldDisplayView(t.value),l.updateField(t.value.alias,t.value),v.applyConditionForField(t.value.alias),l.getPageBreakEnabled&&l.getActivePage.action==="not_skip"&&f.checkPageFieldsConditions()},k=e=>{o.value=[];const a=e.split(",");for(const n of a){const s=t.value.options.find(u=>u.optionValue===n);s&&o.value.push(s)}c(o.value)},_=i(()=>{var a;return((a=b().getWarningTexts)==null?void 0:a.requiredMsg)||""});return{style:V,selectedOptions:o,updateValue:c,applyChanges:k,isRequired:F,fieldValue:r,getKey:y,requiredWarningText:_}}export{B as u};
//# sourceMappingURL=useMultiOptionsFieldShared-B94LQkbD.js.map
