import{ae as j,ax as w,u as y,dP as b,r,j as e,d as n,bM as k,b6 as c,aN as C,am as g}from"./index-CK33qGU_.js";import{C as E}from"./CardLabels-DNjldwBW.js";import{B as K}from"./ButtonWithRole-NHXEosto.js";j().shape({keyword:w.label("Keyword name")});const N=({value:s,onSave:o,isDisabled:i=!1,isSaving:d=!1,editRestrictionText:x})=>{const{id:h}=y(),{currentData:p=[]}=b(h),[a,l]=r.useState(s),[m,t]=r.useState(!1),u=r.useCallback(async()=>{t(!0),await o(a),t(!1)},[a,o]),f=r.useCallback(()=>{l(s),t(!1)},[s]);return m?e.jsxs(n,{gap:"10px",children:[e.jsx(n,{flex:"1",width:"100%",children:e.jsx(k,{isMulti:!0,value:a,options:p,placeholder:"keywords",variant:"white",onChange:l,noDataMessage:"No keywords defined"})}),e.jsxs(n,{gap:"10px",maxHeight:"33px",flex:"0 1 min-content",children:[e.jsx(c,{disabled:d,onClick:f,intent:"secondary",children:"Cancel"}),e.jsx(c,{"data-test":"save-keyword",onClick:u,isLoading:d,children:"Save"})]})]}):e.jsxs(n,{alignItems:"baseline",children:[s!=null&&s.length?e.jsx(E,{flexGrow:1,flexWrap:"wrap",labels:a}):e.jsx(C,{value:"No keywords"}),e.jsx(g,{disabled:!i,mainText:x??"You have no edit right on the feature store",children:e.jsx(K,{height:"20px",mt:"-7px",intent:"inline",disabled:i,onClick:()=>t(!0),children:"edit keywords"})})]})};export{N as K};
