import{aS as b,r as c,g as i,x as h,A as P,b8 as j,z as C,c as I,b as y,bh as _,b1 as S,b3 as u,aY as L,j as e,a$ as M,E as f,aU as d,cj as k,Q as a,o as g,aZ as v}from"./index-ea7817a2.js";import{s as E,a as N,b as z}from"./scope.selectors-1aab3a9c.js";import{c as D}from"./utils-297973b8.js";import"./useCurrentProject-0132f110.js";import"./useProject-77619fff.js";import"./FileUploaderButton-495e1c87.js";import"./useDownload-09eaf3eb.js";import"./props-31bc4ea7.js";import"./zipObj-08c84ab1.js";const K={td:{whiteSpace:"nowrap",textAlign:"left",pr:0},"td:nth-of-type(1)":{pl:"20px"},"td:nth-of-type(6)":{pr:"20px",svg:{fontSize:"14px"}},">table>tbody>tr:first-of-type":{mb:"0px"}},R=(t,n)=>{const s=b(),r=c.useMemo(()=>t.map(({scope:o})=>[i,n.length===o.length?h:i,i,h,h,P]),[t,n]),p=c.useMemo(()=>t.map(({name:o,scope:l,prefix:x,created:m,modified:w})=>[{children:o},{...l.length===n.length?{children:"full scope",gray:!0}:{children:D(l.map(A=>A.toLowerCase()).join(", "),65)}},{children:x},{gray:!0,children:j(new Date(m),"yyyy-MM-dd")},{gray:!0,children:j(new Date(w),"yyyy-MM-dd")},{intent:"ghost",icon:C.edit,tooltip:"Edit",onClick:()=>s(I(y.account.api.edit,"",{name:o}))}]),[t,s,n]);return c.useMemo(()=>[r,p],[r,p])},V=c.memo(_),$=()=>{const t=S(),n=u(E),s=u(N).sort((x,m)=>x.name.localeCompare(m.name));L(v.api);const r=b(),p=u(z),[o,l]=R(s,n);return c.useEffect(()=>{t.api.fetch(),t.scope.fetch()},[t]),p?e.jsx(M,{}):s.length?e.jsxs(e.Fragment,{children:[e.jsxs(f,{width:"1000px",title:"API keys",contentProps:{pb:0,overflow:"auto"},actions:e.jsx(d,{href:"https://docs.hopsworks.ai/".concat(k.docsVersion,"/user_guides/projects/api_key/create_api_key/"),external:!0,target:"_blank",p:0,intent:"inline",children:"documentation↗"}),children:[e.jsxs(a,{mb:"25x",children:[e.jsxs(a,{width:"100%",children:[e.jsx(i,{primary:!0,children:s.length}),e.jsx(i,{ml:"5px",children:s.length>1?" API keys":" API key"})]}),e.jsx(d,{minWidth:"105px",onClick:()=>r(y.account.api.create),children:"New API key"})]}),e.jsx(g,{mt:"20px",mx:"-20px",sx:K,children:e.jsx(V,{legend:["name","scope","API key prefix","creation","modification"],middleColumn:1,groupComponents:o,groupProps:l})})]}),e.jsx(g,{sx:{height:"20px",width:"100%",backgroundColor:"grayShade3",opacity:0},children:"invisible block margin"})]}):e.jsxs(f,{title:"API keys",actions:e.jsx(d,{href:"https://docs.hopsworks.ai/".concat(k.docsVersion,"/user_guides/projects/api_key/create_api_key/"),target:"_blank",external:!0,p:0,intent:"inline",children:"documentation↗"}),children:[e.jsxs(a,{mb:"25x",children:[e.jsxs(a,{width:"100%",children:[e.jsx(i,{primary:!0,children:"0"}),e.jsx(i,{ml:"5px",children:"API keys"})]}),e.jsx(d,{minWidth:"105px",onClick:()=>r(y.account.api.create),children:"New API key"})]}),e.jsx(g,{mt:"20px",mx:"-20px",children:e.jsx(a,{height:"50px",mt:"30px",justifyContent:"center",children:e.jsx(h,{fontSize:"18px",gray:!0,children:"No API keys defined"})})})]})};export{$ as default};
