import{d as g,t as C,r as l,n as V,o as u,c as m,b as i,e as H,u as e,Q as L,g as $,H as p,a as j}from"../../../../common/index.DXvi0yH9.js";/* empty css                                                                                       *//* empty css                                                                                 */import"../../../../common/Confirmation.vue_vue_type_script_setup_true_lang.BvpajMdU.js";import{_ as B}from"../../../../common/LabelControl.vue_vue_type_script_setup_true_lang.B_b65Eg0.js";import"../../../../common/transition.CRNcmuQX.js";import"../../../../common/keyboard.D4P2wQc7.js";import"../../../../common/open-closed.CQX5sZkx.js";import"../../../../common/micro-task.CxIZtCgj.js";const D={class:"stwlite-tw-flex stwlite-tw-items-center stwlite-tw-justify-between"},N=["innerHTML"],q={class:"stwlite-tw-flex stwlite-tw-items-center"},E=["id"],M=["id"],J=g({__name:"SwitchControl",props:{params:{type:Object,required:!0},conditionalValues:{type:Object,required:!1,default:()=>({})}},emits:["conditionalData"],setup(f,{emit:h}){const b=f,_=h,{params:v,conditionalValues:o}=C(b),t=v.value,a=l(o.value[t.id]?o.value[t.id]:t.default),s=V({check:a.value==="yes"}),k=l(t.options.yes),y=l(t.options.no),w=l([]),x=n=>{a.value=n?"yes":"no",w.value[t.id]=a.value,s.check=n,_("conditionalData",w.value)};return(n,c)=>{var r,d;return u(),m("div",D,[i("div",null,[H(e(B),{params:e(t)},null,8,["params"]),e(t).description!=="undefined"?(u(),m("p",{key:0,class:"stwlite-tw-text-sm stwlite-tw-text-gray-600 stwlite-tw-mt-1",innerHTML:e(L)((d=(r=e(t))==null?void 0:r.description)!=null?d:"")},null,8,N)):$("",!0)]),i("div",q,[i("button",{type:"button",id:"".concat(e(t).id,"-btn"),onClick:c[0]||(c[0]=O=>x(!s.check)),class:p(["stwlite-tw-relative stwlite-tw-inline-flex stwlite-tw-h-6 stwlite-tw-w-11 stwlite-tw-items-center stwlite-tw-rounded-full stwlite-tw-transition-colors stwlite-tw-border-0",s.check?"stwlite-tw-bg-blue-600 stwlite-selected-btn-field":"stwlite-tw-bg-gray-200"])},[i("span",{class:p(["stwlite-tw-inline-block stwlite-tw-h-4 stwlite-tw-w-4 stwlite-tw-transform stwlite-tw-rounded-full stwlite-tw-bg-white stwlite-tw-transition-transform",s.check?"stwlite-tw-translate-x-4 stwlite-selected-label-field":"stwlite-tw-translate-x-0"])},null,2)],10,E),i("span",{id:"".concat(e(t).id,"-label"),class:"stwlite-tw-ml-2 stwlite-tw-text-sm stwlite-tw-font-medium stwlite-tw-text-blue-600"},j(s.check?k.value:y.value),9,M)])])}}});export{J as default};
