import{af as G,j as e,q as i,F as T,fC as ee,o as se,bp as te,r as m,p as ne,fj as oe,Q as N,ay as ie,bZ as re,gJ as ae,ar as le,gr as xe,gK as pe,eN as me,a as ce,an as y,c6 as de,d as he,ee as W,en as ue,eo as ge,be as _,bl as c,ao as z,v as r,eh as d,gL as je}from"./index-DHiyXWqE.js";import{u as fe,D as be}from"./Deprecated-C23Jh13V.js";const ye=({children:n})=>{const o=document.getElementById("panel-portal");return o?G.createPortal(e.jsx(i,{sx:{position:"sticky",top:"0px",zIndex:10,width:"100%",flexDirection:"column"},children:n}),o):n},Te=ee`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,Ie=({children:n,...o})=>e.jsx(T,{sx:{animation:`${Te} 1.5s ease infinite`},...o,children:n}),ve=n=>({minWidth:je,bg:"white",boxShadow:"0px 4px 163px -99px rgba(0, 0, 0, 0.25)",borderBottomColor:"grayShade2",borderBottomWidth:"1px",borderBottomStyle:"solid",justifyContent:"center",":after":{content:'""',width:"100%",height:"10px",position:"absolute",top:"-10px"},...n&&{bg:"grayShade2"}}),$e=({onClickEdit:n,onClickDelete:o,onClickRefresh:I,isEditDisabled:v,isVersionsLoading:A,title:a,id:P,idColor:h,versions:x=[],version:u,onVersionChange:M,hasCommits:H=!1,commits:g=[],commit:$,handleCommitChange:k,showDelete:L=!1,type:q=W.td,data:s,status:j,withoutPin:O=!1,pathnamePostFix:U="",editRightText:Q,children:R})=>{var B,D,E;const f=s==null?void 0:s.deprecated,b=se(U,te().pathname),{isActiveFeatures:w,handleBasket:Y,isSwitch:Z}=fe(),C=m.useMemo(()=>Math.max(...x.map(({version:t})=>t)||[]),[x]),S=m.useMemo(()=>ne(re(ae(N("version"))),ie(({version:t,deployments:F=0})=>({value:`${t}`,label:`${t} ${t===C?"(latest)":""}`,deployments:F?`${F} dep.`:""})),oe(N("value")))(x),[x,C]),l=m.useMemo(()=>g.map(t=>({label:`${le(+t)}${t===g[0]?" (latest)":""}`,value:`${t}`})),[g]),{pinnedIds:J,handlePin:K,handleUnPin:V}=m.useContext(xe),p=J.includes(b),X=()=>p?V(b):K({id:b,name:s.name,entityVersion:s.version,entityId:s.id,color:h});return e.jsx(ye,{children:e.jsx(i,{alignItems:"center",minHeight:"50px",sx:ve(f),children:e.jsxs(i,{width:"100%",maxWidth:`min(calc(100% - 20px), calc(${pe} - 25px))`,alignItems:"flex-end",children:[e.jsxs(i,{alignItems:"center",children:[j&&e.jsx(me,{mainText:j.text,variant:j.variant}),f&&e.jsx(be,{}),e.jsxs(ce,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(y,{mainText:a,disabled:!a||(a==null?void 0:a.length)<55,children:e.jsx(T,{sx:{...de,maxWidth:"650px"},children:a})}),P&&e.jsxs(he,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:h},as:"span",children:["#",P]})]}),Z&&!!s&&q===W.fg&&e.jsx(T,{onClick:t=>t.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(ue,{possible:s.features.length>0,handleClick:Y(s.features,s),mode:ge.bulk,tooltipMainText:w(s.features,s)?"Remove all features from basket":"Add all features to basket",tooltipSecondaryText:`${s.features.length} features`,inBasket:w(s.features,s)})}),e.jsxs(i,{alignItems:"center",m:"auto 0",children:[(u||s.version)&&(M&&S.length>1?e.jsx(_,{width:"143px",value:`${u}`,options:S,placeholder:"version",onChange:M}):e.jsxs(e.Fragment,{children:[e.jsx(c,{color:"gray",children:"version"}),e.jsx(c,{mx:"5px",color:h,children:u??s.version})]})),A&&e.jsx(Ie,{children:e.jsx(z,{icon:r.loading})})]}),(s==null?void 0:s.missingMandatoryTags)&&s.missingMandatoryTags.length>0&&e.jsx(y,{mainText:`Missing mandatory tags: ${s.missingMandatoryTags.map(t=>t.name).join(", ")}`,position:"bottom",children:e.jsx(i,{alignItems:"center",ml:"10px",children:e.jsx(z,{icon:r.warning,size:"sm",color:"labels.red"})})}),H&&k&&(l.length>1?e.jsx(_,{ml:"20px",my:"5px",width:"280px",value:$||((B=l[0])==null?void 0:B.value),options:l,placeholder:"commit time",onChange:k,maxListHeight:"400px"}):e.jsxs(i,{my:"5px",ml:"20px",alignItems:"flex-end",children:[e.jsx(c,{color:"gray",children:"commit"}),e.jsx(c,{mx:"5px",children:((D=l.find(t=>t.value===$))==null?void 0:D.label)||((E=l[0])==null?void 0:E.label)||"latest"})]}))]}),R,e.jsxs(i,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"10px"},children:[L&&e.jsx(y,{mainText:"Your role is not allowed to perform this action",disabled:!!o,children:e.jsx(d,{"data-test":"delete-button",icon:r.bin,onClick:o,disabled:!o,tooltipText:"Delete",borderless:!0})}),n&&!f&&e.jsx(d,{"data-test":"edit-button",icon:r.edit,onClick:n,tooltipText:v?Q??"You have no edit right on the feature store":"",disabled:v,borderless:!0}),I&&e.jsx(d,{icon:r.refresh,onClick:I,tooltipText:"Refresh",borderless:!0}),!O&&e.jsx(d,{"data-test":p?"unpin-item":"pin-item",icon:p?r.pin_filled:r.pin_empty,onClick:X,tooltipText:p?"Unpin from shortcuts":"Pin to shortcuts",borderless:!0})]})]})})})};export{$e as P};
