import{u as b,bI as t,bH as f,bo as x,bw as g,bx as A,r as o,q as c,j as a,D as h,b1 as y}from"./index-46ma1THH.js";import{d as L,e as S,b as j,a as E}from"./scope.selectors-C6FB6Cbj.js";import{A as k}from"./ApiForm-DiiRmSSB.js";const N=()=>{const{name:r}=b(),l=t(L),p=t(S),d=t(j),s=f(),e=x(),u=t(E);g(A.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(h,{}):a.jsxs(a.Fragment,{children:[a.jsx(y,{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};
