import{M as d,r,p as g}from"./index-CPuF8FlG.js";const h=d("groups",()=>{const u=r([]),l=r(null),e=r(!1),s=r(null),o=r(null),c=g(()=>u.value.length);async function p(){e.value=!0,s.value=null;try{const a=await(await fetch("/api/groups")).json();a.success?u.value=a.data.groups:s.value=a.error}catch(t){s.value=String(t)}finally{e.value=!1}}async function i(t){e.value=!0,s.value=null;try{const n=await(await fetch(`/api/groups/${t}/status`)).json();n.success?l.value=n.data:s.value=n.error}catch(a){s.value=String(a)}finally{e.value=!1}}async function f(t){o.value=t;try{return await(await fetch(`/api/groups/${t}/start`,{method:"POST"})).json()}finally{o.value=null}}async function v(t){o.value=t;try{return await(await fetch(`/api/groups/${t}/stop`,{method:"POST"})).json()}finally{o.value=null}}return{groups:u,currentGroupStatus:l,loading:e,error:s,operationInProgress:o,groupCount:c,fetchGroups:p,fetchGroupStatus:i,startGroup:f,stopGroup:v}});export{h as u};
