import{ag as Q,j as e,$ as a,L as y,ft as Z,m as ee,bg as te,r as c,p as se,fd as ne,U as N,az as oe,bL as ae,fL as ie,at as re,fD as le,fM as xe,fN as pe,eO as ce,v as me,ao as _,bU as de,f as he,ef as z,eo as ue,ep as fe,bd as E,bG as m,ap as be,C as r,ei as d}from"./index-ljTaFLaB.js";import{u as je,D as ge}from"./Deprecated-D_iwBiXP.js";const ye=({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},Te=Z`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,ve=({children:n,...o})=>e.jsx(y,{sx:{animation:`${Te} 1.5s ease infinite`},...o,children:n}),Ie=n=>({minWidth:xe,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"}}),Ce=({onClickEdit:n,onClickDelete:o,onClickRefresh:T,isEditDisabled:v,isVersionsLoading:W,title:i,id:I,idColor:h,versions:x=[],version:u,onVersionChange:$,hasCommits:A=!1,commits:f=[],commit:k,handleCommitChange:C,showDelete:U=!1,type:F=z.td,data:t,status:b,withoutPin:H=!1,pathnamePostFix:O="",editRightText:Y,children:R})=>{var D,S,M;const j=t==null?void 0:t.deprecated,g=ee(O,te().pathname),{isActiveFeatures:w,handleBasket:q,isSwitch:G}=je(),P=c.useMemo(()=>Math.max(...x.map(({version:s})=>s)||[]),[x]),B=c.useMemo(()=>se(ae(ie(N("version"))),oe(({version:s,deployments:L=0})=>({value:`${s}`,label:`${s} ${s===P?"(latest)":""}`,deployments:L?`${L} dep.`:""})),ne(N("value")))(x),[x,P]),l=c.useMemo(()=>f.map(s=>({label:`${re(+s)}${s===f[0]?" (latest)":""}`,value:`${s}`})),[f]),{pinnedIds:V,handlePin:X,handleUnPin:J}=c.useContext(le),p=V.includes(g),K=()=>p?J(g):X({id:g,name:t.name,entityVersion:t.version,entityId:t.id,color:h});return e.jsx(ye,{children:e.jsx(a,{alignItems:"center",minHeight:"50px",sx:Ie(j),children:e.jsxs(a,{width:"100%",maxWidth:`min(calc(100% - 20px), calc(${pe} - 25px))`,alignItems:"flex-end",children:[e.jsxs(a,{alignItems:"center",children:[b&&e.jsx(ce,{mainText:b.text,variant:b.variant}),j&&e.jsx(ge,{}),e.jsxs(me,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(_,{mainText:i,disabled:!i||(i==null?void 0:i.length)<55,children:e.jsx(y,{sx:{...de,maxWidth:"650px"},children:i})}),I&&e.jsxs(he,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:h},as:"span",children:["#",I]})]}),G&&!!t&&F===z.fg&&e.jsx(y,{onClick:s=>s.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(ue,{possible:t.features.length>0,handleClick:q(t.features,t),mode:fe.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(a,{alignItems:"center",m:"auto 0",children:[(u||t.version)&&($&&B.length>1?e.jsx(E,{width:"143px",value:`${u}`,options:B,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})]})),W&&e.jsx(ve,{children:e.jsx(be,{icon:r.loading})})]}),A&&C&&(l.length>1?e.jsx(E,{ml:"20px",my:"5px",width:"280px",value:k||((D=l[0])==null?void 0:D.value),options:l,placeholder:"commit time",onChange:C,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:((S=l.find(s=>s.value===k))==null?void 0:S.label)||((M=l[0])==null?void 0:M.label)||"latest"})]}))]}),R,e.jsxs(a,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"10px"},children:[U&&e.jsx(_,{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,tooltipText:"Delete",borderless:!0})}),n&&!j&&e.jsx(d,{"data-test":"edit-button",icon:r.edit,onClick:n,tooltipText:v?Y??"You have no edit right on the feature store":"",disabled:v,borderless:!0}),T&&e.jsx(d,{icon:r.refresh,onClick:T,tooltipText:"Refresh",borderless:!0}),!H&&e.jsx(d,{"data-test":p?"unpin-item":"pin-item",icon:p?r.pin_filled:r.pin_empty,onClick:K,tooltipText:p?"Unpin from shortcuts":"Pin to shortcuts",borderless:!0})]})]})})})};export{Ce as P};
