import{j as o,r as m}from"./vendor-react-wBh_31cN.js";import{A}from"./animated-progress-DY4TkPAt.js";import{u as N}from"./useNotifier-BGMn6HaH.js";import{R as h,X as E,g as d,r as n}from"./index-dNe6i2rS.js";import{L}from"./label-gPWmc6ow.js";import{u as v}from"./useTitle-DQo_L6Ox.js";import{a as O,b as y}from"./index-DURBtSjL.js";import{t as w}from"./titles-CzjGGAB3.js";import{A as b}from"./constants-CHYRqupQ.js";import{P as F}from"./ProjectForm-BqDp1fVv.js";import{u as G}from"./vendor-router-D1GqFWiT.js";import"./notifications-5miqOdlG.js";import"./toast-wiGcevcF.js";import"./vendor-redux-CJZrIb6x.js";import"./vendor-utils-OeoE2qq_.js";import"./vendor-icons-BUUmD6ht.js";import"./vendor-radix-BRyWS4bQ.js";import"./vendor-grid-CeFlDWv4.js";import"./index.esm-CAGtek53.js";import"./yup-XkUC3UEH.js";import"./getInputValidation-B3ahFDSx.js";import"./input-DFI7JniT.js";import"./card-BeQtvmcJ.js";import"./form-footer-Drg8-unW.js";import"./tooltip-DFFgUYh6.js";import"./utils-DT8scj4W.js";import"./storage-connector-DQCKY9HZ.js";import"./combobox-QqI9aNup.js";import"./input-group-gxy3DSmS.js";import"./textarea-BJVuSob1.js";import"./vendor-recharts-DmJlpLaF.js";import"./hoverable-link-BgaAJWrR.js";import"./getHopsDoc-B_Rq_F9V.js";import"./selectors-DK1_X0Cd.js";import"./index-DLI8oDiK.js";import"./ArrayField-DnSSsYNA.js";import"./icon-button-BZeFL7T7.js";import"./radio-group-CjbLFQxV.js";import"./always-oSAuSdys.js";import"./useCurrentProject-CTMLbmkf.js";import"./useProject-BbrP3CX5.js";import"./confirmation-dialog-C7dws5K4.js";import"./useCopyToClipboard-DfzwgDFE.js";import"./fileExplorer-DEDqs5DH.js";import"./useDownload-TmtSNiQ3.js";import"./getPathAndFileName-BId4RGny.js";import"./FileUploaderButton-8zI4DD0I.js";import"./fileUploader-Bkmyjd3t.js";import"./index-B3Hxcv-8.js";import"./file-utils-B4k-DQmp.js";import"./converge-D7u3m7i4.js";import"./lensPath-D2xKReso.js";import"./join-oazOKFfj.js";import"./init-Dq_gEBi9.js";import"./ifElse-D151OpR6.js";import"./length-DKJxdznt.js";import"./_isNumber-DRgbAj-F.js";import"./inc-BMMaAqPC.js";import"./add-SI0q72Q7.js";import"./append-DQbPxMil.js";import"./includes-ucXR_9jq.js";import"./uniq--Ej6WwWR.js";import"./uniqBy-6oWnYXMs.js";import"./concat-CTXo1gGM.js";import"./useDebounce-BiuGz9t2.js";import"./dumbPluralize-CcxDsNiu.js";import"./utils-DDC-jqbJ.js";import"./all-SKhbxKhE.js";import"./mergeRight-D1nsCm60.js";import"./juxt-B5kKHsyp.js";import"./checkbox-BlA4MwH9.js";import"./callout-BFSXVeMz.js";import"./value-7N0Keti9.js";import"./props-ljQIuZvU.js";import"./zipObj-C8Moen4w.js";const I=({children:t})=>o.jsxs("div",{className:"flex w-full flex-col items-center",children:[o.jsx(h,{bold:!0,gray:!0,className:"mb-2 text-lg",children:"Building new project"}),o.jsx(L,{className:"mb-5",children:"Project creation"}),t]}),it=()=>{const t=G(),c=N(),{currentData:a,isLoading:S}=O(),[u]=y(),{data:l}=E("trino_enabled"),{data:g}=E("superset_enabled"),[T,p]=m.useState({isProgressing:!1,isSuccess:!1,isError:!1}),f=m.useCallback(r=>{t(d(n.project.prj.view,n.project.value,{id:r}))},[t]),j=m.useCallback(async r=>{p(e=>({...e,isProgressing:!1,isSuccess:!0})),setTimeout(()=>{r?f(r):t(d(n.project.list))},1e3)},[t,f]),x=m.useCallback(async r=>{var e;try{p(s=>({...s,isProgressing:!0,isError:!1}));const i=await u({services:["JOBS","JUPYTER","HIVE","KAFKA","FEATURESTORE","SERVING","AIRFLOW",...l?["TRINO"]:[],...g?["SUPERSET"]:[]],projectName:r.projectName,namespace:r.namespace,description:r.description,featureStoreTopic:r.featureStoreTopic}).unwrap();j(i.data)}catch(i){p(C=>({...C,isProgressing:!1,isError:!0}));const s=(e=i==null?void 0:i.response)==null?void 0:e.data;c.error({title:"Error",content:`${s.errorMsg||""} ${s.usrMsg||""}`})}},[u,j,c,l,g]),{isProgressing:P,isSuccess:R}=T;return v(w.createProject),o.jsx(F,{projectsNames:a==null?void 0:a.map(({projectName:r})=>r),isLoading:S,onSubmit:x,isProgressingSubmit:P,isSuccessSubmit:R,progressElement:o.jsx(I,{children:o.jsx(A,{isAnimating:P,animationDuration:b/100,incrementDuration:b/25})})})};export{it as default};
