import{u as f,aL as t,aD as x,bw as g,bC as b,r as o,s as c,j as a,L as A,aG as L,bD as h}from"./index-dP1W1_bd.js";import{d as y,e as S,b as j,a as E}from"./scope.selectors-C6FB6Cbj.js";import{A as k}from"./ApiForm-CdjbKaUS.js";const N=()=>{const{name:r}=f(),l=t(y),p=t(S),d=t(j),s=x(),e=g(),u=t(E);b(h.editAPI);const n=u.find(({name:i})=>i===r);o.useEffect(()=>(s.api.fetch(),s.scope.fetch(),()=>{s.api.clear()}),[s]);const m=o.useCallback(async i=>{await s.api.edit({data:i}),e(c.account.api.list)},[s,e]);return l||d||!n?a.jsx(A,{}):a.jsxs(a.Fragment,{children:[a.jsx(L,{mb:"15px",ml:"-12px",intent:"inline",alignSelf:"flex-start",onClick:()=>e(c.account.api.list),children:"⇽ all API keys"}),a.jsx(k,{isEdit:!0,initialData:n,isLoading:p,onSubmit:m})]})};export{N as default};
