import{a as r,E as c}from"./index-Cc0s9xHj.js";import{r as o}from"./lucide-C_a_D9Y7.js";const t=o(null),l=o(!1),u=o(!1);let a=null;async function s(n=!1){return u.value&&!n?t.value:(a&&!n||(l.value=!0,a=(async()=>{try{const e=await r.sendCommand("party/config");return t.value=e,u.value=!0,e}catch{return t.value=null,u.value=!0,null}finally{l.value=!1,a=null}})()),a)}function i(){t.value=null,u.value=!1,a=null}let f=!1;function v(){f||(f=!0,r.subscribe(c.PROVIDERS_UPDATED,async()=>{Object.values(r.providers).some(e=>e.domain==="party")?(i(),await s(!0)):(t.value=null,u.value=!0)}),r.subscribe(c.CORE_STATE_UPDATED,async()=>{Object.values(r.providers).some(e=>e.domain==="party")&&(i(),await s(!0))}))}function m(){return v(),{config:t,loading:l,loaded:u,fetchConfig:s,invalidate:i}}export{m as u};
