import{a as c,E as v,ac as o}from"./index-Cc0s9xHj.js";import{o as T,a as f,g as p,r as d}from"./lucide-C_a_D9Y7.js";const k="music_sync",r=d([]),n=d(!0);let t=0,e,a;const u=p(()=>r.value.filter(s=>(s.status===o.PENDING||s.status===o.RUNNING)&&s.metadata.task_domain===k)),S=()=>{a||(a=c.subscribe(v.TASKS_UPDATED,s=>{r.value=s.data}))},b=()=>{t>0||!a||(a(),a=void 0)},i=async()=>e||(n.value=!0,e=c.getTasks().then(s=>{r.value=s}).finally(()=>{n.value=!1,e=void 0}),e);function U(){return T(()=>{t+=1,S(),i()}),f(()=>{t=Math.max(0,t-1),b()}),{tasks:r,loading:n,activeSyncTasks:u,refreshTasks:i,isProviderSyncing:m=>u.value.some(l=>l.metadata.provider_instance===m)}}export{U as u};
