/* empty css             *//* empty css                  */import{q as e,ac as a,ct as l,M as u,cv as s,P as n,d as t,cw as o,o as i,l as d,f as v,ap as r}from"./index-545c1a76.js";const c=t({__name:"index",props:{modelValue:Boolean|Number|String,api:String,id:Number|String},emits:["update:modelValue","refresh"],setup(t,{emit:c}){const m=t,{enabled:p,success:f,loading:g,afterEnabled:b}=function(){const t=e(!1),o=e(!1),i=e();return{enabled:function(e,n,d={}){o.value=!0,a.put(e+"/enable/"+n,d).then((e=>{e.data.code===l.SUCCESS?(t.value=!0,u.success(e.data.message),s(i.value)&&i.value()):u.error(e.data.message)})).finally((()=>{o.value=!1}))},success:e=>{n(t,(function(){t.value=!1,e()}))},loading:o,afterEnabled:i}}(),S=e(),E=e();return"boolean"==typeof m.modelValue?(S.value=!0,E.value=!1):(S.value=o.ENABLE,E.value=o.DISABLE),f((()=>{c("update:modelValue",m.modelValue===S.value?E.value:S.value)})),b.value=()=>{c("refresh")},(e,a)=>{const l=r;return i(),d(l,{onChange:a[0]||(a[0]=e=>v(p)(t.api,t.id)),"active-value":S.value,"inactive-value":E.value,"model-value":t.modelValue,loading:v(g)},null,8,["active-value","inactive-value","model-value","loading"])}}});export{c as _};
