import{d as n,r as d,D as p,j as t,H as x,n as f,J as l}from"./index-Cziemgsu.js";import{F as v,i as h,Y as A}from"./FormMenuItem-phSiN9Ls.js";import{A as F}from"./AutoExpandingTextArea-Bc4N4lSt.js";import{S as w}from"./FormFooterLayout-BJQGpdhQ.js";import{Y as y}from"./YamlNotification-hNvwvtOz.js";const g="Main configuration",u="YAML configuration",b=({active:e,setActive:a})=>{var i;const s=n.useNotify(),o={active:e,setActive:a},r=()=>{x("form-navigation","p-bottom-controls")};return d.useEffect(r,[(i=s.notification)==null?void 0:i.message]),p("resize",r),t.jsx("div",{className:"p-side-navigation--accordion form-navigation",children:t.jsx("nav",{"aria-label":"Network form navigation",children:t.jsx("ul",{className:"p-side-navigation__list",children:t.jsx(v,{label:g,...o})})})})},C=({formik:e})=>{const a=s=>({id:s,name:s,onBlur:e.handleBlur,onChange:o=>{h(e),e.handleChange(o)},value:e.values[s]??"",error:e.touched[s]?e.errors[s]:null,placeholder:`Enter ${s.replaceAll("_"," ")}`});return t.jsx(w,{children:t.jsx(n.Row,{children:t.jsxs(n.Col,{size:12,children:[t.jsx(n.Input,{...a("name"),type:"text",label:"Name",required:!0,disabled:e.values.readOnly||!e.values.isCreating,help:e.values.isCreating?void 0:"Click the name in the header to rename the network ACL"}),t.jsx(F,{...a("description"),label:"Description"})]})})})},L=e=>({name:e.name,description:e.description}),O=({formik:e,getYaml:a,section:s,setSection:o,version:r=0})=>{var m;const i=f(),j=n.useNotify(),c=()=>{x("form-contents","p-bottom-controls")};return d.useEffect(c,[(m=j.notification)==null?void 0:m.message,s]),p("resize",c),t.jsxs(n.Form,{className:"form network-form",onSubmit:e.handleSubmit,children:[t.jsx(n.Input,{type:"submit",hidden:!0,value:"Hidden input"}),s!==l(u)&&t.jsx(b,{active:s,setActive:o}),t.jsx(n.Row,{className:"form-contents",children:t.jsxs(n.Col,{size:12,children:[s===l(g)&&t.jsx(C,{formik:e}),s===l(u)&&t.jsx(A,{yaml:a(),setYaml:N=>{h(e),e.setFieldValue("yaml",N)},children:t.jsx(y,{entity:"network-acl",href:`${i}/explanation/networks/#managed-networks`})},`yaml-form-${r}`)]})},s)]})};export{g as M,O as N,u as Y,L as t};
