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