import{j as a,d as n,K as h}from"./index-Dz5JRQhj.js";const x=({name:s,relatedChip:r,titleClassName:d,parentItems:u,centerControls:m,controls:o,isLoaded:p,formik:e,renameDisabledReason:t})=>{const l=t===void 0,c=()=>{setTimeout(()=>window.dispatchEvent(new Event("resize")),10),!(!l||!e)&&e.setValues({...e.values,name:s,isRenaming:!e.values.isRenaming})};return a.jsxs("div",{className:"p-panel__header rename-header",children:[a.jsx("h1",{className:"u-off-screen",children:s}),a.jsxs("div",{className:h("p-panel__title",d),children:[a.jsxs("nav",{className:"p-breadcrumbs p-breadcrumbs--large","aria-label":"Breadcrumbs",children:[a.jsxs("ol",{className:"p-breadcrumbs__items breadcrumb-wrapper",children:[u.map((i,b)=>a.jsx("li",{className:"p-heading--4 u-no-margin--bottom continuous-breadcrumb",children:i},b)),e?.values.isRenaming?a.jsxs("li",{className:"p-breadcrumbs__item rename",children:[a.jsx(n.Input,{autoFocus:!0,id:"name",name:"name",className:"name-input",onBlur:e.handleBlur,onChange:e.handleChange,value:e.values.name,error:e.touched.name?e.errors.name:null,onKeyUp:i=>i.key==="Enter"&&void e.submitForm(),type:"text"}),a.jsxs("div",{children:[a.jsx(n.Button,{appearance:"base",className:"cancel",onClick:c,children:"Cancel"}),a.jsx(n.ActionButton,{appearance:"positive",loading:e.isSubmitting,disabled:!e.isValid||e.isSubmitting||s===e.values.name,onClick:()=>{e.submitForm()},children:"Save"})]})]}):a.jsx("li",{className:"p-heading--4 u-no-margin--bottom name continuous-breadcrumb u-truncate",onClick:c,title:l?`Rename ${s}`:"",children:a.jsx(n.Tooltip,{message:!l&&t,position:"btm-left",children:s})})]}),r]},"breadcrumbs"),!e?.values.isRenaming&&m]}),p&&!e?.values.isRenaming&&a.jsx("div",{className:"p-panel__controls",children:o})]})};export{x as R};
