import{ag as Q,j as e,$ as a,L as y,fr as Z,m as ee,bg as te,r as c,p as se,fb as ne,U as A,az as oe,bK as ae,fJ as re,at as ie,fB as le,fK as xe,eM as pe,v as ce,ao as E,bT as me,f as de,ee as F,en as he,eo as ue,bd as L,bF as m,ap as fe,C as i,eh as d}from"./index-46ma1THH.js";import{u as be,D as je}from"./Deprecated-CcWZugSq.js";const ge=({children:n})=>{const o=document.getElementById("panel-portal");return o?Q.createPortal(e.jsx(a,{sx:{position:"sticky",top:"0px",zIndex:10,width:"100%",flexDirection:"column"},children:n}),o):n},ye=Z`
  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}),Te=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"}}),ke=({onClickEdit:n,onClickDelete:o,onClickRefresh:v,isEditDisabled:T,isVersionsLoading:_,title:r,id:I,idColor:h,versions:x=[],version:u,onVersionChange:$,hasCommits:U=!1,commits:f=[],commit:k,handleCommitChange:w,showDelete:W=!1,type:H=F.td,data:t,status:b,withoutPin:N=!1,pathnamePostFix:Y="",editRightText:K,children:O})=>{var S,D,M;const j=t==null?void 0:t.deprecated,g=ee(Y,te().pathname),{isActiveFeatures:B,handleBasket:R,isSwitch:q}=be(),C=c.useMemo(()=>Math.max(...x.map(({version:s})=>s)||[]),[x]),P=c.useMemo(()=>se(ae(re(A("version"))),oe(({version:s,deployments:z=0})=>({value:`${s}`,label:`${s} ${s===C?"(latest)":""}`,deployments:z?`${z} dep.`:""})),ne(A("value")))(x),[x,C]),l=c.useMemo(()=>f.map(s=>({label:`${ie(+s)}${s===f[0]?" (latest)":""}`,value:`${s}`})),[f]),{pinnedIds:J,handlePin:V,handleUnPin:X}=c.useContext(le),p=J.includes(g),G=()=>p?X(g):V({id:g,name:t.name,entityVersion:t.version,entityId:t.id,color:h});return e.jsx(ge,{children:e.jsx(a,{alignItems:"center",minHeight:"50px",sx:Te(j),children:e.jsxs(a,{width:"100%",maxWidth:`min(calc(100% - 50px), calc(${xe} - 65px))`,alignItems:"flex-end",px:"10px",children:[e.jsxs(a,{alignItems:"center",children:[b&&e.jsx(pe,{mainText:b.text,variant:b.variant}),j&&e.jsx(je,{}),e.jsxs(ce,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(E,{mainText:r,disabled:!r||(r==null?void 0:r.length)<55,children:e.jsx(y,{sx:{...me,maxWidth:"650px"},children:r})}),I&&e.jsxs(de,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:h},as:"span",children:["#",I]})]}),q&&!!t&&H===F.fg&&e.jsx(y,{onClick:s=>s.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(he,{possible:t.features.length>0,handleClick:R(t.features,t),mode:ue.bulk,tooltipMainText:B(t.features,t)?"Remove all features from basket":"Add all features to basket",tooltipSecondaryText:`${t.features.length} features`,inBasket:B(t.features,t)})}),e.jsxs(a,{alignItems:"center",m:"auto 0",children:[(u||t.version)&&($&&P.length>1?e.jsx(L,{width:"143px",value:`${u}`,options:P,placeholder:"version",onChange:$}):e.jsxs(e.Fragment,{children:[e.jsx(m,{color:"gray",children:"version"}),e.jsx(m,{mx:"5px",color:h,children:u??t.version})]})),_&&e.jsx(ve,{children:e.jsx(fe,{icon:i.loading})})]}),U&&w&&(l.length>1?e.jsx(L,{ml:"20px",my:"5px",width:"280px",value:k||((S=l[0])==null?void 0:S.value),options:l,placeholder:"commit time",onChange:w,maxListHeight:"400px"}):e.jsxs(a,{my:"5px",ml:"20px",alignItems:"flex-end",children:[e.jsx(m,{color:"gray",children:"commit"}),e.jsx(m,{mx:"5px",children:((D=l.find(s=>s.value===k))==null?void 0:D.label)||((M=l[0])==null?void 0:M.label)||"latest"})]}))]}),O,e.jsxs(a,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"10px"},children:[W&&e.jsx(E,{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&&!j&&e.jsx(d,{"data-test":"edit-button",icon:i.edit,onClick:n,tooltipText:T?K??"You have no edit right on the feature store":"",disabled:T,borderless:!0}),v&&e.jsx(d,{icon:i.refresh,onClick:v,tooltipText:"Refresh",borderless:!0}),!N&&e.jsx(d,{"data-test":p?"unpin-item":"pin-item",icon:p?i.pin_filled:i.pin_empty,onClick:G,tooltipText:p?"Unpin from shortcuts":"Pin to shortcuts",borderless:!0})]})]})})})};export{ke as P};
