import{r as a,aJ as e}from"./@ui-core-DKdciH1Z.js";import{a9 as g,ci as C,r as u,bQ as b,bU as y,ai as i,B as c,ap as j}from"./index-D7KLAbvI.js";import{H as x,B as h,F as v,W as N}from"./Wizard-CpBM0aaK.js";import{C as S}from"./configuration-form-DQMoUCqK.js";import{c as k,L as F}from"./@react-router-DaIuhn3X.js";import{S as B}from"./flavor-select-XFQkfujn.js";import{C as w}from"./ComponentIcon-BOKrWHiD.js";import{s as T}from"./constants-Dj_C1ZPH.js";import"./@reactflow-CJzATMj6.js";import"./@zod-DKyD3xVW.js";import"./@monaco-editor-CSMpaClf.js";import"./index-DPr7bdjs.js";import"./form-DKk08jkZ.js";import"./transform-Bq7p9csj.js";import"./check-tR7EFZ1z.js";import"./CodeSnippet-Dwuwo3ZI.js";import"./file-text-BLW8J__B.js";import"./bar-chart-square-check-Lt3fLSJ-.js";import"./layout-BRN9AeDt.js";function z(){const{setBreadcrumbs:s}=g();a.useEffect(()=>{s([C,{label:"Create",href:u.components.create}])},[s])}function H(){return z(),e.jsx(b,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(y,{className:"h-5 w-5 fill-turquoise-400"}),e.jsx("h1",{className:"text-display-xs font-semibold",children:"Register new Component"})]})})}function I({flavor:s,type:t,handleBack:r}){const l=a.useId(),o=k();function m(p){o(u.components.detail(p))}const d=s.body?.display_name??i(s.name);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{className:"flex items-center gap-2",children:[e.jsxs(c,{intent:"secondary",emphasis:"subtle",className:"flex aspect-square size-6 items-center justify-center",onClick:()=>r(),children:[e.jsx(j,{className:"size-5 shrink-0"}),e.jsx("span",{className:"sr-only",children:"Go step back"})]}),e.jsxs("span",{children:["Configure your ",d," ",i(t)]})]}),e.jsx(h,{className:"p-0",children:e.jsx(S,{flavorId:s.id,formId:l,successHandler:m,FooterComponent:L})})]})}function L({formId:s,isPending:t}){return e.jsxs(v,{children:[e.jsx(c,{asChild:!0,intent:"secondary",size:"md",children:e.jsx(F,{to:u.components.overview,children:"Cancel"})}),e.jsxs(c,{size:"md",disabled:t,type:"submit",form:s,children:[t&&e.jsx("div",{role:"alert","aria-busy":"true",className:"full h-[20px] w-[20px] animate-spin rounded-rounded border-2 border-theme-text-negative border-b-theme-text-brand"}),"Register Component"]})]})}function R({type:s,handleFlavorSelect:t,handleBack:r}){return e.jsxs(e.Fragment,{children:[e.jsxs(x,{className:"flex items-center gap-2",children:[e.jsxs(c,{intent:"secondary",emphasis:"subtle",className:"flex aspect-square size-6 items-center justify-center",onClick:()=>r(),children:[e.jsx(j,{className:"size-5 shrink-0"}),e.jsx("span",{className:"sr-only",children:"Go step back"})]}),e.jsxs("span",{children:["Select your ",i(s)," Flavor"]})," "]}),e.jsx(h,{children:e.jsx(B,{type:s,setSelectedFlavor:t})})]})}function q({selectTypeHandler:s}){return e.jsxs(e.Fragment,{children:[e.jsx(x,{children:"Select your Component Type"}),e.jsx(h,{children:e.jsx("ul",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4",children:T.map(t=>e.jsx(E,{type:t,selectTypeHandler:s},t))})})]})}function E({type:s,selectTypeHandler:t}){return e.jsxs("button",{onClick:()=>t(s),className:"flex h-[110px] flex-col items-center justify-center space-y-2 truncate whitespace-nowrap rounded-md border border-theme-border-moderate bg-theme-surface-secondary py-5 text-center text-text-sm text-theme-text-secondary transition-all duration-150 hover:bg-theme-surface-primary hover:shadow-sm",children:[e.jsx(w,{className:"h-5 w-5 shrink-0 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong",type:s}),e.jsx("span",{children:i(s)})]})}function W(){const[s,t]=a.useState(0),[r,l]=a.useState(null),[o,m]=a.useState();function d(n){l(n),t(1)}function p(n){m(n),t(2)}function f(){t(n=>n-1)}return e.jsxs(N,{children:[s===0&&e.jsx(q,{selectTypeHandler:d}),s===1&&r&&e.jsx(R,{type:r,handleFlavorSelect:p,handleBack:f}),s===2&&o&&r&&e.jsx(I,{flavor:o,type:r,handleBack:f})]})}function re(){return e.jsxs("div",{className:"space-y-5",children:[e.jsx(H,{}),e.jsx("section",{className:"layout-container pb-5",children:e.jsx(W,{})})]})}export{re as default};
