import{i as r}from"./_virtual___federation_fn_import-DB-0B1B_.js";import{j as e}from"./jsx-runtime-u17CrQMm.js";import{a as P}from"./zod-DVFqTTZn.js";import{R as k}from"./index-DbAjQnMT.js";const{appEntityType:C,createWebAppSchema:F}=await r("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:N,useDefinitionSchema:D,useProjectDefinition:L,useResettableForm:E}=await r("@baseplate-dev/project-builder-lib/web"),{Button:R,FormActionBar:B,InputFieldController:o,SectionList:I,SectionListSection:l,SectionListSectionContent:c,SectionListSectionDescription:d,SectionListSectionHeader:p,SectionListSectionTitle:m,SwitchFieldController:h}=await r("@baseplate-dev/ui-components"),{Link:T}=await r("@tanstack/react-router");function M(){const{saveDefinitionWithFeedback:u,definition:j}=L(),{webDefinition:s}=k.useRouteContext(),f=C.keyFromId(s.id),v=s.adminApp.enabled,y=()=>{u(a=>{const n=a.apps.find(i=>i.id===s.id);n?.type==="web"&&(n.adminApp.enabled=!0)},{successMessage:"Admin panel enabled!"})},S=D(F),b=E({resolver:P(S),values:s}),{control:t,handleSubmit:A,reset:g,setError:w}=b,x=A(a=>{if(a.devPort){const n=j.apps.find(i=>i.id!==s.id&&i.devPort===a.devPort);if(n){w("devPort",{type:"manual",message:`Port ${a.devPort} is already used by app "${n.name}"`});return}}return u(n=>{n.apps=n.apps.map(i=>i.id===s.id?a:i)})});return N({control:t,reset:g,onSubmit:x}),e.jsxs("form",{onSubmit:x,className:"w-full max-w-7xl space-y-4 p-4",children:[e.jsxs(I,{children:[e.jsxs(l,{children:[e.jsxs(p,{children:[e.jsx(m,{children:"General"}),e.jsx(d,{children:"Basic configuration for your web application."})]}),e.jsxs(c,{className:"space-y-6",children:[e.jsx(o,{label:"Name",control:t,name:"name"}),e.jsx(o,{label:"Page Title",control:t,name:"title"}),e.jsx(o,{label:"Description Meta Tag",control:t,name:"description"}),e.jsx(o,{label:"Development Port",control:t,name:"devPort",type:"number",registerOptions:{valueAsNumber:!0},description:"Port number for the development server (e.g., 5030)"})]})]}),e.jsxs(l,{children:[e.jsxs(p,{children:[e.jsx(m,{children:"Features"}),e.jsx(d,{children:"Configure optional features for your web application."})]}),e.jsxs(c,{className:"space-y-6",children:[e.jsx(h,{label:"Include Auth?",control:t,name:"includeAuth"}),e.jsx(h,{label:"Include Upload Components?",control:t,name:"includeUploadComponents"})]})]}),e.jsxs(l,{children:[e.jsxs(p,{children:[e.jsx(m,{children:"Admin Panel"}),e.jsx(d,{children:"Add an administrative interface to manage your data models."})]}),e.jsx(c,{children:v?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Admin panel is enabled."," ",e.jsx(T,{to:"/packages/apps/$key/web/admin",params:{key:f},className:"text-foreground underline",children:"Configure admin settings"})]}):e.jsx(R,{variant:"secondary",onClick:y,children:"Enable Admin Panel"})})]})]}),e.jsx(B,{form:b})]})}export{M as component};
//# sourceMappingURL=index-Cu7q83NJ.js.map
