import{u as P,bg as M,bo as k,g0 as y,ct as I,r as s,g1 as L,g2 as N,g3 as j}from"./index-46ma1THH.js";const C=()=>{const{id:u,fsId:m}=P(),h=M(),l=k(),{data:r,isLoading:g}=y(u),{data:i,isFetching:p}=I(+u),d=s.useCallback(a=>{if(!a)return"";const t=L("/p/:id/fs/:fsId/*",h.pathname);return t?N(t.pattern.path,{...t.params,fsId:String(a)}):""},[h.pathname]),n=s.useMemo(()=>r==null?void 0:r.filter(a=>a.accepted),[r]),e=s.useMemo(()=>i==null?void 0:i.map(a=>{var o;const t=(o=n==null?void 0:n.find(c=>c.projectName===a.projectName))==null?void 0:o.permission;return{label:`${a.projectName} (${t?j[t]:"current"})`,key:a.featurestoreId}}),[i,n]),S=s.useMemo(()=>{const a=e==null?void 0:e.find(t=>t.key===+m);return(a==null?void 0:a.label)||""},[e,m]),b=s.useMemo(()=>(e==null?void 0:e.map(a=>a.label))??[],[e]),f=s.useCallback(a=>{var c;const t=(c=e==null?void 0:e.find(F=>F.label===a))==null?void 0:c.key,o=d(t);l(o)},[d,l,e]);return{selectFSValue:S,selectFSOptions:b,handleFSSelectionChange:f,isLoading:p,hasSharedFS:!!n&&n.length>0,isSharedLoading:g}};export{C as u};
