import{h as j,iP as q,iQ as B,iR as H,iS as K,gF as N,b8 as O,u as W,b1 as J,c9 as U,e0 as Y,aw as F,hw as ee,W as se,m as te,hz as T,g1 as k,z as _,r as y,e as f,gn as ae,g as re,fe as ne,gD as ie,fb as oe,dx as G,j as r,a_ as ce,a as C,af as P,Z as S,bf as A,ak as le,b3 as E}from"./index-d6499a22.js";import{u as de,S as ue}from"./useQueryParam-5b0284e3.js";import{f as fe,u as he}from"./index-6716d449.js";import{d as pe}from"./FileUploaderButton-c4f1b533.js";import{P as me}from"./Panel-b19e8cc0.js";var ge=function(){function t(e,s){this.xf=s,this.f=e,this.all=!0}return t.prototype["@@transducer/init"]=q.init,t.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,s){return this.f(s)||(this.all=!1,e=B(this.xf["@@transducer/step"](e,!1))),e},t}(),xe=j(function(e,s){return new ge(e,s)}),ve=j(H(["all"],xe,function(e,s){for(var a=0;a<s.length;){if(!e(s[a]))return!1;a+=1}return!0})),Ve=j(function(e,s){return ve(K(e),s)});const ye=Ve,Q=N(O.DATE_TIME.DATE),Fe=()=>{var D,b;const{id:t,fsId:e,fvName:s,fvVersion:a,tdVersion:i}=W(),o=J(),{pathname:h}=U(),{currentData:c={items:[]}}=fe({pId:+t,fsId:+e,id:s}),{currentData:g,isFetching:p,refetch:m}=he({pId:+t,fsId:+e,id:s,version:+a,params:{expand:["features"]}}),{currentData:u={items:[]},refetch:x}=Y({pId:+t,fsId:+e,id:s,version:+a}),l=u.items.find(F("version",+i)),{currentData:n,isFetching:L}=ee({pId:+t,fsId:+e,fvName:s,fvVersion:+a,id:+i,params:{fields:"content"}},{skip:ye(F("version",+i),u.items)}),R=se(k(pe(_("version"))),te(({version:d,eventStartTime:v,eventEndTime:V})=>({key:d,label:`${d} (${Q(T(v))} -> ${Q(T(V))})`})))(u.items),$=y.useCallback(d=>{o(f.featureView.td.statistics,{fsId:e,fvName:s,fvVersion:d,tdVersion:+i})},[e,s,o,i]),z=y.useCallback(d=>{const v=[f.featureView.td.statistics,f.featureView.td.correlation].find(V=>ae(re(V,f.project.value),h))??f.featureView.td.statistics;o(v,{fsId:e,fvName:s,fvVersion:+a,tdVersion:+d.key})},[e,s,a,o,h]),[w,M]=de("split",ue),I=n!=null&&n.entities?[]:k(ne(ie),oe(n)),X=n!=null&&n.entities?n.entities.statistics:(b=(D=_(w??G(I),n))==null?void 0:D.entities)==null?void 0:b.statistics,Z=y.useCallback(()=>{m(),x()},[x,m]);return{allFvs:c,fv:g,fvName:s,fvVersion:a,isFetching:p||L,handleTdVersionChange:z,handleVersionChange:$,refetchAllData:Z,statistics:X,splitNames:I,setSplit:M,split:w,tdVersion:i,tdVersionOptions:R,trainingDataset:l}},Te=({isFetching:t,fvName:e,fvVersion:s,allFvs:a,handleVersionChange:i,handleTdVersionChange:o,refetchAllData:h,splitNames:c,setSplit:g,split:p,tdVersion:m,tdVersionOptions:u,fv:x})=>r.jsxs(r.Fragment,{children:[t&&r.jsx(ce,{}),r.jsx(me,{title:e,versions:(a==null?void 0:a.items)??[{version:+s}],version:+s,onVersionChange:i,idColor:"labels.purple",onClickRefresh:h,children:r.jsxs(C,{alignItems:"center",ml:"2px",children:[r.jsx(P,{icon:S.arrow_right,color:"grayShade1"}),r.jsx(A,{width:"216px",value:+m,options:u,placeholder:"version",onChange:o,isMulti:!1,format:"fill"}),!le(c)&&r.jsxs(r.Fragment,{children:[r.jsx(P,{icon:S.arrow_right,color:"grayShade1"}),c.length>1?r.jsx(A,{width:"140px",value:p||G(c),options:c.map(l=>({key:l,label:l})),placeholder:"split",onChange:l=>g(l.key)}):r.jsxs(C,{alignItems:"flex-end",children:[r.jsx(E,{ml:"5px",color:"gray",children:"split"}),r.jsx(E,{mx:"5px",children:p})]})]})]})})]});export{Te as T,Fe as u};
