import{aa as G,j as e,B as r,fv as J,e as y,n as ee,bq as te,r as m,p as se,X as D,ax as ne,bM as oe,eY as re,an as ae,fC as ie,fG as le,es as xe,V as pe,ar as W,aW as me,Q as ce,e0 as _,e7 as de,e8 as he,bm as z,bK as c,as as ue,Z as i}from"./index-dP1W1_bd.js";import{u as fe,D as je}from"./Deprecated-ClfPkp7s.js";import{C as d}from"./CardActionButton-BtCnEqTK.js";import{u as be}from"./uniqBy-6mvKp2Ip.js";const ge=({children:n})=>{const o=document.getElementById("panel-portal");return o?G.createPortal(e.jsx(r,{sx:{position:"sticky",top:"0px",zIndex:10,width:"100%",flexDirection:"column"},children:n}),o):n},ye=J`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,ve=({children:n,...o})=>e.jsx(y,{sx:{animation:`${ye} 1.5s ease infinite`},...o,children:n}),Ie=n=>({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"}}),we=({onClickEdit:n,onClickDelete:o,onClickRefresh:v,isEditDisabled:I,isVersionsLoading:F,title:a,id:T,idColor:h,versions:x=[],version:u,onVersionChange:k,hasCommits:N=!1,commits:f=[],commit:B,handleCommitChange:C,showDelete:V=!1,type:H=_.td,data:t,status:j,withoutPin:L=!1,pathnamePostFix:Y="",editRightText:q,children:K})=>{var S,M,E;const b=t==null?void 0:t.deprecated,g=ee(Y,te().pathname),{isActiveFeatures:w,handleBasket:O,isSwitch:Q}=fe(),P=m.useMemo(()=>Math.max(...x.map(({version:s})=>s)||[]),[x]),$=m.useMemo(()=>se(oe(re(D("version"))),ne(({version:s,deployments:A=0})=>({value:`${s}`,label:`${s} ${s===P?"(latest)":""}`,deployments:A?`${A} dep.`:""})),be(D("value")))(x),[x,P]),l=m.useMemo(()=>f.map(s=>({label:`${ae(+s)}${s===f[0]?" (latest)":""}`,value:`${s}`})),[f]),{pinnedIds:R,handlePin:U,handleUnPin:X}=m.useContext(ie),p=R.includes(g),Z=()=>p?X(g):U({id:g,name:t.name,entityVersion:t.version,entityId:t.id,color:h});return e.jsx(ge,{children:e.jsx(r,{alignItems:"center",minHeight:"50px",sx:Ie(b),children:e.jsxs(r,{width:"100%",maxWidth:le,alignItems:"flex-end",px:"10px",children:[e.jsxs(r,{alignItems:"center",children:[j&&e.jsx(xe,{mb:"5px",mr:"-5px",mainText:j.text,variant:j.variant}),b&&e.jsx(je,{}),e.jsxs(pe,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(W,{mainText:a,disabled:!a||(a==null?void 0:a.length)<55,children:e.jsx(y,{sx:{...me,maxWidth:"650px"},children:a})}),T&&e.jsxs(ce,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:h},as:"span",children:["#",T]})]}),Q&&!!t&&H===_.fg&&e.jsx(y,{onClick:s=>s.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(de,{possible:t.features.length>0,handleClick:O(t.features,t),mode:he.bulk,tooltipMainText:w(t.features,t)?"Remove all features from basket":"Add all features to basket",tooltipSecondaryText:`${t.features.length} features`,inBasket:w(t.features,t)})}),e.jsxs(r,{alignItems:"center",m:"auto 0",children:[(u||t.version)&&(k&&$.length>1?e.jsx(z,{width:"143px",value:`${u}`,options:$,placeholder:"version",onChange:k}):e.jsxs(e.Fragment,{children:[e.jsx(c,{color:"gray",children:"version"}),e.jsx(c,{mx:"5px",color:h,children:u??t.version})]})),F&&e.jsx(ve,{children:e.jsx(ue,{icon:i.loading})})]}),N&&C&&(l.length>1?e.jsx(z,{ml:"20px",my:"5px",width:"280px",value:B||((S=l[0])==null?void 0:S.value),options:l,placeholder:"commit time",onChange:C,maxListHeight:"400px"}):e.jsxs(r,{my:"5px",ml:"20px",alignItems:"flex-end",children:[e.jsx(c,{color:"gray",children:"commit"}),e.jsx(c,{mx:"5px",children:((M=l.find(s=>s.value===B))==null?void 0:M.label)||((E=l[0])==null?void 0:E.label)||"latest"})]}))]}),K,e.jsxs(r,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"10px"},children:[V&&e.jsx(W,{mainText:"Your role is not allowed to perform this action",disabled:!!o,children:e.jsx(d,{"data-test":"delete-button",icon:i.bin,onClick:o,tooltipText:"Delete",borderless:!0})}),n&&!b&&e.jsx(d,{"data-test":"edit-button",icon:i.edit,onClick:n,tooltipText:I?q??"You have no edit right on the feature store":"",disabled:I,borderless:!0}),v&&e.jsx(d,{icon:i.refresh,onClick:v,tooltipText:"Refresh",borderless:!0}),!L&&e.jsx(d,{"data-test":p?"unpin-item":"pin-item",icon:p?i.pin_filled:i.pin_empty,onClick:Z,tooltipText:p?"Unpin from shortcuts":"Pin to shortcuts",borderless:!0})]})]})})})};export{we as P};
