import{p as E,u as b}from"./useEvent-D91BmmQi.js";import{t as k}from"./compiler-runtime-B3qBwwSJ.js";import{t as q}from"./createReducer-CI9qeK_X.js";import{t as y}from"./requests-DIwGYs0l.js";import{t as A}from"./createLucideIcon-D5guW7EU.js";import{t as g}from"./DeferredRequestRegistry-CNldVcrP.js";import{n as $}from"./useAsyncData-bgszE9F0.js";var I=A("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const v=new g("storage-list-entries",async(r,t)=>{await y().listStorageEntries({requestId:r,...t})}),N=new g("storage-download",async(r,t)=>{await y().downloadStorage({requestId:r,...t})});function w(r,t){return`${r}::${t??""}`}function _(r){return`${r}::`}var z=k();function C(){return{namespaces:[],entriesByPath:new Map}}var{reducer:O,createActions:Q,valueAtom:P,useActions:F}=q(C,{setNamespaces:(r,t)=>{let e=new Map(r.namespaces.map(a=>[a.name,a]));for(let a of t.namespaces)e.set(a.name,a);return{...r,namespaces:[...e.values()]}},setEntries:(r,t)=>{let e=w(t.namespace,t.prefix),a=new Map(r.entriesByPath);return a.set(e,t.entries),{...r,entriesByPath:a}},clearNamespaceCache:(r,t)=>{let e=new Map(r.entriesByPath),a=_(t);for(let n of e.keys())n.startsWith(a)&&e.delete(n);return{...r,entriesByPath:e}},filterFromVariables:(r,t)=>{let e=new Set(t),a=r.namespaces.filter(n=>e.has(n.name));return{...r,namespaces:a}}});const x=()=>b(P),H=E(r=>r(P).namespaces);function B(){return F()}function V(r,t){let e=(0,z.c)(20),{entriesByPath:a}=x(),{setEntries:n}=B(),o;e[0]!==a||e[1]!==r||e[2]!==t?(o=a.get(w(r,t)),e[0]=a,e[1]=r,e[2]=t,e[3]=o):o=e[3];let s=o,m;e[4]!==s||e[5]!==r||e[6]!==t||e[7]!==n?(m=async()=>{if(s)return;let d=await v.request({namespace:r,prefix:t??"",limit:150});if(d.error)throw Error(d.error);n({namespace:r,prefix:t,entries:d.entries})},e[4]=s,e[5]=r,e[6]=t,e[7]=n,e[8]=m):m=e[8];let f=s===void 0,c;e[9]!==r||e[10]!==t||e[11]!==f?(c=[r,t,f],e[9]=r,e[10]=t,e[11]=f,e[12]=c):c=e[12];let{isPending:M,error:S,refetch:l}=$(m,c),i;e[13]===s?i=e[14]:(i=s??[],e[13]=s,e[14]=i);let u=M&&!s,h=s?void 0:S,p;return e[15]!==l||e[16]!==i||e[17]!==u||e[18]!==h?(p={entries:i,isPending:u,error:h,refetch:l},e[15]=l,e[16]=i,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}export{w as a,I as c,V as i,x as n,N as o,B as r,v as s,H as t};
