import"./router.ed823a0a.js";import{r as i}from"./jwt-decode.esm.fbcfeaec.js";import{T as c}from"./tables.76beaff5.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]="49ed2d26-1231-477f-ad2c-9df29fa2f472",e._sentryDebugIdIdentifier="sentry-dbid-49ed2d26-1231-477f-ad2c-9df29fa2f472")}catch{}})();const s=new Map,n=new Set,y=e=>{const a=i([]),t=i(!1),r=i(null),u=async(f=!1)=>{if(!f&&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),r.value=null;const l=await c.list(e);return a.value=l,s.set(e,l),l}catch(l){throw r.value=l,console.error("Error fetching tables:",l),l}finally{t.value=!1,n.delete(e)}},o=f=>a.value.find(l=>l.id===f)||null,d=()=>{s.delete(e)},b=()=>{s.clear()};return!s.has(e)&&!n.has(e)?u():s.has(e)&&(a.value=s.get(e)),{tables:a,loading:t,error:r,fetchTables:u,getTableById:o,invalidateCache:d,invalidateAllCache:b}};export{y as u};
//# sourceMappingURL=useTables.77dbe628.js.map
