import{t as e}from"./useSnackbar-BFeYjAzp.js";import{en as t,ii as n}from"./index-BKLG6eUi.js";import{t as r}from"./apiError-C9ZCize-.js";function i(){let i=n([]),a=n(!1),o=e();async function s(e){a.value=!0;try{let n=e?.perPage??200;if(!e?.all){i.value=(await t.getList(`/servers/`,{per_page:n})).items;return}let r=[],a=1,o=1;do{let e=await t.get(`/servers/`,{page:a,per_page:n});r.push(...e.items||[]),o=e.pages??1,a+=1}while(a<=o);i.value=r}catch(e){i.value=[],o(r(e,`加载服务器列表失败`),`error`)}finally{a.value=!1}}return{servers:i,loading:a,loadServers:s}}export{i as t};