import{V as te,j as e,Q as r,fD as oe,o as h,bm as re,ca as ae,r as c,W as ie,g5 as le,w as W,m as xe,g6 as pe,fi as ce,ab as _,g1 as me,g7 as de,d_ as he,Y as ue,af as m,bb as ge,g as je,dJ as E,dL as fe,dM as be,bg as D,b4 as i,ag as F,z as d,bq as ye,aU as L}from"./index-ea7817a2.js";import{u as ke,D as Ie}from"./Deprecated-9bfe2e44.js";import{C as Se}from"./CardActionButton-6aa39bc1.js";const Te=({children:t})=>{const o=document.getElementById("panel-portal");return o?te.createPortal(e.jsx(r,{sx:{position:"sticky",top:"0px",zIndex:10,width:"100%",flexDirection:"column"},children:t}),o):t},we=oe`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,ve=({children:t,...o})=>e.jsx(h,{sx:{animation:`${we} 1.5s ease infinite`},...o,children:t}),Pe=t=>({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"},...t&&{bg:"grayShade2"}}),Ce=({onClickEdit:t,onClickDelete:o,onClickRefresh:I,isEditDisabled:S,isDeleting:Y,isVersionsLoading:Q,title:a,id:T,idColor:u,versions:x=[],version:g,versionHasSearch:U,onVersionChange:w,hasCommits:V=!1,commits:l=[],commit:j,handleCommitChange:v,hasSplits:q=!1,splits:f=[],split:P,showDelete:H=!1,onSplitChange:B,type:N=E.td,data:s,status:b,withoutPin:R=!1,pathnamePostFix:J="",editRightText:O,children:X})=>{const y=s==null?void 0:s.deprecated,k=re(J,ae().pathname),{isActiveFeatures:$,handleBasket:G,isSwitch:K}=ke(),A=c.useMemo(()=>Math.max(...x.map(({version:n})=>n)||[]),[x]),C=c.useMemo(()=>ie(pe(ce(W("version"))),xe(({version:n,deployments:z=0})=>({key:n,label:`${n} ${n===A?"(latest)":""}`,deployments:z?`${z} dep.`:""})),le(W("key")))(x),[x,A]),M=c.useMemo(()=>l.map(n=>`${_(+n)}${n===l[0]?" (latest)":""}`),[l]),{pinnedIds:Z,handlePin:ee,handleUnPin:se}=c.useContext(me),p=Z.includes(k),ne=()=>p?se(k):ee({id:k,name:s.name,entityVersion:s.version,entityId:s.id,color:u});return e.jsx(Te,{children:e.jsx(r,{alignItems:"center",minHeight:"50px",sx:Pe(y),children:e.jsxs(r,{width:"100%",maxWidth:de,alignItems:"flex-end",px:"10px",children:[e.jsxs(r,{alignItems:"center",children:[b&&e.jsx(he,{mb:"5px",mr:"-5px",mainText:b.text,variant:b.variant}),y&&e.jsx(Ie,{}),e.jsxs(ue,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(m,{mainText:a,disabled:!a||(a==null?void 0:a.length)<55,children:e.jsx(h,{sx:{...ge,maxWidth:"650px"},children:a})}),T&&e.jsxs(je,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:u},as:"span",children:["#",T]})]}),K&&!!s&&N===E.fg&&e.jsx(h,{onClick:n=>n.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(fe,{possible:s.features.length>0,handleClick:G(s.features,s),mode:be.bulk,tooltipMainText:$(s.features,s)?"Remove all features from basket":"Add all features to basket",tooltipSecondaryText:`${s.features.length} features`,inBasket:$(s.features,s)})}),e.jsxs(r,{alignItems:"center",m:"auto 0",children:[(g||s.version)&&(w&&C.length>1?e.jsx(D,{width:"143px",variant:"white",value:g,hasSearch:U,options:C,placeholder:"version",onChange:n=>w(n.key),isMulti:!1}):e.jsxs(e.Fragment,{children:[e.jsx(i,{color:"gray",children:"version"}),e.jsx(i,{mx:"5px",color:u,children:g??s.version})]})),Q&&e.jsx(ve,{children:e.jsx(F,{icon:d.loading})})]}),V&&v&&(M.length>1?e.jsx(ye,{ml:"20px",my:"5px",width:"280px",listWidth:"100%",value:[`${j||"-"} ${j===_(l?+l[0]:0)?"(latest)":""}`],options:M,placeholder:"commit time",onChange:v}):e.jsxs(r,{my:"5px",ml:"20px",alignItems:"flex-end",children:[e.jsx(i,{color:"gray",children:"commit"}),e.jsx(i,{mx:"5px",children:j})]})),q&&B&&(f.length>1?e.jsx(D,{ml:"20px",mb:"-5px",width:"140px",value:[P||f[0]],options:f.map(n=>({key:n,label:n})),placeholder:"split",onChange:n=>B(n.key)}):e.jsxs(r,{alignItems:"flex-end",children:[e.jsx(i,{ml:"5px",color:"gray",children:"split"}),e.jsx(i,{mx:"5px",children:P})]}))]}),X,e.jsxs(r,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"15px"},children:[H&&e.jsx(m,{mainText:"Your role is not allowed to perform this action",disabled:!!o,children:e.jsx(L,{color:"red",intent:"ghost",onClick:o,isLoading:Y,disabled:!o,sx:{userSelect:"none"},children:"delete"})}),t&&!y&&e.jsx(m,{disabled:!S,mainText:O??"You have no edit right on the feature store",children:e.jsx(L,{intent:"ghost",disabled:S,onClick:t,children:"edit"})}),I&&e.jsx(h,{children:e.jsx(Se,{icon:d.refresh,onClick:I,tooltipText:"Refresh"})}),!R&&e.jsx(m,{mainText:p?"Unpin from shortcuts":"Pin to shortcuts",children:e.jsx(F,{icon:p?d.pin_filled:d.pin_empty,onClick:ne,"data-test":p?"unpin-item":"pin-item",sx:{cursor:"pointer"},size:"md",ml:"8px"})})]})]})})})};export{Ce as P};
