"use strict";const e=require("../../../../common/vendor.js"),a=require("../common/util.js"),o=require("./types.js"),l=e.defineComponent({name:"wd-switch",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"},props:o.switchProps,emits:["change","update:modelValue"],setup(o,{emit:l}){const t=o,i=l,u=e.computed((()=>`wd-switch ${t.customClass} ${t.disabled?"is-disabled":""} ${t.modelValue===t.activeValue?"is-checked":""}`)),c=e.computed((()=>{const e={background:t.modelValue===t.activeValue?t.activeColor:t.inactiveColor,"border-color":t.modelValue===t.activeValue?t.activeColor:t.inactiveColor};return t.size&&(e["font-size"]=a.addUnit(t.size)),`${a.objToStyle(e)}${t.customStyle}`})),n=e.computed((()=>t.modelValue===t.activeValue&&t.activeColor||t.modelValue!==t.activeValue&&t.inactiveColor?"box-shadow: none;":""));function s(){if(t.disabled)return;const e=t.modelValue===t.activeValue?t.inactiveValue:t.activeValue;t.beforeChange&&a.isFunction(t.beforeChange)?t.beforeChange({value:e,resolve:a=>{a&&(i("update:modelValue",e),i("change",{value:e}))}}):(i("update:modelValue",e),i("change",{value:e}))}return e.onBeforeMount((()=>{-1===[t.activeValue,t.inactiveValue].indexOf(t.modelValue)&&(i("update:modelValue",t.inactiveValue),i("change",{value:t.inactiveValue}))})),(a,o)=>({a:e.s(n.value),b:e.n(u.value),c:e.s(c.value),d:e.o(s)})}}),t=e._export_sfc(l,[["__scopeId","data-v-55242008"]]);wx.createComponent(t);
