import{u as y,P as I,ie as P,ig as E,ih as L,r as n,W as T,cW as k,aY as F,aZ as $,j as t,a$ as B,cf as M,b as O,b0 as R}from"./index-ea7817a2.js";import{R as w}from"./RedirectInProject-7cd1be4f.js";import{S as G}from"./StorageConnectorsForm-66d28a35.js";import{g as N,a as W,h as Q}from"./utils-297973b8.js";import"./Project-80a71be4.js";import"./index-43e7382e.js";import"./FileUploaderButton-495e1c87.js";import"./useDownload-09eaf3eb.js";import"./useCurrentProject-0132f110.js";import"./useProject-77619fff.js";import"./PrimaryIconButton-fe990c52.js";import"./zipObj-08c84ab1.js";import"./dumbPluralize-86a9b9d6.js";import"./git-d9965c1a.js";import"./NoData-8733f606.js";import"./index-8f672200.js";import"./file-utils-a5f053e8.js";import"./alertManagerConfig.selectors-c57f191b.js";import"./props-31bc4ea7.js";const ie=()=>{const{connectorName:s,id:r,fsId:o}=y(),[g,a]=I(),[c,{error:S,isLoading:p,isSuccess:f}]=P(),[d,{isLoading:m,isSuccess:C}]=E(),{currentData:e,isFetching:x}=L({pId:+r,fsId:+o,id:s}),D=n.useCallback(async l=>{const{storageConnectorType:u}=l,b=T(k("type",W(u)),N(u))(l);await c({pId:+r,fsId:+o,id:s,data:b}).unwrap()},[c,r,s,o]),h=n.useCallback(()=>d({pId:+r,fsId:+o,id:s}),[d,o,r,s]),i=e==null?void 0:e.storageConnectorType,j=n.useMemo(()=>Q(i)(e),[e,i]);return F(`${$.editStorageConnector} - ${e==null?void 0:e.name}`),x?t.jsx(B,{}):e?f||C?t.jsx(w,{to:O.storageConnector.list,params:{fsId:o}}):t.jsxs(t.Fragment,{children:[t.jsx(G,{error:S,isLoading:p||m,isDisabled:p,onSubmit:D,initialProtocol:i,initialData:j,onDelete:a,isEdit:!0}),t.jsx(R,{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:h,isLoading:m},secondaryButtonProps:{children:"Back",onClick:a}})]}):t.jsx(M,{})};export{ie as default};
