import"./router.95e6e4b6.js";import{r as i}from"./jwt-decode.esm.7c9b757c.js";import{T as h}from"./tables.4a013a6e.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="f7cc8019-91bf-4ff8-9eff-6716e7375fa6",e._sentryDebugIdIdentifier="sentry-dbid-f7cc8019-91bf-4ff8-9eff-6716e7375fa6")}catch{}})();const s=new Map,n=new Set,y=e=>{const a=i([]),t=i(!1),f=i(null),u=async(r=!1)=>{if(!r&&s.has(e))return a.value=s.get(e),a.value;if(n.has(e)){for(;n.has(e);)await new Promise(l=>setTimeout(l,100));return a.value=s.get(e)||[],a.value}try{t.value=!0,n.add(e),f.value=null;const l=await h.list(e);return a.value=l,s.set(e,l),l}catch(l){throw f.value=l,console.error("Error fetching tables:",l),l}finally{t.value=!1,n.delete(e)}},o=r=>a.value.find(l=>l.id===r)||null,b=()=>{s.delete(e)},c=()=>{s.clear()};return!s.has(e)&&!n.has(e)?u():s.has(e)&&(a.value=s.get(e)),{tables:a,loading:t,error:f,fetchTables:u,getTableById:o,invalidateCache:b,invalidateAllCache:c}};export{y as u};
//# sourceMappingURL=useTables.65852515.js.map
