import{r as x,j as e}from"./vendor-react-wBh_31cN.js";import{_ as B,eG as J,b as P,h as K,m as U,eh as S,p as W,r as p,g as X,aC as Y,cm as Z,t as $,n as ee,l as se,ao as te,aq as ae,a0 as T,q as re}from"./index-BKr2rJhV.js";import{s as ie,c as oe}from"./index-DJIjy7qt.js";import{u as ne,a as ce}from"./index-BP2S764X.js";import{u as me}from"./useProjectNavigate-5znX7Ojg.js";import{u as de}from"./useQueryParam-CfnQDC5y.js";import{c as le,a as pe,m as fe}from"./vendor-router-D1GqFWiT.js";import{a as ue}from"./all-DVU-BA5G.js";import{s as k}from"./sort-BIlPehKK.js";import{d as he}from"./descend-D5yKnR_m.js";import{a as ge}from"./ascend-D9xyxTFQ.js";import{p as xe}from"./pathSatisfies-BOGQJCXJ.js";import{C as G}from"./combobox-CcK1PxyF.js";import{L as Q}from"./label-Dnebucx5.js";import{P as je}from"./Panel-epT8eD0X.js";var Ve=B(function(a,s){return ue(J(a),s)});const _=te("yyyy/MM/dd"),Qe=()=>{var L,D;const{id:n,fsId:a,fvName:s,fvVersion:o,tdVersion:r}=le(),c=me(),{pathname:f}=pe(),{currentData:j={items:[]}}=ie({pId:+n,fsId:+a,id:s}),{currentData:m,isLoading:V,isFetching:u,refetch:h}=oe({pId:+n,fsId:+a,id:s,version:+o,params:{expand:["features"]}}),{currentData:l={items:[]},refetch:g}=ne({pId:+n,fsId:+a,id:s,version:+o}),v=l.items.find(P("version",+r)),{currentData:t,isLoading:i,isFetching:q}=ce({pId:+n,fsId:+a,fvName:s,fvVersion:+o,id:+r,params:{fields:"content"}},{skip:Ve(P("version",+r),l.items)}),E=K(k(he(W("version"))),U(({version:d,eventStartTime:C,eventEndTime:F})=>{const I=_(S(C)),N=_(S(F)),O=I===N?I:`${I} → ${N}`;return{value:`${d}`,label:`${d} (${O})`}}))(l.items),R=x.useCallback(d=>{c(p.project.featureView.td.statistics,{fsId:a,fvName:s,fvVersion:d,tdVersion:+r})},[a,s,c,r]),A=x.useCallback(d=>{const C=[p.project.featureView.td.statistics,p.project.featureView.td.correlation].find(F=>fe(X(F,p.project.value),f))??p.project.featureView.td.statistics;c(C,{fsId:a,fvName:s,fvVersion:+o,tdVersion:+d})},[a,s,o,c,f]),[b,M]=de("split"),w=t!=null&&t.entities?[]:k(ge(Y),Z(t)),y=t!=null&&t.entities?t.entities.statistics:(D=(L=t==null?void 0:t[b??$(w)??""])==null?void 0:L.entities)==null?void 0:D.statistics,z=x.useMemo(()=>ee(xe(se,["extendedStatistics","correlations"]),y??{}),[y]),H=x.useCallback(()=>{h(),g()},[g,h]);return{allFvs:j,correlations:z,fv:m,fvName:s,fvVersion:o,handleTdVersionChange:A,handleVersionChange:R,isLoading:V||i,isFetching:u||q,refetchAllData:H,statistics:y,splitNames:w,setSplit:M,split:b,tdVersion:r,tdVersionOptions:E,trainingDataset:v}},_e=({isLoading:n,isFetching:a,fvName:s,fvVersion:o,allFvs:r,handleVersionChange:c,handleTdVersionChange:f,refetchAllData:j,splitNames:m,setSplit:V,split:u,tdVersion:h,tdVersionOptions:l,filterToolbar:g,countContent:v,tools:t})=>e.jsxs(e.Fragment,{children:[n&&e.jsx(ae,{}),e.jsx(je,{title:s,versions:(r==null?void 0:r.items)??[{version:+o}],version:+o,onVersionChange:c,idColor:"labels.purple",onClickRefresh:j,filterToolbar:g,countContent:v,tools:t,isFetching:a,children:e.jsxs("div",{className:"ml-0.5 flex items-center",children:[e.jsx(T,{icon:"arrow_right",color:"grayShade1"}),e.jsx(G,{className:"w-[280px]",value:h,options:l,placeholder:"version",onChange:i=>{i&&f(i)}}),!re(m)&&e.jsxs(e.Fragment,{children:[e.jsx(T,{icon:"arrow_right",color:"grayShade1"}),m.length>1?e.jsx(G,{className:"w-[140px]",value:u||$(m)||"",options:m.map(i=>({value:i,label:i})).reverse(),placeholder:"split",onChange:i=>{i&&V(i)}}):e.jsxs("div",{className:"flex items-end",children:[e.jsx(Q,{className:"ml-1.5 text-quartz-gray",children:"split"}),e.jsx(Q,{className:"mx-1.5",children:u})]})]})]})})]});export{_e as T,Qe as u};
