import{r as s,j as t}from"./vendor-react-wBh_31cN.js";import{u as p,j as A}from"./vendor-redux-CJZrIb6x.js";import{B as S}from"./back-button-CQo-pvZ0.js";import{c as j,d as y}from"./scope.selectors-C6FB6Cbj.js";import{aq as g,r as m}from"./index-dNe6i2rS.js";import{u as h}from"./useTitle-DQo_L6Ox.js";import{t as k}from"./titles-CzjGGAB3.js";import{A as L}from"./ApiForm-CIp0OHhC.js";import{A as b}from"./ApiKeyPopup-BE1xYjvA.js";import{a as C,u as P}from"./vendor-router-D1GqFWiT.js";import"./vendor-icons-BUUmD6ht.js";import"./vendor-utils-OeoE2qq_.js";import"./vendor-radix-BRyWS4bQ.js";import"./vendor-grid-CeFlDWv4.js";import"./callout-BFSXVeMz.js";import"./checkbox-group-C1CJIuf5.js";import"./checkbox-BlA4MwH9.js";import"./label-gPWmc6ow.js";import"./confirmation-dialog-C7dws5K4.js";import"./input-DFI7JniT.js";import"./useCopyToClipboard-DfzwgDFE.js";import"./useNotifier-BGMn6HaH.js";import"./notifications-5miqOdlG.js";import"./toast-wiGcevcF.js";import"./date-picker-K4pHuu1h.js";import"./popover-BzVbz_d3.js";import"./editable-select-DItn4ZHW.js";import"./index.esm-CAGtek53.js";import"./yup-XkUC3UEH.js";import"./card-BeQtvmcJ.js";import"./card-link-4kqDd55h.js";import"./getHopsDoc-B_Rq_F9V.js";import"./addDays-Cdit4yPz.js";import"./code-BwgxKro-.js";const pt=()=>{const c=p(j),n=p(y),{state:i={}}=C(),[u,l]=s.useState(""),[f,e]=s.useState(!1),o=A(),a=P();h(k.createAPI),s.useEffect(()=>(o.scope.fetch(),()=>{o.api.clear()}),[o]);const d=s.useCallback(async x=>{const{data:r}=await o.api.create({data:x});r!=null&&r.key&&(l(r.key),e(!0))},[o]);return n?t.jsx(g,{}):t.jsxs(t.Fragment,{children:[t.jsx(b,{isOpen:f,onClose:()=>e(!1),onSave:()=>a((i==null?void 0:i.redirectUrl)??m.account.api.list),createdKey:u}),t.jsx(S,{className:"mb-3 self-start",onClick:()=>a(m.account.api.list),children:"All API keys"}),t.jsx(L,{isLoading:c,onSubmit:d})]})};export{pt as default};
