import{u as y,w as I,r as n,f as L,bv as E,bx as T,by as P,j as t,L as k,cr as w,s as F,bA as B}from"./index-C1DmWO_C.js";import{d as M,e as O,f as R}from"./index-DDgDmsNg.js";import{R as $}from"./RedirectInProject-DyNX4L_7.js";import{S as G}from"./StorageConnectorsForm-hi7kKabn.js";import{g as N,a as v,h as A}from"./utils-DospTenN.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./storage-connector-BuEuJyVA.js";import"./Project-CpwJZ-CK.js";import"./alertManagerConfig.selectors-B9ELaxCY.js";import"./index-Dub34MAX.js";import"./FileUploaderButton-BtxUzlTS.js";import"./zipObj-D8EtfWld.js";import"./symmetricDifference-B3GPGppJ.js";import"./git-C8OLuEaG.js";import"./NoData-Y_e6mfNf.js";import"./useCopyToClipboard-v9FBn9Nz.js";import"./Anchor-DFXOcnPw.js";import"./flip-DcJ5-1Gs.js";const ae=()=>{const{connectorName:s,id:r,fsId:o}=y(),[g,a]=I(),[c,{error:f,isLoading:d,isSuccess:S}]=M(),[p,{isLoading:m,isSuccess:C}]=O(),{currentData:e,isFetching:b}=R({pId:+r,fsId:+o,id:s}),x=n.useCallback(async l=>{const{storageConnectorType:u}=l,j=L(E("type",v(u)),N(u))(l);await c({pId:+r,fsId:+o,id:s,data:j}).unwrap()},[c,r,s,o]),D=n.useCallback(()=>p({pId:+r,fsId:+o,id:s}),[p,o,r,s]),i=e==null?void 0:e.storageConnectorType,h=n.useMemo(()=>A(i)(e),[e,i]);return T(`${P.editStorageConnector} - ${e==null?void 0:e.name}`),b?t.jsx(k,{}):e?S||C?t.jsx($,{to:F.storageConnector.list,params:{fsId:o}}):t.jsxs(t.Fragment,{children:[t.jsx(G,{error:f,isLoading:d||m,isDisabled:d,onSubmit:x,initialProtocol:i,initialData:h,onDelete:a,isEdit:!0}),t.jsx(B,{title:`Delete ${e.name}`,secondaryText:"Once you delete a storage connector, there is no going back. Please be certain.",isOpen:g,onClose:a,mainButtonProps:{children:"Delete storage connector",onClick:D,isLoading:m},secondaryButtonProps:{children:"Back",onClick:a}})]}):t.jsx(w,{})};export{ae as default};
