import{z as S,A as C,d as r,e as b,j as V,t as n,x as l,k as h,y,w as B,m as w,n as D,B as P,a as u}from"./init-DI1ou7Mp.js";const M=["for"],j={key:0,class:"mt-0 form-text"},N=["id","true-value","false-value"],q={key:0,class:"form-text"},F={__name:"Checkbox",props:P({class:{type:String,default:""},desc:{type:String,default:null},id:{type:String,required:!0},label:{type:String,default:null},localePrefix:{type:String,default:"missing-prefix"},inverseValues:{type:Boolean,default:!1},default:{type:void 0,default:null}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(d){const a=S(d,"modelValue"),x=C(),s=d,k=(()=>{let e=s.class.split(" ");return e.includes("form-check")||e.push("form-check"),e.join(" ")})(),i=e=>{if(e===!0||e===!1)return{possibleValues:[!0,!1],value:e};if(e===1||e===0)return{possibleValues:[1,0],value:e};const o=[["true","false"],["1","0"],["enabled","disabled"],["enable","disable"],["yes","no"],["on","off"]];e=`${e}`.toLowerCase().trim();for(const t of o)if(e===t[0]||e===t[1])return{possibleValues:t,value:e};return null},c=(()=>{const e=(()=>{const m=i(a.value);return m!==null?m.possibleValues:(console.error(`Checkbox value ${a.value} for "${s.id}" did not match any acceptable pattern!`),["true","false"])})(),o=s.inverseValues?1:0,t=s.inverseValues?0:1;return{truthy:e[o],falsy:e[t]}})(),f=(()=>{const e=i(s.default);return e!==null?e.value===e.possibleValues[0]:null})(),_=s.label??`${s.localePrefix}.${s.id}`,v=s.desc??`${s.localePrefix}.${s.id}_desc`,p=s.desc!==""||Object.entries(x).length>0,$=f!==null,g=f?"_common.enabled_def_cbox":"_common.disabled_def_cbox";return(e,o)=>(u(),r("div",{class:y(l(k))},[b("label",{for:s.id,class:y(`form-check-label${l(p)?" mb-2":""}`)},[V(n(e.$t(l(_)))+" ",1),$?(u(),r("div",j,n(e.$t(l(g))),1)):h("",!0)],10,M),B(b("input",{type:"checkbox",class:"form-check-input",id:s.id,"onUpdate:modelValue":o[0]||(o[0]=t=>a.value=t),"true-value":l(c).truthy,"false-value":l(c).falsy},null,8,N),[[w,a.value]]),l(p)?(u(),r("div",q,[V(n(e.$t(l(v)))+" ",1),D(e.$slots,"default")])):h("",!0)],2))}};export{F as _};
