import{inject as m,ref as s,computed as f}from"/vue.js";import{n as d}from"./nc-main.DEgIQeOo.js";function y(i,n){return{name:i,props:{model:{type:String,default:void 0,required:!0},hdr:{type:String,default:void 0},disabled:{type:Boolean,default:void 0},value:{type:[String,Boolean],default:void 0},name:{type:String,default:void 0}},setup(e,{emit:r}){const t=m("state"),l=s(),o=n?"radio":"checkbox",a=f(()=>d.getRec(t,l.value)),c=f(()=>n&&e.value!=null?a.value===e.value:e.value!=null?e.value:!!a.value);e.model==null?e.value==null&&console.error(`nc-${o}: props.model and props.value do not exist`):e.model.indexOf("rec.")!==0?e.value==null&&console.warn(`nc-${o}: props.model does not start with 'rec.'`,e.model):l.value=e.model.substr(4);function v(){if(l.value!=null){d.setPrevRec(t,l.value,"nc-radio-checkbox.js");let u;n?u=e.value:u=!c.value,d.setRec(t,l.value,u),r("change",u)}else e.value!=null&&(n||(e.value=!c.value),r("change",e.value))}return{isChecked:c,recValue:a,change:v}}}}export{y as c};
