import{C as e}from"./chatroom.aaFzn9sH.js";import{aa as a,ai as r}from"./vue-vendor.CIPxpJKQ.js";function n(e){return Array.isArray(e.enabledTypes)&&e.enabledTypes.includes("PK")}const l=r([]),t=a(!1),u=a(!1),o=a(!1);let s=0,i=null;async function v(a=!1){if(!("undefined"!=typeof document&&document.hidden&&t.value||!a&&t.value&&s&&Date.now()-s<3e4))return i||(i=(async()=>{try{const r=await e.list(),t=n(a=r)&&Array.isArray(a.rooms)?a.rooms.filter(e=>{var a;return"PK"===e.type&&2===(null==(a=e.roles)?void 0:a.length)}):[];u.value=n(r),o.value=!0,l.value=t,s=Date.now()}catch{l.value=[],u.value=!1,o.value=!1,s=0}finally{t.value=!0,i=null}var a})(),i)}async function y(){t.value=!1,l.value=[],u.value=!1,o.value=!1,await v(!0)}function c(){return{rooms:l,ready:t,enabled:u,availabilityKnown:o,refresh:v,refreshForEntry:y}}export{c as u};